diff options
Diffstat (limited to 'drivers/usb')
58 files changed, 782 insertions, 893 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0c2f14ff9696..162c95a088ed 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1201,7 +1201,7 @@ made_compressed_probe: | |||
1201 | if (rcv->urb == NULL) { | 1201 | if (rcv->urb == NULL) { |
1202 | dev_dbg(&intf->dev, | 1202 | dev_dbg(&intf->dev, |
1203 | "out of memory (read urbs usb_alloc_urb)\n"); | 1203 | "out of memory (read urbs usb_alloc_urb)\n"); |
1204 | goto alloc_fail7; | 1204 | goto alloc_fail6; |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1207 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
@@ -1225,7 +1225,7 @@ made_compressed_probe: | |||
1225 | if (snd->urb == NULL) { | 1225 | if (snd->urb == NULL) { |
1226 | dev_dbg(&intf->dev, | 1226 | dev_dbg(&intf->dev, |
1227 | "out of memory (write urbs usb_alloc_urb)"); | 1227 | "out of memory (write urbs usb_alloc_urb)"); |
1228 | goto alloc_fail7; | 1228 | goto alloc_fail8; |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | if (usb_endpoint_xfer_int(epwrite)) | 1231 | if (usb_endpoint_xfer_int(epwrite)) |
@@ -1264,6 +1264,7 @@ made_compressed_probe: | |||
1264 | i = device_create_file(&intf->dev, | 1264 | i = device_create_file(&intf->dev, |
1265 | &dev_attr_iCountryCodeRelDate); | 1265 | &dev_attr_iCountryCodeRelDate); |
1266 | if (i < 0) { | 1266 | if (i < 0) { |
1267 | device_remove_file(&intf->dev, &dev_attr_wCountryCodes); | ||
1267 | kfree(acm->country_codes); | 1268 | kfree(acm->country_codes); |
1268 | goto skip_countries; | 1269 | goto skip_countries; |
1269 | } | 1270 | } |
@@ -1300,6 +1301,7 @@ alloc_fail8: | |||
1300 | usb_free_urb(acm->wb[i].urb); | 1301 | usb_free_urb(acm->wb[i].urb); |
1301 | alloc_fail7: | 1302 | alloc_fail7: |
1302 | acm_read_buffers_free(acm); | 1303 | acm_read_buffers_free(acm); |
1304 | alloc_fail6: | ||
1303 | for (i = 0; i < num_rx_buf; i++) | 1305 | for (i = 0; i < num_rx_buf; i++) |
1304 | usb_free_urb(acm->ru[i].urb); | 1306 | usb_free_urb(acm->ru[i].urb); |
1305 | usb_free_urb(acm->ctrlurb); | 1307 | usb_free_urb(acm->ctrlurb); |
@@ -1594,6 +1596,7 @@ static const struct usb_device_id acm_ids[] = { | |||
1594 | { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ | 1596 | { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ |
1595 | { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ | 1597 | { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ |
1596 | { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ | 1598 | { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ |
1599 | { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 */ | ||
1597 | 1600 | ||
1598 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1601 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
1599 | 1602 | ||
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ded550eda5d9..a6bd53ace035 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1272,8 +1272,7 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg) | |||
1272 | 1272 | ||
1273 | static void choose_wakeup(struct usb_device *udev, pm_message_t msg) | 1273 | static void choose_wakeup(struct usb_device *udev, pm_message_t msg) |
1274 | { | 1274 | { |
1275 | int w, i; | 1275 | int w; |
1276 | struct usb_interface *intf; | ||
1277 | 1276 | ||
1278 | /* Remote wakeup is needed only when we actually go to sleep. | 1277 | /* Remote wakeup is needed only when we actually go to sleep. |
1279 | * For things like FREEZE and QUIESCE, if the device is already | 1278 | * For things like FREEZE and QUIESCE, if the device is already |
@@ -1285,16 +1284,10 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg) | |||
1285 | return; | 1284 | return; |
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | /* If remote wakeup is permitted, see whether any interface drivers | 1287 | /* Enable remote wakeup if it is allowed, even if no interface drivers |
1289 | * actually want it. | 1288 | * actually want it. |
1290 | */ | 1289 | */ |
1291 | w = 0; | 1290 | w = device_may_wakeup(&udev->dev); |
1292 | if (device_may_wakeup(&udev->dev) && udev->actconfig) { | ||
1293 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { | ||
1294 | intf = udev->actconfig->interface[i]; | ||
1295 | w |= intf->needs_remote_wakeup; | ||
1296 | } | ||
1297 | } | ||
1298 | 1291 | ||
1299 | /* If the device is autosuspended with the wrong wakeup setting, | 1292 | /* If the device is autosuspended with the wrong wakeup setting, |
1300 | * autoresume now so the setting can be changed. | 1293 | * autoresume now so the setting can be changed. |
@@ -1328,6 +1321,7 @@ int usb_resume(struct device *dev, pm_message_t msg) | |||
1328 | 1321 | ||
1329 | /* For all other calls, take the device back to full power and | 1322 | /* For all other calls, take the device back to full power and |
1330 | * tell the PM core in case it was autosuspended previously. | 1323 | * tell the PM core in case it was autosuspended previously. |
1324 | * Unbind the interfaces that will need rebinding later. | ||
1331 | */ | 1325 | */ |
1332 | } else { | 1326 | } else { |
1333 | status = usb_resume_both(udev, msg); | 1327 | status = usb_resume_both(udev, msg); |
@@ -1336,6 +1330,7 @@ int usb_resume(struct device *dev, pm_message_t msg) | |||
1336 | pm_runtime_set_active(dev); | 1330 | pm_runtime_set_active(dev); |
1337 | pm_runtime_enable(dev); | 1331 | pm_runtime_enable(dev); |
1338 | udev->last_busy = jiffies; | 1332 | udev->last_busy = jiffies; |
1333 | do_unbind_rebind(udev, DO_REBIND); | ||
1339 | } | 1334 | } |
1340 | } | 1335 | } |
1341 | 1336 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 83e7bbbe97fa..70cccc75a362 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1982,6 +1982,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
1982 | (portstatus & USB_PORT_STAT_ENABLE)) { | 1982 | (portstatus & USB_PORT_STAT_ENABLE)) { |
1983 | if (hub_is_wusb(hub)) | 1983 | if (hub_is_wusb(hub)) |
1984 | udev->speed = USB_SPEED_WIRELESS; | 1984 | udev->speed = USB_SPEED_WIRELESS; |
1985 | else if (portstatus & USB_PORT_STAT_SUPER_SPEED) | ||
1986 | udev->speed = USB_SPEED_SUPER; | ||
1985 | else if (portstatus & USB_PORT_STAT_HIGH_SPEED) | 1987 | else if (portstatus & USB_PORT_STAT_HIGH_SPEED) |
1986 | udev->speed = USB_SPEED_HIGH; | 1988 | udev->speed = USB_SPEED_HIGH; |
1987 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) | 1989 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a73e08fdab36..fd4c36ea5e46 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -416,8 +416,11 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, | |||
416 | /* A length of zero means transfer the whole sg list */ | 416 | /* A length of zero means transfer the whole sg list */ |
417 | len = length; | 417 | len = length; |
418 | if (len == 0) { | 418 | if (len == 0) { |
419 | for_each_sg(sg, sg, nents, i) | 419 | struct scatterlist *sg2; |
420 | len += sg->length; | 420 | int j; |
421 | |||
422 | for_each_sg(sg, sg2, nents, j) | ||
423 | len += sg2->length; | ||
421 | } | 424 | } |
422 | } else { | 425 | } else { |
423 | /* | 426 | /* |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f22d03df8b17..db99c084df92 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -41,6 +41,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
41 | /* Philips PSC805 audio device */ | 41 | /* Philips PSC805 audio device */ |
42 | { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, | 42 | { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, |
43 | 43 | ||
44 | /* Artisman Watchdog Dongle */ | ||
45 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = | ||
46 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
47 | |||
44 | /* Roland SC-8820 */ | 48 | /* Roland SC-8820 */ |
45 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 49 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
46 | 50 | ||
@@ -64,6 +68,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
64 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | 68 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
65 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | 69 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
66 | 70 | ||
71 | /* Broadcom BCM92035DGROM BT dongle */ | ||
72 | { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
73 | |||
67 | /* Action Semiconductor flash disk */ | 74 | /* Action Semiconductor flash disk */ |
68 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 75 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
69 | USB_QUIRK_STRING_FETCH_255 }, | 76 | USB_QUIRK_STRING_FETCH_255 }, |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 649c0c5f7158..591ae9fde199 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -295,6 +295,7 @@ config USB_GADGET_S3C_HSOTG | |||
295 | boolean "S3C HS/OtG USB Device controller" | 295 | boolean "S3C HS/OtG USB Device controller" |
296 | depends on S3C_DEV_USB_HSOTG | 296 | depends on S3C_DEV_USB_HSOTG |
297 | select USB_GADGET_S3C_HSOTG_PIO | 297 | select USB_GADGET_S3C_HSOTG_PIO |
298 | select USB_GADGET_DUALSPEED | ||
298 | help | 299 | help |
299 | The Samsung S3C64XX USB2.0 high-speed gadget controller | 300 | The Samsung S3C64XX USB2.0 high-speed gadget controller |
300 | integrated into the S3C64XX series SoC. | 301 | integrated into the S3C64XX series SoC. |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index eaa79c8a9b8c..93ead19507b6 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -76,11 +76,12 @@ | |||
76 | static const char driver_name [] = "at91_udc"; | 76 | static const char driver_name [] = "at91_udc"; |
77 | static const char ep0name[] = "ep0"; | 77 | static const char ep0name[] = "ep0"; |
78 | 78 | ||
79 | #define VBUS_POLL_TIMEOUT msecs_to_jiffies(1000) | ||
79 | 80 | ||
80 | #define at91_udp_read(dev, reg) \ | 81 | #define at91_udp_read(udc, reg) \ |
81 | __raw_readl((dev)->udp_baseaddr + (reg)) | 82 | __raw_readl((udc)->udp_baseaddr + (reg)) |
82 | #define at91_udp_write(dev, reg, val) \ | 83 | #define at91_udp_write(udc, reg, val) \ |
83 | __raw_writel((val), (dev)->udp_baseaddr + (reg)) | 84 | __raw_writel((val), (udc)->udp_baseaddr + (reg)) |
84 | 85 | ||
85 | /*-------------------------------------------------------------------------*/ | 86 | /*-------------------------------------------------------------------------*/ |
86 | 87 | ||
@@ -102,8 +103,9 @@ static void proc_ep_show(struct seq_file *s, struct at91_ep *ep) | |||
102 | u32 csr; | 103 | u32 csr; |
103 | struct at91_request *req; | 104 | struct at91_request *req; |
104 | unsigned long flags; | 105 | unsigned long flags; |
106 | struct at91_udc *udc = ep->udc; | ||
105 | 107 | ||
106 | local_irq_save(flags); | 108 | spin_lock_irqsave(&udc->lock, flags); |
107 | 109 | ||
108 | csr = __raw_readl(ep->creg); | 110 | csr = __raw_readl(ep->creg); |
109 | 111 | ||
@@ -147,7 +149,7 @@ static void proc_ep_show(struct seq_file *s, struct at91_ep *ep) | |||
147 | &req->req, length, | 149 | &req->req, length, |
148 | req->req.length, req->req.buf); | 150 | req->req.length, req->req.buf); |
149 | } | 151 | } |
150 | local_irq_restore(flags); | 152 | spin_unlock_irqrestore(&udc->lock, flags); |
151 | } | 153 | } |
152 | 154 | ||
153 | static void proc_irq_show(struct seq_file *s, const char *label, u32 mask) | 155 | static void proc_irq_show(struct seq_file *s, const char *label, u32 mask) |
@@ -272,7 +274,9 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status) | |||
272 | VDBG("%s done %p, status %d\n", ep->ep.name, req, status); | 274 | VDBG("%s done %p, status %d\n", ep->ep.name, req, status); |
273 | 275 | ||
274 | ep->stopped = 1; | 276 | ep->stopped = 1; |
277 | spin_unlock(&udc->lock); | ||
275 | req->req.complete(&ep->ep, &req->req); | 278 | req->req.complete(&ep->ep, &req->req); |
279 | spin_lock(&udc->lock); | ||
276 | ep->stopped = stopped; | 280 | ep->stopped = stopped; |
277 | 281 | ||
278 | /* ep0 is always ready; other endpoints need a non-empty queue */ | 282 | /* ep0 is always ready; other endpoints need a non-empty queue */ |
@@ -472,7 +476,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
472 | const struct usb_endpoint_descriptor *desc) | 476 | const struct usb_endpoint_descriptor *desc) |
473 | { | 477 | { |
474 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); | 478 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); |
475 | struct at91_udc *dev = ep->udc; | 479 | struct at91_udc *udc = ep->udc; |
476 | u16 maxpacket; | 480 | u16 maxpacket; |
477 | u32 tmp; | 481 | u32 tmp; |
478 | unsigned long flags; | 482 | unsigned long flags; |
@@ -487,7 +491,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
487 | return -EINVAL; | 491 | return -EINVAL; |
488 | } | 492 | } |
489 | 493 | ||
490 | if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { | 494 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { |
491 | DBG("bogus device state\n"); | 495 | DBG("bogus device state\n"); |
492 | return -ESHUTDOWN; | 496 | return -ESHUTDOWN; |
493 | } | 497 | } |
@@ -521,7 +525,7 @@ bogus_max: | |||
521 | } | 525 | } |
522 | 526 | ||
523 | ok: | 527 | ok: |
524 | local_irq_save(flags); | 528 | spin_lock_irqsave(&udc->lock, flags); |
525 | 529 | ||
526 | /* initialize endpoint to match this descriptor */ | 530 | /* initialize endpoint to match this descriptor */ |
527 | ep->is_in = usb_endpoint_dir_in(desc); | 531 | ep->is_in = usb_endpoint_dir_in(desc); |
@@ -540,10 +544,10 @@ ok: | |||
540 | * reset/init endpoint fifo. NOTE: leaves fifo_bank alone, | 544 | * reset/init endpoint fifo. NOTE: leaves fifo_bank alone, |
541 | * since endpoint resets don't reset hw pingpong state. | 545 | * since endpoint resets don't reset hw pingpong state. |
542 | */ | 546 | */ |
543 | at91_udp_write(dev, AT91_UDP_RST_EP, ep->int_mask); | 547 | at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); |
544 | at91_udp_write(dev, AT91_UDP_RST_EP, 0); | 548 | at91_udp_write(udc, AT91_UDP_RST_EP, 0); |
545 | 549 | ||
546 | local_irq_restore(flags); | 550 | spin_unlock_irqrestore(&udc->lock, flags); |
547 | return 0; | 551 | return 0; |
548 | } | 552 | } |
549 | 553 | ||
@@ -556,7 +560,7 @@ static int at91_ep_disable (struct usb_ep * _ep) | |||
556 | if (ep == &ep->udc->ep[0]) | 560 | if (ep == &ep->udc->ep[0]) |
557 | return -EINVAL; | 561 | return -EINVAL; |
558 | 562 | ||
559 | local_irq_save(flags); | 563 | spin_lock_irqsave(&udc->lock, flags); |
560 | 564 | ||
561 | nuke(ep, -ESHUTDOWN); | 565 | nuke(ep, -ESHUTDOWN); |
562 | 566 | ||
@@ -571,7 +575,7 @@ static int at91_ep_disable (struct usb_ep * _ep) | |||
571 | __raw_writel(0, ep->creg); | 575 | __raw_writel(0, ep->creg); |
572 | } | 576 | } |
573 | 577 | ||
574 | local_irq_restore(flags); | 578 | spin_unlock_irqrestore(&udc->lock, flags); |
575 | return 0; | 579 | return 0; |
576 | } | 580 | } |
577 | 581 | ||
@@ -607,7 +611,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
607 | { | 611 | { |
608 | struct at91_request *req; | 612 | struct at91_request *req; |
609 | struct at91_ep *ep; | 613 | struct at91_ep *ep; |
610 | struct at91_udc *dev; | 614 | struct at91_udc *udc; |
611 | int status; | 615 | int status; |
612 | unsigned long flags; | 616 | unsigned long flags; |
613 | 617 | ||
@@ -625,9 +629,9 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
625 | return -EINVAL; | 629 | return -EINVAL; |
626 | } | 630 | } |
627 | 631 | ||
628 | dev = ep->udc; | 632 | udc = ep->udc; |
629 | 633 | ||
630 | if (!dev || !dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { | 634 | if (!udc || !udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { |
631 | DBG("invalid device\n"); | 635 | DBG("invalid device\n"); |
632 | return -EINVAL; | 636 | return -EINVAL; |
633 | } | 637 | } |
@@ -635,7 +639,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
635 | _req->status = -EINPROGRESS; | 639 | _req->status = -EINPROGRESS; |
636 | _req->actual = 0; | 640 | _req->actual = 0; |
637 | 641 | ||
638 | local_irq_save(flags); | 642 | spin_lock_irqsave(&udc->lock, flags); |
639 | 643 | ||
640 | /* try to kickstart any empty and idle queue */ | 644 | /* try to kickstart any empty and idle queue */ |
641 | if (list_empty(&ep->queue) && !ep->stopped) { | 645 | if (list_empty(&ep->queue) && !ep->stopped) { |
@@ -653,7 +657,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
653 | if (is_ep0) { | 657 | if (is_ep0) { |
654 | u32 tmp; | 658 | u32 tmp; |
655 | 659 | ||
656 | if (!dev->req_pending) { | 660 | if (!udc->req_pending) { |
657 | status = -EINVAL; | 661 | status = -EINVAL; |
658 | goto done; | 662 | goto done; |
659 | } | 663 | } |
@@ -662,11 +666,11 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
662 | * defer changing CONFG until after the gadget driver | 666 | * defer changing CONFG until after the gadget driver |
663 | * reconfigures the endpoints. | 667 | * reconfigures the endpoints. |
664 | */ | 668 | */ |
665 | if (dev->wait_for_config_ack) { | 669 | if (udc->wait_for_config_ack) { |
666 | tmp = at91_udp_read(dev, AT91_UDP_GLB_STAT); | 670 | tmp = at91_udp_read(udc, AT91_UDP_GLB_STAT); |
667 | tmp ^= AT91_UDP_CONFG; | 671 | tmp ^= AT91_UDP_CONFG; |
668 | VDBG("toggle config\n"); | 672 | VDBG("toggle config\n"); |
669 | at91_udp_write(dev, AT91_UDP_GLB_STAT, tmp); | 673 | at91_udp_write(udc, AT91_UDP_GLB_STAT, tmp); |
670 | } | 674 | } |
671 | if (req->req.length == 0) { | 675 | if (req->req.length == 0) { |
672 | ep0_in_status: | 676 | ep0_in_status: |
@@ -676,7 +680,7 @@ ep0_in_status: | |||
676 | tmp &= ~SET_FX; | 680 | tmp &= ~SET_FX; |
677 | tmp |= CLR_FX | AT91_UDP_TXPKTRDY; | 681 | tmp |= CLR_FX | AT91_UDP_TXPKTRDY; |
678 | __raw_writel(tmp, ep->creg); | 682 | __raw_writel(tmp, ep->creg); |
679 | dev->req_pending = 0; | 683 | udc->req_pending = 0; |
680 | goto done; | 684 | goto done; |
681 | } | 685 | } |
682 | } | 686 | } |
@@ -695,31 +699,40 @@ ep0_in_status: | |||
695 | 699 | ||
696 | if (req && !status) { | 700 | if (req && !status) { |
697 | list_add_tail (&req->queue, &ep->queue); | 701 | list_add_tail (&req->queue, &ep->queue); |
698 | at91_udp_write(dev, AT91_UDP_IER, ep->int_mask); | 702 | at91_udp_write(udc, AT91_UDP_IER, ep->int_mask); |
699 | } | 703 | } |
700 | done: | 704 | done: |
701 | local_irq_restore(flags); | 705 | spin_unlock_irqrestore(&udc->lock, flags); |
702 | return (status < 0) ? status : 0; | 706 | return (status < 0) ? status : 0; |
703 | } | 707 | } |
704 | 708 | ||
705 | static int at91_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | 709 | static int at91_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
706 | { | 710 | { |
707 | struct at91_ep *ep; | 711 | struct at91_ep *ep; |
708 | struct at91_request *req; | 712 | struct at91_request *req; |
713 | unsigned long flags; | ||
714 | struct at91_udc *udc; | ||
709 | 715 | ||
710 | ep = container_of(_ep, struct at91_ep, ep); | 716 | ep = container_of(_ep, struct at91_ep, ep); |
711 | if (!_ep || ep->ep.name == ep0name) | 717 | if (!_ep || ep->ep.name == ep0name) |
712 | return -EINVAL; | 718 | return -EINVAL; |
713 | 719 | ||
720 | udc = ep->udc; | ||
721 | |||
722 | spin_lock_irqsave(&udc->lock, flags); | ||
723 | |||
714 | /* make sure it's actually queued on this endpoint */ | 724 | /* make sure it's actually queued on this endpoint */ |
715 | list_for_each_entry (req, &ep->queue, queue) { | 725 | list_for_each_entry (req, &ep->queue, queue) { |
716 | if (&req->req == _req) | 726 | if (&req->req == _req) |
717 | break; | 727 | break; |
718 | } | 728 | } |
719 | if (&req->req != _req) | 729 | if (&req->req != _req) { |
730 | spin_unlock_irqrestore(&udc->lock, flags); | ||
720 | return -EINVAL; | 731 | return -EINVAL; |
732 | } | ||
721 | 733 | ||
722 | done(ep, req, -ECONNRESET); | 734 | done(ep, req, -ECONNRESET); |
735 | spin_unlock_irqrestore(&udc->lock, flags); | ||
723 | return 0; | 736 | return 0; |
724 | } | 737 | } |
725 | 738 | ||
@@ -736,7 +749,7 @@ static int at91_ep_set_halt(struct usb_ep *_ep, int value) | |||
736 | return -EINVAL; | 749 | return -EINVAL; |
737 | 750 | ||
738 | creg = ep->creg; | 751 | creg = ep->creg; |
739 | local_irq_save(flags); | 752 | spin_lock_irqsave(&udc->lock, flags); |
740 | 753 | ||
741 | csr = __raw_readl(creg); | 754 | csr = __raw_readl(creg); |
742 | 755 | ||
@@ -761,7 +774,7 @@ static int at91_ep_set_halt(struct usb_ep *_ep, int value) | |||
761 | __raw_writel(csr, creg); | 774 | __raw_writel(csr, creg); |
762 | } | 775 | } |
763 | 776 | ||
764 | local_irq_restore(flags); | 777 | spin_unlock_irqrestore(&udc->lock, flags); |
765 | return status; | 778 | return status; |
766 | } | 779 | } |
767 | 780 | ||
@@ -795,7 +808,7 @@ static int at91_wakeup(struct usb_gadget *gadget) | |||
795 | unsigned long flags; | 808 | unsigned long flags; |
796 | 809 | ||
797 | DBG("%s\n", __func__ ); | 810 | DBG("%s\n", __func__ ); |
798 | local_irq_save(flags); | 811 | spin_lock_irqsave(&udc->lock, flags); |
799 | 812 | ||
800 | if (!udc->clocked || !udc->suspended) | 813 | if (!udc->clocked || !udc->suspended) |
801 | goto done; | 814 | goto done; |
@@ -809,7 +822,7 @@ static int at91_wakeup(struct usb_gadget *gadget) | |||
809 | at91_udp_write(udc, AT91_UDP_GLB_STAT, glbstate); | 822 | at91_udp_write(udc, AT91_UDP_GLB_STAT, glbstate); |
810 | 823 | ||
811 | done: | 824 | done: |
812 | local_irq_restore(flags); | 825 | spin_unlock_irqrestore(&udc->lock, flags); |
813 | return status; | 826 | return status; |
814 | } | 827 | } |
815 | 828 | ||
@@ -851,8 +864,11 @@ static void stop_activity(struct at91_udc *udc) | |||
851 | ep->stopped = 1; | 864 | ep->stopped = 1; |
852 | nuke(ep, -ESHUTDOWN); | 865 | nuke(ep, -ESHUTDOWN); |
853 | } | 866 | } |
854 | if (driver) | 867 | if (driver) { |
868 | spin_unlock(&udc->lock); | ||
855 | driver->disconnect(&udc->gadget); | 869 | driver->disconnect(&udc->gadget); |
870 | spin_lock(&udc->lock); | ||
871 | } | ||
856 | 872 | ||
857 | udc_reinit(udc); | 873 | udc_reinit(udc); |
858 | } | 874 | } |
@@ -935,13 +951,13 @@ static int at91_vbus_session(struct usb_gadget *gadget, int is_active) | |||
935 | unsigned long flags; | 951 | unsigned long flags; |
936 | 952 | ||
937 | // VDBG("vbus %s\n", is_active ? "on" : "off"); | 953 | // VDBG("vbus %s\n", is_active ? "on" : "off"); |
938 | local_irq_save(flags); | 954 | spin_lock_irqsave(&udc->lock, flags); |
939 | udc->vbus = (is_active != 0); | 955 | udc->vbus = (is_active != 0); |
940 | if (udc->driver) | 956 | if (udc->driver) |
941 | pullup(udc, is_active); | 957 | pullup(udc, is_active); |
942 | else | 958 | else |
943 | pullup(udc, 0); | 959 | pullup(udc, 0); |
944 | local_irq_restore(flags); | 960 | spin_unlock_irqrestore(&udc->lock, flags); |
945 | return 0; | 961 | return 0; |
946 | } | 962 | } |
947 | 963 | ||
@@ -950,10 +966,10 @@ static int at91_pullup(struct usb_gadget *gadget, int is_on) | |||
950 | struct at91_udc *udc = to_udc(gadget); | 966 | struct at91_udc *udc = to_udc(gadget); |
951 | unsigned long flags; | 967 | unsigned long flags; |
952 | 968 | ||
953 | local_irq_save(flags); | 969 | spin_lock_irqsave(&udc->lock, flags); |
954 | udc->enabled = is_on = !!is_on; | 970 | udc->enabled = is_on = !!is_on; |
955 | pullup(udc, is_on); | 971 | pullup(udc, is_on); |
956 | local_irq_restore(flags); | 972 | spin_unlock_irqrestore(&udc->lock, flags); |
957 | return 0; | 973 | return 0; |
958 | } | 974 | } |
959 | 975 | ||
@@ -962,9 +978,9 @@ static int at91_set_selfpowered(struct usb_gadget *gadget, int is_on) | |||
962 | struct at91_udc *udc = to_udc(gadget); | 978 | struct at91_udc *udc = to_udc(gadget); |
963 | unsigned long flags; | 979 | unsigned long flags; |
964 | 980 | ||
965 | local_irq_save(flags); | 981 | spin_lock_irqsave(&udc->lock, flags); |
966 | udc->selfpowered = (is_on != 0); | 982 | udc->selfpowered = (is_on != 0); |
967 | local_irq_restore(flags); | 983 | spin_unlock_irqrestore(&udc->lock, flags); |
968 | return 0; | 984 | return 0; |
969 | } | 985 | } |
970 | 986 | ||
@@ -1226,8 +1242,11 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) | |||
1226 | #undef w_length | 1242 | #undef w_length |
1227 | 1243 | ||
1228 | /* pass request up to the gadget driver */ | 1244 | /* pass request up to the gadget driver */ |
1229 | if (udc->driver) | 1245 | if (udc->driver) { |
1246 | spin_unlock(&udc->lock); | ||
1230 | status = udc->driver->setup(&udc->gadget, &pkt.r); | 1247 | status = udc->driver->setup(&udc->gadget, &pkt.r); |
1248 | spin_lock(&udc->lock); | ||
1249 | } | ||
1231 | else | 1250 | else |
1232 | status = -ENODEV; | 1251 | status = -ENODEV; |
1233 | if (status < 0) { | 1252 | if (status < 0) { |
@@ -1378,6 +1397,9 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
1378 | struct at91_udc *udc = _udc; | 1397 | struct at91_udc *udc = _udc; |
1379 | u32 rescans = 5; | 1398 | u32 rescans = 5; |
1380 | int disable_clock = 0; | 1399 | int disable_clock = 0; |
1400 | unsigned long flags; | ||
1401 | |||
1402 | spin_lock_irqsave(&udc->lock, flags); | ||
1381 | 1403 | ||
1382 | if (!udc->clocked) { | 1404 | if (!udc->clocked) { |
1383 | clk_on(udc); | 1405 | clk_on(udc); |
@@ -1433,8 +1455,11 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
1433 | * and then into standby to avoid drawing more than | 1455 | * and then into standby to avoid drawing more than |
1434 | * 500uA power (2500uA for some high-power configs). | 1456 | * 500uA power (2500uA for some high-power configs). |
1435 | */ | 1457 | */ |
1436 | if (udc->driver && udc->driver->suspend) | 1458 | if (udc->driver && udc->driver->suspend) { |
1459 | spin_unlock(&udc->lock); | ||
1437 | udc->driver->suspend(&udc->gadget); | 1460 | udc->driver->suspend(&udc->gadget); |
1461 | spin_lock(&udc->lock); | ||
1462 | } | ||
1438 | 1463 | ||
1439 | /* host initiated resume */ | 1464 | /* host initiated resume */ |
1440 | } else if (status & AT91_UDP_RXRSM) { | 1465 | } else if (status & AT91_UDP_RXRSM) { |
@@ -1451,8 +1476,11 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
1451 | * would normally want to switch out of slow clock | 1476 | * would normally want to switch out of slow clock |
1452 | * mode into normal mode. | 1477 | * mode into normal mode. |
1453 | */ | 1478 | */ |
1454 | if (udc->driver && udc->driver->resume) | 1479 | if (udc->driver && udc->driver->resume) { |
1480 | spin_unlock(&udc->lock); | ||
1455 | udc->driver->resume(&udc->gadget); | 1481 | udc->driver->resume(&udc->gadget); |
1482 | spin_lock(&udc->lock); | ||
1483 | } | ||
1456 | 1484 | ||
1457 | /* endpoint IRQs are cleared by handling them */ | 1485 | /* endpoint IRQs are cleared by handling them */ |
1458 | } else { | 1486 | } else { |
@@ -1474,6 +1502,8 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
1474 | if (disable_clock) | 1502 | if (disable_clock) |
1475 | clk_off(udc); | 1503 | clk_off(udc); |
1476 | 1504 | ||
1505 | spin_unlock_irqrestore(&udc->lock, flags); | ||
1506 | |||
1477 | return IRQ_HANDLED; | 1507 | return IRQ_HANDLED; |
1478 | } | 1508 | } |
1479 | 1509 | ||
@@ -1556,24 +1586,53 @@ static struct at91_udc controller = { | |||
1556 | /* ep6 and ep7 are also reserved (custom silicon might use them) */ | 1586 | /* ep6 and ep7 are also reserved (custom silicon might use them) */ |
1557 | }; | 1587 | }; |
1558 | 1588 | ||
1589 | static void at91_vbus_update(struct at91_udc *udc, unsigned value) | ||
1590 | { | ||
1591 | value ^= udc->board.vbus_active_low; | ||
1592 | if (value != udc->vbus) | ||
1593 | at91_vbus_session(&udc->gadget, value); | ||
1594 | } | ||
1595 | |||
1559 | static irqreturn_t at91_vbus_irq(int irq, void *_udc) | 1596 | static irqreturn_t at91_vbus_irq(int irq, void *_udc) |
1560 | { | 1597 | { |
1561 | struct at91_udc *udc = _udc; | 1598 | struct at91_udc *udc = _udc; |
1562 | unsigned value; | ||
1563 | 1599 | ||
1564 | /* vbus needs at least brief debouncing */ | 1600 | /* vbus needs at least brief debouncing */ |
1565 | udelay(10); | 1601 | udelay(10); |
1566 | value = gpio_get_value(udc->board.vbus_pin); | 1602 | at91_vbus_update(udc, gpio_get_value(udc->board.vbus_pin)); |
1567 | if (value != udc->vbus) | ||
1568 | at91_vbus_session(&udc->gadget, value); | ||
1569 | 1603 | ||
1570 | return IRQ_HANDLED; | 1604 | return IRQ_HANDLED; |
1571 | } | 1605 | } |
1572 | 1606 | ||
1607 | static void at91_vbus_timer_work(struct work_struct *work) | ||
1608 | { | ||
1609 | struct at91_udc *udc = container_of(work, struct at91_udc, | ||
1610 | vbus_timer_work); | ||
1611 | |||
1612 | at91_vbus_update(udc, gpio_get_value_cansleep(udc->board.vbus_pin)); | ||
1613 | |||
1614 | if (!timer_pending(&udc->vbus_timer)) | ||
1615 | mod_timer(&udc->vbus_timer, jiffies + VBUS_POLL_TIMEOUT); | ||
1616 | } | ||
1617 | |||
1618 | static void at91_vbus_timer(unsigned long data) | ||
1619 | { | ||
1620 | struct at91_udc *udc = (struct at91_udc *)data; | ||
1621 | |||
1622 | /* | ||
1623 | * If we are polling vbus it is likely that the gpio is on an | ||
1624 | * bus such as i2c or spi which may sleep, so schedule some work | ||
1625 | * to read the vbus gpio | ||
1626 | */ | ||
1627 | if (!work_pending(&udc->vbus_timer_work)) | ||
1628 | schedule_work(&udc->vbus_timer_work); | ||
1629 | } | ||
1630 | |||
1573 | int usb_gadget_register_driver (struct usb_gadget_driver *driver) | 1631 | int usb_gadget_register_driver (struct usb_gadget_driver *driver) |
1574 | { | 1632 | { |
1575 | struct at91_udc *udc = &controller; | 1633 | struct at91_udc *udc = &controller; |
1576 | int retval; | 1634 | int retval; |
1635 | unsigned long flags; | ||
1577 | 1636 | ||
1578 | if (!driver | 1637 | if (!driver |
1579 | || driver->speed < USB_SPEED_FULL | 1638 | || driver->speed < USB_SPEED_FULL |
@@ -1605,9 +1664,9 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
1605 | return retval; | 1664 | return retval; |
1606 | } | 1665 | } |
1607 | 1666 | ||
1608 | local_irq_disable(); | 1667 | spin_lock_irqsave(&udc->lock, flags); |
1609 | pullup(udc, 1); | 1668 | pullup(udc, 1); |
1610 | local_irq_enable(); | 1669 | spin_unlock_irqrestore(&udc->lock, flags); |
1611 | 1670 | ||
1612 | DBG("bound to %s\n", driver->driver.name); | 1671 | DBG("bound to %s\n", driver->driver.name); |
1613 | return 0; | 1672 | return 0; |
@@ -1617,15 +1676,16 @@ EXPORT_SYMBOL (usb_gadget_register_driver); | |||
1617 | int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) | 1676 | int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) |
1618 | { | 1677 | { |
1619 | struct at91_udc *udc = &controller; | 1678 | struct at91_udc *udc = &controller; |
1679 | unsigned long flags; | ||
1620 | 1680 | ||
1621 | if (!driver || driver != udc->driver || !driver->unbind) | 1681 | if (!driver || driver != udc->driver || !driver->unbind) |
1622 | return -EINVAL; | 1682 | return -EINVAL; |
1623 | 1683 | ||
1624 | local_irq_disable(); | 1684 | spin_lock_irqsave(&udc->lock, flags); |
1625 | udc->enabled = 0; | 1685 | udc->enabled = 0; |
1626 | at91_udp_write(udc, AT91_UDP_IDR, ~0); | 1686 | at91_udp_write(udc, AT91_UDP_IDR, ~0); |
1627 | pullup(udc, 0); | 1687 | pullup(udc, 0); |
1628 | local_irq_enable(); | 1688 | spin_unlock_irqrestore(&udc->lock, flags); |
1629 | 1689 | ||
1630 | driver->unbind(&udc->gadget); | 1690 | driver->unbind(&udc->gadget); |
1631 | udc->gadget.dev.driver = NULL; | 1691 | udc->gadget.dev.driver = NULL; |
@@ -1641,8 +1701,13 @@ EXPORT_SYMBOL (usb_gadget_unregister_driver); | |||
1641 | 1701 | ||
1642 | static void at91udc_shutdown(struct platform_device *dev) | 1702 | static void at91udc_shutdown(struct platform_device *dev) |
1643 | { | 1703 | { |
1704 | struct at91_udc *udc = platform_get_drvdata(dev); | ||
1705 | unsigned long flags; | ||
1706 | |||
1644 | /* force disconnect on reboot */ | 1707 | /* force disconnect on reboot */ |
1708 | spin_lock_irqsave(&udc->lock, flags); | ||
1645 | pullup(platform_get_drvdata(dev), 0); | 1709 | pullup(platform_get_drvdata(dev), 0); |
1710 | spin_unlock_irqrestore(&udc->lock, flags); | ||
1646 | } | 1711 | } |
1647 | 1712 | ||
1648 | static int __init at91udc_probe(struct platform_device *pdev) | 1713 | static int __init at91udc_probe(struct platform_device *pdev) |
@@ -1683,6 +1748,7 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
1683 | udc->board = *(struct at91_udc_data *) dev->platform_data; | 1748 | udc->board = *(struct at91_udc_data *) dev->platform_data; |
1684 | udc->pdev = pdev; | 1749 | udc->pdev = pdev; |
1685 | udc->enabled = 0; | 1750 | udc->enabled = 0; |
1751 | spin_lock_init(&udc->lock); | ||
1686 | 1752 | ||
1687 | /* rm9200 needs manual D+ pullup; off by default */ | 1753 | /* rm9200 needs manual D+ pullup; off by default */ |
1688 | if (cpu_is_at91rm9200()) { | 1754 | if (cpu_is_at91rm9200()) { |
@@ -1763,13 +1829,23 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
1763 | * Get the initial state of VBUS - we cannot expect | 1829 | * Get the initial state of VBUS - we cannot expect |
1764 | * a pending interrupt. | 1830 | * a pending interrupt. |
1765 | */ | 1831 | */ |
1766 | udc->vbus = gpio_get_value(udc->board.vbus_pin); | 1832 | udc->vbus = gpio_get_value_cansleep(udc->board.vbus_pin) ^ |
1767 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1833 | udc->board.vbus_active_low; |
1768 | IRQF_DISABLED, driver_name, udc)) { | 1834 | |
1769 | DBG("request vbus irq %d failed\n", | 1835 | if (udc->board.vbus_polled) { |
1770 | udc->board.vbus_pin); | 1836 | INIT_WORK(&udc->vbus_timer_work, at91_vbus_timer_work); |
1771 | retval = -EBUSY; | 1837 | setup_timer(&udc->vbus_timer, at91_vbus_timer, |
1772 | goto fail3; | 1838 | (unsigned long)udc); |
1839 | mod_timer(&udc->vbus_timer, | ||
1840 | jiffies + VBUS_POLL_TIMEOUT); | ||
1841 | } else { | ||
1842 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | ||
1843 | IRQF_DISABLED, driver_name, udc)) { | ||
1844 | DBG("request vbus irq %d failed\n", | ||
1845 | udc->board.vbus_pin); | ||
1846 | retval = -EBUSY; | ||
1847 | goto fail3; | ||
1848 | } | ||
1773 | } | 1849 | } |
1774 | } else { | 1850 | } else { |
1775 | DBG("no VBUS detection, assuming always-on\n"); | 1851 | DBG("no VBUS detection, assuming always-on\n"); |
@@ -1804,13 +1880,16 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1804 | { | 1880 | { |
1805 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1881 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1806 | struct resource *res; | 1882 | struct resource *res; |
1883 | unsigned long flags; | ||
1807 | 1884 | ||
1808 | DBG("remove\n"); | 1885 | DBG("remove\n"); |
1809 | 1886 | ||
1810 | if (udc->driver) | 1887 | if (udc->driver) |
1811 | return -EBUSY; | 1888 | return -EBUSY; |
1812 | 1889 | ||
1890 | spin_lock_irqsave(&udc->lock, flags); | ||
1813 | pullup(udc, 0); | 1891 | pullup(udc, 0); |
1892 | spin_unlock_irqrestore(&udc->lock, flags); | ||
1814 | 1893 | ||
1815 | device_init_wakeup(&pdev->dev, 0); | 1894 | device_init_wakeup(&pdev->dev, 0); |
1816 | remove_debug_file(udc); | 1895 | remove_debug_file(udc); |
@@ -1840,6 +1919,7 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1840 | { | 1919 | { |
1841 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1920 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1842 | int wake = udc->driver && device_may_wakeup(&pdev->dev); | 1921 | int wake = udc->driver && device_may_wakeup(&pdev->dev); |
1922 | unsigned long flags; | ||
1843 | 1923 | ||
1844 | /* Unless we can act normally to the host (letting it wake us up | 1924 | /* Unless we can act normally to the host (letting it wake us up |
1845 | * whenever it has work for us) force disconnect. Wakeup requires | 1925 | * whenever it has work for us) force disconnect. Wakeup requires |
@@ -1849,13 +1929,15 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1849 | if ((!udc->suspended && udc->addr) | 1929 | if ((!udc->suspended && udc->addr) |
1850 | || !wake | 1930 | || !wake |
1851 | || at91_suspend_entering_slow_clock()) { | 1931 | || at91_suspend_entering_slow_clock()) { |
1932 | spin_lock_irqsave(&udc->lock, flags); | ||
1852 | pullup(udc, 0); | 1933 | pullup(udc, 0); |
1853 | wake = 0; | 1934 | wake = 0; |
1935 | spin_unlock_irqrestore(&udc->lock, flags); | ||
1854 | } else | 1936 | } else |
1855 | enable_irq_wake(udc->udp_irq); | 1937 | enable_irq_wake(udc->udp_irq); |
1856 | 1938 | ||
1857 | udc->active_suspend = wake; | 1939 | udc->active_suspend = wake; |
1858 | if (udc->board.vbus_pin > 0 && wake) | 1940 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && wake) |
1859 | enable_irq_wake(udc->board.vbus_pin); | 1941 | enable_irq_wake(udc->board.vbus_pin); |
1860 | return 0; | 1942 | return 0; |
1861 | } | 1943 | } |
@@ -1863,15 +1945,20 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1863 | static int at91udc_resume(struct platform_device *pdev) | 1945 | static int at91udc_resume(struct platform_device *pdev) |
1864 | { | 1946 | { |
1865 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1947 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1948 | unsigned long flags; | ||
1866 | 1949 | ||
1867 | if (udc->board.vbus_pin > 0 && udc->active_suspend) | 1950 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && |
1951 | udc->active_suspend) | ||
1868 | disable_irq_wake(udc->board.vbus_pin); | 1952 | disable_irq_wake(udc->board.vbus_pin); |
1869 | 1953 | ||
1870 | /* maybe reconnect to host; if so, clocks on */ | 1954 | /* maybe reconnect to host; if so, clocks on */ |
1871 | if (udc->active_suspend) | 1955 | if (udc->active_suspend) |
1872 | disable_irq_wake(udc->udp_irq); | 1956 | disable_irq_wake(udc->udp_irq); |
1873 | else | 1957 | else { |
1958 | spin_lock_irqsave(&udc->lock, flags); | ||
1874 | pullup(udc, 1); | 1959 | pullup(udc, 1); |
1960 | spin_unlock_irqrestore(&udc->lock, flags); | ||
1961 | } | ||
1875 | return 0; | 1962 | return 0; |
1876 | } | 1963 | } |
1877 | #else | 1964 | #else |
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h index c65d62295890..108ca54f9092 100644 --- a/drivers/usb/gadget/at91_udc.h +++ b/drivers/usb/gadget/at91_udc.h | |||
@@ -144,6 +144,9 @@ struct at91_udc { | |||
144 | struct proc_dir_entry *pde; | 144 | struct proc_dir_entry *pde; |
145 | void __iomem *udp_baseaddr; | 145 | void __iomem *udp_baseaddr; |
146 | int udp_irq; | 146 | int udp_irq; |
147 | spinlock_t lock; | ||
148 | struct timer_list vbus_timer; | ||
149 | struct work_struct vbus_timer_work; | ||
147 | }; | 150 | }; |
148 | 151 | ||
149 | static inline struct at91_udc *to_udc(struct usb_gadget *g) | 152 | static inline struct at91_udc *to_udc(struct usb_gadget *g) |
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c index 43bf44514c41..b91115f84b13 100644 --- a/drivers/usb/gadget/f_audio.c +++ b/drivers/usb/gadget/f_audio.c | |||
@@ -101,7 +101,7 @@ static struct uac_feature_unit_descriptor_0 feature_unit_desc = { | |||
101 | static struct usb_audio_control mute_control = { | 101 | static struct usb_audio_control mute_control = { |
102 | .list = LIST_HEAD_INIT(mute_control.list), | 102 | .list = LIST_HEAD_INIT(mute_control.list), |
103 | .name = "Mute Control", | 103 | .name = "Mute Control", |
104 | .type = UAC_MUTE_CONTROL, | 104 | .type = UAC_FU_MUTE, |
105 | /* Todo: add real Mute control code */ | 105 | /* Todo: add real Mute control code */ |
106 | .set = generic_set_cmd, | 106 | .set = generic_set_cmd, |
107 | .get = generic_get_cmd, | 107 | .get = generic_get_cmd, |
@@ -110,7 +110,7 @@ static struct usb_audio_control mute_control = { | |||
110 | static struct usb_audio_control volume_control = { | 110 | static struct usb_audio_control volume_control = { |
111 | .list = LIST_HEAD_INIT(volume_control.list), | 111 | .list = LIST_HEAD_INIT(volume_control.list), |
112 | .name = "Volume Control", | 112 | .name = "Volume Control", |
113 | .type = UAC_VOLUME_CONTROL, | 113 | .type = UAC_FU_VOLUME, |
114 | /* Todo: add real Volume control code */ | 114 | /* Todo: add real Volume control code */ |
115 | .set = generic_set_cmd, | 115 | .set = generic_set_cmd, |
116 | .get = generic_get_cmd, | 116 | .get = generic_get_cmd, |
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 38226e9a371d..95dd4662d6a8 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
@@ -469,8 +469,7 @@ static int eem_unwrap(struct gether *port, | |||
469 | crc = get_unaligned_le32(skb->data + len | 469 | crc = get_unaligned_le32(skb->data + len |
470 | - ETH_FCS_LEN); | 470 | - ETH_FCS_LEN); |
471 | crc2 = ~crc32_le(~0, | 471 | crc2 = ~crc32_le(~0, |
472 | skb->data, | 472 | skb->data, len - ETH_FCS_LEN); |
473 | skb->len - ETH_FCS_LEN); | ||
474 | } else { | 473 | } else { |
475 | crc = get_unaligned_be32(skb->data + len | 474 | crc = get_unaligned_be32(skb->data + len |
476 | - ETH_FCS_LEN); | 475 | - ETH_FCS_LEN); |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index d69eccf5f197..2aaa0f75c6cf 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -136,7 +136,7 @@ struct ffs_data { | |||
136 | * handling setup requests immidiatelly user space may be so | 136 | * handling setup requests immidiatelly user space may be so |
137 | * slow that another setup will be sent to the gadget but this | 137 | * slow that another setup will be sent to the gadget but this |
138 | * time not to us but another function and then there could be | 138 | * time not to us but another function and then there could be |
139 | * a race. Is taht the case? Or maybe we can use cdev->req | 139 | * a race. Is that the case? Or maybe we can use cdev->req |
140 | * after all, maybe we just need some spinlock for that? */ | 140 | * after all, maybe we just need some spinlock for that? */ |
141 | struct usb_request *ep0req; /* P: mutex */ | 141 | struct usb_request *ep0req; /* P: mutex */ |
142 | struct completion ep0req_completion; /* P: mutex */ | 142 | struct completion ep0req_completion; /* P: mutex */ |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 7d05a0be5c60..4ce899c9b165 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -321,8 +321,8 @@ struct fsg_dev; | |||
321 | /* Data shared by all the FSG instances. */ | 321 | /* Data shared by all the FSG instances. */ |
322 | struct fsg_common { | 322 | struct fsg_common { |
323 | struct usb_gadget *gadget; | 323 | struct usb_gadget *gadget; |
324 | struct fsg_dev *fsg; | 324 | struct fsg_dev *fsg, *new_fsg; |
325 | struct fsg_dev *prev_fsg; | 325 | wait_queue_head_t fsg_wait; |
326 | 326 | ||
327 | /* filesem protects: backing files in use */ | 327 | /* filesem protects: backing files in use */ |
328 | struct rw_semaphore filesem; | 328 | struct rw_semaphore filesem; |
@@ -351,7 +351,6 @@ struct fsg_common { | |||
351 | enum fsg_state state; /* For exception handling */ | 351 | enum fsg_state state; /* For exception handling */ |
352 | unsigned int exception_req_tag; | 352 | unsigned int exception_req_tag; |
353 | 353 | ||
354 | u8 config, new_config; | ||
355 | enum data_direction data_dir; | 354 | enum data_direction data_dir; |
356 | u32 data_size; | 355 | u32 data_size; |
357 | u32 data_size_from_cmnd; | 356 | u32 data_size_from_cmnd; |
@@ -595,7 +594,7 @@ static int fsg_setup(struct usb_function *f, | |||
595 | u16 w_value = le16_to_cpu(ctrl->wValue); | 594 | u16 w_value = le16_to_cpu(ctrl->wValue); |
596 | u16 w_length = le16_to_cpu(ctrl->wLength); | 595 | u16 w_length = le16_to_cpu(ctrl->wLength); |
597 | 596 | ||
598 | if (!fsg->common->config) | 597 | if (!fsg_is_set(fsg->common)) |
599 | return -EOPNOTSUPP; | 598 | return -EOPNOTSUPP; |
600 | 599 | ||
601 | switch (ctrl->bRequest) { | 600 | switch (ctrl->bRequest) { |
@@ -2303,24 +2302,20 @@ static int alloc_request(struct fsg_common *common, struct usb_ep *ep, | |||
2303 | return -ENOMEM; | 2302 | return -ENOMEM; |
2304 | } | 2303 | } |
2305 | 2304 | ||
2306 | /* | 2305 | /* Reset interface setting and re-init endpoint state (toggle etc). */ |
2307 | * Reset interface setting and re-init endpoint state (toggle etc). | 2306 | static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg) |
2308 | * Call with altsetting < 0 to disable the interface. The only other | ||
2309 | * available altsetting is 0, which enables the interface. | ||
2310 | */ | ||
2311 | static int do_set_interface(struct fsg_common *common, int altsetting) | ||
2312 | { | 2307 | { |
2313 | int rc = 0; | 2308 | const struct usb_endpoint_descriptor *d; |
2314 | int i; | 2309 | struct fsg_dev *fsg; |
2315 | const struct usb_endpoint_descriptor *d; | 2310 | int i, rc = 0; |
2316 | 2311 | ||
2317 | if (common->running) | 2312 | if (common->running) |
2318 | DBG(common, "reset interface\n"); | 2313 | DBG(common, "reset interface\n"); |
2319 | 2314 | ||
2320 | reset: | 2315 | reset: |
2321 | /* Deallocate the requests */ | 2316 | /* Deallocate the requests */ |
2322 | if (common->prev_fsg) { | 2317 | if (common->fsg) { |
2323 | struct fsg_dev *fsg = common->prev_fsg; | 2318 | fsg = common->fsg; |
2324 | 2319 | ||
2325 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | 2320 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2326 | struct fsg_buffhd *bh = &common->buffhds[i]; | 2321 | struct fsg_buffhd *bh = &common->buffhds[i]; |
@@ -2345,88 +2340,53 @@ reset: | |||
2345 | fsg->bulk_out_enabled = 0; | 2340 | fsg->bulk_out_enabled = 0; |
2346 | } | 2341 | } |
2347 | 2342 | ||
2348 | common->prev_fsg = 0; | 2343 | common->fsg = NULL; |
2344 | wake_up(&common->fsg_wait); | ||
2349 | } | 2345 | } |
2350 | 2346 | ||
2351 | common->running = 0; | 2347 | common->running = 0; |
2352 | if (altsetting < 0 || rc != 0) | 2348 | if (!new_fsg || rc) |
2353 | return rc; | 2349 | return rc; |
2354 | 2350 | ||
2355 | DBG(common, "set interface %d\n", altsetting); | 2351 | common->fsg = new_fsg; |
2352 | fsg = common->fsg; | ||
2356 | 2353 | ||
2357 | if (fsg_is_set(common)) { | 2354 | /* Enable the endpoints */ |
2358 | struct fsg_dev *fsg = common->fsg; | 2355 | d = fsg_ep_desc(common->gadget, |
2359 | common->prev_fsg = common->fsg; | 2356 | &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc); |
2357 | rc = enable_endpoint(common, fsg->bulk_in, d); | ||
2358 | if (rc) | ||
2359 | goto reset; | ||
2360 | fsg->bulk_in_enabled = 1; | ||
2361 | |||
2362 | d = fsg_ep_desc(common->gadget, | ||
2363 | &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc); | ||
2364 | rc = enable_endpoint(common, fsg->bulk_out, d); | ||
2365 | if (rc) | ||
2366 | goto reset; | ||
2367 | fsg->bulk_out_enabled = 1; | ||
2368 | common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); | ||
2369 | clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); | ||
2360 | 2370 | ||
2361 | /* Enable the endpoints */ | 2371 | /* Allocate the requests */ |
2362 | d = fsg_ep_desc(common->gadget, | 2372 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2363 | &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc); | 2373 | struct fsg_buffhd *bh = &common->buffhds[i]; |
2364 | rc = enable_endpoint(common, fsg->bulk_in, d); | 2374 | |
2375 | rc = alloc_request(common, fsg->bulk_in, &bh->inreq); | ||
2365 | if (rc) | 2376 | if (rc) |
2366 | goto reset; | 2377 | goto reset; |
2367 | fsg->bulk_in_enabled = 1; | 2378 | rc = alloc_request(common, fsg->bulk_out, &bh->outreq); |
2368 | |||
2369 | d = fsg_ep_desc(common->gadget, | ||
2370 | &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc); | ||
2371 | rc = enable_endpoint(common, fsg->bulk_out, d); | ||
2372 | if (rc) | 2379 | if (rc) |
2373 | goto reset; | 2380 | goto reset; |
2374 | fsg->bulk_out_enabled = 1; | 2381 | bh->inreq->buf = bh->outreq->buf = bh->buf; |
2375 | common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); | 2382 | bh->inreq->context = bh->outreq->context = bh; |
2376 | clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); | 2383 | bh->inreq->complete = bulk_in_complete; |
2377 | 2384 | bh->outreq->complete = bulk_out_complete; | |
2378 | /* Allocate the requests */ | ||
2379 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | ||
2380 | struct fsg_buffhd *bh = &common->buffhds[i]; | ||
2381 | |||
2382 | rc = alloc_request(common, fsg->bulk_in, &bh->inreq); | ||
2383 | if (rc) | ||
2384 | goto reset; | ||
2385 | rc = alloc_request(common, fsg->bulk_out, &bh->outreq); | ||
2386 | if (rc) | ||
2387 | goto reset; | ||
2388 | bh->inreq->buf = bh->outreq->buf = bh->buf; | ||
2389 | bh->inreq->context = bh->outreq->context = bh; | ||
2390 | bh->inreq->complete = bulk_in_complete; | ||
2391 | bh->outreq->complete = bulk_out_complete; | ||
2392 | } | ||
2393 | |||
2394 | common->running = 1; | ||
2395 | for (i = 0; i < common->nluns; ++i) | ||
2396 | common->luns[i].unit_attention_data = SS_RESET_OCCURRED; | ||
2397 | return rc; | ||
2398 | } else { | ||
2399 | return -EIO; | ||
2400 | } | ||
2401 | } | ||
2402 | |||
2403 | |||
2404 | /* | ||
2405 | * Change our operational configuration. This code must agree with the code | ||
2406 | * that returns config descriptors, and with interface altsetting code. | ||
2407 | * | ||
2408 | * It's also responsible for power management interactions. Some | ||
2409 | * configurations might not work with our current power sources. | ||
2410 | * For now we just assume the gadget is always self-powered. | ||
2411 | */ | ||
2412 | static int do_set_config(struct fsg_common *common, u8 new_config) | ||
2413 | { | ||
2414 | int rc = 0; | ||
2415 | |||
2416 | /* Disable the single interface */ | ||
2417 | if (common->config != 0) { | ||
2418 | DBG(common, "reset config\n"); | ||
2419 | common->config = 0; | ||
2420 | rc = do_set_interface(common, -1); | ||
2421 | } | 2385 | } |
2422 | 2386 | ||
2423 | /* Enable the interface */ | 2387 | common->running = 1; |
2424 | if (new_config != 0) { | 2388 | for (i = 0; i < common->nluns; ++i) |
2425 | common->config = new_config; | 2389 | common->luns[i].unit_attention_data = SS_RESET_OCCURRED; |
2426 | rc = do_set_interface(common, 0); | ||
2427 | if (rc != 0) | ||
2428 | common->config = 0; /* Reset on errors */ | ||
2429 | } | ||
2430 | return rc; | 2390 | return rc; |
2431 | } | 2391 | } |
2432 | 2392 | ||
@@ -2437,9 +2397,7 @@ static int do_set_config(struct fsg_common *common, u8 new_config) | |||
2437 | static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | 2397 | static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
2438 | { | 2398 | { |
2439 | struct fsg_dev *fsg = fsg_from_func(f); | 2399 | struct fsg_dev *fsg = fsg_from_func(f); |
2440 | fsg->common->prev_fsg = fsg->common->fsg; | 2400 | fsg->common->new_fsg = fsg; |
2441 | fsg->common->fsg = fsg; | ||
2442 | fsg->common->new_config = 1; | ||
2443 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | 2401 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); |
2444 | return 0; | 2402 | return 0; |
2445 | } | 2403 | } |
@@ -2447,9 +2405,7 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
2447 | static void fsg_disable(struct usb_function *f) | 2405 | static void fsg_disable(struct usb_function *f) |
2448 | { | 2406 | { |
2449 | struct fsg_dev *fsg = fsg_from_func(f); | 2407 | struct fsg_dev *fsg = fsg_from_func(f); |
2450 | fsg->common->prev_fsg = fsg->common->fsg; | 2408 | fsg->common->new_fsg = NULL; |
2451 | fsg->common->fsg = fsg; | ||
2452 | fsg->common->new_config = 0; | ||
2453 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | 2409 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); |
2454 | } | 2410 | } |
2455 | 2411 | ||
@@ -2459,19 +2415,17 @@ static void fsg_disable(struct usb_function *f) | |||
2459 | static void handle_exception(struct fsg_common *common) | 2415 | static void handle_exception(struct fsg_common *common) |
2460 | { | 2416 | { |
2461 | siginfo_t info; | 2417 | siginfo_t info; |
2462 | int sig; | ||
2463 | int i; | 2418 | int i; |
2464 | struct fsg_buffhd *bh; | 2419 | struct fsg_buffhd *bh; |
2465 | enum fsg_state old_state; | 2420 | enum fsg_state old_state; |
2466 | u8 new_config; | ||
2467 | struct fsg_lun *curlun; | 2421 | struct fsg_lun *curlun; |
2468 | unsigned int exception_req_tag; | 2422 | unsigned int exception_req_tag; |
2469 | int rc; | ||
2470 | 2423 | ||
2471 | /* Clear the existing signals. Anything but SIGUSR1 is converted | 2424 | /* Clear the existing signals. Anything but SIGUSR1 is converted |
2472 | * into a high-priority EXIT exception. */ | 2425 | * into a high-priority EXIT exception. */ |
2473 | for (;;) { | 2426 | for (;;) { |
2474 | sig = dequeue_signal_lock(current, ¤t->blocked, &info); | 2427 | int sig = |
2428 | dequeue_signal_lock(current, ¤t->blocked, &info); | ||
2475 | if (!sig) | 2429 | if (!sig) |
2476 | break; | 2430 | break; |
2477 | if (sig != SIGUSR1) { | 2431 | if (sig != SIGUSR1) { |
@@ -2482,7 +2436,7 @@ static void handle_exception(struct fsg_common *common) | |||
2482 | } | 2436 | } |
2483 | 2437 | ||
2484 | /* Cancel all the pending transfers */ | 2438 | /* Cancel all the pending transfers */ |
2485 | if (fsg_is_set(common)) { | 2439 | if (likely(common->fsg)) { |
2486 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | 2440 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2487 | bh = &common->buffhds[i]; | 2441 | bh = &common->buffhds[i]; |
2488 | if (bh->inreq_busy) | 2442 | if (bh->inreq_busy) |
@@ -2523,7 +2477,6 @@ static void handle_exception(struct fsg_common *common) | |||
2523 | common->next_buffhd_to_fill = &common->buffhds[0]; | 2477 | common->next_buffhd_to_fill = &common->buffhds[0]; |
2524 | common->next_buffhd_to_drain = &common->buffhds[0]; | 2478 | common->next_buffhd_to_drain = &common->buffhds[0]; |
2525 | exception_req_tag = common->exception_req_tag; | 2479 | exception_req_tag = common->exception_req_tag; |
2526 | new_config = common->new_config; | ||
2527 | old_state = common->state; | 2480 | old_state = common->state; |
2528 | 2481 | ||
2529 | if (old_state == FSG_STATE_ABORT_BULK_OUT) | 2482 | if (old_state == FSG_STATE_ABORT_BULK_OUT) |
@@ -2573,12 +2526,12 @@ static void handle_exception(struct fsg_common *common) | |||
2573 | break; | 2526 | break; |
2574 | 2527 | ||
2575 | case FSG_STATE_CONFIG_CHANGE: | 2528 | case FSG_STATE_CONFIG_CHANGE: |
2576 | rc = do_set_config(common, new_config); | 2529 | do_set_interface(common, common->new_fsg); |
2577 | break; | 2530 | break; |
2578 | 2531 | ||
2579 | case FSG_STATE_EXIT: | 2532 | case FSG_STATE_EXIT: |
2580 | case FSG_STATE_TERMINATED: | 2533 | case FSG_STATE_TERMINATED: |
2581 | do_set_config(common, 0); /* Free resources */ | 2534 | do_set_interface(common, NULL); /* Free resources */ |
2582 | spin_lock_irq(&common->lock); | 2535 | spin_lock_irq(&common->lock); |
2583 | common->state = FSG_STATE_TERMINATED; /* Stop the thread */ | 2536 | common->state = FSG_STATE_TERMINATED; /* Stop the thread */ |
2584 | spin_unlock_irq(&common->lock); | 2537 | spin_unlock_irq(&common->lock); |
@@ -2863,6 +2816,7 @@ buffhds_first_it: | |||
2863 | goto error_release; | 2816 | goto error_release; |
2864 | } | 2817 | } |
2865 | init_completion(&common->thread_notifier); | 2818 | init_completion(&common->thread_notifier); |
2819 | init_waitqueue_head(&common->fsg_wait); | ||
2866 | #undef OR | 2820 | #undef OR |
2867 | 2821 | ||
2868 | 2822 | ||
@@ -2957,9 +2911,17 @@ static void fsg_common_release(struct kref *ref) | |||
2957 | static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) | 2911 | static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) |
2958 | { | 2912 | { |
2959 | struct fsg_dev *fsg = fsg_from_func(f); | 2913 | struct fsg_dev *fsg = fsg_from_func(f); |
2914 | struct fsg_common *common = fsg->common; | ||
2960 | 2915 | ||
2961 | DBG(fsg, "unbind\n"); | 2916 | DBG(fsg, "unbind\n"); |
2962 | fsg_common_put(fsg->common); | 2917 | if (fsg->common->fsg == fsg) { |
2918 | fsg->common->new_fsg = NULL; | ||
2919 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | ||
2920 | /* FIXME: make interruptible or killable somehow? */ | ||
2921 | wait_event(common->fsg_wait, common->fsg != fsg); | ||
2922 | } | ||
2923 | |||
2924 | fsg_common_put(common); | ||
2963 | usb_free_descriptors(fsg->function.descriptors); | 2925 | usb_free_descriptors(fsg->function.descriptors); |
2964 | usb_free_descriptors(fsg->function.hs_descriptors); | 2926 | usb_free_descriptors(fsg->function.hs_descriptors); |
2965 | kfree(fsg); | 2927 | kfree(fsg); |
@@ -2970,7 +2932,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
2970 | { | 2932 | { |
2971 | struct fsg_dev *fsg = fsg_from_func(f); | 2933 | struct fsg_dev *fsg = fsg_from_func(f); |
2972 | struct usb_gadget *gadget = c->cdev->gadget; | 2934 | struct usb_gadget *gadget = c->cdev->gadget; |
2973 | int rc; | ||
2974 | int i; | 2935 | int i; |
2975 | struct usb_ep *ep; | 2936 | struct usb_ep *ep; |
2976 | 2937 | ||
@@ -2996,6 +2957,11 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
2996 | ep->driver_data = fsg->common; /* claim the endpoint */ | 2957 | ep->driver_data = fsg->common; /* claim the endpoint */ |
2997 | fsg->bulk_out = ep; | 2958 | fsg->bulk_out = ep; |
2998 | 2959 | ||
2960 | /* Copy descriptors */ | ||
2961 | f->descriptors = usb_copy_descriptors(fsg_fs_function); | ||
2962 | if (unlikely(!f->descriptors)) | ||
2963 | return -ENOMEM; | ||
2964 | |||
2999 | if (gadget_is_dualspeed(gadget)) { | 2965 | if (gadget_is_dualspeed(gadget)) { |
3000 | /* Assume endpoint addresses are the same for both speeds */ | 2966 | /* Assume endpoint addresses are the same for both speeds */ |
3001 | fsg_hs_bulk_in_desc.bEndpointAddress = | 2967 | fsg_hs_bulk_in_desc.bEndpointAddress = |
@@ -3003,16 +2969,17 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
3003 | fsg_hs_bulk_out_desc.bEndpointAddress = | 2969 | fsg_hs_bulk_out_desc.bEndpointAddress = |
3004 | fsg_fs_bulk_out_desc.bEndpointAddress; | 2970 | fsg_fs_bulk_out_desc.bEndpointAddress; |
3005 | f->hs_descriptors = usb_copy_descriptors(fsg_hs_function); | 2971 | f->hs_descriptors = usb_copy_descriptors(fsg_hs_function); |
3006 | if (unlikely(!f->hs_descriptors)) | 2972 | if (unlikely(!f->hs_descriptors)) { |
2973 | usb_free_descriptors(f->descriptors); | ||
3007 | return -ENOMEM; | 2974 | return -ENOMEM; |
2975 | } | ||
3008 | } | 2976 | } |
3009 | 2977 | ||
3010 | return 0; | 2978 | return 0; |
3011 | 2979 | ||
3012 | autoconf_fail: | 2980 | autoconf_fail: |
3013 | ERROR(fsg, "unable to autoconfigure all endpoints\n"); | 2981 | ERROR(fsg, "unable to autoconfigure all endpoints\n"); |
3014 | rc = -ENOTSUPP; | 2982 | return -ENOTSUPP; |
3015 | return rc; | ||
3016 | } | 2983 | } |
3017 | 2984 | ||
3018 | 2985 | ||
@@ -3036,11 +3003,6 @@ static int fsg_add(struct usb_composite_dev *cdev, | |||
3036 | 3003 | ||
3037 | fsg->function.name = FSG_DRIVER_DESC; | 3004 | fsg->function.name = FSG_DRIVER_DESC; |
3038 | fsg->function.strings = fsg_strings_array; | 3005 | fsg->function.strings = fsg_strings_array; |
3039 | fsg->function.descriptors = usb_copy_descriptors(fsg_fs_function); | ||
3040 | if (unlikely(!fsg->function.descriptors)) { | ||
3041 | rc = -ENOMEM; | ||
3042 | goto error_free_fsg; | ||
3043 | } | ||
3044 | fsg->function.bind = fsg_bind; | 3006 | fsg->function.bind = fsg_bind; |
3045 | fsg->function.unbind = fsg_unbind; | 3007 | fsg->function.unbind = fsg_unbind; |
3046 | fsg->function.setup = fsg_setup; | 3008 | fsg->function.setup = fsg_setup; |
@@ -3056,19 +3018,9 @@ static int fsg_add(struct usb_composite_dev *cdev, | |||
3056 | 3018 | ||
3057 | rc = usb_add_function(c, &fsg->function); | 3019 | rc = usb_add_function(c, &fsg->function); |
3058 | if (unlikely(rc)) | 3020 | if (unlikely(rc)) |
3059 | goto error_free_all; | 3021 | kfree(fsg); |
3060 | 3022 | else | |
3061 | fsg_common_get(fsg->common); | 3023 | fsg_common_get(fsg->common); |
3062 | return 0; | ||
3063 | |||
3064 | error_free_all: | ||
3065 | usb_free_descriptors(fsg->function.descriptors); | ||
3066 | /* fsg_bind() might have copied those; or maybe not? who cares | ||
3067 | * -- free it just in case. */ | ||
3068 | usb_free_descriptors(fsg->function.hs_descriptors); | ||
3069 | error_free_fsg: | ||
3070 | kfree(fsg); | ||
3071 | |||
3072 | return rc; | 3024 | return rc; |
3073 | } | 3025 | } |
3074 | 3026 | ||
diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c index fc2611f8b326..be446b7e7eaa 100644 --- a/drivers/usb/gadget/f_uvc.c +++ b/drivers/usb/gadget/f_uvc.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "uvc.h" | 29 | #include "uvc.h" |
30 | 30 | ||
31 | unsigned int uvc_trace_param; | 31 | unsigned int uvc_gadget_trace_param; |
32 | 32 | ||
33 | /* -------------------------------------------------------------------------- | 33 | /* -------------------------------------------------------------------------- |
34 | * Function descriptors | 34 | * Function descriptors |
@@ -61,12 +61,12 @@ static struct usb_gadget_strings *uvc_function_strings[] = { | |||
61 | #define UVC_INTF_VIDEO_STREAMING 1 | 61 | #define UVC_INTF_VIDEO_STREAMING 1 |
62 | 62 | ||
63 | static struct usb_interface_assoc_descriptor uvc_iad __initdata = { | 63 | static struct usb_interface_assoc_descriptor uvc_iad __initdata = { |
64 | .bLength = USB_DT_INTERFACE_ASSOCIATION_SIZE, | 64 | .bLength = sizeof(uvc_iad), |
65 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, | 65 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, |
66 | .bFirstInterface = 0, | 66 | .bFirstInterface = 0, |
67 | .bInterfaceCount = 2, | 67 | .bInterfaceCount = 2, |
68 | .bFunctionClass = USB_CLASS_VIDEO, | 68 | .bFunctionClass = USB_CLASS_VIDEO, |
69 | .bFunctionSubClass = 0x03, | 69 | .bFunctionSubClass = UVC_SC_VIDEO_INTERFACE_COLLECTION, |
70 | .bFunctionProtocol = 0x00, | 70 | .bFunctionProtocol = 0x00, |
71 | .iFunction = 0, | 71 | .iFunction = 0, |
72 | }; | 72 | }; |
@@ -78,7 +78,7 @@ static struct usb_interface_descriptor uvc_control_intf __initdata = { | |||
78 | .bAlternateSetting = 0, | 78 | .bAlternateSetting = 0, |
79 | .bNumEndpoints = 1, | 79 | .bNumEndpoints = 1, |
80 | .bInterfaceClass = USB_CLASS_VIDEO, | 80 | .bInterfaceClass = USB_CLASS_VIDEO, |
81 | .bInterfaceSubClass = 0x01, | 81 | .bInterfaceSubClass = UVC_SC_VIDEOCONTROL, |
82 | .bInterfaceProtocol = 0x00, | 82 | .bInterfaceProtocol = 0x00, |
83 | .iInterface = 0, | 83 | .iInterface = 0, |
84 | }; | 84 | }; |
@@ -106,7 +106,7 @@ static struct usb_interface_descriptor uvc_streaming_intf_alt0 __initdata = { | |||
106 | .bAlternateSetting = 0, | 106 | .bAlternateSetting = 0, |
107 | .bNumEndpoints = 0, | 107 | .bNumEndpoints = 0, |
108 | .bInterfaceClass = USB_CLASS_VIDEO, | 108 | .bInterfaceClass = USB_CLASS_VIDEO, |
109 | .bInterfaceSubClass = 0x02, | 109 | .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING, |
110 | .bInterfaceProtocol = 0x00, | 110 | .bInterfaceProtocol = 0x00, |
111 | .iInterface = 0, | 111 | .iInterface = 0, |
112 | }; | 112 | }; |
@@ -118,7 +118,7 @@ static struct usb_interface_descriptor uvc_streaming_intf_alt1 __initdata = { | |||
118 | .bAlternateSetting = 1, | 118 | .bAlternateSetting = 1, |
119 | .bNumEndpoints = 1, | 119 | .bNumEndpoints = 1, |
120 | .bInterfaceClass = USB_CLASS_VIDEO, | 120 | .bInterfaceClass = USB_CLASS_VIDEO, |
121 | .bInterfaceSubClass = 0x02, | 121 | .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING, |
122 | .bInterfaceProtocol = 0x00, | 122 | .bInterfaceProtocol = 0x00, |
123 | .iInterface = 0, | 123 | .iInterface = 0, |
124 | }; | 124 | }; |
@@ -603,15 +603,15 @@ uvc_bind_config(struct usb_configuration *c, | |||
603 | 603 | ||
604 | /* Validate the descriptors. */ | 604 | /* Validate the descriptors. */ |
605 | if (control == NULL || control[0] == NULL || | 605 | if (control == NULL || control[0] == NULL || |
606 | control[0]->bDescriptorSubType != UVC_DT_HEADER) | 606 | control[0]->bDescriptorSubType != UVC_VC_HEADER) |
607 | goto error; | 607 | goto error; |
608 | 608 | ||
609 | if (fs_streaming == NULL || fs_streaming[0] == NULL || | 609 | if (fs_streaming == NULL || fs_streaming[0] == NULL || |
610 | fs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER) | 610 | fs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) |
611 | goto error; | 611 | goto error; |
612 | 612 | ||
613 | if (hs_streaming == NULL || hs_streaming[0] == NULL || | 613 | if (hs_streaming == NULL || hs_streaming[0] == NULL || |
614 | hs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER) | 614 | hs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) |
615 | goto error; | 615 | goto error; |
616 | 616 | ||
617 | uvc->desc.control = control; | 617 | uvc->desc.control = control; |
@@ -656,6 +656,6 @@ error: | |||
656 | return ret; | 656 | return ret; |
657 | } | 657 | } |
658 | 658 | ||
659 | module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR); | 659 | module_param_named(trace, uvc_gadget_trace_param, uint, S_IRUGO|S_IWUSR); |
660 | MODULE_PARM_DESC(trace, "Trace level bitmask"); | 660 | MODULE_PARM_DESC(trace, "Trace level bitmask"); |
661 | 661 | ||
diff --git a/drivers/usb/gadget/f_uvc.h b/drivers/usb/gadget/f_uvc.h index 8a5db7c4fe7c..e18a6636c283 100644 --- a/drivers/usb/gadget/f_uvc.h +++ b/drivers/usb/gadget/f_uvc.h | |||
@@ -15,357 +15,7 @@ | |||
15 | #define _F_UVC_H_ | 15 | #define _F_UVC_H_ |
16 | 16 | ||
17 | #include <linux/usb/composite.h> | 17 | #include <linux/usb/composite.h> |
18 | 18 | #include <linux/usb/video.h> | |
19 | #define USB_CLASS_VIDEO_CONTROL 1 | ||
20 | #define USB_CLASS_VIDEO_STREAMING 2 | ||
21 | |||
22 | struct uvc_descriptor_header { | ||
23 | __u8 bLength; | ||
24 | __u8 bDescriptorType; | ||
25 | __u8 bDescriptorSubType; | ||
26 | } __attribute__ ((packed)); | ||
27 | |||
28 | struct uvc_header_descriptor { | ||
29 | __u8 bLength; | ||
30 | __u8 bDescriptorType; | ||
31 | __u8 bDescriptorSubType; | ||
32 | __u16 bcdUVC; | ||
33 | __u16 wTotalLength; | ||
34 | __u32 dwClockFrequency; | ||
35 | __u8 bInCollection; | ||
36 | __u8 baInterfaceNr[]; | ||
37 | } __attribute__((__packed__)); | ||
38 | |||
39 | #define UVC_HEADER_DESCRIPTOR(n) uvc_header_descriptor_##n | ||
40 | |||
41 | #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ | ||
42 | struct UVC_HEADER_DESCRIPTOR(n) { \ | ||
43 | __u8 bLength; \ | ||
44 | __u8 bDescriptorType; \ | ||
45 | __u8 bDescriptorSubType; \ | ||
46 | __u16 bcdUVC; \ | ||
47 | __u16 wTotalLength; \ | ||
48 | __u32 dwClockFrequency; \ | ||
49 | __u8 bInCollection; \ | ||
50 | __u8 baInterfaceNr[n]; \ | ||
51 | } __attribute__ ((packed)) | ||
52 | |||
53 | struct uvc_input_terminal_descriptor { | ||
54 | __u8 bLength; | ||
55 | __u8 bDescriptorType; | ||
56 | __u8 bDescriptorSubType; | ||
57 | __u8 bTerminalID; | ||
58 | __u16 wTerminalType; | ||
59 | __u8 bAssocTerminal; | ||
60 | __u8 iTerminal; | ||
61 | } __attribute__((__packed__)); | ||
62 | |||
63 | struct uvc_output_terminal_descriptor { | ||
64 | __u8 bLength; | ||
65 | __u8 bDescriptorType; | ||
66 | __u8 bDescriptorSubType; | ||
67 | __u8 bTerminalID; | ||
68 | __u16 wTerminalType; | ||
69 | __u8 bAssocTerminal; | ||
70 | __u8 bSourceID; | ||
71 | __u8 iTerminal; | ||
72 | } __attribute__((__packed__)); | ||
73 | |||
74 | struct uvc_camera_terminal_descriptor { | ||
75 | __u8 bLength; | ||
76 | __u8 bDescriptorType; | ||
77 | __u8 bDescriptorSubType; | ||
78 | __u8 bTerminalID; | ||
79 | __u16 wTerminalType; | ||
80 | __u8 bAssocTerminal; | ||
81 | __u8 iTerminal; | ||
82 | __u16 wObjectiveFocalLengthMin; | ||
83 | __u16 wObjectiveFocalLengthMax; | ||
84 | __u16 wOcularFocalLength; | ||
85 | __u8 bControlSize; | ||
86 | __u8 bmControls[3]; | ||
87 | } __attribute__((__packed__)); | ||
88 | |||
89 | struct uvc_selector_unit_descriptor { | ||
90 | __u8 bLength; | ||
91 | __u8 bDescriptorType; | ||
92 | __u8 bDescriptorSubType; | ||
93 | __u8 bUnitID; | ||
94 | __u8 bNrInPins; | ||
95 | __u8 baSourceID[0]; | ||
96 | __u8 iSelector; | ||
97 | } __attribute__((__packed__)); | ||
98 | |||
99 | #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
100 | uvc_selector_unit_descriptor_##n | ||
101 | |||
102 | #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
103 | struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ | ||
104 | __u8 bLength; \ | ||
105 | __u8 bDescriptorType; \ | ||
106 | __u8 bDescriptorSubType; \ | ||
107 | __u8 bUnitID; \ | ||
108 | __u8 bNrInPins; \ | ||
109 | __u8 baSourceID[n]; \ | ||
110 | __u8 iSelector; \ | ||
111 | } __attribute__ ((packed)) | ||
112 | |||
113 | struct uvc_processing_unit_descriptor { | ||
114 | __u8 bLength; | ||
115 | __u8 bDescriptorType; | ||
116 | __u8 bDescriptorSubType; | ||
117 | __u8 bUnitID; | ||
118 | __u8 bSourceID; | ||
119 | __u16 wMaxMultiplier; | ||
120 | __u8 bControlSize; | ||
121 | __u8 bmControls[2]; | ||
122 | __u8 iProcessing; | ||
123 | } __attribute__((__packed__)); | ||
124 | |||
125 | struct uvc_extension_unit_descriptor { | ||
126 | __u8 bLength; | ||
127 | __u8 bDescriptorType; | ||
128 | __u8 bDescriptorSubType; | ||
129 | __u8 bUnitID; | ||
130 | __u8 guidExtensionCode[16]; | ||
131 | __u8 bNumControls; | ||
132 | __u8 bNrInPins; | ||
133 | __u8 baSourceID[0]; | ||
134 | __u8 bControlSize; | ||
135 | __u8 bmControls[0]; | ||
136 | __u8 iExtension; | ||
137 | } __attribute__((__packed__)); | ||
138 | |||
139 | #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
140 | uvc_extension_unit_descriptor_##p_##n | ||
141 | |||
142 | #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
143 | struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ | ||
144 | __u8 bLength; \ | ||
145 | __u8 bDescriptorType; \ | ||
146 | __u8 bDescriptorSubType; \ | ||
147 | __u8 bUnitID; \ | ||
148 | __u8 guidExtensionCode[16]; \ | ||
149 | __u8 bNumControls; \ | ||
150 | __u8 bNrInPins; \ | ||
151 | __u8 baSourceID[p]; \ | ||
152 | __u8 bControlSize; \ | ||
153 | __u8 bmControls[n]; \ | ||
154 | __u8 iExtension; \ | ||
155 | } __attribute__ ((packed)) | ||
156 | |||
157 | struct uvc_control_endpoint_descriptor { | ||
158 | __u8 bLength; | ||
159 | __u8 bDescriptorType; | ||
160 | __u8 bDescriptorSubType; | ||
161 | __u16 wMaxTransferSize; | ||
162 | } __attribute__((__packed__)); | ||
163 | |||
164 | #define UVC_DT_HEADER 1 | ||
165 | #define UVC_DT_INPUT_TERMINAL 2 | ||
166 | #define UVC_DT_OUTPUT_TERMINAL 3 | ||
167 | #define UVC_DT_SELECTOR_UNIT 4 | ||
168 | #define UVC_DT_PROCESSING_UNIT 5 | ||
169 | #define UVC_DT_EXTENSION_UNIT 6 | ||
170 | |||
171 | #define UVC_DT_HEADER_SIZE(n) (12+(n)) | ||
172 | #define UVC_DT_INPUT_TERMINAL_SIZE 8 | ||
173 | #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 | ||
174 | #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) | ||
175 | #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) | ||
176 | #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) | ||
177 | #define UVC_DT_EXTENSION_UNIT_SIZE(p,n) (24+(p)+(n)) | ||
178 | #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 | ||
179 | |||
180 | struct uvc_input_header_descriptor { | ||
181 | __u8 bLength; | ||
182 | __u8 bDescriptorType; | ||
183 | __u8 bDescriptorSubType; | ||
184 | __u8 bNumFormats; | ||
185 | __u16 wTotalLength; | ||
186 | __u8 bEndpointAddress; | ||
187 | __u8 bmInfo; | ||
188 | __u8 bTerminalLink; | ||
189 | __u8 bStillCaptureMethod; | ||
190 | __u8 bTriggerSupport; | ||
191 | __u8 bTriggerUsage; | ||
192 | __u8 bControlSize; | ||
193 | __u8 bmaControls[]; | ||
194 | } __attribute__((__packed__)); | ||
195 | |||
196 | #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
197 | uvc_input_header_descriptor_##n_##p | ||
198 | |||
199 | #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
200 | struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
201 | __u8 bLength; \ | ||
202 | __u8 bDescriptorType; \ | ||
203 | __u8 bDescriptorSubType; \ | ||
204 | __u8 bNumFormats; \ | ||
205 | __u16 wTotalLength; \ | ||
206 | __u8 bEndpointAddress; \ | ||
207 | __u8 bmInfo; \ | ||
208 | __u8 bTerminalLink; \ | ||
209 | __u8 bStillCaptureMethod; \ | ||
210 | __u8 bTriggerSupport; \ | ||
211 | __u8 bTriggerUsage; \ | ||
212 | __u8 bControlSize; \ | ||
213 | __u8 bmaControls[p][n]; \ | ||
214 | } __attribute__ ((packed)) | ||
215 | |||
216 | struct uvc_output_header_descriptor { | ||
217 | __u8 bLength; | ||
218 | __u8 bDescriptorType; | ||
219 | __u8 bDescriptorSubType; | ||
220 | __u8 bNumFormats; | ||
221 | __u16 wTotalLength; | ||
222 | __u8 bEndpointAddress; | ||
223 | __u8 bTerminalLink; | ||
224 | __u8 bControlSize; | ||
225 | __u8 bmaControls[]; | ||
226 | } __attribute__((__packed__)); | ||
227 | |||
228 | #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
229 | uvc_output_header_descriptor_##n_##p | ||
230 | |||
231 | #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
232 | struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
233 | __u8 bLength; \ | ||
234 | __u8 bDescriptorType; \ | ||
235 | __u8 bDescriptorSubType; \ | ||
236 | __u8 bNumFormats; \ | ||
237 | __u16 wTotalLength; \ | ||
238 | __u8 bEndpointAddress; \ | ||
239 | __u8 bTerminalLink; \ | ||
240 | __u8 bControlSize; \ | ||
241 | __u8 bmaControls[p][n]; \ | ||
242 | } __attribute__ ((packed)) | ||
243 | |||
244 | struct uvc_format_uncompressed { | ||
245 | __u8 bLength; | ||
246 | __u8 bDescriptorType; | ||
247 | __u8 bDescriptorSubType; | ||
248 | __u8 bFormatIndex; | ||
249 | __u8 bNumFrameDescriptors; | ||
250 | __u8 guidFormat[16]; | ||
251 | __u8 bBitsPerPixel; | ||
252 | __u8 bDefaultFrameIndex; | ||
253 | __u8 bAspectRatioX; | ||
254 | __u8 bAspectRatioY; | ||
255 | __u8 bmInterfaceFlags; | ||
256 | __u8 bCopyProtect; | ||
257 | } __attribute__((__packed__)); | ||
258 | |||
259 | struct uvc_frame_uncompressed { | ||
260 | __u8 bLength; | ||
261 | __u8 bDescriptorType; | ||
262 | __u8 bDescriptorSubType; | ||
263 | __u8 bFrameIndex; | ||
264 | __u8 bmCapabilities; | ||
265 | __u16 wWidth; | ||
266 | __u16 wHeight; | ||
267 | __u32 dwMinBitRate; | ||
268 | __u32 dwMaxBitRate; | ||
269 | __u32 dwMaxVideoFrameBufferSize; | ||
270 | __u32 dwDefaultFrameInterval; | ||
271 | __u8 bFrameIntervalType; | ||
272 | __u32 dwFrameInterval[]; | ||
273 | } __attribute__((__packed__)); | ||
274 | |||
275 | #define UVC_FRAME_UNCOMPRESSED(n) \ | ||
276 | uvc_frame_uncompressed_##n | ||
277 | |||
278 | #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ | ||
279 | struct UVC_FRAME_UNCOMPRESSED(n) { \ | ||
280 | __u8 bLength; \ | ||
281 | __u8 bDescriptorType; \ | ||
282 | __u8 bDescriptorSubType; \ | ||
283 | __u8 bFrameIndex; \ | ||
284 | __u8 bmCapabilities; \ | ||
285 | __u16 wWidth; \ | ||
286 | __u16 wHeight; \ | ||
287 | __u32 dwMinBitRate; \ | ||
288 | __u32 dwMaxBitRate; \ | ||
289 | __u32 dwMaxVideoFrameBufferSize; \ | ||
290 | __u32 dwDefaultFrameInterval; \ | ||
291 | __u8 bFrameIntervalType; \ | ||
292 | __u32 dwFrameInterval[n]; \ | ||
293 | } __attribute__ ((packed)) | ||
294 | |||
295 | struct uvc_format_mjpeg { | ||
296 | __u8 bLength; | ||
297 | __u8 bDescriptorType; | ||
298 | __u8 bDescriptorSubType; | ||
299 | __u8 bFormatIndex; | ||
300 | __u8 bNumFrameDescriptors; | ||
301 | __u8 bmFlags; | ||
302 | __u8 bDefaultFrameIndex; | ||
303 | __u8 bAspectRatioX; | ||
304 | __u8 bAspectRatioY; | ||
305 | __u8 bmInterfaceFlags; | ||
306 | __u8 bCopyProtect; | ||
307 | } __attribute__((__packed__)); | ||
308 | |||
309 | struct uvc_frame_mjpeg { | ||
310 | __u8 bLength; | ||
311 | __u8 bDescriptorType; | ||
312 | __u8 bDescriptorSubType; | ||
313 | __u8 bFrameIndex; | ||
314 | __u8 bmCapabilities; | ||
315 | __u16 wWidth; | ||
316 | __u16 wHeight; | ||
317 | __u32 dwMinBitRate; | ||
318 | __u32 dwMaxBitRate; | ||
319 | __u32 dwMaxVideoFrameBufferSize; | ||
320 | __u32 dwDefaultFrameInterval; | ||
321 | __u8 bFrameIntervalType; | ||
322 | __u32 dwFrameInterval[]; | ||
323 | } __attribute__((__packed__)); | ||
324 | |||
325 | #define UVC_FRAME_MJPEG(n) \ | ||
326 | uvc_frame_mjpeg_##n | ||
327 | |||
328 | #define DECLARE_UVC_FRAME_MJPEG(n) \ | ||
329 | struct UVC_FRAME_MJPEG(n) { \ | ||
330 | __u8 bLength; \ | ||
331 | __u8 bDescriptorType; \ | ||
332 | __u8 bDescriptorSubType; \ | ||
333 | __u8 bFrameIndex; \ | ||
334 | __u8 bmCapabilities; \ | ||
335 | __u16 wWidth; \ | ||
336 | __u16 wHeight; \ | ||
337 | __u32 dwMinBitRate; \ | ||
338 | __u32 dwMaxBitRate; \ | ||
339 | __u32 dwMaxVideoFrameBufferSize; \ | ||
340 | __u32 dwDefaultFrameInterval; \ | ||
341 | __u8 bFrameIntervalType; \ | ||
342 | __u32 dwFrameInterval[n]; \ | ||
343 | } __attribute__ ((packed)) | ||
344 | |||
345 | struct uvc_color_matching_descriptor { | ||
346 | __u8 bLength; | ||
347 | __u8 bDescriptorType; | ||
348 | __u8 bDescriptorSubType; | ||
349 | __u8 bColorPrimaries; | ||
350 | __u8 bTransferCharacteristics; | ||
351 | __u8 bMatrixCoefficients; | ||
352 | } __attribute__((__packed__)); | ||
353 | |||
354 | #define UVC_DT_INPUT_HEADER 1 | ||
355 | #define UVC_DT_OUTPUT_HEADER 2 | ||
356 | #define UVC_DT_FORMAT_UNCOMPRESSED 4 | ||
357 | #define UVC_DT_FRAME_UNCOMPRESSED 5 | ||
358 | #define UVC_DT_FORMAT_MJPEG 6 | ||
359 | #define UVC_DT_FRAME_MJPEG 7 | ||
360 | #define UVC_DT_COLOR_MATCHING 13 | ||
361 | |||
362 | #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) | ||
363 | #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) | ||
364 | #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 | ||
365 | #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) | ||
366 | #define UVC_DT_FORMAT_MJPEG_SIZE 11 | ||
367 | #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) | ||
368 | #define UVC_DT_COLOR_MATCHING_SIZE 6 | ||
369 | 19 | ||
370 | extern int uvc_bind_config(struct usb_configuration *c, | 20 | extern int uvc_bind_config(struct usb_configuration *c, |
371 | const struct uvc_descriptor_header * const *control, | 21 | const struct uvc_descriptor_header * const *control, |
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index d0b8bde59e59..eafa6d2c5ed7 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c | |||
@@ -30,7 +30,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) | |||
30 | 30 | ||
31 | pdata = pdev->dev.platform_data; | 31 | pdata = pdev->dev.platform_data; |
32 | 32 | ||
33 | if (!cpu_is_mx35()) { | 33 | if (!cpu_is_mx35() && !cpu_is_mx25()) { |
34 | mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb"); | 34 | mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb"); |
35 | if (IS_ERR(mxc_ahb_clk)) | 35 | if (IS_ERR(mxc_ahb_clk)) |
36 | return PTR_ERR(mxc_ahb_clk); | 36 | return PTR_ERR(mxc_ahb_clk); |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 2928523268b5..82506ca297d5 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
@@ -2400,7 +2400,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); | |||
2400 | static struct qe_udc __devinit *qe_udc_config(struct of_device *ofdev) | 2400 | static struct qe_udc __devinit *qe_udc_config(struct of_device *ofdev) |
2401 | { | 2401 | { |
2402 | struct qe_udc *udc; | 2402 | struct qe_udc *udc; |
2403 | struct device_node *np = ofdev->node; | 2403 | struct device_node *np = ofdev->dev.of_node; |
2404 | unsigned int tmp_addr = 0; | 2404 | unsigned int tmp_addr = 0; |
2405 | struct usb_device_para __iomem *usbpram; | 2405 | struct usb_device_para __iomem *usbpram; |
2406 | unsigned int i; | 2406 | unsigned int i; |
@@ -2525,7 +2525,7 @@ static void qe_udc_release(struct device *dev) | |||
2525 | static int __devinit qe_udc_probe(struct of_device *ofdev, | 2525 | static int __devinit qe_udc_probe(struct of_device *ofdev, |
2526 | const struct of_device_id *match) | 2526 | const struct of_device_id *match) |
2527 | { | 2527 | { |
2528 | struct device_node *np = ofdev->node; | 2528 | struct device_node *np = ofdev->dev.of_node; |
2529 | struct qe_ep *ep; | 2529 | struct qe_ep *ep; |
2530 | unsigned int ret = 0; | 2530 | unsigned int ret = 0; |
2531 | unsigned int i; | 2531 | unsigned int i; |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 4b0e4a040d6f..d1af253a9105 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -392,6 +392,17 @@ static int __gfs_do_config(struct usb_configuration *c, | |||
392 | if (unlikely(ret < 0)) | 392 | if (unlikely(ret < 0)) |
393 | return ret; | 393 | return ret; |
394 | 394 | ||
395 | /* After previous do_configs there may be some invalid | ||
396 | * pointers in c->interface array. This happens every time | ||
397 | * a user space function with fewer interfaces than a user | ||
398 | * space function that was run before the new one is run. The | ||
399 | * compasit's set_config() assumes that if there is no more | ||
400 | * then MAX_CONFIG_INTERFACES interfaces in a configuration | ||
401 | * then there is a NULL pointer after the last interface in | ||
402 | * c->interface array. We need to make sure this is true. */ | ||
403 | if (c->next_interface_id < ARRAY_SIZE(c->interface)) | ||
404 | c->interface[c->next_interface_id] = NULL; | ||
405 | |||
395 | return 0; | 406 | return 0; |
396 | } | 407 | } |
397 | 408 | ||
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index 8b960deed680..c3caf1ac73ce 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h | |||
@@ -537,35 +537,35 @@ struct m66592 { | |||
537 | /*-------------------------------------------------------------------------*/ | 537 | /*-------------------------------------------------------------------------*/ |
538 | static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset) | 538 | static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset) |
539 | { | 539 | { |
540 | return inw((unsigned long)m66592->reg + offset); | 540 | return ioread16(m66592->reg + offset); |
541 | } | 541 | } |
542 | 542 | ||
543 | static inline void m66592_read_fifo(struct m66592 *m66592, | 543 | static inline void m66592_read_fifo(struct m66592 *m66592, |
544 | unsigned long offset, | 544 | unsigned long offset, |
545 | void *buf, unsigned long len) | 545 | void *buf, unsigned long len) |
546 | { | 546 | { |
547 | unsigned long fifoaddr = (unsigned long)m66592->reg + offset; | 547 | void __iomem *fifoaddr = m66592->reg + offset; |
548 | 548 | ||
549 | if (m66592->pdata->on_chip) { | 549 | if (m66592->pdata->on_chip) { |
550 | len = (len + 3) / 4; | 550 | len = (len + 3) / 4; |
551 | insl(fifoaddr, buf, len); | 551 | ioread32_rep(fifoaddr, buf, len); |
552 | } else { | 552 | } else { |
553 | len = (len + 1) / 2; | 553 | len = (len + 1) / 2; |
554 | insw(fifoaddr, buf, len); | 554 | ioread16_rep(fifoaddr, buf, len); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | static inline void m66592_write(struct m66592 *m66592, u16 val, | 558 | static inline void m66592_write(struct m66592 *m66592, u16 val, |
559 | unsigned long offset) | 559 | unsigned long offset) |
560 | { | 560 | { |
561 | outw(val, (unsigned long)m66592->reg + offset); | 561 | iowrite16(val, m66592->reg + offset); |
562 | } | 562 | } |
563 | 563 | ||
564 | static inline void m66592_write_fifo(struct m66592 *m66592, | 564 | static inline void m66592_write_fifo(struct m66592 *m66592, |
565 | unsigned long offset, | 565 | unsigned long offset, |
566 | void *buf, unsigned long len) | 566 | void *buf, unsigned long len) |
567 | { | 567 | { |
568 | unsigned long fifoaddr = (unsigned long)m66592->reg + offset; | 568 | void __iomem *fifoaddr = m66592->reg + offset; |
569 | 569 | ||
570 | if (m66592->pdata->on_chip) { | 570 | if (m66592->pdata->on_chip) { |
571 | unsigned long count; | 571 | unsigned long count; |
@@ -573,25 +573,25 @@ static inline void m66592_write_fifo(struct m66592 *m66592, | |||
573 | int i; | 573 | int i; |
574 | 574 | ||
575 | count = len / 4; | 575 | count = len / 4; |
576 | outsl(fifoaddr, buf, count); | 576 | iowrite32_rep(fifoaddr, buf, count); |
577 | 577 | ||
578 | if (len & 0x00000003) { | 578 | if (len & 0x00000003) { |
579 | pb = buf + count * 4; | 579 | pb = buf + count * 4; |
580 | for (i = 0; i < (len & 0x00000003); i++) { | 580 | for (i = 0; i < (len & 0x00000003); i++) { |
581 | if (m66592_read(m66592, M66592_CFBCFG)) /* le */ | 581 | if (m66592_read(m66592, M66592_CFBCFG)) /* le */ |
582 | outb(pb[i], fifoaddr + (3 - i)); | 582 | iowrite8(pb[i], fifoaddr + (3 - i)); |
583 | else | 583 | else |
584 | outb(pb[i], fifoaddr + i); | 584 | iowrite8(pb[i], fifoaddr + i); |
585 | } | 585 | } |
586 | } | 586 | } |
587 | } else { | 587 | } else { |
588 | unsigned long odd = len & 0x0001; | 588 | unsigned long odd = len & 0x0001; |
589 | 589 | ||
590 | len = len / 2; | 590 | len = len / 2; |
591 | outsw(fifoaddr, buf, len); | 591 | iowrite16_rep(fifoaddr, buf, len); |
592 | if (odd) { | 592 | if (odd) { |
593 | unsigned char *p = buf + len*2; | 593 | unsigned char *p = buf + len*2; |
594 | outb(*p, fifoaddr); | 594 | iowrite8(*p, fifoaddr); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | } | 597 | } |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 43abf55d8c60..4c3ac5c42237 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -82,7 +82,7 @@ static struct class *usb_gadget_class; | |||
82 | struct printer_dev { | 82 | struct printer_dev { |
83 | spinlock_t lock; /* lock this structure */ | 83 | spinlock_t lock; /* lock this structure */ |
84 | /* lock buffer lists during read/write calls */ | 84 | /* lock buffer lists during read/write calls */ |
85 | spinlock_t lock_printer_io; | 85 | struct mutex lock_printer_io; |
86 | struct usb_gadget *gadget; | 86 | struct usb_gadget *gadget; |
87 | struct usb_request *req; /* for control responses */ | 87 | struct usb_request *req; /* for control responses */ |
88 | u8 config; | 88 | u8 config; |
@@ -567,7 +567,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
567 | 567 | ||
568 | DBG(dev, "printer_read trying to read %d bytes\n", (int)len); | 568 | DBG(dev, "printer_read trying to read %d bytes\n", (int)len); |
569 | 569 | ||
570 | spin_lock(&dev->lock_printer_io); | 570 | mutex_lock(&dev->lock_printer_io); |
571 | spin_lock_irqsave(&dev->lock, flags); | 571 | spin_lock_irqsave(&dev->lock, flags); |
572 | 572 | ||
573 | /* We will use this flag later to check if a printer reset happened | 573 | /* We will use this flag later to check if a printer reset happened |
@@ -601,7 +601,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
601 | * call or not. | 601 | * call or not. |
602 | */ | 602 | */ |
603 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { | 603 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { |
604 | spin_unlock(&dev->lock_printer_io); | 604 | mutex_unlock(&dev->lock_printer_io); |
605 | return -EAGAIN; | 605 | return -EAGAIN; |
606 | } | 606 | } |
607 | 607 | ||
@@ -648,7 +648,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
648 | if (dev->reset_printer) { | 648 | if (dev->reset_printer) { |
649 | list_add(¤t_rx_req->list, &dev->rx_reqs); | 649 | list_add(¤t_rx_req->list, &dev->rx_reqs); |
650 | spin_unlock_irqrestore(&dev->lock, flags); | 650 | spin_unlock_irqrestore(&dev->lock, flags); |
651 | spin_unlock(&dev->lock_printer_io); | 651 | mutex_unlock(&dev->lock_printer_io); |
652 | return -EAGAIN; | 652 | return -EAGAIN; |
653 | } | 653 | } |
654 | 654 | ||
@@ -673,7 +673,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
673 | dev->current_rx_buf = current_rx_buf; | 673 | dev->current_rx_buf = current_rx_buf; |
674 | 674 | ||
675 | spin_unlock_irqrestore(&dev->lock, flags); | 675 | spin_unlock_irqrestore(&dev->lock, flags); |
676 | spin_unlock(&dev->lock_printer_io); | 676 | mutex_unlock(&dev->lock_printer_io); |
677 | 677 | ||
678 | DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied); | 678 | DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied); |
679 | 679 | ||
@@ -697,7 +697,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
697 | if (len == 0) | 697 | if (len == 0) |
698 | return -EINVAL; | 698 | return -EINVAL; |
699 | 699 | ||
700 | spin_lock(&dev->lock_printer_io); | 700 | mutex_lock(&dev->lock_printer_io); |
701 | spin_lock_irqsave(&dev->lock, flags); | 701 | spin_lock_irqsave(&dev->lock, flags); |
702 | 702 | ||
703 | /* Check if a printer reset happens while we have interrupts on */ | 703 | /* Check if a printer reset happens while we have interrupts on */ |
@@ -713,7 +713,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
713 | * a NON-Blocking call or not. | 713 | * a NON-Blocking call or not. |
714 | */ | 714 | */ |
715 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { | 715 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { |
716 | spin_unlock(&dev->lock_printer_io); | 716 | mutex_unlock(&dev->lock_printer_io); |
717 | return -EAGAIN; | 717 | return -EAGAIN; |
718 | } | 718 | } |
719 | 719 | ||
@@ -752,7 +752,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
752 | 752 | ||
753 | if (copy_from_user(req->buf, buf, size)) { | 753 | if (copy_from_user(req->buf, buf, size)) { |
754 | list_add(&req->list, &dev->tx_reqs); | 754 | list_add(&req->list, &dev->tx_reqs); |
755 | spin_unlock(&dev->lock_printer_io); | 755 | mutex_unlock(&dev->lock_printer_io); |
756 | return bytes_copied; | 756 | return bytes_copied; |
757 | } | 757 | } |
758 | 758 | ||
@@ -766,14 +766,14 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
766 | if (dev->reset_printer) { | 766 | if (dev->reset_printer) { |
767 | list_add(&req->list, &dev->tx_reqs); | 767 | list_add(&req->list, &dev->tx_reqs); |
768 | spin_unlock_irqrestore(&dev->lock, flags); | 768 | spin_unlock_irqrestore(&dev->lock, flags); |
769 | spin_unlock(&dev->lock_printer_io); | 769 | mutex_unlock(&dev->lock_printer_io); |
770 | return -EAGAIN; | 770 | return -EAGAIN; |
771 | } | 771 | } |
772 | 772 | ||
773 | if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { | 773 | if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { |
774 | list_add(&req->list, &dev->tx_reqs); | 774 | list_add(&req->list, &dev->tx_reqs); |
775 | spin_unlock_irqrestore(&dev->lock, flags); | 775 | spin_unlock_irqrestore(&dev->lock, flags); |
776 | spin_unlock(&dev->lock_printer_io); | 776 | mutex_unlock(&dev->lock_printer_io); |
777 | return -EAGAIN; | 777 | return -EAGAIN; |
778 | } | 778 | } |
779 | 779 | ||
@@ -782,7 +782,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
782 | } | 782 | } |
783 | 783 | ||
784 | spin_unlock_irqrestore(&dev->lock, flags); | 784 | spin_unlock_irqrestore(&dev->lock, flags); |
785 | spin_unlock(&dev->lock_printer_io); | 785 | mutex_unlock(&dev->lock_printer_io); |
786 | 786 | ||
787 | DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied); | 787 | DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied); |
788 | 788 | ||
@@ -820,11 +820,11 @@ printer_poll(struct file *fd, poll_table *wait) | |||
820 | unsigned long flags; | 820 | unsigned long flags; |
821 | int status = 0; | 821 | int status = 0; |
822 | 822 | ||
823 | spin_lock(&dev->lock_printer_io); | 823 | mutex_lock(&dev->lock_printer_io); |
824 | spin_lock_irqsave(&dev->lock, flags); | 824 | spin_lock_irqsave(&dev->lock, flags); |
825 | setup_rx_reqs(dev); | 825 | setup_rx_reqs(dev); |
826 | spin_unlock_irqrestore(&dev->lock, flags); | 826 | spin_unlock_irqrestore(&dev->lock, flags); |
827 | spin_unlock(&dev->lock_printer_io); | 827 | mutex_unlock(&dev->lock_printer_io); |
828 | 828 | ||
829 | poll_wait(fd, &dev->rx_wait, wait); | 829 | poll_wait(fd, &dev->rx_wait, wait); |
830 | poll_wait(fd, &dev->tx_wait, wait); | 830 | poll_wait(fd, &dev->tx_wait, wait); |
@@ -1461,7 +1461,7 @@ autoconf_fail: | |||
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | spin_lock_init(&dev->lock); | 1463 | spin_lock_init(&dev->lock); |
1464 | spin_lock_init(&dev->lock_printer_io); | 1464 | mutex_init(&dev->lock_printer_io); |
1465 | INIT_LIST_HEAD(&dev->tx_reqs); | 1465 | INIT_LIST_HEAD(&dev->tx_reqs); |
1466 | INIT_LIST_HEAD(&dev->tx_reqs_active); | 1466 | INIT_LIST_HEAD(&dev->tx_reqs_active); |
1467 | INIT_LIST_HEAD(&dev->rx_reqs); | 1467 | INIT_LIST_HEAD(&dev->rx_reqs); |
@@ -1594,7 +1594,7 @@ cleanup(void) | |||
1594 | { | 1594 | { |
1595 | int status; | 1595 | int status; |
1596 | 1596 | ||
1597 | spin_lock(&usb_printer_gadget.lock_printer_io); | 1597 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1598 | class_destroy(usb_gadget_class); | 1598 | class_destroy(usb_gadget_class); |
1599 | unregister_chrdev_region(g_printer_devno, 2); | 1599 | unregister_chrdev_region(g_printer_devno, 2); |
1600 | 1600 | ||
@@ -1602,6 +1602,6 @@ cleanup(void) | |||
1602 | if (status) | 1602 | if (status) |
1603 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1603 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1604 | 1604 | ||
1605 | spin_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1606 | } | 1606 | } |
1607 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 85b0d8921eae..980762453a9c 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -2561,7 +2561,7 @@ static void pxa_udc_shutdown(struct platform_device *_dev) | |||
2561 | udc_disable(udc); | 2561 | udc_disable(udc); |
2562 | } | 2562 | } |
2563 | 2563 | ||
2564 | #ifdef CONFIG_CPU_PXA27x | 2564 | #ifdef CONFIG_PXA27x |
2565 | extern void pxa27x_clear_otgph(void); | 2565 | extern void pxa27x_clear_otgph(void); |
2566 | #else | 2566 | #else |
2567 | #define pxa27x_clear_otgph() do {} while (0) | 2567 | #define pxa27x_clear_otgph() do {} while (0) |
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 888d8f166c0b..70a817842755 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1500,7 +1500,7 @@ static int __exit r8a66597_remove(struct platform_device *pdev) | |||
1500 | struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); | 1500 | struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); |
1501 | 1501 | ||
1502 | del_timer_sync(&r8a66597->timer); | 1502 | del_timer_sync(&r8a66597->timer); |
1503 | iounmap((void *)r8a66597->reg); | 1503 | iounmap(r8a66597->reg); |
1504 | free_irq(platform_get_irq(pdev, 0), r8a66597); | 1504 | free_irq(platform_get_irq(pdev, 0), r8a66597); |
1505 | r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); | 1505 | r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); |
1506 | #ifdef CONFIG_HAVE_CLK | 1506 | #ifdef CONFIG_HAVE_CLK |
@@ -1578,7 +1578,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1578 | init_timer(&r8a66597->timer); | 1578 | init_timer(&r8a66597->timer); |
1579 | r8a66597->timer.function = r8a66597_timer; | 1579 | r8a66597->timer.function = r8a66597_timer; |
1580 | r8a66597->timer.data = (unsigned long)r8a66597; | 1580 | r8a66597->timer.data = (unsigned long)r8a66597; |
1581 | r8a66597->reg = (unsigned long)reg; | 1581 | r8a66597->reg = reg; |
1582 | 1582 | ||
1583 | #ifdef CONFIG_HAVE_CLK | 1583 | #ifdef CONFIG_HAVE_CLK |
1584 | if (r8a66597->pdata->on_chip) { | 1584 | if (r8a66597->pdata->on_chip) { |
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h index 9a537aa07968..f763b5190afa 100644 --- a/drivers/usb/gadget/r8a66597-udc.h +++ b/drivers/usb/gadget/r8a66597-udc.h | |||
@@ -91,7 +91,7 @@ struct r8a66597_ep { | |||
91 | 91 | ||
92 | struct r8a66597 { | 92 | struct r8a66597 { |
93 | spinlock_t lock; | 93 | spinlock_t lock; |
94 | unsigned long reg; | 94 | void __iomem *reg; |
95 | 95 | ||
96 | #ifdef CONFIG_HAVE_CLK | 96 | #ifdef CONFIG_HAVE_CLK |
97 | struct clk *clk; | 97 | struct clk *clk; |
@@ -127,7 +127,7 @@ struct r8a66597 { | |||
127 | 127 | ||
128 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | 128 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) |
129 | { | 129 | { |
130 | return inw(r8a66597->reg + offset); | 130 | return ioread16(r8a66597->reg + offset); |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, |
@@ -135,7 +135,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
135 | unsigned char *buf, | 135 | unsigned char *buf, |
136 | int len) | 136 | int len) |
137 | { | 137 | { |
138 | unsigned long fifoaddr = r8a66597->reg + offset; | 138 | void __iomem *fifoaddr = r8a66597->reg + offset; |
139 | unsigned int data; | 139 | unsigned int data; |
140 | int i; | 140 | int i; |
141 | 141 | ||
@@ -144,7 +144,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
144 | 144 | ||
145 | /* aligned buf case */ | 145 | /* aligned buf case */ |
146 | if (len >= 4 && !((unsigned long)buf & 0x03)) { | 146 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
147 | insl(fifoaddr, buf, len / 4); | 147 | ioread32_rep(fifoaddr, buf, len / 4); |
148 | buf += len & ~0x03; | 148 | buf += len & ~0x03; |
149 | len &= 0x03; | 149 | len &= 0x03; |
150 | } | 150 | } |
@@ -152,7 +152,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
152 | /* unaligned buf case */ | 152 | /* unaligned buf case */ |
153 | for (i = 0; i < len; i++) { | 153 | for (i = 0; i < len; i++) { |
154 | if (!(i & 0x03)) | 154 | if (!(i & 0x03)) |
155 | data = inl(fifoaddr); | 155 | data = ioread32(fifoaddr); |
156 | 156 | ||
157 | buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; | 157 | buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; |
158 | } | 158 | } |
@@ -161,7 +161,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
161 | 161 | ||
162 | /* aligned buf case */ | 162 | /* aligned buf case */ |
163 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | 163 | if (len >= 2 && !((unsigned long)buf & 0x01)) { |
164 | insw(fifoaddr, buf, len / 2); | 164 | ioread16_rep(fifoaddr, buf, len / 2); |
165 | buf += len & ~0x01; | 165 | buf += len & ~0x01; |
166 | len &= 0x01; | 166 | len &= 0x01; |
167 | } | 167 | } |
@@ -169,7 +169,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
169 | /* unaligned buf case */ | 169 | /* unaligned buf case */ |
170 | for (i = 0; i < len; i++) { | 170 | for (i = 0; i < len; i++) { |
171 | if (!(i & 0x01)) | 171 | if (!(i & 0x01)) |
172 | data = inw(fifoaddr); | 172 | data = ioread16(fifoaddr); |
173 | 173 | ||
174 | buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; | 174 | buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; |
175 | } | 175 | } |
@@ -179,7 +179,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
179 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 179 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
180 | unsigned long offset) | 180 | unsigned long offset) |
181 | { | 181 | { |
182 | outw(val, r8a66597->reg + offset); | 182 | iowrite16(val, r8a66597->reg + offset); |
183 | } | 183 | } |
184 | 184 | ||
185 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 185 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
@@ -187,21 +187,21 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
187 | unsigned char *buf, | 187 | unsigned char *buf, |
188 | int len) | 188 | int len) |
189 | { | 189 | { |
190 | unsigned long fifoaddr = r8a66597->reg + offset; | 190 | void __iomem *fifoaddr = r8a66597->reg + offset; |
191 | int adj = 0; | 191 | int adj = 0; |
192 | int i; | 192 | int i; |
193 | 193 | ||
194 | if (r8a66597->pdata->on_chip) { | 194 | if (r8a66597->pdata->on_chip) { |
195 | /* 32-bit access only if buf is 32-bit aligned */ | 195 | /* 32-bit access only if buf is 32-bit aligned */ |
196 | if (len >= 4 && !((unsigned long)buf & 0x03)) { | 196 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
197 | outsl(fifoaddr, buf, len / 4); | 197 | iowrite32_rep(fifoaddr, buf, len / 4); |
198 | buf += len & ~0x03; | 198 | buf += len & ~0x03; |
199 | len &= 0x03; | 199 | len &= 0x03; |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | /* 16-bit access only if buf is 16-bit aligned */ | 202 | /* 16-bit access only if buf is 16-bit aligned */ |
203 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | 203 | if (len >= 2 && !((unsigned long)buf & 0x01)) { |
204 | outsw(fifoaddr, buf, len / 2); | 204 | iowrite16_rep(fifoaddr, buf, len / 2); |
205 | buf += len & ~0x01; | 205 | buf += len & ~0x01; |
206 | len &= 0x01; | 206 | len &= 0x01; |
207 | } | 207 | } |
@@ -216,7 +216,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | for (i = 0; i < len; i++) | 218 | for (i = 0; i < len; i++) |
219 | outb(buf[i], fifoaddr + adj - (i & adj)); | 219 | iowrite8(buf[i], fifoaddr + adj - (i & adj)); |
220 | } | 220 | } |
221 | 221 | ||
222 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 222 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 1f73b485732d..26193eceb323 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -297,6 +297,12 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, | |||
297 | */ | 297 | */ |
298 | static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | 298 | static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) |
299 | { | 299 | { |
300 | unsigned int ep; | ||
301 | unsigned int addr; | ||
302 | unsigned int size; | ||
303 | int timeout; | ||
304 | u32 val; | ||
305 | |||
300 | /* the ryu 2.6.24 release ahs | 306 | /* the ryu 2.6.24 release ahs |
301 | writel(0x1C0, hsotg->regs + S3C_GRXFSIZ); | 307 | writel(0x1C0, hsotg->regs + S3C_GRXFSIZ); |
302 | writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) | | 308 | writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) | |
@@ -310,6 +316,51 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | |||
310 | writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) | | 316 | writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) | |
311 | S3C_GNPTXFSIZ_NPTxFDep(0x1C0), | 317 | S3C_GNPTXFSIZ_NPTxFDep(0x1C0), |
312 | hsotg->regs + S3C_GNPTXFSIZ); | 318 | hsotg->regs + S3C_GNPTXFSIZ); |
319 | |||
320 | /* arange all the rest of the TX FIFOs, as some versions of this | ||
321 | * block have overlapping default addresses. This also ensures | ||
322 | * that if the settings have been changed, then they are set to | ||
323 | * known values. */ | ||
324 | |||
325 | /* start at the end of the GNPTXFSIZ, rounded up */ | ||
326 | addr = 2048 + 1024; | ||
327 | size = 768; | ||
328 | |||
329 | /* currently we allocate TX FIFOs for all possible endpoints, | ||
330 | * and assume that they are all the same size. */ | ||
331 | |||
332 | for (ep = 0; ep <= 15; ep++) { | ||
333 | val = addr; | ||
334 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; | ||
335 | addr += size; | ||
336 | |||
337 | writel(val, hsotg->regs + S3C_DPTXFSIZn(ep)); | ||
338 | } | ||
339 | |||
340 | /* according to p428 of the design guide, we need to ensure that | ||
341 | * all fifos are flushed before continuing */ | ||
342 | |||
343 | writel(S3C_GRSTCTL_TxFNum(0x10) | S3C_GRSTCTL_TxFFlsh | | ||
344 | S3C_GRSTCTL_RxFFlsh, hsotg->regs + S3C_GRSTCTL); | ||
345 | |||
346 | /* wait until the fifos are both flushed */ | ||
347 | timeout = 100; | ||
348 | while (1) { | ||
349 | val = readl(hsotg->regs + S3C_GRSTCTL); | ||
350 | |||
351 | if ((val & (S3C_GRSTCTL_TxFFlsh | S3C_GRSTCTL_RxFFlsh)) == 0) | ||
352 | break; | ||
353 | |||
354 | if (--timeout == 0) { | ||
355 | dev_err(hsotg->dev, | ||
356 | "%s: timeout flushing fifos (GRSTCTL=%08x)\n", | ||
357 | __func__, val); | ||
358 | } | ||
359 | |||
360 | udelay(1); | ||
361 | } | ||
362 | |||
363 | dev_dbg(hsotg->dev, "FIFOs reset, timeout at %d\n", timeout); | ||
313 | } | 364 | } |
314 | 365 | ||
315 | /** | 366 | /** |
@@ -2574,6 +2625,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
2574 | writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK, | 2625 | writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK, |
2575 | hsotg->regs + S3C_DCTL); | 2626 | hsotg->regs + S3C_DCTL); |
2576 | 2627 | ||
2628 | /* must be at-least 3ms to allow bus to see disconnect */ | ||
2629 | msleep(3); | ||
2630 | |||
2577 | /* remove the soft-disconnect and let's go */ | 2631 | /* remove the soft-disconnect and let's go */ |
2578 | __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon); | 2632 | __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon); |
2579 | 2633 | ||
@@ -2730,6 +2784,9 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg) | |||
2730 | 2784 | ||
2731 | writel(0, hsotg->regs + S3C_DAINTMSK); | 2785 | writel(0, hsotg->regs + S3C_DAINTMSK); |
2732 | 2786 | ||
2787 | /* Be in disconnected state until gadget is registered */ | ||
2788 | __orr32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon); | ||
2789 | |||
2733 | if (0) { | 2790 | if (0) { |
2734 | /* post global nak until we're ready */ | 2791 | /* post global nak until we're ready */ |
2735 | writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak, | 2792 | writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak, |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index d5f4c1d45c97..ea2b3c7ebee5 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -735,6 +735,10 @@ static void s3c2410_udc_handle_ep0_idle(struct s3c2410_udc *dev, | |||
735 | else | 735 | else |
736 | dev->ep0state = EP0_OUT_DATA_PHASE; | 736 | dev->ep0state = EP0_OUT_DATA_PHASE; |
737 | 737 | ||
738 | if (!dev->driver) | ||
739 | return; | ||
740 | |||
741 | /* deliver the request to the gadget driver */ | ||
738 | ret = dev->driver->setup(&dev->gadget, crq); | 742 | ret = dev->driver->setup(&dev->gadget, crq); |
739 | if (ret < 0) { | 743 | if (ret < 0) { |
740 | if (dev->req_config) { | 744 | if (dev->req_config) { |
@@ -1700,9 +1704,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1700 | if (!driver || driver != udc->driver || !driver->unbind) | 1704 | if (!driver || driver != udc->driver || !driver->unbind) |
1701 | return -EINVAL; | 1705 | return -EINVAL; |
1702 | 1706 | ||
1703 | dprintk(DEBUG_NORMAL,"usb_gadget_register_driver() '%s'\n", | 1707 | dprintk(DEBUG_NORMAL, "usb_gadget_unregister_driver() '%s'\n", |
1704 | driver->driver.name); | 1708 | driver->driver.name); |
1705 | 1709 | ||
1710 | /* report disconnect */ | ||
1711 | if (driver->disconnect) | ||
1712 | driver->disconnect(&udc->gadget); | ||
1713 | |||
1706 | driver->unbind(&udc->gadget); | 1714 | driver->unbind(&udc->gadget); |
1707 | 1715 | ||
1708 | device_del(&udc->gadget.dev); | 1716 | device_del(&udc->gadget.dev); |
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 16bdf77f582a..3e8dcb5455e3 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -536,17 +536,11 @@ recycle: | |||
536 | list_move(&req->list, &port->read_pool); | 536 | list_move(&req->list, &port->read_pool); |
537 | } | 537 | } |
538 | 538 | ||
539 | /* Push from tty to ldisc; this is immediate with low_latency, and | 539 | /* Push from tty to ldisc; without low_latency set this is handled by |
540 | * may trigger callbacks to this driver ... so drop the spinlock. | 540 | * a workqueue, so we won't get callbacks and can hold port_lock |
541 | */ | 541 | */ |
542 | if (tty && do_push) { | 542 | if (tty && do_push) { |
543 | spin_unlock_irq(&port->port_lock); | ||
544 | tty_flip_buffer_push(tty); | 543 | tty_flip_buffer_push(tty); |
545 | wake_up_interruptible(&tty->read_wait); | ||
546 | spin_lock_irq(&port->port_lock); | ||
547 | |||
548 | /* tty may have been closed */ | ||
549 | tty = port->port_tty; | ||
550 | } | 544 | } |
551 | 545 | ||
552 | 546 | ||
@@ -784,11 +778,6 @@ static int gs_open(struct tty_struct *tty, struct file *file) | |||
784 | port->open_count = 1; | 778 | port->open_count = 1; |
785 | port->openclose = false; | 779 | port->openclose = false; |
786 | 780 | ||
787 | /* low_latency means ldiscs work in tasklet context, without | ||
788 | * needing a workqueue schedule ... easier to keep up. | ||
789 | */ | ||
790 | tty->low_latency = 1; | ||
791 | |||
792 | /* if connected, start the I/O stream */ | 781 | /* if connected, start the I/O stream */ |
793 | if (port->port_usb) { | 782 | if (port->port_usb) { |
794 | struct gserial *gser = port->port_usb; | 783 | struct gserial *gser = port->port_usb; |
@@ -1195,6 +1184,7 @@ void gserial_cleanup(void) | |||
1195 | n_ports = 0; | 1184 | n_ports = 0; |
1196 | 1185 | ||
1197 | tty_unregister_driver(gs_tty_driver); | 1186 | tty_unregister_driver(gs_tty_driver); |
1187 | put_tty_driver(gs_tty_driver); | ||
1198 | gs_tty_driver = NULL; | 1188 | gs_tty_driver = NULL; |
1199 | 1189 | ||
1200 | pr_debug("%s: cleaned up ttyGS* support\n", __func__); | 1190 | pr_debug("%s: cleaned up ttyGS* support\n", __func__); |
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index 0a705e63c936..5b7919460fd2 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
@@ -48,39 +48,6 @@ struct uvc_event | |||
48 | #define UVC_INTF_STREAMING 1 | 48 | #define UVC_INTF_STREAMING 1 |
49 | 49 | ||
50 | /* ------------------------------------------------------------------------ | 50 | /* ------------------------------------------------------------------------ |
51 | * UVC constants & structures | ||
52 | */ | ||
53 | |||
54 | /* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */ | ||
55 | #define UVC_STREAM_EOH (1 << 7) | ||
56 | #define UVC_STREAM_ERR (1 << 6) | ||
57 | #define UVC_STREAM_STI (1 << 5) | ||
58 | #define UVC_STREAM_RES (1 << 4) | ||
59 | #define UVC_STREAM_SCR (1 << 3) | ||
60 | #define UVC_STREAM_PTS (1 << 2) | ||
61 | #define UVC_STREAM_EOF (1 << 1) | ||
62 | #define UVC_STREAM_FID (1 << 0) | ||
63 | |||
64 | struct uvc_streaming_control { | ||
65 | __u16 bmHint; | ||
66 | __u8 bFormatIndex; | ||
67 | __u8 bFrameIndex; | ||
68 | __u32 dwFrameInterval; | ||
69 | __u16 wKeyFrameRate; | ||
70 | __u16 wPFrameRate; | ||
71 | __u16 wCompQuality; | ||
72 | __u16 wCompWindowSize; | ||
73 | __u16 wDelay; | ||
74 | __u32 dwMaxVideoFrameSize; | ||
75 | __u32 dwMaxPayloadTransferSize; | ||
76 | __u32 dwClockFrequency; | ||
77 | __u8 bmFramingInfo; | ||
78 | __u8 bPreferedVersion; | ||
79 | __u8 bMinVersion; | ||
80 | __u8 bMaxVersion; | ||
81 | } __attribute__((__packed__)); | ||
82 | |||
83 | /* ------------------------------------------------------------------------ | ||
84 | * Debugging, printing and logging | 51 | * Debugging, printing and logging |
85 | */ | 52 | */ |
86 | 53 | ||
@@ -107,11 +74,11 @@ struct uvc_streaming_control { | |||
107 | #define UVC_WARN_MINMAX 0 | 74 | #define UVC_WARN_MINMAX 0 |
108 | #define UVC_WARN_PROBE_DEF 1 | 75 | #define UVC_WARN_PROBE_DEF 1 |
109 | 76 | ||
110 | extern unsigned int uvc_trace_param; | 77 | extern unsigned int uvc_gadget_trace_param; |
111 | 78 | ||
112 | #define uvc_trace(flag, msg...) \ | 79 | #define uvc_trace(flag, msg...) \ |
113 | do { \ | 80 | do { \ |
114 | if (uvc_trace_param & flag) \ | 81 | if (uvc_gadget_trace_param & flag) \ |
115 | printk(KERN_DEBUG "uvcvideo: " msg); \ | 82 | printk(KERN_DEBUG "uvcvideo: " msg); \ |
116 | } while (0) | 83 | } while (0) |
117 | 84 | ||
@@ -137,9 +104,6 @@ extern unsigned int uvc_trace_param; | |||
137 | #define UVC_MAX_REQUEST_SIZE 64 | 104 | #define UVC_MAX_REQUEST_SIZE 64 |
138 | #define UVC_MAX_EVENTS 4 | 105 | #define UVC_MAX_EVENTS 4 |
139 | 106 | ||
140 | #define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 | ||
141 | #define USB_CLASS_MISC 0xef | ||
142 | |||
143 | /* ------------------------------------------------------------------------ | 107 | /* ------------------------------------------------------------------------ |
144 | * Structures | 108 | * Structures |
145 | */ | 109 | */ |
@@ -220,16 +184,10 @@ struct uvc_file_handle | |||
220 | #define to_uvc_file_handle(handle) \ | 184 | #define to_uvc_file_handle(handle) \ |
221 | container_of(handle, struct uvc_file_handle, vfh) | 185 | container_of(handle, struct uvc_file_handle, vfh) |
222 | 186 | ||
223 | extern struct v4l2_file_operations uvc_v4l2_fops; | ||
224 | |||
225 | /* ------------------------------------------------------------------------ | 187 | /* ------------------------------------------------------------------------ |
226 | * Functions | 188 | * Functions |
227 | */ | 189 | */ |
228 | 190 | ||
229 | extern int uvc_video_enable(struct uvc_video *video, int enable); | ||
230 | extern int uvc_video_init(struct uvc_video *video); | ||
231 | extern int uvc_video_pump(struct uvc_video *video); | ||
232 | |||
233 | extern void uvc_endpoint_stream(struct uvc_device *dev); | 191 | extern void uvc_endpoint_stream(struct uvc_device *dev); |
234 | 192 | ||
235 | extern void uvc_function_connect(struct uvc_device *uvc); | 193 | extern void uvc_function_connect(struct uvc_device *uvc); |
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index 43891991bf21..f7395ac5dc17 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
@@ -78,7 +78,8 @@ | |||
78 | * | 78 | * |
79 | */ | 79 | */ |
80 | 80 | ||
81 | void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | 81 | static void |
82 | uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | ||
82 | { | 83 | { |
83 | mutex_init(&queue->mutex); | 84 | mutex_init(&queue->mutex); |
84 | spin_lock_init(&queue->irqlock); | 85 | spin_lock_init(&queue->irqlock); |
@@ -88,6 +89,28 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | |||
88 | } | 89 | } |
89 | 90 | ||
90 | /* | 91 | /* |
92 | * Free the video buffers. | ||
93 | * | ||
94 | * This function must be called with the queue lock held. | ||
95 | */ | ||
96 | static int uvc_free_buffers(struct uvc_video_queue *queue) | ||
97 | { | ||
98 | unsigned int i; | ||
99 | |||
100 | for (i = 0; i < queue->count; ++i) { | ||
101 | if (queue->buffer[i].vma_use_count != 0) | ||
102 | return -EBUSY; | ||
103 | } | ||
104 | |||
105 | if (queue->count) { | ||
106 | vfree(queue->mem); | ||
107 | queue->count = 0; | ||
108 | } | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | /* | ||
91 | * Allocate the video buffers. | 114 | * Allocate the video buffers. |
92 | * | 115 | * |
93 | * Pages are reserved to make sure they will not be swapped, as they will be | 116 | * Pages are reserved to make sure they will not be swapped, as they will be |
@@ -95,8 +118,9 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | |||
95 | * | 118 | * |
96 | * Buffers will be individually mapped, so they must all be page aligned. | 119 | * Buffers will be individually mapped, so they must all be page aligned. |
97 | */ | 120 | */ |
98 | int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, | 121 | static int |
99 | unsigned int buflength) | 122 | uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, |
123 | unsigned int buflength) | ||
100 | { | 124 | { |
101 | unsigned int bufsize = PAGE_ALIGN(buflength); | 125 | unsigned int bufsize = PAGE_ALIGN(buflength); |
102 | unsigned int i; | 126 | unsigned int i; |
@@ -150,28 +174,6 @@ done: | |||
150 | return ret; | 174 | return ret; |
151 | } | 175 | } |
152 | 176 | ||
153 | /* | ||
154 | * Free the video buffers. | ||
155 | * | ||
156 | * This function must be called with the queue lock held. | ||
157 | */ | ||
158 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
159 | { | ||
160 | unsigned int i; | ||
161 | |||
162 | for (i = 0; i < queue->count; ++i) { | ||
163 | if (queue->buffer[i].vma_use_count != 0) | ||
164 | return -EBUSY; | ||
165 | } | ||
166 | |||
167 | if (queue->count) { | ||
168 | vfree(queue->mem); | ||
169 | queue->count = 0; | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static void __uvc_query_buffer(struct uvc_buffer *buf, | 177 | static void __uvc_query_buffer(struct uvc_buffer *buf, |
176 | struct v4l2_buffer *v4l2_buf) | 178 | struct v4l2_buffer *v4l2_buf) |
177 | { | 179 | { |
@@ -195,8 +197,8 @@ static void __uvc_query_buffer(struct uvc_buffer *buf, | |||
195 | } | 197 | } |
196 | } | 198 | } |
197 | 199 | ||
198 | int uvc_query_buffer(struct uvc_video_queue *queue, | 200 | static int |
199 | struct v4l2_buffer *v4l2_buf) | 201 | uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf) |
200 | { | 202 | { |
201 | int ret = 0; | 203 | int ret = 0; |
202 | 204 | ||
@@ -217,8 +219,8 @@ done: | |||
217 | * Queue a video buffer. Attempting to queue a buffer that has already been | 219 | * Queue a video buffer. Attempting to queue a buffer that has already been |
218 | * queued will return -EINVAL. | 220 | * queued will return -EINVAL. |
219 | */ | 221 | */ |
220 | int uvc_queue_buffer(struct uvc_video_queue *queue, | 222 | static int |
221 | struct v4l2_buffer *v4l2_buf) | 223 | uvc_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf) |
222 | { | 224 | { |
223 | struct uvc_buffer *buf; | 225 | struct uvc_buffer *buf; |
224 | unsigned long flags; | 226 | unsigned long flags; |
@@ -298,8 +300,9 @@ static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking) | |||
298 | * Dequeue a video buffer. If nonblocking is false, block until a buffer is | 300 | * Dequeue a video buffer. If nonblocking is false, block until a buffer is |
299 | * available. | 301 | * available. |
300 | */ | 302 | */ |
301 | int uvc_dequeue_buffer(struct uvc_video_queue *queue, | 303 | static int |
302 | struct v4l2_buffer *v4l2_buf, int nonblocking) | 304 | uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf, |
305 | int nonblocking) | ||
303 | { | 306 | { |
304 | struct uvc_buffer *buf; | 307 | struct uvc_buffer *buf; |
305 | int ret = 0; | 308 | int ret = 0; |
@@ -359,8 +362,9 @@ done: | |||
359 | * This function implements video queue polling and is intended to be used by | 362 | * This function implements video queue polling and is intended to be used by |
360 | * the device poll handler. | 363 | * the device poll handler. |
361 | */ | 364 | */ |
362 | unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, | 365 | static unsigned int |
363 | poll_table *wait) | 366 | uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, |
367 | poll_table *wait) | ||
364 | { | 368 | { |
365 | struct uvc_buffer *buf; | 369 | struct uvc_buffer *buf; |
366 | unsigned int mask = 0; | 370 | unsigned int mask = 0; |
@@ -407,7 +411,8 @@ static struct vm_operations_struct uvc_vm_ops = { | |||
407 | * This function implements video buffer memory mapping and is intended to be | 411 | * This function implements video buffer memory mapping and is intended to be |
408 | * used by the device mmap handler. | 412 | * used by the device mmap handler. |
409 | */ | 413 | */ |
410 | int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | 414 | static int |
415 | uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | ||
411 | { | 416 | { |
412 | struct uvc_buffer *uninitialized_var(buffer); | 417 | struct uvc_buffer *uninitialized_var(buffer); |
413 | struct page *page; | 418 | struct page *page; |
@@ -458,6 +463,42 @@ done: | |||
458 | } | 463 | } |
459 | 464 | ||
460 | /* | 465 | /* |
466 | * Cancel the video buffers queue. | ||
467 | * | ||
468 | * Cancelling the queue marks all buffers on the irq queue as erroneous, | ||
469 | * wakes them up and removes them from the queue. | ||
470 | * | ||
471 | * If the disconnect parameter is set, further calls to uvc_queue_buffer will | ||
472 | * fail with -ENODEV. | ||
473 | * | ||
474 | * This function acquires the irq spinlock and can be called from interrupt | ||
475 | * context. | ||
476 | */ | ||
477 | static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) | ||
478 | { | ||
479 | struct uvc_buffer *buf; | ||
480 | unsigned long flags; | ||
481 | |||
482 | spin_lock_irqsave(&queue->irqlock, flags); | ||
483 | while (!list_empty(&queue->irqqueue)) { | ||
484 | buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | ||
485 | queue); | ||
486 | list_del(&buf->queue); | ||
487 | buf->state = UVC_BUF_STATE_ERROR; | ||
488 | wake_up(&buf->wait); | ||
489 | } | ||
490 | /* This must be protected by the irqlock spinlock to avoid race | ||
491 | * conditions between uvc_queue_buffer and the disconnection event that | ||
492 | * could result in an interruptible wait in uvc_dequeue_buffer. Do not | ||
493 | * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED | ||
494 | * state outside the queue code. | ||
495 | */ | ||
496 | if (disconnect) | ||
497 | queue->flags |= UVC_QUEUE_DISCONNECTED; | ||
498 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
499 | } | ||
500 | |||
501 | /* | ||
461 | * Enable or disable the video buffers queue. | 502 | * Enable or disable the video buffers queue. |
462 | * | 503 | * |
463 | * The queue must be enabled before starting video acquisition and must be | 504 | * The queue must be enabled before starting video acquisition and must be |
@@ -474,7 +515,7 @@ done: | |||
474 | * This function can't be called from interrupt context. Use | 515 | * This function can't be called from interrupt context. Use |
475 | * uvc_queue_cancel() instead. | 516 | * uvc_queue_cancel() instead. |
476 | */ | 517 | */ |
477 | int uvc_queue_enable(struct uvc_video_queue *queue, int enable) | 518 | static int uvc_queue_enable(struct uvc_video_queue *queue, int enable) |
478 | { | 519 | { |
479 | unsigned int i; | 520 | unsigned int i; |
480 | int ret = 0; | 521 | int ret = 0; |
@@ -503,44 +544,8 @@ done: | |||
503 | return ret; | 544 | return ret; |
504 | } | 545 | } |
505 | 546 | ||
506 | /* | 547 | static struct uvc_buffer * |
507 | * Cancel the video buffers queue. | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
508 | * | ||
509 | * Cancelling the queue marks all buffers on the irq queue as erroneous, | ||
510 | * wakes them up and removes them from the queue. | ||
511 | * | ||
512 | * If the disconnect parameter is set, further calls to uvc_queue_buffer will | ||
513 | * fail with -ENODEV. | ||
514 | * | ||
515 | * This function acquires the irq spinlock and can be called from interrupt | ||
516 | * context. | ||
517 | */ | ||
518 | void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) | ||
519 | { | ||
520 | struct uvc_buffer *buf; | ||
521 | unsigned long flags; | ||
522 | |||
523 | spin_lock_irqsave(&queue->irqlock, flags); | ||
524 | while (!list_empty(&queue->irqqueue)) { | ||
525 | buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | ||
526 | queue); | ||
527 | list_del(&buf->queue); | ||
528 | buf->state = UVC_BUF_STATE_ERROR; | ||
529 | wake_up(&buf->wait); | ||
530 | } | ||
531 | /* This must be protected by the irqlock spinlock to avoid race | ||
532 | * conditions between uvc_queue_buffer and the disconnection event that | ||
533 | * could result in an interruptible wait in uvc_dequeue_buffer. Do not | ||
534 | * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED | ||
535 | * state outside the queue code. | ||
536 | */ | ||
537 | if (disconnect) | ||
538 | queue->flags |= UVC_QUEUE_DISCONNECTED; | ||
539 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
540 | } | ||
541 | |||
542 | struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | ||
543 | struct uvc_buffer *buf) | ||
544 | { | 549 | { |
545 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
546 | unsigned long flags; | 551 | unsigned long flags; |
@@ -568,7 +573,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | |||
568 | return nextbuf; | 573 | return nextbuf; |
569 | } | 574 | } |
570 | 575 | ||
571 | struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) | 576 | static struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) |
572 | { | 577 | { |
573 | struct uvc_buffer *buf = NULL; | 578 | struct uvc_buffer *buf = NULL; |
574 | 579 | ||
diff --git a/drivers/usb/gadget/uvc_queue.h b/drivers/usb/gadget/uvc_queue.h index 7f5a33fe7ae2..1812a8ecc5d0 100644 --- a/drivers/usb/gadget/uvc_queue.h +++ b/drivers/usb/gadget/uvc_queue.h | |||
@@ -58,30 +58,10 @@ struct uvc_video_queue { | |||
58 | struct list_head irqqueue; | 58 | struct list_head irqqueue; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | extern void uvc_queue_init(struct uvc_video_queue *queue, | ||
62 | enum v4l2_buf_type type); | ||
63 | extern int uvc_alloc_buffers(struct uvc_video_queue *queue, | ||
64 | unsigned int nbuffers, unsigned int buflength); | ||
65 | extern int uvc_free_buffers(struct uvc_video_queue *queue); | ||
66 | extern int uvc_query_buffer(struct uvc_video_queue *queue, | ||
67 | struct v4l2_buffer *v4l2_buf); | ||
68 | extern int uvc_queue_buffer(struct uvc_video_queue *queue, | ||
69 | struct v4l2_buffer *v4l2_buf); | ||
70 | extern int uvc_dequeue_buffer(struct uvc_video_queue *queue, | ||
71 | struct v4l2_buffer *v4l2_buf, int nonblocking); | ||
72 | extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable); | ||
73 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); | ||
74 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | ||
75 | struct uvc_buffer *buf); | ||
76 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, | ||
77 | struct file *file, poll_table *wait); | ||
78 | extern int uvc_queue_mmap(struct uvc_video_queue *queue, | ||
79 | struct vm_area_struct *vma); | ||
80 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) | 61 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) |
81 | { | 62 | { |
82 | return queue->flags & UVC_QUEUE_STREAMING; | 63 | return queue->flags & UVC_QUEUE_STREAMING; |
83 | } | 64 | } |
84 | extern struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue); | ||
85 | 65 | ||
86 | #endif /* __KERNEL__ */ | 66 | #endif /* __KERNEL__ */ |
87 | 67 | ||
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index a7989f29837e..2dcffdac86d2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
@@ -363,7 +363,7 @@ uvc_v4l2_poll(struct file *file, poll_table *wait) | |||
363 | return mask; | 363 | return mask; |
364 | } | 364 | } |
365 | 365 | ||
366 | struct v4l2_file_operations uvc_v4l2_fops = { | 366 | static struct v4l2_file_operations uvc_v4l2_fops = { |
367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
368 | .open = uvc_v4l2_open, | 368 | .open = uvc_v4l2_open, |
369 | .release = uvc_v4l2_release, | 369 | .release = uvc_v4l2_release, |
diff --git a/drivers/usb/gadget/uvc_video.c b/drivers/usb/gadget/uvc_video.c index de8cbc46518d..b08f35438d70 100644 --- a/drivers/usb/gadget/uvc_video.c +++ b/drivers/usb/gadget/uvc_video.c | |||
@@ -271,7 +271,7 @@ error: | |||
271 | * This function fills the available USB requests (listed in req_free) with | 271 | * This function fills the available USB requests (listed in req_free) with |
272 | * video data from the queued buffers. | 272 | * video data from the queued buffers. |
273 | */ | 273 | */ |
274 | int | 274 | static int |
275 | uvc_video_pump(struct uvc_video *video) | 275 | uvc_video_pump(struct uvc_video *video) |
276 | { | 276 | { |
277 | struct usb_request *req; | 277 | struct usb_request *req; |
@@ -328,7 +328,7 @@ uvc_video_pump(struct uvc_video *video) | |||
328 | /* | 328 | /* |
329 | * Enable or disable the video stream. | 329 | * Enable or disable the video stream. |
330 | */ | 330 | */ |
331 | int | 331 | static int |
332 | uvc_video_enable(struct uvc_video *video, int enable) | 332 | uvc_video_enable(struct uvc_video *video, int enable) |
333 | { | 333 | { |
334 | unsigned int i; | 334 | unsigned int i; |
@@ -367,7 +367,7 @@ uvc_video_enable(struct uvc_video *video, int enable) | |||
367 | /* | 367 | /* |
368 | * Initialize the UVC video stream. | 368 | * Initialize the UVC video stream. |
369 | */ | 369 | */ |
370 | int | 370 | static int |
371 | uvc_video_init(struct uvc_video *video) | 371 | uvc_video_init(struct uvc_video *video) |
372 | { | 372 | { |
373 | INIT_LIST_HEAD(&video->req_free); | 373 | INIT_LIST_HEAD(&video->req_free); |
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c index 417fd6887698..288d21155abe 100644 --- a/drivers/usb/gadget/webcam.c +++ b/drivers/usb/gadget/webcam.c | |||
@@ -28,10 +28,10 @@ | |||
28 | #include "config.c" | 28 | #include "config.c" |
29 | #include "epautoconf.c" | 29 | #include "epautoconf.c" |
30 | 30 | ||
31 | #include "f_uvc.c" | ||
32 | #include "uvc_queue.c" | 31 | #include "uvc_queue.c" |
33 | #include "uvc_v4l2.c" | ||
34 | #include "uvc_video.c" | 32 | #include "uvc_video.c" |
33 | #include "uvc_v4l2.c" | ||
34 | #include "f_uvc.c" | ||
35 | 35 | ||
36 | /* -------------------------------------------------------------------------- | 36 | /* -------------------------------------------------------------------------- |
37 | * Device descriptor | 37 | * Device descriptor |
@@ -90,7 +90,7 @@ DECLARE_UVC_HEADER_DESCRIPTOR(1); | |||
90 | static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { | 90 | static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { |
91 | .bLength = UVC_DT_HEADER_SIZE(1), | 91 | .bLength = UVC_DT_HEADER_SIZE(1), |
92 | .bDescriptorType = USB_DT_CS_INTERFACE, | 92 | .bDescriptorType = USB_DT_CS_INTERFACE, |
93 | .bDescriptorSubType = UVC_DT_HEADER, | 93 | .bDescriptorSubType = UVC_VC_HEADER, |
94 | .bcdUVC = cpu_to_le16(0x0100), | 94 | .bcdUVC = cpu_to_le16(0x0100), |
95 | .wTotalLength = 0, /* dynamic */ | 95 | .wTotalLength = 0, /* dynamic */ |
96 | .dwClockFrequency = cpu_to_le32(48000000), | 96 | .dwClockFrequency = cpu_to_le32(48000000), |
@@ -101,7 +101,7 @@ static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { | |||
101 | static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { | 101 | static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { |
102 | .bLength = UVC_DT_CAMERA_TERMINAL_SIZE(3), | 102 | .bLength = UVC_DT_CAMERA_TERMINAL_SIZE(3), |
103 | .bDescriptorType = USB_DT_CS_INTERFACE, | 103 | .bDescriptorType = USB_DT_CS_INTERFACE, |
104 | .bDescriptorSubType = UVC_DT_INPUT_TERMINAL, | 104 | .bDescriptorSubType = UVC_VC_INPUT_TERMINAL, |
105 | .bTerminalID = 1, | 105 | .bTerminalID = 1, |
106 | .wTerminalType = cpu_to_le16(0x0201), | 106 | .wTerminalType = cpu_to_le16(0x0201), |
107 | .bAssocTerminal = 0, | 107 | .bAssocTerminal = 0, |
@@ -118,7 +118,7 @@ static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { | |||
118 | static const struct uvc_processing_unit_descriptor uvc_processing = { | 118 | static const struct uvc_processing_unit_descriptor uvc_processing = { |
119 | .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2), | 119 | .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2), |
120 | .bDescriptorType = USB_DT_CS_INTERFACE, | 120 | .bDescriptorType = USB_DT_CS_INTERFACE, |
121 | .bDescriptorSubType = UVC_DT_PROCESSING_UNIT, | 121 | .bDescriptorSubType = UVC_VC_PROCESSING_UNIT, |
122 | .bUnitID = 2, | 122 | .bUnitID = 2, |
123 | .bSourceID = 1, | 123 | .bSourceID = 1, |
124 | .wMaxMultiplier = cpu_to_le16(16*1024), | 124 | .wMaxMultiplier = cpu_to_le16(16*1024), |
@@ -131,7 +131,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = { | |||
131 | static const struct uvc_output_terminal_descriptor uvc_output_terminal = { | 131 | static const struct uvc_output_terminal_descriptor uvc_output_terminal = { |
132 | .bLength = UVC_DT_OUTPUT_TERMINAL_SIZE, | 132 | .bLength = UVC_DT_OUTPUT_TERMINAL_SIZE, |
133 | .bDescriptorType = USB_DT_CS_INTERFACE, | 133 | .bDescriptorType = USB_DT_CS_INTERFACE, |
134 | .bDescriptorSubType = UVC_DT_OUTPUT_TERMINAL, | 134 | .bDescriptorSubType = UVC_VC_OUTPUT_TERMINAL, |
135 | .bTerminalID = 3, | 135 | .bTerminalID = 3, |
136 | .wTerminalType = cpu_to_le16(0x0101), | 136 | .wTerminalType = cpu_to_le16(0x0101), |
137 | .bAssocTerminal = 0, | 137 | .bAssocTerminal = 0, |
@@ -144,7 +144,7 @@ DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(1, 2); | |||
144 | static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { | 144 | static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { |
145 | .bLength = UVC_DT_INPUT_HEADER_SIZE(1, 2), | 145 | .bLength = UVC_DT_INPUT_HEADER_SIZE(1, 2), |
146 | .bDescriptorType = USB_DT_CS_INTERFACE, | 146 | .bDescriptorType = USB_DT_CS_INTERFACE, |
147 | .bDescriptorSubType = UVC_DT_INPUT_HEADER, | 147 | .bDescriptorSubType = UVC_VS_INPUT_HEADER, |
148 | .bNumFormats = 2, | 148 | .bNumFormats = 2, |
149 | .wTotalLength = 0, /* dynamic */ | 149 | .wTotalLength = 0, /* dynamic */ |
150 | .bEndpointAddress = 0, /* dynamic */ | 150 | .bEndpointAddress = 0, /* dynamic */ |
@@ -161,7 +161,7 @@ static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { | |||
161 | static const struct uvc_format_uncompressed uvc_format_yuv = { | 161 | static const struct uvc_format_uncompressed uvc_format_yuv = { |
162 | .bLength = UVC_DT_FORMAT_UNCOMPRESSED_SIZE, | 162 | .bLength = UVC_DT_FORMAT_UNCOMPRESSED_SIZE, |
163 | .bDescriptorType = USB_DT_CS_INTERFACE, | 163 | .bDescriptorType = USB_DT_CS_INTERFACE, |
164 | .bDescriptorSubType = UVC_DT_FORMAT_UNCOMPRESSED, | 164 | .bDescriptorSubType = UVC_VS_FORMAT_UNCOMPRESSED, |
165 | .bFormatIndex = 1, | 165 | .bFormatIndex = 1, |
166 | .bNumFrameDescriptors = 2, | 166 | .bNumFrameDescriptors = 2, |
167 | .guidFormat = | 167 | .guidFormat = |
@@ -181,7 +181,7 @@ DECLARE_UVC_FRAME_UNCOMPRESSED(3); | |||
181 | static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { | 181 | static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { |
182 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(3), | 182 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(3), |
183 | .bDescriptorType = USB_DT_CS_INTERFACE, | 183 | .bDescriptorType = USB_DT_CS_INTERFACE, |
184 | .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED, | 184 | .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED, |
185 | .bFrameIndex = 1, | 185 | .bFrameIndex = 1, |
186 | .bmCapabilities = 0, | 186 | .bmCapabilities = 0, |
187 | .wWidth = cpu_to_le16(640), | 187 | .wWidth = cpu_to_le16(640), |
@@ -199,7 +199,7 @@ static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { | |||
199 | static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { | 199 | static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { |
200 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(1), | 200 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(1), |
201 | .bDescriptorType = USB_DT_CS_INTERFACE, | 201 | .bDescriptorType = USB_DT_CS_INTERFACE, |
202 | .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED, | 202 | .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED, |
203 | .bFrameIndex = 2, | 203 | .bFrameIndex = 2, |
204 | .bmCapabilities = 0, | 204 | .bmCapabilities = 0, |
205 | .wWidth = cpu_to_le16(1280), | 205 | .wWidth = cpu_to_le16(1280), |
@@ -215,7 +215,7 @@ static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { | |||
215 | static const struct uvc_format_mjpeg uvc_format_mjpg = { | 215 | static const struct uvc_format_mjpeg uvc_format_mjpg = { |
216 | .bLength = UVC_DT_FORMAT_MJPEG_SIZE, | 216 | .bLength = UVC_DT_FORMAT_MJPEG_SIZE, |
217 | .bDescriptorType = USB_DT_CS_INTERFACE, | 217 | .bDescriptorType = USB_DT_CS_INTERFACE, |
218 | .bDescriptorSubType = UVC_DT_FORMAT_MJPEG, | 218 | .bDescriptorSubType = UVC_VS_FORMAT_MJPEG, |
219 | .bFormatIndex = 2, | 219 | .bFormatIndex = 2, |
220 | .bNumFrameDescriptors = 2, | 220 | .bNumFrameDescriptors = 2, |
221 | .bmFlags = 0, | 221 | .bmFlags = 0, |
@@ -232,7 +232,7 @@ DECLARE_UVC_FRAME_MJPEG(3); | |||
232 | static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { | 232 | static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { |
233 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(3), | 233 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(3), |
234 | .bDescriptorType = USB_DT_CS_INTERFACE, | 234 | .bDescriptorType = USB_DT_CS_INTERFACE, |
235 | .bDescriptorSubType = UVC_DT_FRAME_MJPEG, | 235 | .bDescriptorSubType = UVC_VS_FRAME_MJPEG, |
236 | .bFrameIndex = 1, | 236 | .bFrameIndex = 1, |
237 | .bmCapabilities = 0, | 237 | .bmCapabilities = 0, |
238 | .wWidth = cpu_to_le16(640), | 238 | .wWidth = cpu_to_le16(640), |
@@ -250,7 +250,7 @@ static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { | |||
250 | static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { | 250 | static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { |
251 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(1), | 251 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(1), |
252 | .bDescriptorType = USB_DT_CS_INTERFACE, | 252 | .bDescriptorType = USB_DT_CS_INTERFACE, |
253 | .bDescriptorSubType = UVC_DT_FRAME_MJPEG, | 253 | .bDescriptorSubType = UVC_VS_FRAME_MJPEG, |
254 | .bFrameIndex = 2, | 254 | .bFrameIndex = 2, |
255 | .bmCapabilities = 0, | 255 | .bmCapabilities = 0, |
256 | .wWidth = cpu_to_le16(1280), | 256 | .wWidth = cpu_to_le16(1280), |
@@ -266,7 +266,7 @@ static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { | |||
266 | static const struct uvc_color_matching_descriptor uvc_color_matching = { | 266 | static const struct uvc_color_matching_descriptor uvc_color_matching = { |
267 | .bLength = UVC_DT_COLOR_MATCHING_SIZE, | 267 | .bLength = UVC_DT_COLOR_MATCHING_SIZE, |
268 | .bDescriptorType = USB_DT_CS_INTERFACE, | 268 | .bDescriptorType = USB_DT_CS_INTERFACE, |
269 | .bDescriptorSubType = UVC_DT_COLOR_MATCHING, | 269 | .bDescriptorSubType = UVC_VS_COLORFORMAT, |
270 | .bColorPrimaries = 1, | 270 | .bColorPrimaries = 1, |
271 | .bTransferCharacteristics = 1, | 271 | .bTransferCharacteristics = 1, |
272 | .bMatrixCoefficients = 4, | 272 | .bMatrixCoefficients = 4, |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ef3e88f0b3c3..a3ef2a9d9dc2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1135,7 +1135,7 @@ MODULE_LICENSE ("GPL"); | |||
1135 | 1135 | ||
1136 | #ifdef CONFIG_XPS_USB_HCD_XILINX | 1136 | #ifdef CONFIG_XPS_USB_HCD_XILINX |
1137 | #include "ehci-xilinx-of.c" | 1137 | #include "ehci-xilinx-of.c" |
1138 | #define OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver | 1138 | #define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver |
1139 | #endif | 1139 | #endif |
1140 | 1140 | ||
1141 | #ifdef CONFIG_PLAT_ORION | 1141 | #ifdef CONFIG_PLAT_ORION |
@@ -1159,7 +1159,8 @@ MODULE_LICENSE ("GPL"); | |||
1159 | #endif | 1159 | #endif |
1160 | 1160 | ||
1161 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ | 1161 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ |
1162 | !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) | 1162 | !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ |
1163 | !defined(XILINX_OF_PLATFORM_DRIVER) | ||
1163 | #error "missing bus glue for ehci-hcd" | 1164 | #error "missing bus glue for ehci-hcd" |
1164 | #endif | 1165 | #endif |
1165 | 1166 | ||
@@ -1213,10 +1214,20 @@ static int __init ehci_hcd_init(void) | |||
1213 | if (retval < 0) | 1214 | if (retval < 0) |
1214 | goto clean3; | 1215 | goto clean3; |
1215 | #endif | 1216 | #endif |
1217 | |||
1218 | #ifdef XILINX_OF_PLATFORM_DRIVER | ||
1219 | retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER); | ||
1220 | if (retval < 0) | ||
1221 | goto clean4; | ||
1222 | #endif | ||
1216 | return retval; | 1223 | return retval; |
1217 | 1224 | ||
1225 | #ifdef XILINX_OF_PLATFORM_DRIVER | ||
1226 | /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */ | ||
1227 | clean4: | ||
1228 | #endif | ||
1218 | #ifdef OF_PLATFORM_DRIVER | 1229 | #ifdef OF_PLATFORM_DRIVER |
1219 | /* of_unregister_platform_driver(&OF_PLATFORM_DRIVER); */ | 1230 | of_unregister_platform_driver(&OF_PLATFORM_DRIVER); |
1220 | clean3: | 1231 | clean3: |
1221 | #endif | 1232 | #endif |
1222 | #ifdef PS3_SYSTEM_BUS_DRIVER | 1233 | #ifdef PS3_SYSTEM_BUS_DRIVER |
@@ -1243,6 +1254,9 @@ module_init(ehci_hcd_init); | |||
1243 | 1254 | ||
1244 | static void __exit ehci_hcd_cleanup(void) | 1255 | static void __exit ehci_hcd_cleanup(void) |
1245 | { | 1256 | { |
1257 | #ifdef XILINX_OF_PLATFORM_DRIVER | ||
1258 | of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); | ||
1259 | #endif | ||
1246 | #ifdef OF_PLATFORM_DRIVER | 1260 | #ifdef OF_PLATFORM_DRIVER |
1247 | of_unregister_platform_driver(&OF_PLATFORM_DRIVER); | 1261 | of_unregister_platform_driver(&OF_PLATFORM_DRIVER); |
1248 | #endif | 1262 | #endif |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index 544ccfd7056e..a8ad8ac120a2 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -182,7 +182,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
182 | } | 182 | } |
183 | clk_enable(priv->usbclk); | 183 | clk_enable(priv->usbclk); |
184 | 184 | ||
185 | if (!cpu_is_mx35()) { | 185 | if (!cpu_is_mx35() && !cpu_is_mx25()) { |
186 | priv->ahbclk = clk_get(dev, "usb_ahb"); | 186 | priv->ahbclk = clk_get(dev, "usb_ahb"); |
187 | if (IS_ERR(priv->ahbclk)) { | 187 | if (IS_ERR(priv->ahbclk)) { |
188 | ret = PTR_ERR(priv->ahbclk); | 188 | ret = PTR_ERR(priv->ahbclk); |
@@ -207,10 +207,17 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
207 | /* Initialize the transceiver */ | 207 | /* Initialize the transceiver */ |
208 | if (pdata->otg) { | 208 | if (pdata->otg) { |
209 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; | 209 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; |
210 | if (otg_init(pdata->otg) != 0) | 210 | ret = otg_init(pdata->otg); |
211 | dev_err(dev, "unable to init transceiver\n"); | 211 | if (ret) { |
212 | else if (otg_set_vbus(pdata->otg, 1) != 0) | 212 | dev_err(dev, "unable to init transceiver, probably missing\n"); |
213 | ret = -ENODEV; | ||
214 | goto err_add; | ||
215 | } | ||
216 | ret = otg_set_vbus(pdata->otg, 1); | ||
217 | if (ret) { | ||
213 | dev_err(dev, "unable to enable vbus on transceiver\n"); | 218 | dev_err(dev, "unable to enable vbus on transceiver\n"); |
219 | goto err_add; | ||
220 | } | ||
214 | } | 221 | } |
215 | 222 | ||
216 | priv->hcd = hcd; | 223 | priv->hcd = hcd; |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index 013972bbde57..4899f451add9 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
@@ -151,7 +151,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = { | |||
151 | static int __devinit | 151 | static int __devinit |
152 | ehci_hcd_xilinx_of_probe(struct of_device *op, const struct of_device_id *match) | 152 | ehci_hcd_xilinx_of_probe(struct of_device *op, const struct of_device_id *match) |
153 | { | 153 | { |
154 | struct device_node *dn = op->node; | 154 | struct device_node *dn = op->dev.of_node; |
155 | struct usb_hcd *hcd; | 155 | struct usb_hcd *hcd; |
156 | struct ehci_hcd *ehci; | 156 | struct ehci_hcd *ehci; |
157 | struct resource res; | 157 | struct resource res; |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 20a0dfe0fe36..0587ad4ce5c2 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -2224,12 +2224,9 @@ static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) | |||
2224 | 2224 | ||
2225 | /*-------------------------------------------------------------------------*/ | 2225 | /*-------------------------------------------------------------------------*/ |
2226 | 2226 | ||
2227 | static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | 2227 | static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) |
2228 | { | 2228 | { |
2229 | int tmp = 20; | 2229 | int tmp = 20; |
2230 | unsigned long flags; | ||
2231 | |||
2232 | spin_lock_irqsave(&isp1362_hcd->lock, flags); | ||
2233 | 2230 | ||
2234 | isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); | 2231 | isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); |
2235 | isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); | 2232 | isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); |
@@ -2240,6 +2237,14 @@ static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | |||
2240 | } | 2237 | } |
2241 | if (!tmp) | 2238 | if (!tmp) |
2242 | pr_err("Software reset timeout\n"); | 2239 | pr_err("Software reset timeout\n"); |
2240 | } | ||
2241 | |||
2242 | static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | ||
2243 | { | ||
2244 | unsigned long flags; | ||
2245 | |||
2246 | spin_lock_irqsave(&isp1362_hcd->lock, flags); | ||
2247 | __isp1362_sw_reset(isp1362_hcd); | ||
2243 | spin_unlock_irqrestore(&isp1362_hcd->lock, flags); | 2248 | spin_unlock_irqrestore(&isp1362_hcd->lock, flags); |
2244 | } | 2249 | } |
2245 | 2250 | ||
@@ -2418,7 +2423,7 @@ static void isp1362_hc_stop(struct usb_hcd *hcd) | |||
2418 | if (isp1362_hcd->board && isp1362_hcd->board->reset) | 2423 | if (isp1362_hcd->board && isp1362_hcd->board->reset) |
2419 | isp1362_hcd->board->reset(hcd->self.controller, 1); | 2424 | isp1362_hcd->board->reset(hcd->self.controller, 1); |
2420 | else | 2425 | else |
2421 | isp1362_sw_reset(isp1362_hcd); | 2426 | __isp1362_sw_reset(isp1362_hcd); |
2422 | 2427 | ||
2423 | if (isp1362_hcd->board && isp1362_hcd->board->clock) | 2428 | if (isp1362_hcd->board && isp1362_hcd->board->clock) |
2424 | isp1362_hcd->board->clock(hcd->self.controller, 0); | 2429 | isp1362_hcd->board->clock(hcd->self.controller, 0); |
diff --git a/drivers/usb/host/isp1362.h b/drivers/usb/host/isp1362.h index 5151516ea1de..d995351f9bed 100644 --- a/drivers/usb/host/isp1362.h +++ b/drivers/usb/host/isp1362.h | |||
@@ -65,7 +65,7 @@ static inline void delayed_insw(unsigned int addr, void *buf, int len) | |||
65 | unsigned short *bp = (unsigned short *)buf; | 65 | unsigned short *bp = (unsigned short *)buf; |
66 | while (len--) { | 66 | while (len--) { |
67 | DUMMY_DELAY_ACCESS; | 67 | DUMMY_DELAY_ACCESS; |
68 | *bp++ = inw((void *)addr); | 68 | *bp++ = inw(addr); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index a18debdd79b8..418163894775 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -203,7 +203,7 @@ static inline void pxa27x_reset_hc(struct pxa27x_ohci *ohci) | |||
203 | __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); | 203 | __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); |
204 | } | 204 | } |
205 | 205 | ||
206 | #ifdef CONFIG_CPU_PXA27x | 206 | #ifdef CONFIG_PXA27x |
207 | extern void pxa27x_clear_otgph(void); | 207 | extern void pxa27x_clear_otgph(void); |
208 | #else | 208 | #else |
209 | #define pxa27x_clear_otgph() do {} while (0) | 209 | #define pxa27x_clear_otgph() do {} while (0) |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 6db57ab6079d..77be3c24a427 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -1065,7 +1065,7 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port) | |||
1065 | else if (speed == LSMODE) | 1065 | else if (speed == LSMODE) |
1066 | rh->port |= USB_PORT_STAT_LOW_SPEED; | 1066 | rh->port |= USB_PORT_STAT_LOW_SPEED; |
1067 | 1067 | ||
1068 | rh->port &= USB_PORT_STAT_RESET; | 1068 | rh->port &= ~USB_PORT_STAT_RESET; |
1069 | rh->port |= USB_PORT_STAT_ENABLE; | 1069 | rh->port |= USB_PORT_STAT_ENABLE; |
1070 | } | 1070 | } |
1071 | 1071 | ||
@@ -2404,7 +2404,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
2404 | 2404 | ||
2405 | del_timer_sync(&r8a66597->rh_timer); | 2405 | del_timer_sync(&r8a66597->rh_timer); |
2406 | usb_remove_hcd(hcd); | 2406 | usb_remove_hcd(hcd); |
2407 | iounmap((void *)r8a66597->reg); | 2407 | iounmap(r8a66597->reg); |
2408 | #ifdef CONFIG_HAVE_CLK | 2408 | #ifdef CONFIG_HAVE_CLK |
2409 | if (r8a66597->pdata->on_chip) | 2409 | if (r8a66597->pdata->on_chip) |
2410 | clk_put(r8a66597->clk); | 2410 | clk_put(r8a66597->clk); |
@@ -2496,7 +2496,7 @@ static int __devinit r8a66597_probe(struct platform_device *pdev) | |||
2496 | init_timer(&r8a66597->rh_timer); | 2496 | init_timer(&r8a66597->rh_timer); |
2497 | r8a66597->rh_timer.function = r8a66597_timer; | 2497 | r8a66597->rh_timer.function = r8a66597_timer; |
2498 | r8a66597->rh_timer.data = (unsigned long)r8a66597; | 2498 | r8a66597->rh_timer.data = (unsigned long)r8a66597; |
2499 | r8a66597->reg = (unsigned long)reg; | 2499 | r8a66597->reg = reg; |
2500 | 2500 | ||
2501 | /* make sure no interrupts are pending */ | 2501 | /* make sure no interrupts are pending */ |
2502 | ret = r8a66597_clock_enable(r8a66597); | 2502 | ret = r8a66597_clock_enable(r8a66597); |
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 228e3fb23854..95d0f5adfdcf 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -112,7 +112,7 @@ struct r8a66597_root_hub { | |||
112 | 112 | ||
113 | struct r8a66597 { | 113 | struct r8a66597 { |
114 | spinlock_t lock; | 114 | spinlock_t lock; |
115 | unsigned long reg; | 115 | void __iomem *reg; |
116 | #ifdef CONFIG_HAVE_CLK | 116 | #ifdef CONFIG_HAVE_CLK |
117 | struct clk *clk; | 117 | struct clk *clk; |
118 | #endif | 118 | #endif |
@@ -170,67 +170,67 @@ static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597, | |||
170 | 170 | ||
171 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | 171 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) |
172 | { | 172 | { |
173 | return inw(r8a66597->reg + offset); | 173 | return ioread16(r8a66597->reg + offset); |
174 | } | 174 | } |
175 | 175 | ||
176 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 176 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, |
177 | unsigned long offset, u16 *buf, | 177 | unsigned long offset, u16 *buf, |
178 | int len) | 178 | int len) |
179 | { | 179 | { |
180 | unsigned long fifoaddr = r8a66597->reg + offset; | 180 | void __iomem *fifoaddr = r8a66597->reg + offset; |
181 | unsigned long count; | 181 | unsigned long count; |
182 | 182 | ||
183 | if (r8a66597->pdata->on_chip) { | 183 | if (r8a66597->pdata->on_chip) { |
184 | count = len / 4; | 184 | count = len / 4; |
185 | insl(fifoaddr, buf, count); | 185 | ioread32_rep(fifoaddr, buf, count); |
186 | 186 | ||
187 | if (len & 0x00000003) { | 187 | if (len & 0x00000003) { |
188 | unsigned long tmp = inl(fifoaddr); | 188 | unsigned long tmp = ioread32(fifoaddr); |
189 | memcpy((unsigned char *)buf + count * 4, &tmp, | 189 | memcpy((unsigned char *)buf + count * 4, &tmp, |
190 | len & 0x03); | 190 | len & 0x03); |
191 | } | 191 | } |
192 | } else { | 192 | } else { |
193 | len = (len + 1) / 2; | 193 | len = (len + 1) / 2; |
194 | insw(fifoaddr, buf, len); | 194 | ioread16_rep(fifoaddr, buf, len); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 198 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
199 | unsigned long offset) | 199 | unsigned long offset) |
200 | { | 200 | { |
201 | outw(val, r8a66597->reg + offset); | 201 | iowrite16(val, r8a66597->reg + offset); |
202 | } | 202 | } |
203 | 203 | ||
204 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 204 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
205 | unsigned long offset, u16 *buf, | 205 | unsigned long offset, u16 *buf, |
206 | int len) | 206 | int len) |
207 | { | 207 | { |
208 | unsigned long fifoaddr = r8a66597->reg + offset; | 208 | void __iomem *fifoaddr = r8a66597->reg + offset; |
209 | unsigned long count; | 209 | unsigned long count; |
210 | unsigned char *pb; | 210 | unsigned char *pb; |
211 | int i; | 211 | int i; |
212 | 212 | ||
213 | if (r8a66597->pdata->on_chip) { | 213 | if (r8a66597->pdata->on_chip) { |
214 | count = len / 4; | 214 | count = len / 4; |
215 | outsl(fifoaddr, buf, count); | 215 | iowrite32_rep(fifoaddr, buf, count); |
216 | 216 | ||
217 | if (len & 0x00000003) { | 217 | if (len & 0x00000003) { |
218 | pb = (unsigned char *)buf + count * 4; | 218 | pb = (unsigned char *)buf + count * 4; |
219 | for (i = 0; i < (len & 0x00000003); i++) { | 219 | for (i = 0; i < (len & 0x00000003); i++) { |
220 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | 220 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) |
221 | outb(pb[i], fifoaddr + i); | 221 | iowrite8(pb[i], fifoaddr + i); |
222 | else | 222 | else |
223 | outb(pb[i], fifoaddr + 3 - i); | 223 | iowrite8(pb[i], fifoaddr + 3 - i); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } else { | 226 | } else { |
227 | int odd = len & 0x0001; | 227 | int odd = len & 0x0001; |
228 | 228 | ||
229 | len = len / 2; | 229 | len = len / 2; |
230 | outsw(fifoaddr, buf, len); | 230 | ioread16_rep(fifoaddr, buf, len); |
231 | if (unlikely(odd)) { | 231 | if (unlikely(odd)) { |
232 | buf = &buf[len]; | 232 | buf = &buf[len]; |
233 | outb((unsigned char)*buf, fifoaddr); | 233 | iowrite8((unsigned char)*buf, fifoaddr); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | } | 236 | } |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index fd9e03afd91c..2eb658d26394 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -835,6 +835,27 @@ fail: | |||
835 | return 0; | 835 | return 0; |
836 | } | 836 | } |
837 | 837 | ||
838 | void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, | ||
839 | struct usb_device *udev) | ||
840 | { | ||
841 | struct xhci_virt_device *virt_dev; | ||
842 | struct xhci_ep_ctx *ep0_ctx; | ||
843 | struct xhci_ring *ep_ring; | ||
844 | |||
845 | virt_dev = xhci->devs[udev->slot_id]; | ||
846 | ep0_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, 0); | ||
847 | ep_ring = virt_dev->eps[0].ring; | ||
848 | /* | ||
849 | * FIXME we don't keep track of the dequeue pointer very well after a | ||
850 | * Set TR dequeue pointer, so we're setting the dequeue pointer of the | ||
851 | * host to our enqueue pointer. This should only be called after a | ||
852 | * configured device has reset, so all control transfers should have | ||
853 | * been completed or cancelled before the reset. | ||
854 | */ | ||
855 | ep0_ctx->deq = xhci_trb_virt_to_dma(ep_ring->enq_seg, ep_ring->enqueue); | ||
856 | ep0_ctx->deq |= ep_ring->cycle_state; | ||
857 | } | ||
858 | |||
838 | /* Setup an xHCI virtual device for a Set Address command */ | 859 | /* Setup an xHCI virtual device for a Set Address command */ |
839 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) | 860 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) |
840 | { | 861 | { |
@@ -1002,7 +1023,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
1002 | return EP_INTERVAL(interval); | 1023 | return EP_INTERVAL(interval); |
1003 | } | 1024 | } |
1004 | 1025 | ||
1005 | /* The "Mult" field in the endpoint context is only set for SuperSpeed devices. | 1026 | /* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps. |
1006 | * High speed endpoint descriptors can define "the number of additional | 1027 | * High speed endpoint descriptors can define "the number of additional |
1007 | * transaction opportunities per microframe", but that goes in the Max Burst | 1028 | * transaction opportunities per microframe", but that goes in the Max Burst |
1008 | * endpoint context field. | 1029 | * endpoint context field. |
@@ -1010,7 +1031,8 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
1010 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | 1031 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, |
1011 | struct usb_host_endpoint *ep) | 1032 | struct usb_host_endpoint *ep) |
1012 | { | 1033 | { |
1013 | if (udev->speed != USB_SPEED_SUPER) | 1034 | if (udev->speed != USB_SPEED_SUPER || |
1035 | !usb_endpoint_xfer_isoc(&ep->desc)) | ||
1014 | return 0; | 1036 | return 0; |
1015 | return ep->ss_ep_comp.bmAttributes; | 1037 | return ep->ss_ep_comp.bmAttributes; |
1016 | } | 1038 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index edffd81fc253..11482b6b9381 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -78,6 +78,8 @@ static int xhci_pci_setup(struct usb_hcd *hcd) | |||
78 | xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" | 78 | xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" |
79 | " endpoint cmd after reset endpoint\n"); | 79 | " endpoint cmd after reset endpoint\n"); |
80 | } | 80 | } |
81 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | ||
82 | xhci->quirks |= XHCI_NEC_HOST; | ||
81 | 83 | ||
82 | /* Make sure the HC is halted. */ | 84 | /* Make sure the HC is halted. */ |
83 | retval = xhci_halt(xhci); | 85 | retval = xhci_halt(xhci); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 36c858e5b529..bfc99a939455 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -182,8 +182,12 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
182 | * set, but other sections talk about dealing with the chain bit set. This was | 182 | * set, but other sections talk about dealing with the chain bit set. This was |
183 | * fixed in the 0.96 specification errata, but we have to assume that all 0.95 | 183 | * fixed in the 0.96 specification errata, but we have to assume that all 0.95 |
184 | * xHCI hardware can't handle the chain bit being cleared on a link TRB. | 184 | * xHCI hardware can't handle the chain bit being cleared on a link TRB. |
185 | * | ||
186 | * @more_trbs_coming: Will you enqueue more TRBs before calling | ||
187 | * prepare_transfer()? | ||
185 | */ | 188 | */ |
186 | static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer) | 189 | static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, |
190 | bool consumer, bool more_trbs_coming) | ||
187 | { | 191 | { |
188 | u32 chain; | 192 | u32 chain; |
189 | union xhci_trb *next; | 193 | union xhci_trb *next; |
@@ -199,15 +203,28 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
199 | while (last_trb(xhci, ring, ring->enq_seg, next)) { | 203 | while (last_trb(xhci, ring, ring->enq_seg, next)) { |
200 | if (!consumer) { | 204 | if (!consumer) { |
201 | if (ring != xhci->event_ring) { | 205 | if (ring != xhci->event_ring) { |
202 | if (chain) { | 206 | /* |
203 | next->link.control |= TRB_CHAIN; | 207 | * If the caller doesn't plan on enqueueing more |
204 | 208 | * TDs before ringing the doorbell, then we | |
205 | /* Give this link TRB to the hardware */ | 209 | * don't want to give the link TRB to the |
206 | wmb(); | 210 | * hardware just yet. We'll give the link TRB |
207 | next->link.control ^= TRB_CYCLE; | 211 | * back in prepare_ring() just before we enqueue |
208 | } else { | 212 | * the TD at the top of the ring. |
213 | */ | ||
214 | if (!chain && !more_trbs_coming) | ||
209 | break; | 215 | break; |
216 | |||
217 | /* If we're not dealing with 0.95 hardware, | ||
218 | * carry over the chain bit of the previous TRB | ||
219 | * (which may mean the chain bit is cleared). | ||
220 | */ | ||
221 | if (!xhci_link_trb_quirk(xhci)) { | ||
222 | next->link.control &= ~TRB_CHAIN; | ||
223 | next->link.control |= chain; | ||
210 | } | 224 | } |
225 | /* Give this link TRB to the hardware */ | ||
226 | wmb(); | ||
227 | next->link.control ^= TRB_CYCLE; | ||
211 | } | 228 | } |
212 | /* Toggle the cycle bit after the last ring segment. */ | 229 | /* Toggle the cycle bit after the last ring segment. */ |
213 | if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { | 230 | if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { |
@@ -1071,6 +1088,15 @@ bandwidth_change: | |||
1071 | xhci_warn(xhci, "Reset device command completion " | 1088 | xhci_warn(xhci, "Reset device command completion " |
1072 | "for disabled slot %u\n", slot_id); | 1089 | "for disabled slot %u\n", slot_id); |
1073 | break; | 1090 | break; |
1091 | case TRB_TYPE(TRB_NEC_GET_FW): | ||
1092 | if (!(xhci->quirks & XHCI_NEC_HOST)) { | ||
1093 | xhci->error_bitmask |= 1 << 6; | ||
1094 | break; | ||
1095 | } | ||
1096 | xhci_dbg(xhci, "NEC firmware version %2x.%02x\n", | ||
1097 | NEC_FW_MAJOR(event->status), | ||
1098 | NEC_FW_MINOR(event->status)); | ||
1099 | break; | ||
1074 | default: | 1100 | default: |
1075 | /* Skip over unknown commands on the event ring */ | 1101 | /* Skip over unknown commands on the event ring */ |
1076 | xhci->error_bitmask |= 1 << 6; | 1102 | xhci->error_bitmask |= 1 << 6; |
@@ -1079,6 +1105,17 @@ bandwidth_change: | |||
1079 | inc_deq(xhci, xhci->cmd_ring, false); | 1105 | inc_deq(xhci, xhci->cmd_ring, false); |
1080 | } | 1106 | } |
1081 | 1107 | ||
1108 | static void handle_vendor_event(struct xhci_hcd *xhci, | ||
1109 | union xhci_trb *event) | ||
1110 | { | ||
1111 | u32 trb_type; | ||
1112 | |||
1113 | trb_type = TRB_FIELD_TO_TYPE(event->generic.field[3]); | ||
1114 | xhci_dbg(xhci, "Vendor specific event TRB type = %u\n", trb_type); | ||
1115 | if (trb_type == TRB_NEC_CMD_COMP && (xhci->quirks & XHCI_NEC_HOST)) | ||
1116 | handle_cmd_completion(xhci, &event->event_cmd); | ||
1117 | } | ||
1118 | |||
1082 | static void handle_port_status(struct xhci_hcd *xhci, | 1119 | static void handle_port_status(struct xhci_hcd *xhci, |
1083 | union xhci_trb *event) | 1120 | union xhci_trb *event) |
1084 | { | 1121 | { |
@@ -1659,7 +1696,10 @@ void xhci_handle_event(struct xhci_hcd *xhci) | |||
1659 | update_ptrs = 0; | 1696 | update_ptrs = 0; |
1660 | break; | 1697 | break; |
1661 | default: | 1698 | default: |
1662 | xhci->error_bitmask |= 1 << 3; | 1699 | if ((event->event_cmd.flags & TRB_TYPE_BITMASK) >= TRB_TYPE(48)) |
1700 | handle_vendor_event(xhci, event); | ||
1701 | else | ||
1702 | xhci->error_bitmask |= 1 << 3; | ||
1663 | } | 1703 | } |
1664 | /* Any of the above functions may drop and re-acquire the lock, so check | 1704 | /* Any of the above functions may drop and re-acquire the lock, so check |
1665 | * to make sure a watchdog timer didn't mark the host as non-responsive. | 1705 | * to make sure a watchdog timer didn't mark the host as non-responsive. |
@@ -1684,9 +1724,12 @@ void xhci_handle_event(struct xhci_hcd *xhci) | |||
1684 | /* | 1724 | /* |
1685 | * Generic function for queueing a TRB on a ring. | 1725 | * Generic function for queueing a TRB on a ring. |
1686 | * The caller must have checked to make sure there's room on the ring. | 1726 | * The caller must have checked to make sure there's room on the ring. |
1727 | * | ||
1728 | * @more_trbs_coming: Will you enqueue more TRBs before calling | ||
1729 | * prepare_transfer()? | ||
1687 | */ | 1730 | */ |
1688 | static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | 1731 | static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, |
1689 | bool consumer, | 1732 | bool consumer, bool more_trbs_coming, |
1690 | u32 field1, u32 field2, u32 field3, u32 field4) | 1733 | u32 field1, u32 field2, u32 field3, u32 field4) |
1691 | { | 1734 | { |
1692 | struct xhci_generic_trb *trb; | 1735 | struct xhci_generic_trb *trb; |
@@ -1696,7 +1739,7 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
1696 | trb->field[1] = field2; | 1739 | trb->field[1] = field2; |
1697 | trb->field[2] = field3; | 1740 | trb->field[2] = field3; |
1698 | trb->field[3] = field4; | 1741 | trb->field[3] = field4; |
1699 | inc_enq(xhci, ring, consumer); | 1742 | inc_enq(xhci, ring, consumer, more_trbs_coming); |
1700 | } | 1743 | } |
1701 | 1744 | ||
1702 | /* | 1745 | /* |
@@ -1965,6 +2008,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
1965 | int trb_buff_len, this_sg_len, running_total; | 2008 | int trb_buff_len, this_sg_len, running_total; |
1966 | bool first_trb; | 2009 | bool first_trb; |
1967 | u64 addr; | 2010 | u64 addr; |
2011 | bool more_trbs_coming; | ||
1968 | 2012 | ||
1969 | struct xhci_generic_trb *start_trb; | 2013 | struct xhci_generic_trb *start_trb; |
1970 | int start_cycle; | 2014 | int start_cycle; |
@@ -2050,7 +2094,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2050 | length_field = TRB_LEN(trb_buff_len) | | 2094 | length_field = TRB_LEN(trb_buff_len) | |
2051 | remainder | | 2095 | remainder | |
2052 | TRB_INTR_TARGET(0); | 2096 | TRB_INTR_TARGET(0); |
2053 | queue_trb(xhci, ep_ring, false, | 2097 | if (num_trbs > 1) |
2098 | more_trbs_coming = true; | ||
2099 | else | ||
2100 | more_trbs_coming = false; | ||
2101 | queue_trb(xhci, ep_ring, false, more_trbs_coming, | ||
2054 | lower_32_bits(addr), | 2102 | lower_32_bits(addr), |
2055 | upper_32_bits(addr), | 2103 | upper_32_bits(addr), |
2056 | length_field, | 2104 | length_field, |
@@ -2101,6 +2149,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2101 | int num_trbs; | 2149 | int num_trbs; |
2102 | struct xhci_generic_trb *start_trb; | 2150 | struct xhci_generic_trb *start_trb; |
2103 | bool first_trb; | 2151 | bool first_trb; |
2152 | bool more_trbs_coming; | ||
2104 | int start_cycle; | 2153 | int start_cycle; |
2105 | u32 field, length_field; | 2154 | u32 field, length_field; |
2106 | 2155 | ||
@@ -2189,7 +2238,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2189 | length_field = TRB_LEN(trb_buff_len) | | 2238 | length_field = TRB_LEN(trb_buff_len) | |
2190 | remainder | | 2239 | remainder | |
2191 | TRB_INTR_TARGET(0); | 2240 | TRB_INTR_TARGET(0); |
2192 | queue_trb(xhci, ep_ring, false, | 2241 | if (num_trbs > 1) |
2242 | more_trbs_coming = true; | ||
2243 | else | ||
2244 | more_trbs_coming = false; | ||
2245 | queue_trb(xhci, ep_ring, false, more_trbs_coming, | ||
2193 | lower_32_bits(addr), | 2246 | lower_32_bits(addr), |
2194 | upper_32_bits(addr), | 2247 | upper_32_bits(addr), |
2195 | length_field, | 2248 | length_field, |
@@ -2268,7 +2321,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2268 | /* Queue setup TRB - see section 6.4.1.2.1 */ | 2321 | /* Queue setup TRB - see section 6.4.1.2.1 */ |
2269 | /* FIXME better way to translate setup_packet into two u32 fields? */ | 2322 | /* FIXME better way to translate setup_packet into two u32 fields? */ |
2270 | setup = (struct usb_ctrlrequest *) urb->setup_packet; | 2323 | setup = (struct usb_ctrlrequest *) urb->setup_packet; |
2271 | queue_trb(xhci, ep_ring, false, | 2324 | queue_trb(xhci, ep_ring, false, true, |
2272 | /* FIXME endianness is probably going to bite my ass here. */ | 2325 | /* FIXME endianness is probably going to bite my ass here. */ |
2273 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, | 2326 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, |
2274 | setup->wIndex | setup->wLength << 16, | 2327 | setup->wIndex | setup->wLength << 16, |
@@ -2284,7 +2337,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2284 | if (urb->transfer_buffer_length > 0) { | 2337 | if (urb->transfer_buffer_length > 0) { |
2285 | if (setup->bRequestType & USB_DIR_IN) | 2338 | if (setup->bRequestType & USB_DIR_IN) |
2286 | field |= TRB_DIR_IN; | 2339 | field |= TRB_DIR_IN; |
2287 | queue_trb(xhci, ep_ring, false, | 2340 | queue_trb(xhci, ep_ring, false, true, |
2288 | lower_32_bits(urb->transfer_dma), | 2341 | lower_32_bits(urb->transfer_dma), |
2289 | upper_32_bits(urb->transfer_dma), | 2342 | upper_32_bits(urb->transfer_dma), |
2290 | length_field, | 2343 | length_field, |
@@ -2301,7 +2354,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2301 | field = 0; | 2354 | field = 0; |
2302 | else | 2355 | else |
2303 | field = TRB_DIR_IN; | 2356 | field = TRB_DIR_IN; |
2304 | queue_trb(xhci, ep_ring, false, | 2357 | queue_trb(xhci, ep_ring, false, false, |
2305 | 0, | 2358 | 0, |
2306 | 0, | 2359 | 0, |
2307 | TRB_INTR_TARGET(0), | 2360 | TRB_INTR_TARGET(0), |
@@ -2327,18 +2380,21 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2, | |||
2327 | u32 field3, u32 field4, bool command_must_succeed) | 2380 | u32 field3, u32 field4, bool command_must_succeed) |
2328 | { | 2381 | { |
2329 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; | 2382 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; |
2383 | int ret; | ||
2384 | |||
2330 | if (!command_must_succeed) | 2385 | if (!command_must_succeed) |
2331 | reserved_trbs++; | 2386 | reserved_trbs++; |
2332 | 2387 | ||
2333 | if (!room_on_ring(xhci, xhci->cmd_ring, reserved_trbs)) { | 2388 | ret = prepare_ring(xhci, xhci->cmd_ring, EP_STATE_RUNNING, |
2334 | if (!in_interrupt()) | 2389 | reserved_trbs, GFP_ATOMIC); |
2335 | xhci_err(xhci, "ERR: No room for command on command ring\n"); | 2390 | if (ret < 0) { |
2391 | xhci_err(xhci, "ERR: No room for command on command ring\n"); | ||
2336 | if (command_must_succeed) | 2392 | if (command_must_succeed) |
2337 | xhci_err(xhci, "ERR: Reserved TRB counting for " | 2393 | xhci_err(xhci, "ERR: Reserved TRB counting for " |
2338 | "unfailable commands failed.\n"); | 2394 | "unfailable commands failed.\n"); |
2339 | return -ENOMEM; | 2395 | return ret; |
2340 | } | 2396 | } |
2341 | queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, | 2397 | queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, |
2342 | field4 | xhci->cmd_ring->cycle_state); | 2398 | field4 | xhci->cmd_ring->cycle_state); |
2343 | return 0; | 2399 | return 0; |
2344 | } | 2400 | } |
@@ -2378,6 +2434,12 @@ int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | |||
2378 | false); | 2434 | false); |
2379 | } | 2435 | } |
2380 | 2436 | ||
2437 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, | ||
2438 | u32 field1, u32 field2, u32 field3, u32 field4) | ||
2439 | { | ||
2440 | return queue_command(xhci, field1, field2, field3, field4, false); | ||
2441 | } | ||
2442 | |||
2381 | /* Queue a reset device command TRB */ | 2443 | /* Queue a reset device command TRB */ |
2382 | int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id) | 2444 | int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id) |
2383 | { | 2445 | { |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 40e0a0c221b8..3998f72cd0c4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -106,6 +106,33 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * Set the run bit and wait for the host to be running. | ||
110 | */ | ||
111 | int xhci_start(struct xhci_hcd *xhci) | ||
112 | { | ||
113 | u32 temp; | ||
114 | int ret; | ||
115 | |||
116 | temp = xhci_readl(xhci, &xhci->op_regs->command); | ||
117 | temp |= (CMD_RUN); | ||
118 | xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n", | ||
119 | temp); | ||
120 | xhci_writel(xhci, temp, &xhci->op_regs->command); | ||
121 | |||
122 | /* | ||
123 | * Wait for the HCHalted Status bit to be 0 to indicate the host is | ||
124 | * running. | ||
125 | */ | ||
126 | ret = handshake(xhci, &xhci->op_regs->status, | ||
127 | STS_HALT, 0, XHCI_MAX_HALT_USEC); | ||
128 | if (ret == -ETIMEDOUT) | ||
129 | xhci_err(xhci, "Host took too long to start, " | ||
130 | "waited %u microseconds.\n", | ||
131 | XHCI_MAX_HALT_USEC); | ||
132 | return ret; | ||
133 | } | ||
134 | |||
135 | /* | ||
109 | * Reset a halted HC, and set the internal HC state to HC_STATE_HALT. | 136 | * Reset a halted HC, and set the internal HC state to HC_STATE_HALT. |
110 | * | 137 | * |
111 | * This resets pipelines, timers, counters, state machines, etc. | 138 | * This resets pipelines, timers, counters, state machines, etc. |
@@ -116,6 +143,7 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
116 | { | 143 | { |
117 | u32 command; | 144 | u32 command; |
118 | u32 state; | 145 | u32 state; |
146 | int ret; | ||
119 | 147 | ||
120 | state = xhci_readl(xhci, &xhci->op_regs->status); | 148 | state = xhci_readl(xhci, &xhci->op_regs->status); |
121 | if ((state & STS_HALT) == 0) { | 149 | if ((state & STS_HALT) == 0) { |
@@ -130,7 +158,17 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
130 | /* XXX: Why does EHCI set this here? Shouldn't other code do this? */ | 158 | /* XXX: Why does EHCI set this here? Shouldn't other code do this? */ |
131 | xhci_to_hcd(xhci)->state = HC_STATE_HALT; | 159 | xhci_to_hcd(xhci)->state = HC_STATE_HALT; |
132 | 160 | ||
133 | return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000); | 161 | ret = handshake(xhci, &xhci->op_regs->command, |
162 | CMD_RESET, 0, 250 * 1000); | ||
163 | if (ret) | ||
164 | return ret; | ||
165 | |||
166 | xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n"); | ||
167 | /* | ||
168 | * xHCI cannot write to any doorbells or operational registers other | ||
169 | * than status until the "Controller Not Ready" flag is cleared. | ||
170 | */ | ||
171 | return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000); | ||
134 | } | 172 | } |
135 | 173 | ||
136 | 174 | ||
@@ -448,17 +486,20 @@ int xhci_run(struct usb_hcd *hcd) | |||
448 | 486 | ||
449 | if (NUM_TEST_NOOPS > 0) | 487 | if (NUM_TEST_NOOPS > 0) |
450 | doorbell = xhci_setup_one_noop(xhci); | 488 | doorbell = xhci_setup_one_noop(xhci); |
489 | if (xhci->quirks & XHCI_NEC_HOST) | ||
490 | xhci_queue_vendor_command(xhci, 0, 0, 0, | ||
491 | TRB_TYPE(TRB_NEC_GET_FW)); | ||
492 | |||
493 | if (xhci_start(xhci)) { | ||
494 | xhci_halt(xhci); | ||
495 | return -ENODEV; | ||
496 | } | ||
451 | 497 | ||
452 | temp = xhci_readl(xhci, &xhci->op_regs->command); | ||
453 | temp |= (CMD_RUN); | ||
454 | xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n", | ||
455 | temp); | ||
456 | xhci_writel(xhci, temp, &xhci->op_regs->command); | ||
457 | /* Flush PCI posted writes */ | ||
458 | temp = xhci_readl(xhci, &xhci->op_regs->command); | ||
459 | xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp); | 498 | xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp); |
460 | if (doorbell) | 499 | if (doorbell) |
461 | (*doorbell)(xhci); | 500 | (*doorbell)(xhci); |
501 | if (xhci->quirks & XHCI_NEC_HOST) | ||
502 | xhci_ring_cmd_db(xhci); | ||
462 | 503 | ||
463 | xhci_dbg(xhci, "Finished xhci_run\n"); | 504 | xhci_dbg(xhci, "Finished xhci_run\n"); |
464 | return 0; | 505 | return 0; |
@@ -2093,6 +2134,8 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
2093 | /* If this is a Set Address to an unconfigured device, setup ep 0 */ | 2134 | /* If this is a Set Address to an unconfigured device, setup ep 0 */ |
2094 | if (!udev->config) | 2135 | if (!udev->config) |
2095 | xhci_setup_addressable_virt_dev(xhci, udev); | 2136 | xhci_setup_addressable_virt_dev(xhci, udev); |
2137 | else | ||
2138 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); | ||
2096 | /* Otherwise, assume the core has the device configured how it wants */ | 2139 | /* Otherwise, assume the core has the device configured how it wants */ |
2097 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); | 2140 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); |
2098 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); | 2141 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index dada2fb59261..6c7e3430ec93 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -925,6 +925,7 @@ union xhci_trb { | |||
925 | /* TRB bit mask */ | 925 | /* TRB bit mask */ |
926 | #define TRB_TYPE_BITMASK (0xfc00) | 926 | #define TRB_TYPE_BITMASK (0xfc00) |
927 | #define TRB_TYPE(p) ((p) << 10) | 927 | #define TRB_TYPE(p) ((p) << 10) |
928 | #define TRB_FIELD_TO_TYPE(p) (((p) & TRB_TYPE_BITMASK) >> 10) | ||
928 | /* TRB type IDs */ | 929 | /* TRB type IDs */ |
929 | /* bulk, interrupt, isoc scatter/gather, and control data stage */ | 930 | /* bulk, interrupt, isoc scatter/gather, and control data stage */ |
930 | #define TRB_NORMAL 1 | 931 | #define TRB_NORMAL 1 |
@@ -992,6 +993,14 @@ union xhci_trb { | |||
992 | #define TRB_MFINDEX_WRAP 39 | 993 | #define TRB_MFINDEX_WRAP 39 |
993 | /* TRB IDs 40-47 reserved, 48-63 is vendor-defined */ | 994 | /* TRB IDs 40-47 reserved, 48-63 is vendor-defined */ |
994 | 995 | ||
996 | /* Nec vendor-specific command completion event. */ | ||
997 | #define TRB_NEC_CMD_COMP 48 | ||
998 | /* Get NEC firmware revision. */ | ||
999 | #define TRB_NEC_GET_FW 49 | ||
1000 | |||
1001 | #define NEC_FW_MINOR(p) (((p) >> 0) & 0xff) | ||
1002 | #define NEC_FW_MAJOR(p) (((p) >> 8) & 0xff) | ||
1003 | |||
995 | /* | 1004 | /* |
996 | * TRBS_PER_SEGMENT must be a multiple of 4, | 1005 | * TRBS_PER_SEGMENT must be a multiple of 4, |
997 | * since the command ring is 64-byte aligned. | 1006 | * since the command ring is 64-byte aligned. |
@@ -1172,6 +1181,7 @@ struct xhci_hcd { | |||
1172 | unsigned int quirks; | 1181 | unsigned int quirks; |
1173 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1182 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
1174 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1183 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
1184 | #define XHCI_NEC_HOST (1 << 2) | ||
1175 | }; | 1185 | }; |
1176 | 1186 | ||
1177 | /* For testing purposes */ | 1187 | /* For testing purposes */ |
@@ -1282,6 +1292,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags); | |||
1282 | void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); | 1292 | void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); |
1283 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); | 1293 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); |
1284 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); | 1294 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); |
1295 | void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, | ||
1296 | struct usb_device *udev); | ||
1285 | unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); | 1297 | unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); |
1286 | unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); | 1298 | unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); |
1287 | unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); | 1299 | unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); |
@@ -1379,6 +1391,8 @@ void xhci_set_hc_event_deq(struct xhci_hcd *xhci); | |||
1379 | int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); | 1391 | int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); |
1380 | int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1392 | int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, |
1381 | u32 slot_id); | 1393 | u32 slot_id); |
1394 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, | ||
1395 | u32 field1, u32 field2, u32 field3, u32 field4); | ||
1382 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, | 1396 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, |
1383 | unsigned int ep_index); | 1397 | unsigned int ep_index); |
1384 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1398 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 30d930386b65..d25814c172b2 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -2436,7 +2436,8 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2436 | } | 2436 | } |
2437 | 2437 | ||
2438 | if (!sisusb->devinit) { | 2438 | if (!sisusb->devinit) { |
2439 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { | 2439 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH || |
2440 | sisusb->sisusb_dev->speed == USB_SPEED_SUPER) { | ||
2440 | if (sisusb_init_gfxdevice(sisusb, 0)) { | 2441 | if (sisusb_init_gfxdevice(sisusb, 0)) { |
2441 | mutex_unlock(&sisusb->lock); | 2442 | mutex_unlock(&sisusb->lock); |
2442 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); | 2443 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); |
@@ -3166,7 +3167,7 @@ static int sisusb_probe(struct usb_interface *intf, | |||
3166 | 3167 | ||
3167 | sisusb->present = 1; | 3168 | sisusb->present = 1; |
3168 | 3169 | ||
3169 | if (dev->speed == USB_SPEED_HIGH) { | 3170 | if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) { |
3170 | int initscreen = 1; | 3171 | int initscreen = 1; |
3171 | #ifdef INCL_SISUSB_CON | 3172 | #ifdef INCL_SISUSB_CON |
3172 | if (sisusb_first_vc > 0 && | 3173 | if (sisusb_first_vc > 0 && |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fad70bc83555..3b795c56221f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -219,8 +219,8 @@ static int musb_ulpi_write(struct otg_transceiver *otg, | |||
219 | return 0; | 219 | return 0; |
220 | } | 220 | } |
221 | #else | 221 | #else |
222 | #define musb_ulpi_read(a, b) NULL | 222 | #define musb_ulpi_read NULL |
223 | #define musb_ulpi_write(a, b, c) NULL | 223 | #define musb_ulpi_write NULL |
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | static struct otg_io_access_ops musb_ulpi_access = { | 226 | static struct otg_io_access_ops musb_ulpi_access = { |
@@ -451,10 +451,6 @@ void musb_hnp_stop(struct musb *musb) | |||
451 | * @param power | 451 | * @param power |
452 | */ | 452 | */ |
453 | 453 | ||
454 | #define STAGE0_MASK (MUSB_INTR_RESUME | MUSB_INTR_SESSREQ \ | ||
455 | | MUSB_INTR_VBUSERROR | MUSB_INTR_CONNECT \ | ||
456 | | MUSB_INTR_RESET) | ||
457 | |||
458 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | 454 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, |
459 | u8 devctl, u8 power) | 455 | u8 devctl, u8 power) |
460 | { | 456 | { |
@@ -642,7 +638,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
642 | handled = IRQ_HANDLED; | 638 | handled = IRQ_HANDLED; |
643 | } | 639 | } |
644 | 640 | ||
645 | 641 | #endif | |
646 | if (int_usb & MUSB_INTR_SUSPEND) { | 642 | if (int_usb & MUSB_INTR_SUSPEND) { |
647 | DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", | 643 | DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", |
648 | otg_state_string(musb), devctl, power); | 644 | otg_state_string(musb), devctl, power); |
@@ -705,6 +701,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
705 | } | 701 | } |
706 | } | 702 | } |
707 | 703 | ||
704 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
708 | if (int_usb & MUSB_INTR_CONNECT) { | 705 | if (int_usb & MUSB_INTR_CONNECT) { |
709 | struct usb_hcd *hcd = musb_to_hcd(musb); | 706 | struct usb_hcd *hcd = musb_to_hcd(musb); |
710 | void __iomem *mbase = musb->mregs; | 707 | void __iomem *mbase = musb->mregs; |
@@ -1597,7 +1594,7 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1597 | /* the core can interrupt us for multiple reasons; docs have | 1594 | /* the core can interrupt us for multiple reasons; docs have |
1598 | * a generic interrupt flowchart to follow | 1595 | * a generic interrupt flowchart to follow |
1599 | */ | 1596 | */ |
1600 | if (musb->int_usb & STAGE0_MASK) | 1597 | if (musb->int_usb) |
1601 | retval |= musb_stage0_irq(musb, musb->int_usb, | 1598 | retval |= musb_stage0_irq(musb, musb->int_usb, |
1602 | devctl, power); | 1599 | devctl, power); |
1603 | 1600 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index b22d02dea7d3..91d67794e350 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -470,7 +470,8 @@ struct musb_csr_regs { | |||
470 | 470 | ||
471 | struct musb_context_registers { | 471 | struct musb_context_registers { |
472 | 472 | ||
473 | #ifdef CONFIG_PM | 473 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
474 | defined(CONFIG_ARCH_OMAP4) | ||
474 | u32 otg_sysconfig, otg_forcestandby; | 475 | u32 otg_sysconfig, otg_forcestandby; |
475 | #endif | 476 | #endif |
476 | u8 power; | 477 | u8 power; |
@@ -484,7 +485,8 @@ struct musb_context_registers { | |||
484 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; | 485 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; |
485 | }; | 486 | }; |
486 | 487 | ||
487 | #ifdef CONFIG_PM | 488 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
489 | defined(CONFIG_ARCH_OMAP4) | ||
488 | extern void musb_platform_save_context(struct musb *musb, | 490 | extern void musb_platform_save_context(struct musb *musb, |
489 | struct musb_context_registers *musb_context); | 491 | struct musb_context_registers *musb_context); |
490 | extern void musb_platform_restore_context(struct musb *musb, | 492 | extern void musb_platform_restore_context(struct musb *musb, |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 1008044a3bbc..dc66e4376d49 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
@@ -132,18 +132,9 @@ static void configure_channel(struct dma_channel *channel, | |||
132 | if (mode) { | 132 | if (mode) { |
133 | csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; | 133 | csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; |
134 | BUG_ON(len < packet_sz); | 134 | BUG_ON(len < packet_sz); |
135 | |||
136 | if (packet_sz >= 64) { | ||
137 | csr |= MUSB_HSDMA_BURSTMODE_INCR16 | ||
138 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
139 | } else if (packet_sz >= 32) { | ||
140 | csr |= MUSB_HSDMA_BURSTMODE_INCR8 | ||
141 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
142 | } else if (packet_sz >= 16) { | ||
143 | csr |= MUSB_HSDMA_BURSTMODE_INCR4 | ||
144 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
145 | } | ||
146 | } | 135 | } |
136 | csr |= MUSB_HSDMA_BURSTMODE_INCR16 | ||
137 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
147 | 138 | ||
148 | csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) | 139 | csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) |
149 | | (1 << MUSB_HSDMA_ENABLE_SHIFT) | 140 | | (1 << MUSB_HSDMA_ENABLE_SHIFT) |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 05c077f8f9ac..3c48e77a0aa2 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -29,19 +29,6 @@ static void tusb_source_power(struct musb *musb, int is_on); | |||
29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) | 29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) |
30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) | 30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) |
31 | 31 | ||
32 | #ifdef CONFIG_PM | ||
33 | /* REVISIT: These should be only needed if somebody implements off idle */ | ||
34 | void musb_platform_save_context(struct musb *musb, | ||
35 | struct musb_context_registers *musb_context) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | void musb_platform_restore_context(struct musb *musb, | ||
40 | struct musb_context_registers *musb_context) | ||
41 | { | ||
42 | } | ||
43 | #endif | ||
44 | |||
45 | /* | 32 | /* |
46 | * Checks the revision. We need to use the DMA register as 3.0 does not | 33 | * Checks the revision. We need to use the DMA register as 3.0 does not |
47 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. | 34 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index b1b346932946..d331b222ad21 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -59,12 +59,17 @@ static int ulpi_set_flags(struct otg_transceiver *otg) | |||
59 | 59 | ||
60 | static int ulpi_init(struct otg_transceiver *otg) | 60 | static int ulpi_init(struct otg_transceiver *otg) |
61 | { | 61 | { |
62 | int i, vid, pid; | 62 | int i, vid, pid, ret; |
63 | 63 | u32 ulpi_id = 0; | |
64 | vid = (otg_io_read(otg, ULPI_VENDOR_ID_HIGH) << 8) | | 64 | |
65 | otg_io_read(otg, ULPI_VENDOR_ID_LOW); | 65 | for (i = 0; i < 4; i++) { |
66 | pid = (otg_io_read(otg, ULPI_PRODUCT_ID_HIGH) << 8) | | 66 | ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i); |
67 | otg_io_read(otg, ULPI_PRODUCT_ID_LOW); | 67 | if (ret < 0) |
68 | return ret; | ||
69 | ulpi_id = (ulpi_id << 8) | ret; | ||
70 | } | ||
71 | vid = ulpi_id & 0xffff; | ||
72 | pid = ulpi_id >> 16; | ||
68 | 73 | ||
69 | pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); | 74 | pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); |
70 | 75 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 3edda3ed822a..fd35f73b5721 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -1239,8 +1239,7 @@ static void digi_write_bulk_callback(struct urb *urb) | |||
1239 | 1239 | ||
1240 | /* port and serial sanity check */ | 1240 | /* port and serial sanity check */ |
1241 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { | 1241 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
1242 | dev_err(&port->dev, | 1242 | pr_err("%s: port or port->private is NULL, status=%d\n", |
1243 | "%s: port or port->private is NULL, status=%d\n", | ||
1244 | __func__, status); | 1243 | __func__, status); |
1245 | return; | 1244 | return; |
1246 | } | 1245 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 050211afc07e..e298dc4baed7 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -653,7 +653,6 @@ static struct usb_device_id id_table_combined [] = { | |||
653 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | 653 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, |
654 | { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, | 654 | { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, |
655 | { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, | 655 | { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, |
656 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, | ||
657 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, | 656 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, |
658 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, | 657 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, |
659 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, | 658 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, |
@@ -692,6 +691,7 @@ static struct usb_device_id id_table_combined [] = { | |||
692 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 691 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
693 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 692 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
694 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 693 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
694 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | ||
695 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 695 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
696 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 696 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
697 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 697 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
@@ -738,6 +738,14 @@ static struct usb_device_id id_table_combined [] = { | |||
738 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, | 738 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, |
739 | { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, | 739 | { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, |
740 | { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, | 740 | { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, |
741 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID), | ||
742 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
743 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID), | ||
744 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
745 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID), | ||
746 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
747 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), | ||
748 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
741 | { }, /* Optional parameter entry */ | 749 | { }, /* Optional parameter entry */ |
742 | { } /* Terminating entry */ | 750 | { } /* Terminating entry */ |
743 | }; | 751 | }; |
@@ -2005,6 +2013,8 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2005 | "urb failed to set to rts/cts flow control\n"); | 2013 | "urb failed to set to rts/cts flow control\n"); |
2006 | } | 2014 | } |
2007 | 2015 | ||
2016 | /* raise DTR/RTS */ | ||
2017 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); | ||
2008 | } else { | 2018 | } else { |
2009 | /* | 2019 | /* |
2010 | * Xon/Xoff code | 2020 | * Xon/Xoff code |
@@ -2052,6 +2062,8 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2052 | } | 2062 | } |
2053 | } | 2063 | } |
2054 | 2064 | ||
2065 | /* lower DTR/RTS */ | ||
2066 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | ||
2055 | } | 2067 | } |
2056 | return; | 2068 | return; |
2057 | } | 2069 | } |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 94d86c3febcb..d01946db8fac 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -501,13 +501,6 @@ | |||
501 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ | 501 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * Contec products (http://www.contec.com) | ||
505 | * Submitted by Daniel Sangorrin | ||
506 | */ | ||
507 | #define CONTEC_VID 0x06CE /* Vendor ID */ | ||
508 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ | ||
509 | |||
510 | /* | ||
511 | * Definitions for B&B Electronics products. | 504 | * Definitions for B&B Electronics products. |
512 | */ | 505 | */ |
513 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ | 506 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ |
@@ -703,6 +696,12 @@ | |||
703 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 696 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
704 | 697 | ||
705 | /* | 698 | /* |
699 | * RT Systems programming cables for various ham radios | ||
700 | */ | ||
701 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | ||
702 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | ||
703 | |||
704 | /* | ||
706 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. | 705 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. |
707 | * http://winglucofacts.com/cables/ | 706 | * http://winglucofacts.com/cables/ |
708 | */ | 707 | */ |
@@ -1024,3 +1023,12 @@ | |||
1024 | #define MJSG_SR_RADIO_PID 0x9379 | 1023 | #define MJSG_SR_RADIO_PID 0x9379 |
1025 | #define MJSG_XM_RADIO_PID 0x937A | 1024 | #define MJSG_XM_RADIO_PID 0x937A |
1026 | #define MJSG_HD_RADIO_PID 0x937C | 1025 | #define MJSG_HD_RADIO_PID 0x937C |
1026 | |||
1027 | /* | ||
1028 | * Xverve Signalyzer tools (http://www.signalyzer.com/) | ||
1029 | */ | ||
1030 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 | ||
1031 | #define XVERVE_SIGNALYZER_SLITE_PID 0xBCA1 | ||
1032 | #define XVERVE_SIGNALYZER_SH2_PID 0xBCA2 | ||
1033 | #define XVERVE_SIGNALYZER_SH4_PID 0xBCA4 | ||
1034 | |||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index f8424d1bfc1b..585b7e663740 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -730,7 +730,6 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
730 | mos7840_port = urb->context; | 730 | mos7840_port = urb->context; |
731 | if (!mos7840_port) { | 731 | if (!mos7840_port) { |
732 | dbg("%s", "NULL mos7840_port pointer"); | 732 | dbg("%s", "NULL mos7840_port pointer"); |
733 | mos7840_port->read_urb_busy = false; | ||
734 | return; | 733 | return; |
735 | } | 734 | } |
736 | 735 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e280ad8e12f7..5cd30e4345c6 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -206,6 +206,7 @@ static void option_instat_callback(struct urb *urb); | |||
206 | #define AMOI_PRODUCT_H01 0x0800 | 206 | #define AMOI_PRODUCT_H01 0x0800 |
207 | #define AMOI_PRODUCT_H01A 0x7002 | 207 | #define AMOI_PRODUCT_H01A 0x7002 |
208 | #define AMOI_PRODUCT_H02 0x0802 | 208 | #define AMOI_PRODUCT_H02 0x0802 |
209 | #define AMOI_PRODUCT_SKYPEPHONE_S2 0x0407 | ||
209 | 210 | ||
210 | #define DELL_VENDOR_ID 0x413C | 211 | #define DELL_VENDOR_ID 0x413C |
211 | 212 | ||
@@ -302,6 +303,7 @@ static void option_instat_callback(struct urb *urb); | |||
302 | #define QISDA_PRODUCT_H21_4512 0x4512 | 303 | #define QISDA_PRODUCT_H21_4512 0x4512 |
303 | #define QISDA_PRODUCT_H21_4523 0x4523 | 304 | #define QISDA_PRODUCT_H21_4523 0x4523 |
304 | #define QISDA_PRODUCT_H20_4515 0x4515 | 305 | #define QISDA_PRODUCT_H20_4515 0x4515 |
306 | #define QISDA_PRODUCT_H20_4518 0x4518 | ||
305 | #define QISDA_PRODUCT_H20_4519 0x4519 | 307 | #define QISDA_PRODUCT_H20_4519 0x4519 |
306 | 308 | ||
307 | /* TLAYTECH PRODUCTS */ | 309 | /* TLAYTECH PRODUCTS */ |
@@ -516,6 +518,7 @@ static const struct usb_device_id option_ids[] = { | |||
516 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, | 518 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
517 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, | 519 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
518 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, | 520 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, |
521 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_SKYPEPHONE_S2) }, | ||
519 | 522 | ||
520 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ | 523 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ |
521 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 524 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
@@ -852,6 +855,7 @@ static const struct usb_device_id option_ids[] = { | |||
852 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, | 855 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, |
853 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, | 856 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, |
854 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, | 857 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, |
858 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4518) }, | ||
855 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, | 859 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, |
856 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, | 860 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, |
857 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ | 861 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 04bb759536bb..cde67cacb2c3 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -51,6 +51,8 @@ static const struct usb_device_id id_table[] = { | |||
51 | {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ | 51 | {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ |
52 | {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ | 52 | {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ |
53 | {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ | 53 | {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
54 | {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */ | ||
55 | {USB_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | ||
54 | {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ | 56 | {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ |
55 | {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | 57 | {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
56 | {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ | 58 | {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ |
@@ -139,6 +141,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
139 | "Could not set interface, error %d\n", | 141 | "Could not set interface, error %d\n", |
140 | retval); | 142 | retval); |
141 | retval = -ENODEV; | 143 | retval = -ENODEV; |
144 | kfree(data); | ||
142 | } | 145 | } |
143 | return retval; | 146 | return retval; |
144 | } | 147 | } |
@@ -155,6 +158,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
155 | "Could not set interface, error %d\n", | 158 | "Could not set interface, error %d\n", |
156 | retval); | 159 | retval); |
157 | retval = -ENODEV; | 160 | retval = -ENODEV; |
161 | kfree(data); | ||
158 | } | 162 | } |
159 | return retval; | 163 | return retval; |
160 | } | 164 | } |
@@ -163,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
163 | default: | 167 | default: |
164 | dev_err(&serial->dev->dev, | 168 | dev_err(&serial->dev->dev, |
165 | "unknown number of interfaces: %d\n", nintf); | 169 | "unknown number of interfaces: %d\n", nintf); |
170 | kfree(data); | ||
166 | return -ENODEV; | 171 | return -ENODEV; |
167 | } | 172 | } |
168 | 173 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ef0bdb08d788..d47b56e9e8ce 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -245,6 +245,7 @@ static const struct usb_device_id id_table[] = { | |||
245 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 245 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
246 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | 246 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ |
247 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ | 247 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ |
248 | { USB_DEVICE(0x1199, 0x0301) }, /* Sierra Wireless USB Dongle 250U */ | ||
248 | /* Sierra Wireless C597 */ | 249 | /* Sierra Wireless C597 */ |
249 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, |
250 | /* Sierra Wireless T598 */ | 251 | /* Sierra Wireless T598 */ |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 44716427c51c..64ec073e89de 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -139,9 +139,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
139 | 139 | ||
140 | /* fill the common fields in the URB */ | 140 | /* fill the common fields in the URB */ |
141 | us->current_urb->context = &urb_done; | 141 | us->current_urb->context = &urb_done; |
142 | us->current_urb->actual_length = 0; | 142 | us->current_urb->transfer_flags = 0; |
143 | us->current_urb->error_count = 0; | ||
144 | us->current_urb->status = 0; | ||
145 | 143 | ||
146 | /* we assume that if transfer_buffer isn't us->iobuf then it | 144 | /* we assume that if transfer_buffer isn't us->iobuf then it |
147 | * hasn't been mapped for DMA. Yes, this is clunky, but it's | 145 | * hasn't been mapped for DMA. Yes, this is clunky, but it's |