diff options
Diffstat (limited to 'drivers/usb/gadget/pxa25x_udc.c')
-rw-r--r-- | drivers/usb/gadget/pxa25x_udc.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index e4e59b4de25d..c090a7e3ecf8 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -11,16 +11,6 @@ | |||
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | */ | 14 | */ |
25 | 15 | ||
26 | /* #define VERBOSE_DEBUG */ | 16 | /* #define VERBOSE_DEBUG */ |
@@ -232,8 +222,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep, | |||
232 | if (!_ep || !desc || ep->desc || _ep->name == ep0name | 222 | if (!_ep || !desc || ep->desc || _ep->name == ep0name |
233 | || desc->bDescriptorType != USB_DT_ENDPOINT | 223 | || desc->bDescriptorType != USB_DT_ENDPOINT |
234 | || ep->bEndpointAddress != desc->bEndpointAddress | 224 | || ep->bEndpointAddress != desc->bEndpointAddress |
235 | || ep->fifo_size < le16_to_cpu | 225 | || ep->fifo_size < usb_endpoint_maxp (desc)) { |
236 | (desc->wMaxPacketSize)) { | ||
237 | DMSG("%s, bad ep or descriptor\n", __func__); | 226 | DMSG("%s, bad ep or descriptor\n", __func__); |
238 | return -EINVAL; | 227 | return -EINVAL; |
239 | } | 228 | } |
@@ -248,7 +237,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep, | |||
248 | 237 | ||
249 | /* hardware _could_ do smaller, but driver doesn't */ | 238 | /* hardware _could_ do smaller, but driver doesn't */ |
250 | if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK | 239 | if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK |
251 | && le16_to_cpu (desc->wMaxPacketSize) | 240 | && usb_endpoint_maxp (desc) |
252 | != BULK_FIFO_SIZE) | 241 | != BULK_FIFO_SIZE) |
253 | || !desc->wMaxPacketSize) { | 242 | || !desc->wMaxPacketSize) { |
254 | DMSG("%s, bad %s maxpacket\n", __func__, _ep->name); | 243 | DMSG("%s, bad %s maxpacket\n", __func__, _ep->name); |
@@ -264,7 +253,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep, | |||
264 | ep->desc = desc; | 253 | ep->desc = desc; |
265 | ep->stopped = 0; | 254 | ep->stopped = 0; |
266 | ep->pio_irqs = 0; | 255 | ep->pio_irqs = 0; |
267 | ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); | 256 | ep->ep.maxpacket = usb_endpoint_maxp (desc); |
268 | 257 | ||
269 | /* flush fifo (mostly for OUT buffers) */ | 258 | /* flush fifo (mostly for OUT buffers) */ |
270 | pxa25x_ep_fifo_flush (_ep); | 259 | pxa25x_ep_fifo_flush (_ep); |
@@ -401,7 +390,7 @@ write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) | |||
401 | { | 390 | { |
402 | unsigned max; | 391 | unsigned max; |
403 | 392 | ||
404 | max = le16_to_cpu(ep->desc->wMaxPacketSize); | 393 | max = usb_endpoint_maxp(ep->desc); |
405 | do { | 394 | do { |
406 | unsigned count; | 395 | unsigned count; |
407 | int is_last, is_short; | 396 | int is_last, is_short; |
@@ -671,8 +660,7 @@ pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
671 | * we can report per-packet status. that also helps with dma. | 660 | * we can report per-packet status. that also helps with dma. |
672 | */ | 661 | */ |
673 | if (unlikely (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC | 662 | if (unlikely (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC |
674 | && req->req.length > le16_to_cpu | 663 | && req->req.length > usb_endpoint_maxp (ep->desc))) |
675 | (ep->desc->wMaxPacketSize))) | ||
676 | return -EMSGSIZE; | 664 | return -EMSGSIZE; |
677 | 665 | ||
678 | DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n", | 666 | DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n", |
@@ -1105,7 +1093,7 @@ udc_seq_show(struct seq_file *m, void *_d) | |||
1105 | tmp = *dev->ep [i].reg_udccs; | 1093 | tmp = *dev->ep [i].reg_udccs; |
1106 | seq_printf(m, | 1094 | seq_printf(m, |
1107 | "%s max %d %s udccs %02x irqs %lu\n", | 1095 | "%s max %d %s udccs %02x irqs %lu\n", |
1108 | ep->ep.name, le16_to_cpu(desc->wMaxPacketSize), | 1096 | ep->ep.name, usb_endpoint_maxp(desc), |
1109 | "pio", tmp, ep->pio_irqs); | 1097 | "pio", tmp, ep->pio_irqs); |
1110 | /* TODO translate all five groups of udccs bits! */ | 1098 | /* TODO translate all five groups of udccs bits! */ |
1111 | 1099 | ||
@@ -2202,7 +2190,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2202 | 2190 | ||
2203 | /* irq setup after old hardware state is cleaned up */ | 2191 | /* irq setup after old hardware state is cleaned up */ |
2204 | retval = request_irq(irq, pxa25x_udc_irq, | 2192 | retval = request_irq(irq, pxa25x_udc_irq, |
2205 | IRQF_DISABLED, driver_name, dev); | 2193 | 0, driver_name, dev); |
2206 | if (retval != 0) { | 2194 | if (retval != 0) { |
2207 | pr_err("%s: can't get irq %d, err %d\n", | 2195 | pr_err("%s: can't get irq %d, err %d\n", |
2208 | driver_name, irq, retval); | 2196 | driver_name, irq, retval); |
@@ -2214,7 +2202,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2214 | if (machine_is_lubbock()) { | 2202 | if (machine_is_lubbock()) { |
2215 | retval = request_irq(LUBBOCK_USB_DISC_IRQ, | 2203 | retval = request_irq(LUBBOCK_USB_DISC_IRQ, |
2216 | lubbock_vbus_irq, | 2204 | lubbock_vbus_irq, |
2217 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | 2205 | IRQF_SAMPLE_RANDOM, |
2218 | driver_name, dev); | 2206 | driver_name, dev); |
2219 | if (retval != 0) { | 2207 | if (retval != 0) { |
2220 | pr_err("%s: can't get irq %i, err %d\n", | 2208 | pr_err("%s: can't get irq %i, err %d\n", |
@@ -2223,7 +2211,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2223 | } | 2211 | } |
2224 | retval = request_irq(LUBBOCK_USB_IRQ, | 2212 | retval = request_irq(LUBBOCK_USB_IRQ, |
2225 | lubbock_vbus_irq, | 2213 | lubbock_vbus_irq, |
2226 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | 2214 | IRQF_SAMPLE_RANDOM, |
2227 | driver_name, dev); | 2215 | driver_name, dev); |
2228 | if (retval != 0) { | 2216 | if (retval != 0) { |
2229 | pr_err("%s: can't get irq %i, err %d\n", | 2217 | pr_err("%s: can't get irq %i, err %d\n", |