aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/atm/ueagle-atm.c8
-rw-r--r--drivers/usb/c67x00/c67x00-drv.c2
-rw-r--r--drivers/usb/c67x00/c67x00-hcd.h2
-rw-r--r--drivers/usb/c67x00/c67x00-sched.c2
-rw-r--r--drivers/usb/class/cdc-acm.c7
-rw-r--r--drivers/usb/class/cdc-acm.h2
-rw-r--r--drivers/usb/class/cdc-wdm.c2
-rw-r--r--drivers/usb/class/usbtmc.c2
-rw-r--r--drivers/usb/core/devices.c10
-rw-r--r--drivers/usb/core/devio.c2
-rw-r--r--drivers/usb/core/driver.c15
-rw-r--r--drivers/usb/core/hcd.c4
-rw-r--r--drivers/usb/core/hub.c14
-rw-r--r--drivers/usb/core/usb.c5
-rw-r--r--drivers/usb/core/usb.h3
-rw-r--r--drivers/usb/early/ehci-dbgp.c2
-rw-r--r--drivers/usb/gadget/amd5536udc.c14
-rw-r--r--drivers/usb/gadget/amd5536udc.h2
-rw-r--r--drivers/usb/gadget/at91_udc.c2
-rw-r--r--drivers/usb/gadget/composite.c6
-rw-r--r--drivers/usb/gadget/f_audio.c3
-rw-r--r--drivers/usb/gadget/f_eem.c8
-rw-r--r--drivers/usb/gadget/f_ncm.c2
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c20
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.h6
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c6
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.h4
-rw-r--r--drivers/usb/gadget/gmidi.c2
-rw-r--r--drivers/usb/gadget/inode.c4
-rw-r--r--drivers/usb/gadget/langwell_udc.c2
-rw-r--r--drivers/usb/gadget/mv_udc_core.c6
-rw-r--r--drivers/usb/gadget/net2280.c2
-rw-r--r--drivers/usb/gadget/nokia.c2
-rw-r--r--drivers/usb/gadget/pch_udc.c8
-rw-r--r--drivers/usb/gadget/printer.c2
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c76
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c12
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c2
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c18
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-omap.c20
-rw-r--r--drivers/usb/host/ehci-q.c27
-rw-r--r--drivers/usb/host/ehci.h2
-rw-r--r--drivers/usb/host/fhci-hcd.c2
-rw-r--r--drivers/usb/host/fhci-tds.c8
-rw-r--r--drivers/usb/host/fhci.h4
-rw-r--r--drivers/usb/host/imx21-hcd.c2
-rw-r--r--drivers/usb/host/isp116x.h2
-rw-r--r--drivers/usb/host/isp1362-hcd.c2
-rw-r--r--drivers/usb/host/isp1760-hcd.c3
-rw-r--r--drivers/usb/host/ohci-au1xxx.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-tmio.c8
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c6
-rw-r--r--drivers/usb/host/pci-quirks.c117
-rw-r--r--drivers/usb/host/whci/qset.c2
-rw-r--r--drivers/usb/host/xhci-hub.c19
-rw-r--r--drivers/usb/host/xhci-mem.c106
-rw-r--r--drivers/usb/host/xhci-pci.c4
-rw-r--r--drivers/usb/host/xhci-ring.c219
-rw-r--r--drivers/usb/host/xhci.c27
-rw-r--r--drivers/usb/host/xhci.h13
-rw-r--r--drivers/usb/image/microtek.c8
-rw-r--r--drivers/usb/misc/appledisplay.c1
-rw-r--r--drivers/usb/misc/iowarrior.c2
-rw-r--r--drivers/usb/misc/uss720.c7
-rw-r--r--drivers/usb/musb/Kconfig6
-rw-r--r--drivers/usb/musb/blackfin.c30
-rw-r--r--drivers/usb/musb/cppi_dma.c27
-rw-r--r--drivers/usb/musb/musb_core.c2
-rw-r--r--drivers/usb/musb/musb_core.h5
-rw-r--r--drivers/usb/musb/musb_gadget.c18
-rw-r--r--drivers/usb/musb/musbhsdma.c8
-rw-r--r--drivers/usb/musb/omap2430.c5
-rw-r--r--drivers/usb/musb/tusb6010.c2
-rw-r--r--drivers/usb/musb/ux500.c2
-rw-r--r--drivers/usb/otg/isp1301_omap.c2
-rw-r--r--drivers/usb/otg/langwell_otg.c4
-rw-r--r--drivers/usb/serial/aircable.c4
-rw-r--r--drivers/usb/serial/cp210x.c2
-rw-r--r--drivers/usb/serial/cypress_m8.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c7
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h12
-rw-r--r--drivers/usb/serial/io_edgeport.c2
-rw-r--r--drivers/usb/serial/io_edgeport.h2
-rw-r--r--drivers/usb/serial/io_ti.c2
-rw-r--r--drivers/usb/serial/mct_u232.c4
-rw-r--r--drivers/usb/serial/opticon.c4
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/qcserial.c31
-rw-r--r--drivers/usb/serial/usb_wwan.c3
-rw-r--r--drivers/usb/storage/ene_ub6250.c4
-rw-r--r--drivers/usb/storage/isd200.c2
-rw-r--r--drivers/usb/storage/scsiglue.c2
-rw-r--r--drivers/usb/storage/shuttle_usbat.c2
-rw-r--r--drivers/usb/wusbcore/crypto.c4
-rw-r--r--drivers/usb/wusbcore/reservation.c2
-rw-r--r--drivers/usb/wusbcore/rh.c2
-rw-r--r--drivers/usb/wusbcore/wa-rpipe.c2
-rw-r--r--drivers/usb/wusbcore/wa-xfer.c8
-rw-r--r--drivers/usb/wusbcore/wusbhc.h2
102 files changed, 679 insertions, 451 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 41b6e51188e4..006489d82dc3 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -66,6 +66,7 @@ config USB_ARCH_HAS_EHCI
66 default y if ARCH_VT8500 66 default y if ARCH_VT8500
67 default y if PLAT_SPEAR 67 default y if PLAT_SPEAR
68 default y if ARCH_MSM 68 default y if ARCH_MSM
69 default y if MICROBLAZE
69 default PCI 70 default PCI
70 71
71# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. 72# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index b268e9fccb47..e71521ce3010 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1283,7 +1283,7 @@ static void uea_set_bulk_timeout(struct uea_softc *sc, u32 dsrate)
1283 1283
1284 /* in bulk mode the modem have problem with high rate 1284 /* in bulk mode the modem have problem with high rate
1285 * changing internal timing could improve things, but the 1285 * changing internal timing could improve things, but the
1286 * value is misterious. 1286 * value is mysterious.
1287 * ADI930 don't support it (-EPIPE error). 1287 * ADI930 don't support it (-EPIPE error).
1288 */ 1288 */
1289 1289
@@ -1743,7 +1743,7 @@ static int uea_send_cmvs_e1(struct uea_softc *sc)
1743 goto out; 1743 goto out;
1744 } 1744 }
1745 } else { 1745 } else {
1746 /* This realy should not happen */ 1746 /* This really should not happen */
1747 uea_err(INS_TO_USBDEV(sc), "bad cmvs version %d\n", ver); 1747 uea_err(INS_TO_USBDEV(sc), "bad cmvs version %d\n", ver);
1748 goto out; 1748 goto out;
1749 } 1749 }
@@ -1798,7 +1798,7 @@ static int uea_send_cmvs_e4(struct uea_softc *sc)
1798 goto out; 1798 goto out;
1799 } 1799 }
1800 } else { 1800 } else {
1801 /* This realy should not happen */ 1801 /* This really should not happen */
1802 uea_err(INS_TO_USBDEV(sc), "bad cmvs version %d\n", ver); 1802 uea_err(INS_TO_USBDEV(sc), "bad cmvs version %d\n", ver);
1803 goto out; 1803 goto out;
1804 } 1804 }
@@ -1829,7 +1829,7 @@ static int uea_start_reset(struct uea_softc *sc)
1829 1829
1830 /* mask interrupt */ 1830 /* mask interrupt */
1831 sc->booting = 1; 1831 sc->booting = 1;
1832 /* We need to set this here because, a ack timeout could have occured, 1832 /* We need to set this here because, a ack timeout could have occurred,
1833 * but before we start the reboot, the ack occurs and set this to 1. 1833 * but before we start the reboot, the ack occurs and set this to 1.
1834 * So we will failed to wait Ready CMV. 1834 * So we will failed to wait Ready CMV.
1835 */ 1835 */
diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c
index b6d49234e521..62050f7a4f97 100644
--- a/drivers/usb/c67x00/c67x00-drv.c
+++ b/drivers/usb/c67x00/c67x00-drv.c
@@ -27,7 +27,7 @@
27 * the link between the common hardware parts and the subdrivers (e.g. 27 * the link between the common hardware parts and the subdrivers (e.g.
28 * interrupt handling). 28 * interrupt handling).
29 * 29 *
30 * The c67x00 has 2 SIE's (serial interface engine) wich can be configured 30 * The c67x00 has 2 SIE's (serial interface engine) which can be configured
31 * to be host, device or OTG (with some limitations, E.G. only SIE1 can be OTG). 31 * to be host, device or OTG (with some limitations, E.G. only SIE1 can be OTG).
32 * 32 *
33 * Depending on the platform configuration, the SIE's are created and 33 * Depending on the platform configuration, the SIE's are created and
diff --git a/drivers/usb/c67x00/c67x00-hcd.h b/drivers/usb/c67x00/c67x00-hcd.h
index 74e44621e313..e3d493d4d61a 100644
--- a/drivers/usb/c67x00/c67x00-hcd.h
+++ b/drivers/usb/c67x00/c67x00-hcd.h
@@ -34,7 +34,7 @@
34/* 34/*
35 * The following parameters depend on the CPU speed, bus speed, ... 35 * The following parameters depend on the CPU speed, bus speed, ...
36 * These can be tuned for specific use cases, e.g. if isochronous transfers 36 * These can be tuned for specific use cases, e.g. if isochronous transfers
37 * are very important, bandwith can be sacrificed to guarantee that the 37 * are very important, bandwidth can be sacrificed to guarantee that the
38 * 1ms deadline will be met. 38 * 1ms deadline will be met.
39 * If bulk transfers are important, the MAX_FRAME_BW can be increased, 39 * If bulk transfers are important, the MAX_FRAME_BW can be increased,
40 * but some (or many) isochronous deadlines might not be met. 40 * but some (or many) isochronous deadlines might not be met.
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c
index f6b3c253f3fa..a03fbc15fa9c 100644
--- a/drivers/usb/c67x00/c67x00-sched.c
+++ b/drivers/usb/c67x00/c67x00-sched.c
@@ -907,7 +907,7 @@ static inline int c67x00_end_of_data(struct c67x00_td *td)
907 907
908/* Remove all td's from the list which come 908/* Remove all td's from the list which come
909 * after last_td and are meant for the same pipe. 909 * after last_td and are meant for the same pipe.
910 * This is used when a short packet has occured */ 910 * This is used when a short packet has occurred */
911static inline void c67x00_clear_pipe(struct c67x00_hcd *c67x00, 911static inline void c67x00_clear_pipe(struct c67x00_hcd *c67x00,
912 struct c67x00_td *last_td) 912 struct c67x00_td *last_td)
913{ 913{
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index f492a7f2b6ee..e057e5381465 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -297,6 +297,8 @@ static void acm_ctrl_irq(struct urb *urb)
297 if (!ACM_READY(acm)) 297 if (!ACM_READY(acm))
298 goto exit; 298 goto exit;
299 299
300 usb_mark_last_busy(acm->dev);
301
300 data = (unsigned char *)(dr + 1); 302 data = (unsigned char *)(dr + 1);
301 switch (dr->bNotificationType) { 303 switch (dr->bNotificationType) {
302 case USB_CDC_NOTIFY_NETWORK_CONNECTION: 304 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
@@ -336,7 +338,6 @@ static void acm_ctrl_irq(struct urb *urb)
336 break; 338 break;
337 } 339 }
338exit: 340exit:
339 usb_mark_last_busy(acm->dev);
340 retval = usb_submit_urb(urb, GFP_ATOMIC); 341 retval = usb_submit_urb(urb, GFP_ATOMIC);
341 if (retval) 342 if (retval)
342 dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with " 343 dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with "
@@ -533,6 +534,8 @@ static void acm_softint(struct work_struct *work)
533 if (!ACM_READY(acm)) 534 if (!ACM_READY(acm))
534 return; 535 return;
535 tty = tty_port_tty_get(&acm->port); 536 tty = tty_port_tty_get(&acm->port);
537 if (!tty)
538 return;
536 tty_wakeup(tty); 539 tty_wakeup(tty);
537 tty_kref_put(tty); 540 tty_kref_put(tty);
538} 541}
@@ -646,8 +649,10 @@ static void acm_port_down(struct acm *acm)
646 usb_kill_urb(acm->ctrlurb); 649 usb_kill_urb(acm->ctrlurb);
647 for (i = 0; i < ACM_NW; i++) 650 for (i = 0; i < ACM_NW; i++)
648 usb_kill_urb(acm->wb[i].urb); 651 usb_kill_urb(acm->wb[i].urb);
652 tasklet_disable(&acm->urb_task);
649 for (i = 0; i < nr; i++) 653 for (i = 0; i < nr; i++)
650 usb_kill_urb(acm->ru[i].urb); 654 usb_kill_urb(acm->ru[i].urb);
655 tasklet_enable(&acm->urb_task);
651 acm->control->needs_remote_wakeup = 0; 656 acm->control->needs_remote_wakeup = 0;
652 usb_autopm_put_interface(acm->control); 657 usb_autopm_put_interface(acm->control);
653 } 658 }
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index 5eeb570b9a61..b4ea54dbf323 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54/* 54/*
55 * The only reason to have several buffers is to accomodate assumptions 55 * The only reason to have several buffers is to accommodate assumptions
56 * in line disciplines. They ask for empty space amount, receive our URB size, 56 * in line disciplines. They ask for empty space amount, receive our URB size,
57 * and proceed to issue several 1-character writes, assuming they will fit. 57 * and proceed to issue several 1-character writes, assuming they will fit.
58 * The very first write takes a complete URB. Fortunately, this only happens 58 * The very first write takes a complete URB. Fortunately, this only happens
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 47085e5879ab..a97c018dd419 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -281,7 +281,7 @@ static void cleanup(struct wdm_device *desc)
281 desc->sbuf, 281 desc->sbuf,
282 desc->validity->transfer_dma); 282 desc->validity->transfer_dma);
283 usb_free_coherent(interface_to_usbdev(desc->intf), 283 usb_free_coherent(interface_to_usbdev(desc->intf),
284 desc->wMaxCommand, 284 desc->bMaxPacketSize0,
285 desc->inbuf, 285 desc->inbuf,
286 desc->response->transfer_dma); 286 desc->response->transfer_dma);
287 kfree(desc->orq); 287 kfree(desc->orq);
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6a54634ab823..385acb895ab3 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -483,7 +483,7 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
483 } 483 }
484 484
485 done += n_characters; 485 done += n_characters;
486 /* Terminate if end-of-message bit recieved from device */ 486 /* Terminate if end-of-message bit received from device */
487 if ((buffer[8] & 0x01) && (actual >= n_characters + 12)) 487 if ((buffer[8] & 0x01) && (actual >= n_characters + 12))
488 remaining = 0; 488 remaining = 0;
489 else 489 else
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index a3d2e2399655..96fdfb815f89 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -221,7 +221,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
221 break; 221 break;
222 case USB_ENDPOINT_XFER_INT: 222 case USB_ENDPOINT_XFER_INT:
223 type = "Int."; 223 type = "Int.";
224 if (speed == USB_SPEED_HIGH) 224 if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER)
225 interval = 1 << (desc->bInterval - 1); 225 interval = 1 << (desc->bInterval - 1);
226 else 226 else
227 interval = desc->bInterval; 227 interval = desc->bInterval;
@@ -229,7 +229,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
229 default: /* "can't happen" */ 229 default: /* "can't happen" */
230 return start; 230 return start;
231 } 231 }
232 interval *= (speed == USB_SPEED_HIGH) ? 125 : 1000; 232 interval *= (speed == USB_SPEED_HIGH ||
233 speed == USB_SPEED_SUPER) ? 125 : 1000;
233 if (interval % 1000) 234 if (interval % 1000)
234 unit = 'u'; 235 unit = 'u';
235 else { 236 else {
@@ -542,8 +543,9 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
542 if (level == 0) { 543 if (level == 0) {
543 int max; 544 int max;
544 545
545 /* high speed reserves 80%, full/low reserves 90% */ 546 /* super/high speed reserves 80%, full/low reserves 90% */
546 if (usbdev->speed == USB_SPEED_HIGH) 547 if (usbdev->speed == USB_SPEED_HIGH ||
548 usbdev->speed == USB_SPEED_SUPER)
547 max = 800; 549 max = 800;
548 else 550 else
549 max = FRAME_TIME_MAX_USECS_ALLOC; 551 max = FRAME_TIME_MAX_USECS_ALLOC;
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index a7131ad630f9..37518dfdeb98 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -802,7 +802,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
802 tbuf, ctrl.wLength, tmo); 802 tbuf, ctrl.wLength, tmo);
803 usb_lock_device(dev); 803 usb_lock_device(dev);
804 snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, 804 snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE,
805 tbuf, i); 805 tbuf, max(i, 0));
806 if ((i > 0) && ctrl.wLength) { 806 if ((i > 0) && ctrl.wLength) {
807 if (copy_to_user(ctrl.data, tbuf, i)) { 807 if (copy_to_user(ctrl.data, tbuf, i)) {
808 free_page((unsigned long)tbuf); 808 free_page((unsigned long)tbuf);
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 38072e4e74bd..e35a17687c05 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1646,7 +1646,7 @@ static int autosuspend_check(struct usb_device *udev)
1646 return 0; 1646 return 0;
1647} 1647}
1648 1648
1649static int usb_runtime_suspend(struct device *dev) 1649int usb_runtime_suspend(struct device *dev)
1650{ 1650{
1651 struct usb_device *udev = to_usb_device(dev); 1651 struct usb_device *udev = to_usb_device(dev);
1652 int status; 1652 int status;
@@ -1667,7 +1667,7 @@ static int usb_runtime_suspend(struct device *dev)
1667 return status; 1667 return status;
1668} 1668}
1669 1669
1670static int usb_runtime_resume(struct device *dev) 1670int usb_runtime_resume(struct device *dev)
1671{ 1671{
1672 struct usb_device *udev = to_usb_device(dev); 1672 struct usb_device *udev = to_usb_device(dev);
1673 int status; 1673 int status;
@@ -1679,7 +1679,7 @@ static int usb_runtime_resume(struct device *dev)
1679 return status; 1679 return status;
1680} 1680}
1681 1681
1682static int usb_runtime_idle(struct device *dev) 1682int usb_runtime_idle(struct device *dev)
1683{ 1683{
1684 struct usb_device *udev = to_usb_device(dev); 1684 struct usb_device *udev = to_usb_device(dev);
1685 1685
@@ -1691,19 +1691,10 @@ static int usb_runtime_idle(struct device *dev)
1691 return 0; 1691 return 0;
1692} 1692}
1693 1693
1694static const struct dev_pm_ops usb_bus_pm_ops = {
1695 .runtime_suspend = usb_runtime_suspend,
1696 .runtime_resume = usb_runtime_resume,
1697 .runtime_idle = usb_runtime_idle,
1698};
1699
1700#endif /* CONFIG_USB_SUSPEND */ 1694#endif /* CONFIG_USB_SUSPEND */
1701 1695
1702struct bus_type usb_bus_type = { 1696struct bus_type usb_bus_type = {
1703 .name = "usb", 1697 .name = "usb",
1704 .match = usb_device_match, 1698 .match = usb_device_match,
1705 .uevent = usb_uevent, 1699 .uevent = usb_uevent,
1706#ifdef CONFIG_USB_SUSPEND
1707 .pm = &usb_bus_pm_ops,
1708#endif
1709}; 1700};
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 02b4dbfa488a..77a7faec8d78 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -700,7 +700,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd)
700 /* The USB 2.0 spec says 256 ms. This is close enough and won't 700 /* The USB 2.0 spec says 256 ms. This is close enough and won't
701 * exceed that limit if HZ is 100. The math is more clunky than 701 * exceed that limit if HZ is 100. The math is more clunky than
702 * maybe expected, this is to make sure that all timers for USB devices 702 * maybe expected, this is to make sure that all timers for USB devices
703 * fire at the same time to give the CPU a break inbetween */ 703 * fire at the same time to give the CPU a break in between */
704 if (hcd->uses_new_polling ? HCD_POLL_RH(hcd) : 704 if (hcd->uses_new_polling ? HCD_POLL_RH(hcd) :
705 (length == 0 && hcd->status_urb != NULL)) 705 (length == 0 && hcd->status_urb != NULL))
706 mod_timer (&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4)); 706 mod_timer (&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4));
@@ -1908,7 +1908,7 @@ void usb_free_streams(struct usb_interface *interface,
1908 1908
1909 /* Streams only apply to bulk endpoints. */ 1909 /* Streams only apply to bulk endpoints. */
1910 for (i = 0; i < num_eps; i++) 1910 for (i = 0; i < num_eps; i++)
1911 if (!usb_endpoint_xfer_bulk(&eps[i]->desc)) 1911 if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc))
1912 return; 1912 return;
1913 1913
1914 hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); 1914 hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 564eaa5525d7..93720bdc9efd 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1649,7 +1649,7 @@ void usb_disconnect(struct usb_device **pdev)
1649 1649
1650 /* mark the device as inactive, so any further urb submissions for 1650 /* mark the device as inactive, so any further urb submissions for
1651 * this device (and any of its children) will fail immediately. 1651 * this device (and any of its children) will fail immediately.
1652 * this quiesces everyting except pending urbs. 1652 * this quiesces everything except pending urbs.
1653 */ 1653 */
1654 usb_set_device_state(udev, USB_STATE_NOTATTACHED); 1654 usb_set_device_state(udev, USB_STATE_NOTATTACHED);
1655 dev_info(&udev->dev, "USB disconnect, device number %d\n", 1655 dev_info(&udev->dev, "USB disconnect, device number %d\n",
@@ -2285,7 +2285,17 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2285 } 2285 }
2286 2286
2287 /* see 7.1.7.6 */ 2287 /* see 7.1.7.6 */
2288 status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); 2288 /* Clear PORT_POWER if it's a USB3.0 device connected to USB 3.0
2289 * external hub.
2290 * FIXME: this is a temporary workaround to make the system able
2291 * to suspend/resume.
2292 */
2293 if ((hub->hdev->parent != NULL) && hub_is_superspeed(hub->hdev))
2294 status = clear_port_feature(hub->hdev, port1,
2295 USB_PORT_FEAT_POWER);
2296 else
2297 status = set_port_feature(hub->hdev, port1,
2298 USB_PORT_FEAT_SUSPEND);
2289 if (status) { 2299 if (status) {
2290 dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", 2300 dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n",
2291 port1, status); 2301 port1, status);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 079cb57bab4f..d9d4b169404f 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -315,6 +315,11 @@ static const struct dev_pm_ops usb_device_pm_ops = {
315 .thaw = usb_dev_thaw, 315 .thaw = usb_dev_thaw,
316 .poweroff = usb_dev_poweroff, 316 .poweroff = usb_dev_poweroff,
317 .restore = usb_dev_restore, 317 .restore = usb_dev_restore,
318#ifdef CONFIG_USB_SUSPEND
319 .runtime_suspend = usb_runtime_suspend,
320 .runtime_resume = usb_runtime_resume,
321 .runtime_idle = usb_runtime_idle,
322#endif
318}; 323};
319 324
320#endif /* CONFIG_PM */ 325#endif /* CONFIG_PM */
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index a9cf484ecae4..d450b742137e 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -77,6 +77,9 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)
77extern void usb_autosuspend_device(struct usb_device *udev); 77extern void usb_autosuspend_device(struct usb_device *udev);
78extern int usb_autoresume_device(struct usb_device *udev); 78extern int usb_autoresume_device(struct usb_device *udev);
79extern int usb_remote_wakeup(struct usb_device *dev); 79extern int usb_remote_wakeup(struct usb_device *dev);
80extern int usb_runtime_suspend(struct device *dev);
81extern int usb_runtime_resume(struct device *dev);
82extern int usb_runtime_idle(struct device *dev);
80 83
81#else 84#else
82 85
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 0bc06e2bcfcb..a6a350f5827b 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -648,7 +648,7 @@ static int ehci_reset_port(int port)
648 if (!(portsc & PORT_CONNECT)) 648 if (!(portsc & PORT_CONNECT))
649 return -ENOTCONN; 649 return -ENOTCONN;
650 650
651 /* bomb out completely if something weird happend */ 651 /* bomb out completely if something weird happened */
652 if ((portsc & PORT_CSC)) 652 if ((portsc & PORT_CSC))
653 return -EINVAL; 653 return -EINVAL;
654 654
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index f8dd7269d79c..6e42aab75806 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -278,7 +278,7 @@ static int udc_enable_dev_setup_interrupts(struct udc *dev)
278 return 0; 278 return 0;
279} 279}
280 280
281/* Calculates fifo start of endpoint based on preceeding endpoints */ 281/* Calculates fifo start of endpoint based on preceding endpoints */
282static int udc_set_txfifo_addr(struct udc_ep *ep) 282static int udc_set_txfifo_addr(struct udc_ep *ep)
283{ 283{
284 struct udc *dev; 284 struct udc *dev;
@@ -2137,7 +2137,7 @@ static irqreturn_t udc_data_out_isr(struct udc *dev, int ep_ix)
2137 if (use_dma) { 2137 if (use_dma) {
2138 /* BNA event ? */ 2138 /* BNA event ? */
2139 if (tmp & AMD_BIT(UDC_EPSTS_BNA)) { 2139 if (tmp & AMD_BIT(UDC_EPSTS_BNA)) {
2140 DBG(dev, "BNA ep%dout occured - DESPTR = %x \n", 2140 DBG(dev, "BNA ep%dout occurred - DESPTR = %x \n",
2141 ep->num, readl(&ep->regs->desptr)); 2141 ep->num, readl(&ep->regs->desptr));
2142 /* clear BNA */ 2142 /* clear BNA */
2143 writel(tmp | AMD_BIT(UDC_EPSTS_BNA), &ep->regs->sts); 2143 writel(tmp | AMD_BIT(UDC_EPSTS_BNA), &ep->regs->sts);
@@ -2151,7 +2151,7 @@ static irqreturn_t udc_data_out_isr(struct udc *dev, int ep_ix)
2151 } 2151 }
2152 /* HE event ? */ 2152 /* HE event ? */
2153 if (tmp & AMD_BIT(UDC_EPSTS_HE)) { 2153 if (tmp & AMD_BIT(UDC_EPSTS_HE)) {
2154 dev_err(&dev->pdev->dev, "HE ep%dout occured\n", ep->num); 2154 dev_err(&dev->pdev->dev, "HE ep%dout occurred\n", ep->num);
2155 2155
2156 /* clear HE */ 2156 /* clear HE */
2157 writel(tmp | AMD_BIT(UDC_EPSTS_HE), &ep->regs->sts); 2157 writel(tmp | AMD_BIT(UDC_EPSTS_HE), &ep->regs->sts);
@@ -2354,7 +2354,7 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
2354 /* BNA ? */ 2354 /* BNA ? */
2355 if (epsts & AMD_BIT(UDC_EPSTS_BNA)) { 2355 if (epsts & AMD_BIT(UDC_EPSTS_BNA)) {
2356 dev_err(&dev->pdev->dev, 2356 dev_err(&dev->pdev->dev,
2357 "BNA ep%din occured - DESPTR = %08lx \n", 2357 "BNA ep%din occurred - DESPTR = %08lx \n",
2358 ep->num, 2358 ep->num,
2359 (unsigned long) readl(&ep->regs->desptr)); 2359 (unsigned long) readl(&ep->regs->desptr));
2360 2360
@@ -2367,7 +2367,7 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
2367 /* HE event ? */ 2367 /* HE event ? */
2368 if (epsts & AMD_BIT(UDC_EPSTS_HE)) { 2368 if (epsts & AMD_BIT(UDC_EPSTS_HE)) {
2369 dev_err(&dev->pdev->dev, 2369 dev_err(&dev->pdev->dev,
2370 "HE ep%dn occured - DESPTR = %08lx \n", 2370 "HE ep%dn occurred - DESPTR = %08lx \n",
2371 ep->num, (unsigned long) readl(&ep->regs->desptr)); 2371 ep->num, (unsigned long) readl(&ep->regs->desptr));
2372 2372
2373 /* clear HE */ 2373 /* clear HE */
@@ -2384,7 +2384,7 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
2384 req = list_entry(ep->queue.next, 2384 req = list_entry(ep->queue.next,
2385 struct udc_request, queue); 2385 struct udc_request, queue);
2386 /* 2386 /*
2387 * length bytes transfered 2387 * length bytes transferred
2388 * check dma done of last desc. in PPBDU mode 2388 * check dma done of last desc. in PPBDU mode
2389 */ 2389 */
2390 if (use_dma_ppb_du) { 2390 if (use_dma_ppb_du) {
@@ -2784,7 +2784,7 @@ static irqreturn_t udc_control_in_isr(struct udc *dev)
2784 /* write fifo */ 2784 /* write fifo */
2785 udc_txfifo_write(ep, &req->req); 2785 udc_txfifo_write(ep, &req->req);
2786 2786
2787 /* lengh bytes transfered */ 2787 /* lengh bytes transferred */
2788 len = req->req.length - req->req.actual; 2788 len = req->req.length - req->req.actual;
2789 if (len > ep->ep.maxpacket) 2789 if (len > ep->ep.maxpacket)
2790 len = ep->ep.maxpacket; 2790 len = ep->ep.maxpacket;
diff --git a/drivers/usb/gadget/amd5536udc.h b/drivers/usb/gadget/amd5536udc.h
index 4bbabbbfc93f..1d1c7543468e 100644
--- a/drivers/usb/gadget/amd5536udc.h
+++ b/drivers/usb/gadget/amd5536udc.h
@@ -584,7 +584,7 @@ union udc_setup_data {
584 * SET and GET bitfields in u32 values 584 * SET and GET bitfields in u32 values
585 * via constants for mask/offset: 585 * via constants for mask/offset:
586 * <bit_field_stub_name> is the text between 586 * <bit_field_stub_name> is the text between
587 * UDC_ and _MASK|_OFS of appropiate 587 * UDC_ and _MASK|_OFS of appropriate
588 * constant 588 * constant
589 * 589 *
590 * set bitfield value in u32 u32Val 590 * set bitfield value in u32 u32Val
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index bb8ddf0469f9..9b7cdb16f26b 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -826,7 +826,7 @@ done:
826 return status; 826 return status;
827} 827}
828 828
829/* reinit == restore inital software state */ 829/* reinit == restore initial software state */
830static void udc_reinit(struct at91_udc *udc) 830static void udc_reinit(struct at91_udc *udc)
831{ 831{
832 u32 i; 832 u32 i;
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index c2251c40a205..82314ed22506 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -42,7 +42,7 @@
42static struct usb_composite_driver *composite; 42static struct usb_composite_driver *composite;
43static int (*composite_gadget_bind)(struct usb_composite_dev *cdev); 43static int (*composite_gadget_bind)(struct usb_composite_dev *cdev);
44 44
45/* Some systems will need runtime overrides for the product identifers 45/* Some systems will need runtime overrides for the product identifiers
46 * published in the device descriptor, either numbers or strings or both. 46 * published in the device descriptor, either numbers or strings or both.
47 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). 47 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
48 */ 48 */
@@ -205,14 +205,14 @@ int usb_function_activate(struct usb_function *function)
205 * usb_interface_id() is called from usb_function.bind() callbacks to 205 * usb_interface_id() is called from usb_function.bind() callbacks to
206 * allocate new interface IDs. The function driver will then store that 206 * allocate new interface IDs. The function driver will then store that
207 * ID in interface, association, CDC union, and other descriptors. It 207 * ID in interface, association, CDC union, and other descriptors. It
208 * will also handle any control requests targetted at that interface, 208 * will also handle any control requests targeted at that interface,
209 * particularly changing its altsetting via set_alt(). There may 209 * particularly changing its altsetting via set_alt(). There may
210 * also be class-specific or vendor-specific requests to handle. 210 * also be class-specific or vendor-specific requests to handle.
211 * 211 *
212 * All interface identifier should be allocated using this routine, to 212 * All interface identifier should be allocated using this routine, to
213 * ensure that for example different functions don't wrongly assign 213 * ensure that for example different functions don't wrongly assign
214 * different meanings to the same identifier. Note that since interface 214 * different meanings to the same identifier. Note that since interface
215 * identifers are configuration-specific, functions used in more than 215 * identifiers are configuration-specific, functions used in more than
216 * one configuration (or more than once in a given configuration) need 216 * one configuration (or more than once in a given configuration) need
217 * multiple versions of the relevant descriptors. 217 * multiple versions of the relevant descriptors.
218 * 218 *
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index 00975ed903d1..0111f8a9cf7f 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -706,6 +706,7 @@ f_audio_unbind(struct usb_configuration *c, struct usb_function *f)
706 struct f_audio *audio = func_to_audio(f); 706 struct f_audio *audio = func_to_audio(f);
707 707
708 usb_free_descriptors(f->descriptors); 708 usb_free_descriptors(f->descriptors);
709 usb_free_descriptors(f->hs_descriptors);
709 kfree(audio); 710 kfree(audio);
710} 711}
711 712
@@ -742,7 +743,7 @@ int __init control_selector_init(struct f_audio *audio)
742} 743}
743 744
744/** 745/**
745 * audio_bind_config - add USB audio fucntion to a configuration 746 * audio_bind_config - add USB audio function to a configuration
746 * @c: the configuration to supcard the USB audio function 747 * @c: the configuration to supcard the USB audio function
747 * Context: single threaded during gadget setup 748 * Context: single threaded during gadget setup
748 * 749 *
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c
index 95dd4662d6a8..b3c304290150 100644
--- a/drivers/usb/gadget/f_eem.c
+++ b/drivers/usb/gadget/f_eem.c
@@ -314,6 +314,9 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f)
314 314
315static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) 315static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req)
316{ 316{
317 struct sk_buff *skb = (struct sk_buff *)req->context;
318
319 dev_kfree_skb_any(skb);
317} 320}
318 321
319/* 322/*
@@ -428,10 +431,11 @@ static int eem_unwrap(struct gether *port,
428 skb_trim(skb2, len); 431 skb_trim(skb2, len);
429 put_unaligned_le16(BIT(15) | BIT(11) | len, 432 put_unaligned_le16(BIT(15) | BIT(11) | len,
430 skb_push(skb2, 2)); 433 skb_push(skb2, 2));
431 skb_copy_bits(skb, 0, req->buf, skb->len); 434 skb_copy_bits(skb2, 0, req->buf, skb2->len);
432 req->length = skb->len; 435 req->length = skb2->len;
433 req->complete = eem_cmd_complete; 436 req->complete = eem_cmd_complete;
434 req->zero = 1; 437 req->zero = 1;
438 req->context = skb2;
435 if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) 439 if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC))
436 DBG(cdev, "echo response queue fail\n"); 440 DBG(cdev, "echo response queue fail\n");
437 break; 441 break;
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c
index 130eee678c8b..86902a60bcdb 100644
--- a/drivers/usb/gadget/f_ncm.c
+++ b/drivers/usb/gadget/f_ncm.c
@@ -111,7 +111,7 @@ static inline unsigned ncm_bitrate(struct usb_gadget *g)
111#define NTB_OUT_SIZE 16384 111#define NTB_OUT_SIZE 16384
112 112
113/* 113/*
114 * skbs of size less than that will not be alligned 114 * skbs of size less than that will not be aligned
115 * to NCM's dwNtbInMaxSize to save bus bandwidth 115 * to NCM's dwNtbInMaxSize to save bus bandwidth
116 */ 116 */
117 117
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index aee7e3c53c38..36613b37c504 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -1148,6 +1148,12 @@ static int qe_ep_tx(struct qe_ep *ep, struct qe_frame *frame)
1148static int txcomplete(struct qe_ep *ep, unsigned char restart) 1148static int txcomplete(struct qe_ep *ep, unsigned char restart)
1149{ 1149{
1150 if (ep->tx_req != NULL) { 1150 if (ep->tx_req != NULL) {
1151 struct qe_req *req = ep->tx_req;
1152 unsigned zlp = 0, last_len = 0;
1153
1154 last_len = min_t(unsigned, req->req.length - ep->sent,
1155 ep->ep.maxpacket);
1156
1151 if (!restart) { 1157 if (!restart) {
1152 int asent = ep->last; 1158 int asent = ep->last;
1153 ep->sent += asent; 1159 ep->sent += asent;
@@ -1156,9 +1162,18 @@ static int txcomplete(struct qe_ep *ep, unsigned char restart)
1156 ep->last = 0; 1162 ep->last = 0;
1157 } 1163 }
1158 1164
1165 /* zlp needed when req->re.zero is set */
1166 if (req->req.zero) {
1167 if (last_len == 0 ||
1168 (req->req.length % ep->ep.maxpacket) != 0)
1169 zlp = 0;
1170 else
1171 zlp = 1;
1172 } else
1173 zlp = 0;
1174
1159 /* a request already were transmitted completely */ 1175 /* a request already were transmitted completely */
1160 if ((ep->tx_req->req.length - ep->sent) <= 0) { 1176 if (((ep->tx_req->req.length - ep->sent) <= 0) && !zlp) {
1161 ep->tx_req->req.actual = (unsigned int)ep->sent;
1162 done(ep, ep->tx_req, 0); 1177 done(ep, ep->tx_req, 0);
1163 ep->tx_req = NULL; 1178 ep->tx_req = NULL;
1164 ep->last = 0; 1179 ep->last = 0;
@@ -1191,6 +1206,7 @@ static int qe_usb_senddata(struct qe_ep *ep, struct qe_frame *frame)
1191 buf = (u8 *)ep->tx_req->req.buf + ep->sent; 1206 buf = (u8 *)ep->tx_req->req.buf + ep->sent;
1192 if (buf && size) { 1207 if (buf && size) {
1193 ep->last = size; 1208 ep->last = size;
1209 ep->tx_req->req.actual += size;
1194 frame_set_data(frame, buf); 1210 frame_set_data(frame, buf);
1195 frame_set_length(frame, size); 1211 frame_set_length(frame, size);
1196 frame_set_status(frame, FRAME_OK); 1212 frame_set_status(frame, FRAME_OK);
diff --git a/drivers/usb/gadget/fsl_qe_udc.h b/drivers/usb/gadget/fsl_qe_udc.h
index bea5b827bebe..e35e24fd64bb 100644
--- a/drivers/usb/gadget/fsl_qe_udc.h
+++ b/drivers/usb/gadget/fsl_qe_udc.h
@@ -208,14 +208,14 @@ struct qe_frame{
208/* Frame status field */ 208/* Frame status field */
209/* Receive side */ 209/* Receive side */
210#define FRAME_OK 0x00000000 /* Frame tranmitted or received OK */ 210#define FRAME_OK 0x00000000 /* Frame tranmitted or received OK */
211#define FRAME_ERROR 0x80000000 /* Error occured on frame */ 211#define FRAME_ERROR 0x80000000 /* Error occurred on frame */
212#define START_FRAME_LOST 0x40000000 /* START_FRAME_LOST */ 212#define START_FRAME_LOST 0x40000000 /* START_FRAME_LOST */
213#define END_FRAME_LOST 0x20000000 /* END_FRAME_LOST */ 213#define END_FRAME_LOST 0x20000000 /* END_FRAME_LOST */
214#define RX_ER_NONOCT 0x10000000 /* Rx Non Octet Aligned Packet */ 214#define RX_ER_NONOCT 0x10000000 /* Rx Non Octet Aligned Packet */
215#define RX_ER_BITSTUFF 0x08000000 /* Frame Aborted --Received packet 215#define RX_ER_BITSTUFF 0x08000000 /* Frame Aborted --Received packet
216 with bit stuff error */ 216 with bit stuff error */
217#define RX_ER_CRC 0x04000000 /* Received packet with CRC error */ 217#define RX_ER_CRC 0x04000000 /* Received packet with CRC error */
218#define RX_ER_OVERUN 0x02000000 /* Over-run occured on reception */ 218#define RX_ER_OVERUN 0x02000000 /* Over-run occurred on reception */
219#define RX_ER_PID 0x01000000 /* Wrong PID received */ 219#define RX_ER_PID 0x01000000 /* Wrong PID received */
220/* Tranmit side */ 220/* Tranmit side */
221#define TX_ER_NAK 0x00800000 /* Received NAK handshake */ 221#define TX_ER_NAK 0x00800000 /* Received NAK handshake */
@@ -379,7 +379,7 @@ struct qe_udc {
379#define T_LSP 0x01000000 /* Low-speed transaction */ 379#define T_LSP 0x01000000 /* Low-speed transaction */
380#define T_PID 0x00c00000 /* packet id */ 380#define T_PID 0x00c00000 /* packet id */
381#define T_NAK 0x00100000 /* No ack. */ 381#define T_NAK 0x00100000 /* No ack. */
382#define T_STAL 0x00080000 /* Stall recieved */ 382#define T_STAL 0x00080000 /* Stall received */
383#define T_TO 0x00040000 /* time out */ 383#define T_TO 0x00040000 /* time out */
384#define T_UN 0x00020000 /* underrun */ 384#define T_UN 0x00020000 /* underrun */
385 385
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 912cb8e63fe3..07499c1cdcc4 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -464,7 +464,7 @@ static int fsl_ep_enable(struct usb_ep *_ep,
464 464
465 max = le16_to_cpu(desc->wMaxPacketSize); 465 max = le16_to_cpu(desc->wMaxPacketSize);
466 466
467 /* Disable automatic zlp generation. Driver is reponsible to indicate 467 /* Disable automatic zlp generation. Driver is responsible to indicate
468 * explicitly through req->req.zero. This is needed to enable multi-td 468 * explicitly through req->req.zero. This is needed to enable multi-td
469 * request. */ 469 * request. */
470 zlt = 1; 470 zlt = 1;
@@ -648,7 +648,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
648 | EP_QUEUE_HEAD_STATUS_HALT)); 648 | EP_QUEUE_HEAD_STATUS_HALT));
649 dQH->size_ioc_int_sts &= temp; 649 dQH->size_ioc_int_sts &= temp;
650 650
651 /* Ensure that updates to the QH will occure before priming. */ 651 /* Ensure that updates to the QH will occur before priming. */
652 wmb(); 652 wmb();
653 653
654 /* Prime endpoint by writing 1 to ENDPTPRIME */ 654 /* Prime endpoint by writing 1 to ENDPTPRIME */
@@ -1459,7 +1459,7 @@ static int process_ep_req(struct fsl_udc *udc, int pipe,
1459 status = -EILSEQ; 1459 status = -EILSEQ;
1460 break; 1460 break;
1461 } else 1461 } else
1462 ERR("Unknown error has occured (0x%x)!\n", 1462 ERR("Unknown error has occurred (0x%x)!\n",
1463 errors); 1463 errors);
1464 1464
1465 } else if (le32_to_cpu(curr_td->size_ioc_sts) 1465 } else if (le32_to_cpu(curr_td->size_ioc_sts)
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h
index 20aeceed48c7..e88cce5c2c0d 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/fsl_usb2_udc.h
@@ -15,7 +15,7 @@ struct usb_dr_device {
15 u8 res1[256]; 15 u8 res1[256];
16 u16 caplength; /* Capability Register Length */ 16 u16 caplength; /* Capability Register Length */
17 u16 hciversion; /* Host Controller Interface Version */ 17 u16 hciversion; /* Host Controller Interface Version */
18 u32 hcsparams; /* Host Controller Structual Parameters */ 18 u32 hcsparams; /* Host Controller Structural Parameters */
19 u32 hccparams; /* Host Controller Capability Parameters */ 19 u32 hccparams; /* Host Controller Capability Parameters */
20 u8 res2[20]; 20 u8 res2[20];
21 u32 dciversion; /* Device Controller Interface Version */ 21 u32 dciversion; /* Device Controller Interface Version */
@@ -52,7 +52,7 @@ struct usb_dr_host {
52 u8 res1[256]; 52 u8 res1[256];
53 u16 caplength; /* Capability Register Length */ 53 u16 caplength; /* Capability Register Length */
54 u16 hciversion; /* Host Controller Interface Version */ 54 u16 hciversion; /* Host Controller Interface Version */
55 u32 hcsparams; /* Host Controller Structual Parameters */ 55 u32 hcsparams; /* Host Controller Structural Parameters */
56 u32 hccparams; /* Host Controller Capability Parameters */ 56 u32 hccparams; /* Host Controller Capability Parameters */
57 u8 res2[20]; 57 u8 res2[20];
58 u32 dciversion; /* Device Controller Interface Version */ 58 u32 dciversion; /* Device Controller Interface Version */
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index 0ab7e141d494..47b86b99d449 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(index, "Index value for the USB MIDI Gadget adapter.");
67module_param(id, charp, 0444); 67module_param(id, charp, 0444);
68MODULE_PARM_DESC(id, "ID string for the USB MIDI Gadget adapter."); 68MODULE_PARM_DESC(id, "ID string for the USB MIDI Gadget adapter.");
69 69
70/* Some systems will want different product identifers published in the 70/* Some systems will want different product identifiers published in the
71 * device descriptor, either numbers or strings or both. These string 71 * device descriptor, either numbers or strings or both. These string
72 * parameters are in UTF-8 (superset of ASCII's 7 bit characters). 72 * parameters are in UTF-8 (superset of ASCII's 7 bit characters).
73 */ 73 */
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 3ed73f49cf18..a01383f71f38 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -386,8 +386,10 @@ ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
386 386
387 /* halt any endpoint by doing a "wrong direction" i/o call */ 387 /* halt any endpoint by doing a "wrong direction" i/o call */
388 if (usb_endpoint_dir_in(&data->desc)) { 388 if (usb_endpoint_dir_in(&data->desc)) {
389 if (usb_endpoint_xfer_isoc(&data->desc)) 389 if (usb_endpoint_xfer_isoc(&data->desc)) {
390 mutex_unlock(&data->lock);
390 return -EINVAL; 391 return -EINVAL;
392 }
391 DBG (data->dev, "%s halt\n", data->name); 393 DBG (data->dev, "%s halt\n", data->name);
392 spin_lock_irq (&data->dev->lock); 394 spin_lock_irq (&data->dev->lock);
393 if (likely (data->ep != NULL)) 395 if (likely (data->ep != NULL))
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 1eca8b47ce3c..9cee88a43a73 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -642,7 +642,7 @@ static int queue_dtd(struct langwell_ep *ep, struct langwell_request *req)
642 dqh->dtd_status &= dtd_status; 642 dqh->dtd_status &= dtd_status;
643 dev_vdbg(&dev->pdev->dev, "dqh->dtd_status = 0x%x\n", dqh->dtd_status); 643 dev_vdbg(&dev->pdev->dev, "dqh->dtd_status = 0x%x\n", dqh->dtd_status);
644 644
645 /* ensure that updates to the dQH will occure before priming */ 645 /* ensure that updates to the dQH will occur before priming */
646 wmb(); 646 wmb();
647 647
648 /* write 1 to endptprime register to PRIME endpoint */ 648 /* write 1 to endptprime register to PRIME endpoint */
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index d5468a7f38e0..b62b2640deb0 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -325,7 +325,7 @@ static int queue_dtd(struct mv_ep *ep, struct mv_req *req)
325 325
326 /* 326 /*
327 * Ensure that updates to the QH will 327 * Ensure that updates to the QH will
328 * occure before priming. 328 * occur before priming.
329 */ 329 */
330 wmb(); 330 wmb();
331 331
@@ -338,7 +338,7 @@ static int queue_dtd(struct mv_ep *ep, struct mv_req *req)
338 & EP_QUEUE_HEAD_NEXT_POINTER_MASK;; 338 & EP_QUEUE_HEAD_NEXT_POINTER_MASK;;
339 dqh->size_ioc_int_sts = 0; 339 dqh->size_ioc_int_sts = 0;
340 340
341 /* Ensure that updates to the QH will occure before priming. */ 341 /* Ensure that updates to the QH will occur before priming. */
342 wmb(); 342 wmb();
343 343
344 /* Prime the Endpoint */ 344 /* Prime the Endpoint */
@@ -1845,7 +1845,7 @@ static irqreturn_t mv_udc_irq(int irq, void *dev)
1845 return IRQ_NONE; 1845 return IRQ_NONE;
1846 } 1846 }
1847 1847
1848 /* Clear all the interrupts occured */ 1848 /* Clear all the interrupts occurred */
1849 writel(status, &udc->op_regs->usbsts); 1849 writel(status, &udc->op_regs->usbsts);
1850 1850
1851 if (status & USBSTS_ERR) 1851 if (status & USBSTS_ERR)
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index d09155b25d73..24696f7fa6a9 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -117,7 +117,7 @@ module_param (fifo_mode, ushort, 0644);
117 117
118/* enable_suspend -- When enabled, the driver will respond to 118/* enable_suspend -- When enabled, the driver will respond to
119 * USB suspend requests by powering down the NET2280. Otherwise, 119 * USB suspend requests by powering down the NET2280. Otherwise,
120 * USB suspend requests will be ignored. This is acceptible for 120 * USB suspend requests will be ignored. This is acceptable for
121 * self-powered devices 121 * self-powered devices
122 */ 122 */
123static int enable_suspend = 0; 123static int enable_suspend = 0;
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index b5364f9d7cd2..55ca63ad3506 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -203,7 +203,7 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
203 goto err_usb; 203 goto err_usb;
204 } 204 }
205 205
206 /* finaly register the configuration */ 206 /* finally register the configuration */
207 status = usb_add_config(cdev, &nokia_config_500ma_driver, 207 status = usb_add_config(cdev, &nokia_config_500ma_driver,
208 nokia_bind_config); 208 nokia_bind_config);
209 if (status < 0) 209 if (status < 0)
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 3e4b35e50c24..68dbcc3e4cc2 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -1608,7 +1608,7 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
1608 return -EINVAL; 1608 return -EINVAL;
1609 if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) 1609 if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN))
1610 return -ESHUTDOWN; 1610 return -ESHUTDOWN;
1611 spin_lock_irqsave(&ep->dev->lock, iflags); 1611 spin_lock_irqsave(&dev->lock, iflags);
1612 /* map the buffer for dma */ 1612 /* map the buffer for dma */
1613 if (usbreq->length && 1613 if (usbreq->length &&
1614 ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { 1614 ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) {
@@ -1625,8 +1625,10 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
1625 DMA_FROM_DEVICE); 1625 DMA_FROM_DEVICE);
1626 } else { 1626 } else {
1627 req->buf = kzalloc(usbreq->length, GFP_ATOMIC); 1627 req->buf = kzalloc(usbreq->length, GFP_ATOMIC);
1628 if (!req->buf) 1628 if (!req->buf) {
1629 return -ENOMEM; 1629 retval = -ENOMEM;
1630 goto probe_end;
1631 }
1630 if (ep->in) { 1632 if (ep->in) {
1631 memcpy(req->buf, usbreq->buf, usbreq->length); 1633 memcpy(req->buf, usbreq->buf, usbreq->length);
1632 req->dma = dma_map_single(&dev->pdev->dev, 1634 req->dma = dma_map_single(&dev->pdev->dev,
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 12ff6cffedc9..c3f2bd42bd5a 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -126,7 +126,7 @@ static struct printer_dev usb_printer_gadget;
126#define PRINTER_VENDOR_NUM 0x0525 /* NetChip */ 126#define PRINTER_VENDOR_NUM 0x0525 /* NetChip */
127#define PRINTER_PRODUCT_NUM 0xa4a8 /* Linux-USB Printer Gadget */ 127#define PRINTER_PRODUCT_NUM 0xa4a8 /* Linux-USB Printer Gadget */
128 128
129/* Some systems will want different product identifers published in the 129/* Some systems will want different product identifiers published in the
130 * device descriptor, either numbers or strings or both. These string 130 * device descriptor, either numbers or strings or both. These string
131 * parameters are in UTF-8 (superset of ASCII's 7 bit characters). 131 * parameters are in UTF-8 (superset of ASCII's 7 bit characters).
132 */ 132 */
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index b37f92cb71bc..444b60aa15e9 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -139,24 +139,6 @@ static const char ep0name [] = "ep0";
139static void pxa25x_ep_fifo_flush (struct usb_ep *ep); 139static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
140static void nuke (struct pxa25x_ep *, int status); 140static void nuke (struct pxa25x_ep *, int status);
141 141
142/* one GPIO should be used to detect VBUS from the host */
143static int is_vbus_present(void)
144{
145 struct pxa2xx_udc_mach_info *mach = the_controller->mach;
146
147 if (gpio_is_valid(mach->gpio_vbus)) {
148 int value = gpio_get_value(mach->gpio_vbus);
149
150 if (mach->gpio_vbus_inverted)
151 return !value;
152 else
153 return !!value;
154 }
155 if (mach->udc_is_connected)
156 return mach->udc_is_connected();
157 return 1;
158}
159
160/* one GPIO should control a D+ pullup, so host sees this device (or not) */ 142/* one GPIO should control a D+ pullup, so host sees this device (or not) */
161static void pullup_off(void) 143static void pullup_off(void)
162{ 144{
@@ -1055,7 +1037,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1055 "%s version: %s\nGadget driver: %s\nHost %s\n\n", 1037 "%s version: %s\nGadget driver: %s\nHost %s\n\n",
1056 driver_name, DRIVER_VERSION SIZE_STR "(pio)", 1038 driver_name, DRIVER_VERSION SIZE_STR "(pio)",
1057 dev->driver ? dev->driver->driver.name : "(none)", 1039 dev->driver ? dev->driver->driver.name : "(none)",
1058 is_vbus_present() ? "full speed" : "disconnected"); 1040 dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected");
1059 1041
1060 /* registers for device and ep0 */ 1042 /* registers for device and ep0 */
1061 seq_printf(m, 1043 seq_printf(m,
@@ -1094,7 +1076,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1094 (tmp & UDCCFR_ACM) ? " acm" : ""); 1076 (tmp & UDCCFR_ACM) ? " acm" : "");
1095 } 1077 }
1096 1078
1097 if (!is_vbus_present() || !dev->driver) 1079 if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver)
1098 goto done; 1080 goto done;
1099 1081
1100 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", 1082 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",
@@ -1435,14 +1417,6 @@ lubbock_vbus_irq(int irq, void *_dev)
1435 1417
1436#endif 1418#endif
1437 1419
1438static irqreturn_t udc_vbus_irq(int irq, void *_dev)
1439{
1440 struct pxa25x_udc *dev = _dev;
1441
1442 pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present());
1443 return IRQ_HANDLED;
1444}
1445
1446 1420
1447/*-------------------------------------------------------------------------*/ 1421/*-------------------------------------------------------------------------*/
1448 1422
@@ -1766,12 +1740,9 @@ pxa25x_udc_irq(int irq, void *_dev)
1766 if (unlikely(udccr & UDCCR_SUSIR)) { 1740 if (unlikely(udccr & UDCCR_SUSIR)) {
1767 udc_ack_int_UDCCR(UDCCR_SUSIR); 1741 udc_ack_int_UDCCR(UDCCR_SUSIR);
1768 handled = 1; 1742 handled = 1;
1769 DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present() 1743 DBG(DBG_VERBOSE, "USB suspend\n");
1770 ? "" : "+disconnect");
1771 1744
1772 if (!is_vbus_present()) 1745 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1773 stop_activity(dev, dev->driver);
1774 else if (dev->gadget.speed != USB_SPEED_UNKNOWN
1775 && dev->driver 1746 && dev->driver
1776 && dev->driver->suspend) 1747 && dev->driver->suspend)
1777 dev->driver->suspend(&dev->gadget); 1748 dev->driver->suspend(&dev->gadget);
@@ -1786,8 +1757,7 @@ pxa25x_udc_irq(int irq, void *_dev)
1786 1757
1787 if (dev->gadget.speed != USB_SPEED_UNKNOWN 1758 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1788 && dev->driver 1759 && dev->driver
1789 && dev->driver->resume 1760 && dev->driver->resume)
1790 && is_vbus_present())
1791 dev->driver->resume(&dev->gadget); 1761 dev->driver->resume(&dev->gadget);
1792 } 1762 }
1793 1763
@@ -2137,7 +2107,7 @@ static struct pxa25x_udc memory = {
2137static int __init pxa25x_udc_probe(struct platform_device *pdev) 2107static int __init pxa25x_udc_probe(struct platform_device *pdev)
2138{ 2108{
2139 struct pxa25x_udc *dev = &memory; 2109 struct pxa25x_udc *dev = &memory;
2140 int retval, vbus_irq, irq; 2110 int retval, irq;
2141 u32 chiprev; 2111 u32 chiprev;
2142 2112
2143 /* insist on Intel/ARM/XScale */ 2113 /* insist on Intel/ARM/XScale */
@@ -2199,19 +2169,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2199 2169
2200 dev->transceiver = otg_get_transceiver(); 2170 dev->transceiver = otg_get_transceiver();
2201 2171
2202 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2203 if ((retval = gpio_request(dev->mach->gpio_vbus,
2204 "pxa25x_udc GPIO VBUS"))) {
2205 dev_dbg(&pdev->dev,
2206 "can't get vbus gpio %d, err: %d\n",
2207 dev->mach->gpio_vbus, retval);
2208 goto err_gpio_vbus;
2209 }
2210 gpio_direction_input(dev->mach->gpio_vbus);
2211 vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);
2212 } else
2213 vbus_irq = 0;
2214
2215 if (gpio_is_valid(dev->mach->gpio_pullup)) { 2172 if (gpio_is_valid(dev->mach->gpio_pullup)) {
2216 if ((retval = gpio_request(dev->mach->gpio_pullup, 2173 if ((retval = gpio_request(dev->mach->gpio_pullup,
2217 "pca25x_udc GPIO PULLUP"))) { 2174 "pca25x_udc GPIO PULLUP"))) {
@@ -2237,7 +2194,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2237 udc_disable(dev); 2194 udc_disable(dev);
2238 udc_reinit(dev); 2195 udc_reinit(dev);
2239 2196
2240 dev->vbus = !!is_vbus_present(); 2197 dev->vbus = 0;
2241 2198
2242 /* irq setup after old hardware state is cleaned up */ 2199 /* irq setup after old hardware state is cleaned up */
2243 retval = request_irq(irq, pxa25x_udc_irq, 2200 retval = request_irq(irq, pxa25x_udc_irq,
@@ -2273,22 +2230,10 @@ lubbock_fail0:
2273 } 2230 }
2274 } else 2231 } else
2275#endif 2232#endif
2276 if (vbus_irq) {
2277 retval = request_irq(vbus_irq, udc_vbus_irq,
2278 IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
2279 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2280 driver_name, dev);
2281 if (retval != 0) {
2282 pr_err("%s: can't get irq %i, err %d\n",
2283 driver_name, vbus_irq, retval);
2284 goto err_vbus_irq;
2285 }
2286 }
2287 create_debug_files(dev); 2233 create_debug_files(dev);
2288 2234
2289 return 0; 2235 return 0;
2290 2236
2291 err_vbus_irq:
2292#ifdef CONFIG_ARCH_LUBBOCK 2237#ifdef CONFIG_ARCH_LUBBOCK
2293 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2238 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
2294 err_irq_lub: 2239 err_irq_lub:
@@ -2298,9 +2243,6 @@ lubbock_fail0:
2298 if (gpio_is_valid(dev->mach->gpio_pullup)) 2243 if (gpio_is_valid(dev->mach->gpio_pullup))
2299 gpio_free(dev->mach->gpio_pullup); 2244 gpio_free(dev->mach->gpio_pullup);
2300 err_gpio_pullup: 2245 err_gpio_pullup:
2301 if (gpio_is_valid(dev->mach->gpio_vbus))
2302 gpio_free(dev->mach->gpio_vbus);
2303 err_gpio_vbus:
2304 if (dev->transceiver) { 2246 if (dev->transceiver) {
2305 otg_put_transceiver(dev->transceiver); 2247 otg_put_transceiver(dev->transceiver);
2306 dev->transceiver = NULL; 2248 dev->transceiver = NULL;
@@ -2337,10 +2279,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2337 free_irq(LUBBOCK_USB_IRQ, dev); 2279 free_irq(LUBBOCK_USB_IRQ, dev);
2338 } 2280 }
2339#endif 2281#endif
2340 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2341 free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev);
2342 gpio_free(dev->mach->gpio_vbus);
2343 }
2344 if (gpio_is_valid(dev->mach->gpio_pullup)) 2282 if (gpio_is_valid(dev->mach->gpio_pullup))
2345 gpio_free(dev->mach->gpio_pullup); 2283 gpio_free(dev->mach->gpio_pullup);
2346 2284
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 2efd6732d130..78a39a41547d 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -602,7 +602,7 @@ static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in)
602/** 602/**
603 * inc_ep_stats_bytes - Update ep stats counts 603 * inc_ep_stats_bytes - Update ep stats counts
604 * @ep: physical endpoint 604 * @ep: physical endpoint
605 * @count: bytes transfered on endpoint 605 * @count: bytes transferred on endpoint
606 * @is_in: ep direction (USB_DIR_IN or 0) 606 * @is_in: ep direction (USB_DIR_IN or 0)
607 */ 607 */
608static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in) 608static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in)
@@ -877,7 +877,7 @@ static void nuke(struct pxa_ep *ep, int status)
877 * If there is less space in request than bytes received in OUT endpoint, 877 * If there is less space in request than bytes received in OUT endpoint,
878 * bytes are left in the OUT endpoint. 878 * bytes are left in the OUT endpoint.
879 * 879 *
880 * Returns how many bytes were actually transfered 880 * Returns how many bytes were actually transferred
881 */ 881 */
882static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req) 882static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req)
883{ 883{
@@ -914,7 +914,7 @@ static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req)
914 * endpoint. If there are no bytes to transfer, doesn't write anything 914 * endpoint. If there are no bytes to transfer, doesn't write anything
915 * to physical endpoint. 915 * to physical endpoint.
916 * 916 *
917 * Returns how many bytes were actually transfered. 917 * Returns how many bytes were actually transferred.
918 */ 918 */
919static int write_packet(struct pxa_ep *ep, struct pxa27x_request *req, 919static int write_packet(struct pxa_ep *ep, struct pxa27x_request *req,
920 unsigned int max) 920 unsigned int max)
@@ -991,7 +991,7 @@ static int read_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
991 * caller guarantees at least one packet buffer is ready (or a zlp). 991 * caller guarantees at least one packet buffer is ready (or a zlp).
992 * Doesn't complete the request, that's the caller's job 992 * Doesn't complete the request, that's the caller's job
993 * 993 *
994 * Returns 1 if request fully transfered, 0 if partial transfer 994 * Returns 1 if request fully transferred, 0 if partial transfer
995 */ 995 */
996static int write_fifo(struct pxa_ep *ep, struct pxa27x_request *req) 996static int write_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
997{ 997{
@@ -1094,7 +1094,7 @@ static int read_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
1094 * Sends a request (or a part of the request) to the control endpoint (ep0 in). 1094 * Sends a request (or a part of the request) to the control endpoint (ep0 in).
1095 * If the request doesn't fit, the remaining part will be sent from irq. 1095 * If the request doesn't fit, the remaining part will be sent from irq.
1096 * The request is considered fully written only if either : 1096 * The request is considered fully written only if either :
1097 * - last write transfered all remaining bytes, but fifo was not fully filled 1097 * - last write transferred all remaining bytes, but fifo was not fully filled
1098 * - last write was a 0 length write 1098 * - last write was a 0 length write
1099 * 1099 *
1100 * Returns 1 if request fully written, 0 if request only partially sent 1100 * Returns 1 if request fully written, 0 if request only partially sent
@@ -1548,7 +1548,7 @@ static int pxa_udc_get_frame(struct usb_gadget *_gadget)
1548 * pxa_udc_wakeup - Force udc device out of suspend 1548 * pxa_udc_wakeup - Force udc device out of suspend
1549 * @_gadget: usb gadget 1549 * @_gadget: usb gadget
1550 * 1550 *
1551 * Returns 0 if successfull, error code otherwise 1551 * Returns 0 if successful, error code otherwise
1552 */ 1552 */
1553static int pxa_udc_wakeup(struct usb_gadget *_gadget) 1553static int pxa_udc_wakeup(struct usb_gadget *_gadget)
1554{ 1554{
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 015118535f77..6dcc1f68fa60 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1083,7 +1083,9 @@ static void irq_device_state(struct r8a66597 *r8a66597)
1083 1083
1084 if (dvsq == DS_DFLT) { 1084 if (dvsq == DS_DFLT) {
1085 /* bus reset */ 1085 /* bus reset */
1086 spin_unlock(&r8a66597->lock);
1086 r8a66597->driver->disconnect(&r8a66597->gadget); 1087 r8a66597->driver->disconnect(&r8a66597->gadget);
1088 spin_lock(&r8a66597->lock);
1087 r8a66597_update_usb_speed(r8a66597); 1089 r8a66597_update_usb_speed(r8a66597);
1088 } 1090 }
1089 if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) 1091 if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG)
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index ef825c3baed9..0912679de99a 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -41,8 +41,8 @@
41/* EP0_MPS_LIMIT 41/* EP0_MPS_LIMIT
42 * 42 *
43 * Unfortunately there seems to be a limit of the amount of data that can 43 * Unfortunately there seems to be a limit of the amount of data that can
44 * be transfered by IN transactions on EP0. This is either 127 bytes or 3 44 * be transferred by IN transactions on EP0. This is either 127 bytes or 3
45 * packets (which practially means 1 packet and 63 bytes of data) when the 45 * packets (which practically means 1 packet and 63 bytes of data) when the
46 * MPS is set to 64. 46 * MPS is set to 64.
47 * 47 *
48 * This means if we are wanting to move >127 bytes of data, we need to 48 * This means if we are wanting to move >127 bytes of data, we need to
@@ -783,7 +783,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
783 hsotg->regs + S3C_DIEPINT(index)); 783 hsotg->regs + S3C_DIEPINT(index));
784 784
785 /* Note, trying to clear the NAK here causes problems with transmit 785 /* Note, trying to clear the NAK here causes problems with transmit
786 * on the S3C6400 ending up with the TXFIFO becomming full. */ 786 * on the S3C6400 ending up with the TXFIFO becoming full. */
787 787
788 /* check ep is enabled */ 788 /* check ep is enabled */
789 if (!(readl(hsotg->regs + epctrl_reg) & S3C_DxEPCTL_EPEna)) 789 if (!(readl(hsotg->regs + epctrl_reg) & S3C_DxEPCTL_EPEna))
@@ -1176,10 +1176,10 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
1176 writel(ctrl, hsotg->regs + reg); 1176 writel(ctrl, hsotg->regs + reg);
1177 1177
1178 dev_dbg(hsotg->dev, 1178 dev_dbg(hsotg->dev,
1179 "writen DxEPCTL=0x%08x to %08x (DxEPCTL=0x%08x)\n", 1179 "written DxEPCTL=0x%08x to %08x (DxEPCTL=0x%08x)\n",
1180 ctrl, reg, readl(hsotg->regs + reg)); 1180 ctrl, reg, readl(hsotg->regs + reg));
1181 1181
1182 /* don't belive we need to anything more to get the EP 1182 /* don't believe we need to anything more to get the EP
1183 * to reply with a STALL packet */ 1183 * to reply with a STALL packet */
1184 } 1184 }
1185} 1185}
@@ -1416,7 +1416,7 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size)
1416 * transaction. 1416 * transaction.
1417 * 1417 *
1418 * Note, since we don't write any data to the TxFIFO, then it is 1418 * Note, since we don't write any data to the TxFIFO, then it is
1419 * currently belived that we do not need to wait for any space in 1419 * currently believed that we do not need to wait for any space in
1420 * the TxFIFO. 1420 * the TxFIFO.
1421 */ 1421 */
1422static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg, 1422static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
@@ -1540,7 +1540,7 @@ static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg)
1540 * that requires processing, so find out what is in there and do the 1540 * that requires processing, so find out what is in there and do the
1541 * appropriate read. 1541 * appropriate read.
1542 * 1542 *
1543 * The RXFIFO is a true FIFO, the packets comming out are still in packet 1543 * The RXFIFO is a true FIFO, the packets coming out are still in packet
1544 * chunks, so if you have x packets received on an endpoint you'll get x 1544 * chunks, so if you have x packets received on an endpoint you'll get x
1545 * FIFO events delivered, each with a packet's worth of data in it. 1545 * FIFO events delivered, each with a packet's worth of data in it.
1546 * 1546 *
@@ -2188,7 +2188,7 @@ irq_retry:
2188 2188
2189 /* these next two seem to crop-up occasionally causing the core 2189 /* these next two seem to crop-up occasionally causing the core
2190 * to shutdown the USB transfer, so try clearing them and logging 2190 * to shutdown the USB transfer, so try clearing them and logging
2191 * the occurence. */ 2191 * the occurrence. */
2192 2192
2193 if (gintsts & S3C_GINTSTS_GOUTNakEff) { 2193 if (gintsts & S3C_GINTSTS_GOUTNakEff) {
2194 dev_info(hsotg->dev, "GOUTNakEff triggered\n"); 2194 dev_info(hsotg->dev, "GOUTNakEff triggered\n");
@@ -2469,7 +2469,7 @@ static struct usb_ep_ops s3c_hsotg_ep_ops = {
2469 .queue = s3c_hsotg_ep_queue, 2469 .queue = s3c_hsotg_ep_queue,
2470 .dequeue = s3c_hsotg_ep_dequeue, 2470 .dequeue = s3c_hsotg_ep_dequeue,
2471 .set_halt = s3c_hsotg_ep_sethalt, 2471 .set_halt = s3c_hsotg_ep_sethalt,
2472 /* note, don't belive we have any call for the fifo routines */ 2472 /* note, don't believe we have any call for the fifo routines */
2473}; 2473};
2474 2474
2475/** 2475/**
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 9483acdf2e9e..e0e0787b724b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -402,7 +402,7 @@ config FHCI_DEBUG
402 depends on USB_FHCI_HCD && DEBUG_FS 402 depends on USB_FHCI_HCD && DEBUG_FS
403 help 403 help
404 Say "y" to see some FHCI debug information and statistics 404 Say "y" to see some FHCI debug information and statistics
405 throught debugfs. 405 through debugfs.
406 406
407config USB_U132_HCD 407config USB_U132_HCD
408 tristate "Elan U132 Adapter Host Controller" 408 tristate "Elan U132 Adapter Host Controller"
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 7e41a95c5ceb..627f3a678759 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -40,6 +40,7 @@
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/usb/ulpi.h> 41#include <linux/usb/ulpi.h>
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h>
43 44
44/* EHCI Register Set */ 45/* EHCI Register Set */
45#define EHCI_INSNREG04 (0xA0) 46#define EHCI_INSNREG04 (0xA0)
@@ -118,6 +119,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
118 struct ehci_hcd *omap_ehci; 119 struct ehci_hcd *omap_ehci;
119 int ret = -ENODEV; 120 int ret = -ENODEV;
120 int irq; 121 int irq;
122 int i;
123 char supply[7];
121 124
122 if (usb_disabled()) 125 if (usb_disabled())
123 return -ENODEV; 126 return -ENODEV;
@@ -158,6 +161,23 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
158 hcd->rsrc_len = resource_size(res); 161 hcd->rsrc_len = resource_size(res);
159 hcd->regs = regs; 162 hcd->regs = regs;
160 163
164 /* get ehci regulator and enable */
165 for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
166 if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) {
167 pdata->regulator[i] = NULL;
168 continue;
169 }
170 snprintf(supply, sizeof(supply), "hsusb%d", i);
171 pdata->regulator[i] = regulator_get(dev, supply);
172 if (IS_ERR(pdata->regulator[i])) {
173 pdata->regulator[i] = NULL;
174 dev_dbg(dev,
175 "failed to get ehci port%d regulator\n", i);
176 } else {
177 regulator_enable(pdata->regulator[i]);
178 }
179 }
180
161 ret = omap_usbhs_enable(dev); 181 ret = omap_usbhs_enable(dev);
162 if (ret) { 182 if (ret) {
163 dev_err(dev, "failed to start usbhs with err %d\n", ret); 183 dev_err(dev, "failed to start usbhs with err %d\n", ret);
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index fe99895fb098..42abd0f603bf 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -315,7 +315,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
315 int stopped; 315 int stopped;
316 unsigned count = 0; 316 unsigned count = 0;
317 u8 state; 317 u8 state;
318 const __le32 halt = HALT_BIT(ehci);
319 struct ehci_qh_hw *hw = qh->hw; 318 struct ehci_qh_hw *hw = qh->hw;
320 319
321 if (unlikely (list_empty (&qh->qtd_list))) 320 if (unlikely (list_empty (&qh->qtd_list)))
@@ -422,7 +421,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
422 && !(qtd->hw_alt_next 421 && !(qtd->hw_alt_next
423 & EHCI_LIST_END(ehci))) { 422 & EHCI_LIST_END(ehci))) {
424 stopped = 1; 423 stopped = 1;
425 goto halt;
426 } 424 }
427 425
428 /* stop scanning when we reach qtds the hc is using */ 426 /* stop scanning when we reach qtds the hc is using */
@@ -456,16 +454,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
456 */ 454 */
457 ehci_clear_tt_buffer(ehci, qh, urb, token); 455 ehci_clear_tt_buffer(ehci, qh, urb, token);
458 } 456 }
459
460 /* force halt for unlinked or blocked qh, so we'll
461 * patch the qh later and so that completions can't
462 * activate it while we "know" it's stopped.
463 */
464 if ((halt & hw->hw_token) == 0) {
465halt:
466 hw->hw_token |= halt;
467 wmb ();
468 }
469 } 457 }
470 458
471 /* unless we already know the urb's status, collect qtd status 459 /* unless we already know the urb's status, collect qtd status
@@ -1259,24 +1247,27 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
1259 1247
1260static void scan_async (struct ehci_hcd *ehci) 1248static void scan_async (struct ehci_hcd *ehci)
1261{ 1249{
1250 bool stopped;
1262 struct ehci_qh *qh; 1251 struct ehci_qh *qh;
1263 enum ehci_timer_action action = TIMER_IO_WATCHDOG; 1252 enum ehci_timer_action action = TIMER_IO_WATCHDOG;
1264 1253
1265 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); 1254 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
1266 timer_action_done (ehci, TIMER_ASYNC_SHRINK); 1255 timer_action_done (ehci, TIMER_ASYNC_SHRINK);
1267rescan: 1256rescan:
1257 stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state);
1268 qh = ehci->async->qh_next.qh; 1258 qh = ehci->async->qh_next.qh;
1269 if (likely (qh != NULL)) { 1259 if (likely (qh != NULL)) {
1270 do { 1260 do {
1271 /* clean any finished work for this qh */ 1261 /* clean any finished work for this qh */
1272 if (!list_empty (&qh->qtd_list) 1262 if (!list_empty(&qh->qtd_list) && (stopped ||
1273 && qh->stamp != ehci->stamp) { 1263 qh->stamp != ehci->stamp)) {
1274 int temp; 1264 int temp;
1275 1265
1276 /* unlinks could happen here; completion 1266 /* unlinks could happen here; completion
1277 * reporting drops the lock. rescan using 1267 * reporting drops the lock. rescan using
1278 * the latest schedule, but don't rescan 1268 * the latest schedule, but don't rescan
1279 * qhs we already finished (no looping). 1269 * qhs we already finished (no looping)
1270 * unless the controller is stopped.
1280 */ 1271 */
1281 qh = qh_get (qh); 1272 qh = qh_get (qh);
1282 qh->stamp = ehci->stamp; 1273 qh->stamp = ehci->stamp;
@@ -1297,9 +1288,9 @@ rescan:
1297 */ 1288 */
1298 if (list_empty(&qh->qtd_list) 1289 if (list_empty(&qh->qtd_list)
1299 && qh->qh_state == QH_STATE_LINKED) { 1290 && qh->qh_state == QH_STATE_LINKED) {
1300 if (!ehci->reclaim 1291 if (!ehci->reclaim && (stopped ||
1301 && ((ehci->stamp - qh->stamp) & 0x1fff) 1292 ((ehci->stamp - qh->stamp) & 0x1fff)
1302 >= (EHCI_SHRINK_FRAMES * 8)) 1293 >= EHCI_SHRINK_FRAMES * 8))
1303 start_unlink_async(ehci, qh); 1294 start_unlink_async(ehci, qh);
1304 else 1295 else
1305 action = TIMER_ASYNC_SHRINK; 1296 action = TIMER_ASYNC_SHRINK;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index f86d3fa20214..333ddc156919 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -644,7 +644,7 @@ static inline void ehci_writel(const struct ehci_hcd *ehci,
644/* 644/*
645 * On certain ppc-44x SoC there is a HW issue, that could only worked around with 645 * On certain ppc-44x SoC there is a HW issue, that could only worked around with
646 * explicit suspend/operate of OHCI. This function hereby makes sense only on that arch. 646 * explicit suspend/operate of OHCI. This function hereby makes sense only on that arch.
647 * Other common bits are dependant on has_amcc_usb23 quirk flag. 647 * Other common bits are dependent on has_amcc_usb23 quirk flag.
648 */ 648 */
649#ifdef CONFIG_44x 649#ifdef CONFIG_44x
650static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational) 650static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational)
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index b84ff7e51896..19223c7449e1 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -401,7 +401,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
401 /* 1 td fro setup,1 for ack */ 401 /* 1 td fro setup,1 for ack */
402 size = 2; 402 size = 2;
403 case PIPE_BULK: 403 case PIPE_BULK:
404 /* one td for every 4096 bytes(can be upto 8k) */ 404 /* one td for every 4096 bytes(can be up to 8k) */
405 size += urb->transfer_buffer_length / 4096; 405 size += urb->transfer_buffer_length / 4096;
406 /* ...add for any remaining bytes... */ 406 /* ...add for any remaining bytes... */
407 if ((urb->transfer_buffer_length % 4096) != 0) 407 if ((urb->transfer_buffer_length % 4096) != 0)
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c
index 38fe058fbe61..0ea577bfca2a 100644
--- a/drivers/usb/host/fhci-tds.c
+++ b/drivers/usb/host/fhci-tds.c
@@ -40,7 +40,7 @@
40#define TD_RXER 0x0020 /* Rx error or not */ 40#define TD_RXER 0x0020 /* Rx error or not */
41 41
42#define TD_NAK 0x0010 /* No ack. */ 42#define TD_NAK 0x0010 /* No ack. */
43#define TD_STAL 0x0008 /* Stall recieved */ 43#define TD_STAL 0x0008 /* Stall received */
44#define TD_TO 0x0004 /* time out */ 44#define TD_TO 0x0004 /* time out */
45#define TD_UN 0x0002 /* underrun */ 45#define TD_UN 0x0002 /* underrun */
46#define TD_NO 0x0010 /* Rx Non Octet Aligned Packet */ 46#define TD_NO 0x0010 /* Rx Non Octet Aligned Packet */
@@ -274,7 +274,7 @@ void fhci_init_ep_registers(struct fhci_usb *usb, struct endpoint *ep,
274 * It is also preparing the TDs for new frames. If the Tx interrupts 274 * It is also preparing the TDs for new frames. If the Tx interrupts
275 * are disabled, the application should call that routine to get 275 * are disabled, the application should call that routine to get
276 * confirmation about the submitted frames. Otherwise, the routine is 276 * confirmation about the submitted frames. Otherwise, the routine is
277 * called frome the interrupt service routine during the Tx interrupt. 277 * called from the interrupt service routine during the Tx interrupt.
278 * In that case the application is informed by calling the application 278 * In that case the application is informed by calling the application
279 * specific 'fhci_transaction_confirm' routine 279 * specific 'fhci_transaction_confirm' routine
280 */ 280 */
@@ -337,7 +337,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb)
337 pkt->status = USB_TD_RX_ER_NONOCT; 337 pkt->status = USB_TD_RX_ER_NONOCT;
338 else 338 else
339 fhci_err(usb->fhci, "illegal error " 339 fhci_err(usb->fhci, "illegal error "
340 "occured\n"); 340 "occurred\n");
341 } else if (td_status & TD_NAK) 341 } else if (td_status & TD_NAK)
342 pkt->status = USB_TD_TX_ER_NAK; 342 pkt->status = USB_TD_TX_ER_NAK;
343 else if (td_status & TD_TO) 343 else if (td_status & TD_TO)
@@ -347,7 +347,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb)
347 else if (td_status & TD_STAL) 347 else if (td_status & TD_STAL)
348 pkt->status = USB_TD_TX_ER_STALL; 348 pkt->status = USB_TD_TX_ER_STALL;
349 else 349 else
350 fhci_err(usb->fhci, "illegal error occured\n"); 350 fhci_err(usb->fhci, "illegal error occurred\n");
351 } else if ((extra_data & TD_TOK_IN) && 351 } else if ((extra_data & TD_TOK_IN) &&
352 pkt->len > td_length - CRC_SIZE) { 352 pkt->len > td_length - CRC_SIZE) {
353 pkt->status = USB_TD_RX_DATA_UNDERUN; 353 pkt->status = USB_TD_RX_DATA_UNDERUN;
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
index 71c3caaea4c1..dc6939a44a1a 100644
--- a/drivers/usb/host/fhci.h
+++ b/drivers/usb/host/fhci.h
@@ -82,7 +82,7 @@
82#define USB_TD_RX_ER_NONOCT 0x40000000 /* Tx Non Octet Aligned Packet */ 82#define USB_TD_RX_ER_NONOCT 0x40000000 /* Tx Non Octet Aligned Packet */
83#define USB_TD_RX_ER_BITSTUFF 0x20000000 /* Frame Aborted-Received pkt */ 83#define USB_TD_RX_ER_BITSTUFF 0x20000000 /* Frame Aborted-Received pkt */
84#define USB_TD_RX_ER_CRC 0x10000000 /* CRC error */ 84#define USB_TD_RX_ER_CRC 0x10000000 /* CRC error */
85#define USB_TD_RX_ER_OVERUN 0x08000000 /* Over - run occured */ 85#define USB_TD_RX_ER_OVERUN 0x08000000 /* Over - run occurred */
86#define USB_TD_RX_ER_PID 0x04000000 /* wrong PID received */ 86#define USB_TD_RX_ER_PID 0x04000000 /* wrong PID received */
87#define USB_TD_RX_DATA_UNDERUN 0x02000000 /* shorter than expected */ 87#define USB_TD_RX_DATA_UNDERUN 0x02000000 /* shorter than expected */
88#define USB_TD_RX_DATA_OVERUN 0x01000000 /* longer than expected */ 88#define USB_TD_RX_DATA_OVERUN 0x01000000 /* longer than expected */
@@ -363,7 +363,7 @@ struct ed {
363struct td { 363struct td {
364 void *data; /* a pointer to the data buffer */ 364 void *data; /* a pointer to the data buffer */
365 unsigned int len; /* length of the data to be submitted */ 365 unsigned int len; /* length of the data to be submitted */
366 unsigned int actual_len; /* actual bytes transfered on this td */ 366 unsigned int actual_len; /* actual bytes transferred on this td */
367 enum fhci_ta_type type; /* transaction type */ 367 enum fhci_ta_type type; /* transaction type */
368 u8 toggle; /* toggle for next trans. within this TD */ 368 u8 toggle; /* toggle for next trans. within this TD */
369 u16 iso_index; /* ISO transaction index */ 369 u16 iso_index; /* ISO transaction index */
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c
index 2562e92e3178..af05718bdc73 100644
--- a/drivers/usb/host/imx21-hcd.c
+++ b/drivers/usb/host/imx21-hcd.c
@@ -1323,7 +1323,7 @@ static void process_etds(struct usb_hcd *hcd, struct imx21 *imx21, int sof)
1323 * (and hence no interrupt occurs). 1323 * (and hence no interrupt occurs).
1324 * This causes the transfer in question to hang. 1324 * This causes the transfer in question to hang.
1325 * The kludge below checks for this condition at each SOF and processes any 1325 * The kludge below checks for this condition at each SOF and processes any
1326 * blocked ETDs (after an arbitary 10 frame wait) 1326 * blocked ETDs (after an arbitrary 10 frame wait)
1327 * 1327 *
1328 * With a single active transfer the usbtest test suite will run for days 1328 * With a single active transfer the usbtest test suite will run for days
1329 * without the kludge. 1329 * without the kludge.
diff --git a/drivers/usb/host/isp116x.h b/drivers/usb/host/isp116x.h
index 12db961acdfb..9a2c400e6090 100644
--- a/drivers/usb/host/isp116x.h
+++ b/drivers/usb/host/isp116x.h
@@ -13,7 +13,7 @@
13 13
14/* Full speed: max # of bytes to transfer for a single urb 14/* Full speed: max # of bytes to transfer for a single urb
15 at a time must be < 1024 && must be multiple of 64. 15 at a time must be < 1024 && must be multiple of 64.
16 832 allows transfering 4kiB within 5 frames. */ 16 832 allows transferring 4kiB within 5 frames. */
17#define MAX_TRANSFER_SIZE_FULLSPEED 832 17#define MAX_TRANSFER_SIZE_FULLSPEED 832
18 18
19/* Low speed: there is no reason to schedule in very big 19/* Low speed: there is no reason to schedule in very big
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 662cd002adfc..f97570a847ca 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -546,7 +546,7 @@ static void postproc_ep(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep)
546 if (usb_pipecontrol(urb->pipe)) { 546 if (usb_pipecontrol(urb->pipe)) {
547 ep->nextpid = USB_PID_ACK; 547 ep->nextpid = USB_PID_ACK;
548 /* save the data underrun error code for later and 548 /* save the data underrun error code for later and
549 * procede with the status stage 549 * proceed with the status stage
550 */ 550 */
551 urb->actual_length += PTD_GET_COUNT(ptd); 551 urb->actual_length += PTD_GET_COUNT(ptd);
552 BUG_ON(urb->actual_length > urb->transfer_buffer_length); 552 BUG_ON(urb->actual_length > urb->transfer_buffer_length);
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index f50e84ac570a..7b2e69aa2e98 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -295,7 +295,7 @@ static void alloc_mem(struct usb_hcd *hcd, struct isp1760_qtd *qtd)
295 } 295 }
296 296
297 dev_err(hcd->self.controller, 297 dev_err(hcd->self.controller,
298 "%s: Can not allocate %lu bytes of memory\n" 298 "%s: Cannot allocate %zu bytes of memory\n"
299 "Current memory map:\n", 299 "Current memory map:\n",
300 __func__, qtd->length); 300 __func__, qtd->length);
301 for (i = 0; i < BLOCKS; i++) { 301 for (i = 0; i < BLOCKS; i++) {
@@ -1633,6 +1633,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
1633 ints[i].qh = NULL; 1633 ints[i].qh = NULL;
1634 ints[i].qtd = NULL; 1634 ints[i].qtd = NULL;
1635 1635
1636 urb->status = status;
1636 isp1760_urb_done(hcd, urb); 1637 isp1760_urb_done(hcd, urb);
1637 if (qtd) 1638 if (qtd)
1638 pe(hcd, qh, qtd); 1639 pe(hcd, qh, qtd);
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 17a6043c1fa0..958d985f2951 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -33,7 +33,7 @@
33 33
34#ifdef __LITTLE_ENDIAN 34#ifdef __LITTLE_ENDIAN
35#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) 35#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C)
36#elif __BIG_ENDIAN 36#elif defined(__BIG_ENDIAN)
37#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ 37#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \
38 USBH_ENABLE_BE) 38 USBH_ENABLE_BE)
39#else 39#else
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index e7288639edb0..d55723514860 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -162,7 +162,7 @@ static int ohci_urb_enqueue (
162 // case PIPE_INTERRUPT: 162 // case PIPE_INTERRUPT:
163 // case PIPE_BULK: 163 // case PIPE_BULK:
164 default: 164 default:
165 /* one TD for every 4096 Bytes (can be upto 8K) */ 165 /* one TD for every 4096 Bytes (can be up to 8K) */
166 size += urb->transfer_buffer_length / 4096; 166 size += urb->transfer_buffer_length / 4096;
167 /* ... and for any remaining bytes ... */ 167 /* ... and for any remaining bytes ... */
168 if ((urb->transfer_buffer_length % 4096) != 0) 168 if ((urb->transfer_buffer_length % 4096) != 0)
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 8dabe8e31d8c..3558491dd87d 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -185,7 +185,7 @@ static struct platform_driver ohci_hcd_tmio_driver;
185 185
186static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev) 186static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev)
187{ 187{
188 struct mfd_cell *cell = dev->dev.platform_data; 188 const struct mfd_cell *cell = mfd_get_cell(dev);
189 struct resource *regs = platform_get_resource(dev, IORESOURCE_MEM, 0); 189 struct resource *regs = platform_get_resource(dev, IORESOURCE_MEM, 0);
190 struct resource *config = platform_get_resource(dev, IORESOURCE_MEM, 1); 190 struct resource *config = platform_get_resource(dev, IORESOURCE_MEM, 1);
191 struct resource *sram = platform_get_resource(dev, IORESOURCE_MEM, 2); 191 struct resource *sram = platform_get_resource(dev, IORESOURCE_MEM, 2);
@@ -274,7 +274,7 @@ static int __devexit ohci_hcd_tmio_drv_remove(struct platform_device *dev)
274{ 274{
275 struct usb_hcd *hcd = platform_get_drvdata(dev); 275 struct usb_hcd *hcd = platform_get_drvdata(dev);
276 struct tmio_hcd *tmio = hcd_to_tmio(hcd); 276 struct tmio_hcd *tmio = hcd_to_tmio(hcd);
277 struct mfd_cell *cell = dev->dev.platform_data; 277 const struct mfd_cell *cell = mfd_get_cell(dev);
278 278
279 usb_remove_hcd(hcd); 279 usb_remove_hcd(hcd);
280 tmio_stop_hc(dev); 280 tmio_stop_hc(dev);
@@ -293,7 +293,7 @@ static int __devexit ohci_hcd_tmio_drv_remove(struct platform_device *dev)
293#ifdef CONFIG_PM 293#ifdef CONFIG_PM
294static int ohci_hcd_tmio_drv_suspend(struct platform_device *dev, pm_message_t state) 294static int ohci_hcd_tmio_drv_suspend(struct platform_device *dev, pm_message_t state)
295{ 295{
296 struct mfd_cell *cell = dev->dev.platform_data; 296 const struct mfd_cell *cell = mfd_get_cell(dev);
297 struct usb_hcd *hcd = platform_get_drvdata(dev); 297 struct usb_hcd *hcd = platform_get_drvdata(dev);
298 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 298 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
299 struct tmio_hcd *tmio = hcd_to_tmio(hcd); 299 struct tmio_hcd *tmio = hcd_to_tmio(hcd);
@@ -326,7 +326,7 @@ static int ohci_hcd_tmio_drv_suspend(struct platform_device *dev, pm_message_t s
326 326
327static int ohci_hcd_tmio_drv_resume(struct platform_device *dev) 327static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
328{ 328{
329 struct mfd_cell *cell = dev->dev.platform_data; 329 const struct mfd_cell *cell = mfd_get_cell(dev);
330 struct usb_hcd *hcd = platform_get_drvdata(dev); 330 struct usb_hcd *hcd = platform_get_drvdata(dev);
331 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 331 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
332 struct tmio_hcd *tmio = hcd_to_tmio(hcd); 332 struct tmio_hcd *tmio = hcd_to_tmio(hcd);
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 38193f4e980e..4a771f6cc822 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -2879,7 +2879,7 @@ static int oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2879 /* Ok, we have more job to do! :) */ 2879 /* Ok, we have more job to do! :) */
2880 2880
2881 for (i = 0; i < num - 1; i++) { 2881 for (i = 0; i < num - 1; i++) {
2882 /* Get free micro URB poll till a free urb is recieved */ 2882 /* Get free micro URB poll till a free urb is received */
2883 2883
2884 do { 2884 do {
2885 murb = (struct urb *) oxu_murb_alloc(oxu); 2885 murb = (struct urb *) oxu_murb_alloc(oxu);
@@ -2911,7 +2911,7 @@ static int oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2911 2911
2912 /* Last urb requires special handling */ 2912 /* Last urb requires special handling */
2913 2913
2914 /* Get free micro URB poll till a free urb is recieved */ 2914 /* Get free micro URB poll till a free urb is received */
2915 do { 2915 do {
2916 murb = (struct urb *) oxu_murb_alloc(oxu); 2916 murb = (struct urb *) oxu_murb_alloc(oxu);
2917 if (!murb) 2917 if (!murb)
@@ -3832,7 +3832,7 @@ static int oxu_drv_probe(struct platform_device *pdev)
3832 return -EBUSY; 3832 return -EBUSY;
3833 } 3833 }
3834 3834
3835 ret = set_irq_type(irq, IRQF_TRIGGER_FALLING); 3835 ret = irq_set_irq_type(irq, IRQF_TRIGGER_FALLING);
3836 if (ret) { 3836 if (ret) {
3837 dev_err(&pdev->dev, "error setting irq type\n"); 3837 dev_err(&pdev->dev, "error setting irq type\n");
3838 ret = -EFAULT; 3838 ret = -EFAULT;
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 1d586d4f7b56..9b166d70ae91 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -84,65 +84,92 @@ int usb_amd_find_chipset_info(void)
84{ 84{
85 u8 rev = 0; 85 u8 rev = 0;
86 unsigned long flags; 86 unsigned long flags;
87 struct amd_chipset_info info;
88 int ret;
87 89
88 spin_lock_irqsave(&amd_lock, flags); 90 spin_lock_irqsave(&amd_lock, flags);
89 91
90 amd_chipset.probe_count++;
91 /* probe only once */ 92 /* probe only once */
92 if (amd_chipset.probe_count > 1) { 93 if (amd_chipset.probe_count > 0) {
94 amd_chipset.probe_count++;
93 spin_unlock_irqrestore(&amd_lock, flags); 95 spin_unlock_irqrestore(&amd_lock, flags);
94 return amd_chipset.probe_result; 96 return amd_chipset.probe_result;
95 } 97 }
98 memset(&info, 0, sizeof(info));
99 spin_unlock_irqrestore(&amd_lock, flags);
96 100
97 amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); 101 info.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL);
98 if (amd_chipset.smbus_dev) { 102 if (info.smbus_dev) {
99 rev = amd_chipset.smbus_dev->revision; 103 rev = info.smbus_dev->revision;
100 if (rev >= 0x40) 104 if (rev >= 0x40)
101 amd_chipset.sb_type = 1; 105 info.sb_type = 1;
102 else if (rev >= 0x30 && rev <= 0x3b) 106 else if (rev >= 0x30 && rev <= 0x3b)
103 amd_chipset.sb_type = 3; 107 info.sb_type = 3;
104 } else { 108 } else {
105 amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 109 info.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
106 0x780b, NULL); 110 0x780b, NULL);
107 if (!amd_chipset.smbus_dev) { 111 if (!info.smbus_dev) {
108 spin_unlock_irqrestore(&amd_lock, flags); 112 ret = 0;
109 return 0; 113 goto commit;
110 } 114 }
111 rev = amd_chipset.smbus_dev->revision; 115
116 rev = info.smbus_dev->revision;
112 if (rev >= 0x11 && rev <= 0x18) 117 if (rev >= 0x11 && rev <= 0x18)
113 amd_chipset.sb_type = 2; 118 info.sb_type = 2;
114 } 119 }
115 120
116 if (amd_chipset.sb_type == 0) { 121 if (info.sb_type == 0) {
117 if (amd_chipset.smbus_dev) { 122 if (info.smbus_dev) {
118 pci_dev_put(amd_chipset.smbus_dev); 123 pci_dev_put(info.smbus_dev);
119 amd_chipset.smbus_dev = NULL; 124 info.smbus_dev = NULL;
120 } 125 }
121 spin_unlock_irqrestore(&amd_lock, flags); 126 ret = 0;
122 return 0; 127 goto commit;
123 } 128 }
124 129
125 amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); 130 info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL);
126 if (amd_chipset.nb_dev) { 131 if (info.nb_dev) {
127 amd_chipset.nb_type = 1; 132 info.nb_type = 1;
128 } else { 133 } else {
129 amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 134 info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL);
130 0x1510, NULL); 135 if (info.nb_dev) {
131 if (amd_chipset.nb_dev) { 136 info.nb_type = 2;
132 amd_chipset.nb_type = 2; 137 } else {
133 } else { 138 info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD,
134 amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 139 0x9600, NULL);
135 0x9600, NULL); 140 if (info.nb_dev)
136 if (amd_chipset.nb_dev) 141 info.nb_type = 3;
137 amd_chipset.nb_type = 3;
138 } 142 }
139 } 143 }
140 144
141 amd_chipset.probe_result = 1; 145 ret = info.probe_result = 1;
142 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); 146 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n");
143 147
144 spin_unlock_irqrestore(&amd_lock, flags); 148commit:
145 return amd_chipset.probe_result; 149
150 spin_lock_irqsave(&amd_lock, flags);
151 if (amd_chipset.probe_count > 0) {
152 /* race - someone else was faster - drop devices */
153
154 /* Mark that we where here */
155 amd_chipset.probe_count++;
156 ret = amd_chipset.probe_result;
157
158 spin_unlock_irqrestore(&amd_lock, flags);
159
160 if (info.nb_dev)
161 pci_dev_put(info.nb_dev);
162 if (info.smbus_dev)
163 pci_dev_put(info.smbus_dev);
164
165 } else {
166 /* no race - commit the result */
167 info.probe_count++;
168 amd_chipset = info;
169 spin_unlock_irqrestore(&amd_lock, flags);
170 }
171
172 return ret;
146} 173}
147EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); 174EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);
148 175
@@ -284,6 +311,7 @@ EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_enable);
284 311
285void usb_amd_dev_put(void) 312void usb_amd_dev_put(void)
286{ 313{
314 struct pci_dev *nb, *smbus;
287 unsigned long flags; 315 unsigned long flags;
288 316
289 spin_lock_irqsave(&amd_lock, flags); 317 spin_lock_irqsave(&amd_lock, flags);
@@ -294,20 +322,23 @@ void usb_amd_dev_put(void)
294 return; 322 return;
295 } 323 }
296 324
297 if (amd_chipset.nb_dev) { 325 /* save them to pci_dev_put outside of spinlock */
298 pci_dev_put(amd_chipset.nb_dev); 326 nb = amd_chipset.nb_dev;
299 amd_chipset.nb_dev = NULL; 327 smbus = amd_chipset.smbus_dev;
300 } 328
301 if (amd_chipset.smbus_dev) { 329 amd_chipset.nb_dev = NULL;
302 pci_dev_put(amd_chipset.smbus_dev); 330 amd_chipset.smbus_dev = NULL;
303 amd_chipset.smbus_dev = NULL;
304 }
305 amd_chipset.nb_type = 0; 331 amd_chipset.nb_type = 0;
306 amd_chipset.sb_type = 0; 332 amd_chipset.sb_type = 0;
307 amd_chipset.isoc_reqs = 0; 333 amd_chipset.isoc_reqs = 0;
308 amd_chipset.probe_result = 0; 334 amd_chipset.probe_result = 0;
309 335
310 spin_unlock_irqrestore(&amd_lock, flags); 336 spin_unlock_irqrestore(&amd_lock, flags);
337
338 if (nb)
339 pci_dev_put(nb);
340 if (smbus)
341 pci_dev_put(smbus);
311} 342}
312EXPORT_SYMBOL_GPL(usb_amd_dev_put); 343EXPORT_SYMBOL_GPL(usb_amd_dev_put);
313 344
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
index dc0ab8382f5d..d6e175428618 100644
--- a/drivers/usb/host/whci/qset.c
+++ b/drivers/usb/host/whci/qset.c
@@ -739,7 +739,7 @@ static int get_urb_status_from_qtd(struct urb *urb, u32 status)
739 * process_inactive_qtd - process an inactive (but not halted) qTD. 739 * process_inactive_qtd - process an inactive (but not halted) qTD.
740 * 740 *
741 * Update the urb with the transfer bytes from the qTD, if the urb is 741 * Update the urb with the transfer bytes from the qTD, if the urb is
742 * completely transfered or (in the case of an IN only) the LPF is 742 * completely transferred or (in the case of an IN only) the LPF is
743 * set, then the transfer is complete and the urb should be returned 743 * set, then the transfer is complete and the urb should be returned
744 * to the system. 744 * to the system.
745 */ 745 */
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a78f2ebd11b7..73f75d26436c 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -777,7 +777,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
777 if (t1 != t2) 777 if (t1 != t2)
778 xhci_writel(xhci, t2, port_array[port_index]); 778 xhci_writel(xhci, t2, port_array[port_index]);
779 779
780 if (DEV_HIGHSPEED(t1)) { 780 if (hcd->speed != HCD_USB3) {
781 /* enable remote wake up for USB 2.0 */ 781 /* enable remote wake up for USB 2.0 */
782 u32 __iomem *addr; 782 u32 __iomem *addr;
783 u32 tmp; 783 u32 tmp;
@@ -866,6 +866,21 @@ int xhci_bus_resume(struct usb_hcd *hcd)
866 temp |= PORT_LINK_STROBE | XDEV_U0; 866 temp |= PORT_LINK_STROBE | XDEV_U0;
867 xhci_writel(xhci, temp, port_array[port_index]); 867 xhci_writel(xhci, temp, port_array[port_index]);
868 } 868 }
869 /* wait for the port to enter U0 and report port link
870 * state change.
871 */
872 spin_unlock_irqrestore(&xhci->lock, flags);
873 msleep(20);
874 spin_lock_irqsave(&xhci->lock, flags);
875
876 /* Clear PLC */
877 temp = xhci_readl(xhci, port_array[port_index]);
878 if (temp & PORT_PLC) {
879 temp = xhci_port_state_to_neutral(temp);
880 temp |= PORT_PLC;
881 xhci_writel(xhci, temp, port_array[port_index]);
882 }
883
869 slot_id = xhci_find_slot_id_by_port(hcd, 884 slot_id = xhci_find_slot_id_by_port(hcd,
870 xhci, port_index + 1); 885 xhci, port_index + 1);
871 if (slot_id) 886 if (slot_id)
@@ -873,7 +888,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)
873 } else 888 } else
874 xhci_writel(xhci, temp, port_array[port_index]); 889 xhci_writel(xhci, temp, port_array[port_index]);
875 890
876 if (DEV_HIGHSPEED(temp)) { 891 if (hcd->speed != HCD_USB3) {
877 /* disable remote wake up for USB 2.0 */ 892 /* disable remote wake up for USB 2.0 */
878 u32 __iomem *addr; 893 u32 __iomem *addr;
879 u32 tmp; 894 u32 tmp;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index a003e79aacdc..627f3438028c 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -846,7 +846,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci,
846 * Skip ports that don't have known speeds, or have duplicate 846 * Skip ports that don't have known speeds, or have duplicate
847 * Extended Capabilities port speed entries. 847 * Extended Capabilities port speed entries.
848 */ 848 */
849 if (port_speed == 0 || port_speed == -1) 849 if (port_speed == 0 || port_speed == DUPLICATE_ENTRY)
850 continue; 850 continue;
851 851
852 /* 852 /*
@@ -974,6 +974,47 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
974 return 0; 974 return 0;
975} 975}
976 976
977/*
978 * Convert interval expressed as 2^(bInterval - 1) == interval into
979 * straight exponent value 2^n == interval.
980 *
981 */
982static unsigned int xhci_parse_exponent_interval(struct usb_device *udev,
983 struct usb_host_endpoint *ep)
984{
985 unsigned int interval;
986
987 interval = clamp_val(ep->desc.bInterval, 1, 16) - 1;
988 if (interval != ep->desc.bInterval - 1)
989 dev_warn(&udev->dev,
990 "ep %#x - rounding interval to %d microframes\n",
991 ep->desc.bEndpointAddress,
992 1 << interval);
993
994 return interval;
995}
996
997/*
998 * Convert bInterval expressed in frames (in 1-255 range) to exponent of
999 * microframes, rounded down to nearest power of 2.
1000 */
1001static unsigned int xhci_parse_frame_interval(struct usb_device *udev,
1002 struct usb_host_endpoint *ep)
1003{
1004 unsigned int interval;
1005
1006 interval = fls(8 * ep->desc.bInterval) - 1;
1007 interval = clamp_val(interval, 3, 10);
1008 if ((1 << interval) != 8 * ep->desc.bInterval)
1009 dev_warn(&udev->dev,
1010 "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n",
1011 ep->desc.bEndpointAddress,
1012 1 << interval,
1013 8 * ep->desc.bInterval);
1014
1015 return interval;
1016}
1017
977/* Return the polling or NAK interval. 1018/* Return the polling or NAK interval.
978 * 1019 *
979 * The polling interval is expressed in "microframes". If xHCI's Interval field 1020 * The polling interval is expressed in "microframes". If xHCI's Interval field
@@ -982,7 +1023,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
982 * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval 1023 * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval
983 * is set to 0. 1024 * is set to 0.
984 */ 1025 */
985static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, 1026static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
986 struct usb_host_endpoint *ep) 1027 struct usb_host_endpoint *ep)
987{ 1028{
988 unsigned int interval = 0; 1029 unsigned int interval = 0;
@@ -991,45 +1032,38 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
991 case USB_SPEED_HIGH: 1032 case USB_SPEED_HIGH:
992 /* Max NAK rate */ 1033 /* Max NAK rate */
993 if (usb_endpoint_xfer_control(&ep->desc) || 1034 if (usb_endpoint_xfer_control(&ep->desc) ||
994 usb_endpoint_xfer_bulk(&ep->desc)) 1035 usb_endpoint_xfer_bulk(&ep->desc)) {
995 interval = ep->desc.bInterval; 1036 interval = ep->desc.bInterval;
1037 break;
1038 }
996 /* Fall through - SS and HS isoc/int have same decoding */ 1039 /* Fall through - SS and HS isoc/int have same decoding */
1040
997 case USB_SPEED_SUPER: 1041 case USB_SPEED_SUPER:
998 if (usb_endpoint_xfer_int(&ep->desc) || 1042 if (usb_endpoint_xfer_int(&ep->desc) ||
999 usb_endpoint_xfer_isoc(&ep->desc)) { 1043 usb_endpoint_xfer_isoc(&ep->desc)) {
1000 if (ep->desc.bInterval == 0) 1044 interval = xhci_parse_exponent_interval(udev, ep);
1001 interval = 0;
1002 else
1003 interval = ep->desc.bInterval - 1;
1004 if (interval > 15)
1005 interval = 15;
1006 if (interval != ep->desc.bInterval + 1)
1007 dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n",
1008 ep->desc.bEndpointAddress, 1 << interval);
1009 } 1045 }
1010 break; 1046 break;
1011 /* Convert bInterval (in 1-255 frames) to microframes and round down to 1047
1012 * nearest power of 2.
1013 */
1014 case USB_SPEED_FULL: 1048 case USB_SPEED_FULL:
1049 if (usb_endpoint_xfer_int(&ep->desc)) {
1050 interval = xhci_parse_exponent_interval(udev, ep);
1051 break;
1052 }
1053 /*
1054 * Fall through for isochronous endpoint interval decoding
1055 * since it uses the same rules as low speed interrupt
1056 * endpoints.
1057 */
1058
1015 case USB_SPEED_LOW: 1059 case USB_SPEED_LOW:
1016 if (usb_endpoint_xfer_int(&ep->desc) || 1060 if (usb_endpoint_xfer_int(&ep->desc) ||
1017 usb_endpoint_xfer_isoc(&ep->desc)) { 1061 usb_endpoint_xfer_isoc(&ep->desc)) {
1018 interval = fls(8*ep->desc.bInterval) - 1; 1062
1019 if (interval > 10) 1063 interval = xhci_parse_frame_interval(udev, ep);
1020 interval = 10;
1021 if (interval < 3)
1022 interval = 3;
1023 if ((1 << interval) != 8*ep->desc.bInterval)
1024 dev_warn(&udev->dev,
1025 "ep %#x - rounding interval"
1026 " to %d microframes, "
1027 "ep desc says %d microframes\n",
1028 ep->desc.bEndpointAddress,
1029 1 << interval,
1030 8*ep->desc.bInterval);
1031 } 1064 }
1032 break; 1065 break;
1066
1033 default: 1067 default:
1034 BUG(); 1068 BUG();
1035 } 1069 }
@@ -1041,7 +1075,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1041 * transaction opportunities per microframe", but that goes in the Max Burst 1075 * transaction opportunities per microframe", but that goes in the Max Burst
1042 * endpoint context field. 1076 * endpoint context field.
1043 */ 1077 */
1044static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, 1078static u32 xhci_get_endpoint_mult(struct usb_device *udev,
1045 struct usb_host_endpoint *ep) 1079 struct usb_host_endpoint *ep)
1046{ 1080{
1047 if (udev->speed != USB_SPEED_SUPER || 1081 if (udev->speed != USB_SPEED_SUPER ||
@@ -1050,7 +1084,7 @@ static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
1050 return ep->ss_ep_comp.bmAttributes; 1084 return ep->ss_ep_comp.bmAttributes;
1051} 1085}
1052 1086
1053static inline u32 xhci_get_endpoint_type(struct usb_device *udev, 1087static u32 xhci_get_endpoint_type(struct usb_device *udev,
1054 struct usb_host_endpoint *ep) 1088 struct usb_host_endpoint *ep)
1055{ 1089{
1056 int in; 1090 int in;
@@ -1084,7 +1118,7 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
1084 * Basically, this is the maxpacket size, multiplied by the burst size 1118 * Basically, this is the maxpacket size, multiplied by the burst size
1085 * and mult size. 1119 * and mult size.
1086 */ 1120 */
1087static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, 1121static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
1088 struct usb_device *udev, 1122 struct usb_device *udev,
1089 struct usb_host_endpoint *ep) 1123 struct usb_host_endpoint *ep)
1090{ 1124{
@@ -1727,12 +1761,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
1727 * found a similar duplicate. 1761 * found a similar duplicate.
1728 */ 1762 */
1729 if (xhci->port_array[i] != major_revision && 1763 if (xhci->port_array[i] != major_revision &&
1730 xhci->port_array[i] != (u8) -1) { 1764 xhci->port_array[i] != DUPLICATE_ENTRY) {
1731 if (xhci->port_array[i] == 0x03) 1765 if (xhci->port_array[i] == 0x03)
1732 xhci->num_usb3_ports--; 1766 xhci->num_usb3_ports--;
1733 else 1767 else
1734 xhci->num_usb2_ports--; 1768 xhci->num_usb2_ports--;
1735 xhci->port_array[i] = (u8) -1; 1769 xhci->port_array[i] = DUPLICATE_ENTRY;
1736 } 1770 }
1737 /* FIXME: Should we disable the port? */ 1771 /* FIXME: Should we disable the port? */
1738 continue; 1772 continue;
@@ -1831,7 +1865,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
1831 for (i = 0; i < num_ports; i++) { 1865 for (i = 0; i < num_ports; i++) {
1832 if (xhci->port_array[i] == 0x03 || 1866 if (xhci->port_array[i] == 0x03 ||
1833 xhci->port_array[i] == 0 || 1867 xhci->port_array[i] == 0 ||
1834 xhci->port_array[i] == -1) 1868 xhci->port_array[i] == DUPLICATE_ENTRY)
1835 continue; 1869 continue;
1836 1870
1837 xhci->usb2_ports[port_index] = 1871 xhci->usb2_ports[port_index] =
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index ceea9f33491c..a10494c2f3c7 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -114,6 +114,10 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
114 if (pdev->vendor == PCI_VENDOR_ID_NEC) 114 if (pdev->vendor == PCI_VENDOR_ID_NEC)
115 xhci->quirks |= XHCI_NEC_HOST; 115 xhci->quirks |= XHCI_NEC_HOST;
116 116
117 /* AMD PLL quirk */
118 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
119 xhci->quirks |= XHCI_AMD_PLL_FIX;
120
117 /* Make sure the HC is halted. */ 121 /* Make sure the HC is halted. */
118 retval = xhci_halt(xhci); 122 retval = xhci_halt(xhci);
119 if (retval) 123 if (retval)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index cfc1ad92473f..7437386a9a50 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -93,7 +93,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg,
93/* Does this link TRB point to the first segment in a ring, 93/* Does this link TRB point to the first segment in a ring,
94 * or was the previous TRB the last TRB on the last segment in the ERST? 94 * or was the previous TRB the last TRB on the last segment in the ERST?
95 */ 95 */
96static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, 96static bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring,
97 struct xhci_segment *seg, union xhci_trb *trb) 97 struct xhci_segment *seg, union xhci_trb *trb)
98{ 98{
99 if (ring == xhci->event_ring) 99 if (ring == xhci->event_ring)
@@ -107,7 +107,7 @@ static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring
107 * segment? I.e. would the updated event TRB pointer step off the end of the 107 * segment? I.e. would the updated event TRB pointer step off the end of the
108 * event seg? 108 * event seg?
109 */ 109 */
110static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, 110static int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
111 struct xhci_segment *seg, union xhci_trb *trb) 111 struct xhci_segment *seg, union xhci_trb *trb)
112{ 112{
113 if (ring == xhci->event_ring) 113 if (ring == xhci->event_ring)
@@ -116,7 +116,7 @@ static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
116 return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); 116 return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK);
117} 117}
118 118
119static inline int enqueue_is_link_trb(struct xhci_ring *ring) 119static int enqueue_is_link_trb(struct xhci_ring *ring)
120{ 120{
121 struct xhci_link_trb *link = &ring->enqueue->link; 121 struct xhci_link_trb *link = &ring->enqueue->link;
122 return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); 122 return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK));
@@ -592,7 +592,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci,
592 ep->ep_state |= SET_DEQ_PENDING; 592 ep->ep_state |= SET_DEQ_PENDING;
593} 593}
594 594
595static inline void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, 595static void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci,
596 struct xhci_virt_ep *ep) 596 struct xhci_virt_ep *ep)
597{ 597{
598 ep->ep_state &= ~EP_HALT_PENDING; 598 ep->ep_state &= ~EP_HALT_PENDING;
@@ -619,6 +619,13 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
619 619
620 /* Only giveback urb when this is the last td in urb */ 620 /* Only giveback urb when this is the last td in urb */
621 if (urb_priv->td_cnt == urb_priv->length) { 621 if (urb_priv->td_cnt == urb_priv->length) {
622 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
623 xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--;
624 if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) {
625 if (xhci->quirks & XHCI_AMD_PLL_FIX)
626 usb_amd_quirk_pll_enable();
627 }
628 }
622 usb_hcd_unlink_urb_from_ep(hcd, urb); 629 usb_hcd_unlink_urb_from_ep(hcd, urb);
623 xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); 630 xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb);
624 631
@@ -1209,7 +1216,7 @@ static unsigned int find_faked_portnum_from_hw_portnum(struct usb_hcd *hcd,
1209 * Skip ports that don't have known speeds, or have duplicate 1216 * Skip ports that don't have known speeds, or have duplicate
1210 * Extended Capabilities port speed entries. 1217 * Extended Capabilities port speed entries.
1211 */ 1218 */
1212 if (port_speed == 0 || port_speed == -1) 1219 if (port_speed == 0 || port_speed == DUPLICATE_ENTRY)
1213 continue; 1220 continue;
1214 1221
1215 /* 1222 /*
@@ -1235,6 +1242,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
1235 u8 major_revision; 1242 u8 major_revision;
1236 struct xhci_bus_state *bus_state; 1243 struct xhci_bus_state *bus_state;
1237 u32 __iomem **port_array; 1244 u32 __iomem **port_array;
1245 bool bogus_port_status = false;
1238 1246
1239 /* Port status change events always have a successful completion code */ 1247 /* Port status change events always have a successful completion code */
1240 if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { 1248 if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) {
@@ -1247,6 +1255,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
1247 max_ports = HCS_MAX_PORTS(xhci->hcs_params1); 1255 max_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1248 if ((port_id <= 0) || (port_id > max_ports)) { 1256 if ((port_id <= 0) || (port_id > max_ports)) {
1249 xhci_warn(xhci, "Invalid port id %d\n", port_id); 1257 xhci_warn(xhci, "Invalid port id %d\n", port_id);
1258 bogus_port_status = true;
1250 goto cleanup; 1259 goto cleanup;
1251 } 1260 }
1252 1261
@@ -1258,12 +1267,14 @@ static void handle_port_status(struct xhci_hcd *xhci,
1258 xhci_warn(xhci, "Event for port %u not in " 1267 xhci_warn(xhci, "Event for port %u not in "
1259 "Extended Capabilities, ignoring.\n", 1268 "Extended Capabilities, ignoring.\n",
1260 port_id); 1269 port_id);
1270 bogus_port_status = true;
1261 goto cleanup; 1271 goto cleanup;
1262 } 1272 }
1263 if (major_revision == (u8) -1) { 1273 if (major_revision == DUPLICATE_ENTRY) {
1264 xhci_warn(xhci, "Event for port %u duplicated in" 1274 xhci_warn(xhci, "Event for port %u duplicated in"
1265 "Extended Capabilities, ignoring.\n", 1275 "Extended Capabilities, ignoring.\n",
1266 port_id); 1276 port_id);
1277 bogus_port_status = true;
1267 goto cleanup; 1278 goto cleanup;
1268 } 1279 }
1269 1280
@@ -1335,6 +1346,13 @@ cleanup:
1335 /* Update event ring dequeue pointer before dropping the lock */ 1346 /* Update event ring dequeue pointer before dropping the lock */
1336 inc_deq(xhci, xhci->event_ring, true); 1347 inc_deq(xhci, xhci->event_ring, true);
1337 1348
1349 /* Don't make the USB core poll the roothub if we got a bad port status
1350 * change event. Besides, at that point we can't tell which roothub
1351 * (USB 2.0 or USB 3.0) to kick.
1352 */
1353 if (bogus_port_status)
1354 return;
1355
1338 spin_unlock(&xhci->lock); 1356 spin_unlock(&xhci->lock);
1339 /* Pass this up to the core */ 1357 /* Pass this up to the core */
1340 usb_hcd_poll_rh_status(hcd); 1358 usb_hcd_poll_rh_status(hcd);
@@ -1554,8 +1572,17 @@ td_cleanup:
1554 1572
1555 urb_priv->td_cnt++; 1573 urb_priv->td_cnt++;
1556 /* Giveback the urb when all the tds are completed */ 1574 /* Giveback the urb when all the tds are completed */
1557 if (urb_priv->td_cnt == urb_priv->length) 1575 if (urb_priv->td_cnt == urb_priv->length) {
1558 ret = 1; 1576 ret = 1;
1577 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
1578 xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--;
1579 if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs
1580 == 0) {
1581 if (xhci->quirks & XHCI_AMD_PLL_FIX)
1582 usb_amd_quirk_pll_enable();
1583 }
1584 }
1585 }
1559 } 1586 }
1560 1587
1561 return ret; 1588 return ret;
@@ -1675,71 +1702,52 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1675 struct urb_priv *urb_priv; 1702 struct urb_priv *urb_priv;
1676 int idx; 1703 int idx;
1677 int len = 0; 1704 int len = 0;
1678 int skip_td = 0;
1679 union xhci_trb *cur_trb; 1705 union xhci_trb *cur_trb;
1680 struct xhci_segment *cur_seg; 1706 struct xhci_segment *cur_seg;
1707 struct usb_iso_packet_descriptor *frame;
1681 u32 trb_comp_code; 1708 u32 trb_comp_code;
1709 bool skip_td = false;
1682 1710
1683 ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); 1711 ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer);
1684 trb_comp_code = GET_COMP_CODE(event->transfer_len); 1712 trb_comp_code = GET_COMP_CODE(event->transfer_len);
1685 urb_priv = td->urb->hcpriv; 1713 urb_priv = td->urb->hcpriv;
1686 idx = urb_priv->td_cnt; 1714 idx = urb_priv->td_cnt;
1715 frame = &td->urb->iso_frame_desc[idx];
1687 1716
1688 if (ep->skip) { 1717 /* handle completion code */
1689 /* The transfer is partly done */ 1718 switch (trb_comp_code) {
1690 *status = -EXDEV; 1719 case COMP_SUCCESS:
1691 td->urb->iso_frame_desc[idx].status = -EXDEV; 1720 frame->status = 0;
1692 } else { 1721 xhci_dbg(xhci, "Successful isoc transfer!\n");
1693 /* handle completion code */ 1722 break;
1694 switch (trb_comp_code) { 1723 case COMP_SHORT_TX:
1695 case COMP_SUCCESS: 1724 frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
1696 td->urb->iso_frame_desc[idx].status = 0; 1725 -EREMOTEIO : 0;
1697 xhci_dbg(xhci, "Successful isoc transfer!\n"); 1726 break;
1698 break; 1727 case COMP_BW_OVER:
1699 case COMP_SHORT_TX: 1728 frame->status = -ECOMM;
1700 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 1729 skip_td = true;
1701 td->urb->iso_frame_desc[idx].status = 1730 break;
1702 -EREMOTEIO; 1731 case COMP_BUFF_OVER:
1703 else 1732 case COMP_BABBLE:
1704 td->urb->iso_frame_desc[idx].status = 0; 1733 frame->status = -EOVERFLOW;
1705 break; 1734 skip_td = true;
1706 case COMP_BW_OVER: 1735 break;
1707 td->urb->iso_frame_desc[idx].status = -ECOMM; 1736 case COMP_STALL:
1708 skip_td = 1; 1737 frame->status = -EPROTO;
1709 break; 1738 skip_td = true;
1710 case COMP_BUFF_OVER: 1739 break;
1711 case COMP_BABBLE: 1740 case COMP_STOP:
1712 td->urb->iso_frame_desc[idx].status = -EOVERFLOW; 1741 case COMP_STOP_INVAL:
1713 skip_td = 1; 1742 break;
1714 break; 1743 default:
1715 case COMP_STALL: 1744 frame->status = -1;
1716 td->urb->iso_frame_desc[idx].status = -EPROTO; 1745 break;
1717 skip_td = 1;
1718 break;
1719 case COMP_STOP:
1720 case COMP_STOP_INVAL:
1721 break;
1722 default:
1723 td->urb->iso_frame_desc[idx].status = -1;
1724 break;
1725 }
1726 }
1727
1728 /* calc actual length */
1729 if (ep->skip) {
1730 td->urb->iso_frame_desc[idx].actual_length = 0;
1731 /* Update ring dequeue pointer */
1732 while (ep_ring->dequeue != td->last_trb)
1733 inc_deq(xhci, ep_ring, false);
1734 inc_deq(xhci, ep_ring, false);
1735 return finish_td(xhci, td, event_trb, event, ep, status, true);
1736 } 1746 }
1737 1747
1738 if (trb_comp_code == COMP_SUCCESS || skip_td == 1) { 1748 if (trb_comp_code == COMP_SUCCESS || skip_td) {
1739 td->urb->iso_frame_desc[idx].actual_length = 1749 frame->actual_length = frame->length;
1740 td->urb->iso_frame_desc[idx].length; 1750 td->urb->actual_length += frame->length;
1741 td->urb->actual_length +=
1742 td->urb->iso_frame_desc[idx].length;
1743 } else { 1751 } else {
1744 for (cur_trb = ep_ring->dequeue, 1752 for (cur_trb = ep_ring->dequeue,
1745 cur_seg = ep_ring->deq_seg; cur_trb != event_trb; 1753 cur_seg = ep_ring->deq_seg; cur_trb != event_trb;
@@ -1755,7 +1763,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1755 TRB_LEN(event->transfer_len); 1763 TRB_LEN(event->transfer_len);
1756 1764
1757 if (trb_comp_code != COMP_STOP_INVAL) { 1765 if (trb_comp_code != COMP_STOP_INVAL) {
1758 td->urb->iso_frame_desc[idx].actual_length = len; 1766 frame->actual_length = len;
1759 td->urb->actual_length += len; 1767 td->urb->actual_length += len;
1760 } 1768 }
1761 } 1769 }
@@ -1766,6 +1774,35 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1766 return finish_td(xhci, td, event_trb, event, ep, status, false); 1774 return finish_td(xhci, td, event_trb, event, ep, status, false);
1767} 1775}
1768 1776
1777static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1778 struct xhci_transfer_event *event,
1779 struct xhci_virt_ep *ep, int *status)
1780{
1781 struct xhci_ring *ep_ring;
1782 struct urb_priv *urb_priv;
1783 struct usb_iso_packet_descriptor *frame;
1784 int idx;
1785
1786 ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer);
1787 urb_priv = td->urb->hcpriv;
1788 idx = urb_priv->td_cnt;
1789 frame = &td->urb->iso_frame_desc[idx];
1790
1791 /* The transfer is partly done */
1792 *status = -EXDEV;
1793 frame->status = -EXDEV;
1794
1795 /* calc actual length */
1796 frame->actual_length = 0;
1797
1798 /* Update ring dequeue pointer */
1799 while (ep_ring->dequeue != td->last_trb)
1800 inc_deq(xhci, ep_ring, false);
1801 inc_deq(xhci, ep_ring, false);
1802
1803 return finish_td(xhci, td, NULL, event, ep, status, true);
1804}
1805
1769/* 1806/*
1770 * Process bulk and interrupt tds, update urb status and actual_length. 1807 * Process bulk and interrupt tds, update urb status and actual_length.
1771 */ 1808 */
@@ -2024,36 +2061,42 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2024 } 2061 }
2025 2062
2026 td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); 2063 td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list);
2064
2027 /* Is this a TRB in the currently executing TD? */ 2065 /* Is this a TRB in the currently executing TD? */
2028 event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, 2066 event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue,
2029 td->last_trb, event_dma); 2067 td->last_trb, event_dma);
2030 if (event_seg && ep->skip) { 2068 if (!event_seg) {
2069 if (!ep->skip ||
2070 !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
2071 /* HC is busted, give up! */
2072 xhci_err(xhci,
2073 "ERROR Transfer event TRB DMA ptr not "
2074 "part of current TD\n");
2075 return -ESHUTDOWN;
2076 }
2077
2078 ret = skip_isoc_td(xhci, td, event, ep, &status);
2079 goto cleanup;
2080 }
2081
2082 if (ep->skip) {
2031 xhci_dbg(xhci, "Found td. Clear skip flag.\n"); 2083 xhci_dbg(xhci, "Found td. Clear skip flag.\n");
2032 ep->skip = false; 2084 ep->skip = false;
2033 } 2085 }
2034 if (!event_seg &&
2035 (!ep->skip || !usb_endpoint_xfer_isoc(&td->urb->ep->desc))) {
2036 /* HC is busted, give up! */
2037 xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not "
2038 "part of current TD\n");
2039 return -ESHUTDOWN;
2040 }
2041 2086
2042 if (event_seg) { 2087 event_trb = &event_seg->trbs[(event_dma - event_seg->dma) /
2043 event_trb = &event_seg->trbs[(event_dma - 2088 sizeof(*event_trb)];
2044 event_seg->dma) / sizeof(*event_trb)]; 2089 /*
2045 /* 2090 * No-op TRB should not trigger interrupts.
2046 * No-op TRB should not trigger interrupts. 2091 * If event_trb is a no-op TRB, it means the
2047 * If event_trb is a no-op TRB, it means the 2092 * corresponding TD has been cancelled. Just ignore
2048 * corresponding TD has been cancelled. Just ignore 2093 * the TD.
2049 * the TD. 2094 */
2050 */ 2095 if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK)
2051 if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) 2096 == TRB_TYPE(TRB_TR_NOOP)) {
2052 == TRB_TYPE(TRB_TR_NOOP)) { 2097 xhci_dbg(xhci,
2053 xhci_dbg(xhci, "event_trb is a no-op TRB. " 2098 "event_trb is a no-op TRB. Skip it\n");
2054 "Skip it\n"); 2099 goto cleanup;
2055 goto cleanup;
2056 }
2057 } 2100 }
2058 2101
2059 /* Now update the urb's actual_length and give back to 2102 /* Now update the urb's actual_length and give back to
@@ -3126,6 +3169,12 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
3126 } 3169 }
3127 } 3170 }
3128 3171
3172 if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) {
3173 if (xhci->quirks & XHCI_AMD_PLL_FIX)
3174 usb_amd_quirk_pll_disable();
3175 }
3176 xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs++;
3177
3129 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, 3178 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id,
3130 start_cycle, start_trb); 3179 start_cycle, start_trb);
3131 return 0; 3180 return 0;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9a3645fd759b..81b976e45880 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -550,6 +550,9 @@ void xhci_stop(struct usb_hcd *hcd)
550 del_timer_sync(&xhci->event_ring_timer); 550 del_timer_sync(&xhci->event_ring_timer);
551#endif 551#endif
552 552
553 if (xhci->quirks & XHCI_AMD_PLL_FIX)
554 usb_amd_dev_put();
555
553 xhci_dbg(xhci, "// Disabling event ring interrupts\n"); 556 xhci_dbg(xhci, "// Disabling event ring interrupts\n");
554 temp = xhci_readl(xhci, &xhci->op_regs->status); 557 temp = xhci_readl(xhci, &xhci->op_regs->status);
555 xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); 558 xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status);
@@ -741,7 +744,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
741 int retval; 744 int retval;
742 745
743 /* Wait a bit if either of the roothubs need to settle from the 746 /* Wait a bit if either of the roothubs need to settle from the
744 * transistion into bus suspend. 747 * transition into bus suspend.
745 */ 748 */
746 if (time_before(jiffies, xhci->bus_state[0].next_statechange) || 749 if (time_before(jiffies, xhci->bus_state[0].next_statechange) ||
747 time_before(jiffies, 750 time_before(jiffies,
@@ -771,7 +774,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
771 774
772 /* If restore operation fails, re-initialize the HC during resume */ 775 /* If restore operation fails, re-initialize the HC during resume */
773 if ((temp & STS_SRE) || hibernated) { 776 if ((temp & STS_SRE) || hibernated) {
774 usb_root_hub_lost_power(hcd->self.root_hub); 777 /* Let the USB core know _both_ roothubs lost power. */
778 usb_root_hub_lost_power(xhci->main_hcd->self.root_hub);
779 usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub);
775 780
776 xhci_dbg(xhci, "Stop HCD\n"); 781 xhci_dbg(xhci, "Stop HCD\n");
777 xhci_halt(xhci); 782 xhci_halt(xhci);
@@ -2072,7 +2077,7 @@ int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev,
2072 return -EINVAL; 2077 return -EINVAL;
2073 } 2078 }
2074 vdev = xhci->devs[udev->slot_id]; 2079 vdev = xhci->devs[udev->slot_id];
2075 /* Mark each endpoint as being in transistion, so 2080 /* Mark each endpoint as being in transition, so
2076 * xhci_urb_enqueue() will reject all URBs. 2081 * xhci_urb_enqueue() will reject all URBs.
2077 */ 2082 */
2078 for (i = 0; i < num_eps; i++) { 2083 for (i = 0; i < num_eps; i++) {
@@ -2386,10 +2391,18 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2386 /* Everything but endpoint 0 is disabled, so free or cache the rings. */ 2391 /* Everything but endpoint 0 is disabled, so free or cache the rings. */
2387 last_freed_endpoint = 1; 2392 last_freed_endpoint = 1;
2388 for (i = 1; i < 31; ++i) { 2393 for (i = 1; i < 31; ++i) {
2389 if (!virt_dev->eps[i].ring) 2394 struct xhci_virt_ep *ep = &virt_dev->eps[i];
2390 continue; 2395
2391 xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); 2396 if (ep->ep_state & EP_HAS_STREAMS) {
2392 last_freed_endpoint = i; 2397 xhci_free_stream_info(xhci, ep->stream_info);
2398 ep->stream_info = NULL;
2399 ep->ep_state &= ~EP_HAS_STREAMS;
2400 }
2401
2402 if (ep->ring) {
2403 xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i);
2404 last_freed_endpoint = i;
2405 }
2393 } 2406 }
2394 xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); 2407 xhci_dbg(xhci, "Output context after successful reset device cmd:\n");
2395 xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint); 2408 xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 711de253bc0f..ba1be6b7cc6d 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -30,6 +30,7 @@
30 30
31/* Code sharing between pci-quirks and xhci hcd */ 31/* Code sharing between pci-quirks and xhci hcd */
32#include "xhci-ext-caps.h" 32#include "xhci-ext-caps.h"
33#include "pci-quirks.h"
33 34
34/* xHCI PCI Configuration Registers */ 35/* xHCI PCI Configuration Registers */
35#define XHCI_SBRN_OFFSET (0x60) 36#define XHCI_SBRN_OFFSET (0x60)
@@ -232,7 +233,7 @@ struct xhci_op_regs {
232 * notification type that matches a bit set in this bit field. 233 * notification type that matches a bit set in this bit field.
233 */ 234 */
234#define DEV_NOTE_MASK (0xffff) 235#define DEV_NOTE_MASK (0xffff)
235#define ENABLE_DEV_NOTE(x) (1 << x) 236#define ENABLE_DEV_NOTE(x) (1 << (x))
236/* Most of the device notification types should only be used for debug. 237/* Most of the device notification types should only be used for debug.
237 * SW does need to pay attention to function wake notifications. 238 * SW does need to pay attention to function wake notifications.
238 */ 239 */
@@ -348,6 +349,9 @@ struct xhci_op_regs {
348/* Initiate a warm port reset - complete when PORT_WRC is '1' */ 349/* Initiate a warm port reset - complete when PORT_WRC is '1' */
349#define PORT_WR (1 << 31) 350#define PORT_WR (1 << 31)
350 351
352/* We mark duplicate entries with -1 */
353#define DUPLICATE_ENTRY ((u8)(-1))
354
351/* Port Power Management Status and Control - port_power_base bitmasks */ 355/* Port Power Management Status and Control - port_power_base bitmasks */
352/* Inactivity timer value for transitions into U1, in microseconds. 356/* Inactivity timer value for transitions into U1, in microseconds.
353 * Timeout can be up to 127us. 0xFF means an infinite timeout. 357 * Timeout can be up to 127us. 0xFF means an infinite timeout.
@@ -601,11 +605,11 @@ struct xhci_ep_ctx {
601#define EP_STATE_STOPPED 3 605#define EP_STATE_STOPPED 3
602#define EP_STATE_ERROR 4 606#define EP_STATE_ERROR 4
603/* Mult - Max number of burtst within an interval, in EP companion desc. */ 607/* Mult - Max number of burtst within an interval, in EP companion desc. */
604#define EP_MULT(p) ((p & 0x3) << 8) 608#define EP_MULT(p) (((p) & 0x3) << 8)
605/* bits 10:14 are Max Primary Streams */ 609/* bits 10:14 are Max Primary Streams */
606/* bit 15 is Linear Stream Array */ 610/* bit 15 is Linear Stream Array */
607/* Interval - period between requests to an endpoint - 125u increments. */ 611/* Interval - period between requests to an endpoint - 125u increments. */
608#define EP_INTERVAL(p) ((p & 0xff) << 16) 612#define EP_INTERVAL(p) (((p) & 0xff) << 16)
609#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) 613#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
610#define EP_MAXPSTREAMS_MASK (0x1f << 10) 614#define EP_MAXPSTREAMS_MASK (0x1f << 10)
611#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) 615#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
@@ -873,7 +877,7 @@ struct xhci_transfer_event {
873#define COMP_CMD_ABORT 25 877#define COMP_CMD_ABORT 25
874/* Stopped - transfer was terminated by a stop endpoint command */ 878/* Stopped - transfer was terminated by a stop endpoint command */
875#define COMP_STOP 26 879#define COMP_STOP 26
876/* Same as COMP_EP_STOPPED, but the transfered length in the event is invalid */ 880/* Same as COMP_EP_STOPPED, but the transferred length in the event is invalid */
877#define COMP_STOP_INVAL 27 881#define COMP_STOP_INVAL 27
878/* Control Abort Error - Debug Capability - control pipe aborted */ 882/* Control Abort Error - Debug Capability - control pipe aborted */
879#define COMP_DBG_ABORT 28 883#define COMP_DBG_ABORT 28
@@ -1276,6 +1280,7 @@ struct xhci_hcd {
1276#define XHCI_LINK_TRB_QUIRK (1 << 0) 1280#define XHCI_LINK_TRB_QUIRK (1 << 0)
1277#define XHCI_RESET_EP_QUIRK (1 << 1) 1281#define XHCI_RESET_EP_QUIRK (1 << 1)
1278#define XHCI_NEC_HOST (1 << 2) 1282#define XHCI_NEC_HOST (1 << 2)
1283#define XHCI_AMD_PLL_FIX (1 << 3)
1279 /* There are two roothubs to keep track of bus suspend info for */ 1284 /* There are two roothubs to keep track of bus suspend info for */
1280 struct xhci_bus_state bus_state[2]; 1285 struct xhci_bus_state bus_state[2];
1281 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ 1286 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index c90c89dc0003..a0037961e5bd 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -69,7 +69,7 @@
69 * 20000513 added IDs for all products supported by Windows driver (john) 69 * 20000513 added IDs for all products supported by Windows driver (john)
70 * 20000514 Rewrote mts_scsi_queuecommand to use URBs (john) 70 * 20000514 Rewrote mts_scsi_queuecommand to use URBs (john)
71 * 20000514 Version 0.0.8j 71 * 20000514 Version 0.0.8j
72 * 20000514 Fix reporting of non-existant devices to SCSI layer (john) 72 * 20000514 Fix reporting of non-existent devices to SCSI layer (john)
73 * 20000514 Added MTS_DEBUG_INT (john) 73 * 20000514 Added MTS_DEBUG_INT (john)
74 * 20000514 Changed "usb-microtek" to "microtek" for consistency (john) 74 * 20000514 Changed "usb-microtek" to "microtek" for consistency (john)
75 * 20000514 Stupid bug fixes (john) 75 * 20000514 Stupid bug fixes (john)
@@ -557,14 +557,14 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
557 557
558 if ( !memcmp( srb->cmnd, mts_read_image_sig, mts_read_image_sig_len ) 558 if ( !memcmp( srb->cmnd, mts_read_image_sig, mts_read_image_sig_len )
559) { pipe = usb_rcvbulkpipe(desc->usb_dev,desc->ep_image); 559) { pipe = usb_rcvbulkpipe(desc->usb_dev,desc->ep_image);
560 MTS_DEBUG( "transfering from desc->ep_image == %d\n", 560 MTS_DEBUG( "transferring from desc->ep_image == %d\n",
561 (int)desc->ep_image ); 561 (int)desc->ep_image );
562 } else if ( MTS_DIRECTION_IS_IN(srb->cmnd[0]) ) { 562 } else if ( MTS_DIRECTION_IS_IN(srb->cmnd[0]) ) {
563 pipe = usb_rcvbulkpipe(desc->usb_dev,desc->ep_response); 563 pipe = usb_rcvbulkpipe(desc->usb_dev,desc->ep_response);
564 MTS_DEBUG( "transfering from desc->ep_response == %d\n", 564 MTS_DEBUG( "transferring from desc->ep_response == %d\n",
565 (int)desc->ep_response); 565 (int)desc->ep_response);
566 } else { 566 } else {
567 MTS_DEBUG("transfering to desc->ep_out == %d\n", 567 MTS_DEBUG("transferring to desc->ep_out == %d\n",
568 (int)desc->ep_out); 568 (int)desc->ep_out);
569 pipe = usb_sndbulkpipe(desc->usb_dev,desc->ep_out); 569 pipe = usb_sndbulkpipe(desc->usb_dev,desc->ep_out);
570 } 570 }
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 1fa6ce3e4a23..68ab460a735c 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -282,6 +282,7 @@ static int appledisplay_probe(struct usb_interface *iface,
282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d", 282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
283 atomic_inc_return(&count_displays) - 1); 283 atomic_inc_return(&count_displays) - 1);
284 memset(&props, 0, sizeof(struct backlight_properties)); 284 memset(&props, 0, sizeof(struct backlight_properties));
285 props.type = BACKLIGHT_RAW;
285 props.max_brightness = 0xff; 286 props.max_brightness = 0xff;
286 pdata->bd = backlight_device_register(bl_name, NULL, pdata, 287 pdata->bd = backlight_device_register(bl_name, NULL, pdata,
287 &appledisplay_bl_data, &props); 288 &appledisplay_bl_data, &props);
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index e573e4704015..a2190b983f52 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -40,7 +40,7 @@
40#ifdef CONFIG_USB_DYNAMIC_MINORS 40#ifdef CONFIG_USB_DYNAMIC_MINORS
41#define IOWARRIOR_MINOR_BASE 0 41#define IOWARRIOR_MINOR_BASE 0
42#else 42#else
43#define IOWARRIOR_MINOR_BASE 208 // SKELETON_MINOR_BASE 192 + 16, not offical yet 43#define IOWARRIOR_MINOR_BASE 208 // SKELETON_MINOR_BASE 192 + 16, not official yet
44#endif 44#endif
45 45
46/* interrupt input queue size */ 46/* interrupt input queue size */
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index f7a205738032..8b1d94a76914 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -177,12 +177,11 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
177 spin_lock_irqsave(&priv->asynclock, flags); 177 spin_lock_irqsave(&priv->asynclock, flags);
178 list_add_tail(&rq->asynclist, &priv->asynclist); 178 list_add_tail(&rq->asynclist, &priv->asynclist);
179 spin_unlock_irqrestore(&priv->asynclock, flags); 179 spin_unlock_irqrestore(&priv->asynclock, flags);
180 kref_get(&rq->ref_count);
180 ret = usb_submit_urb(rq->urb, mem_flags); 181 ret = usb_submit_urb(rq->urb, mem_flags);
181 if (!ret) { 182 if (!ret)
182 kref_get(&rq->ref_count);
183 return rq; 183 return rq;
184 } 184 destroy_async(&rq->ref_count);
185 kref_put(&rq->ref_count, destroy_async);
186 err("submit_async_request submit_urb failed with %d", ret); 185 err("submit_async_request submit_urb failed with %d", ret);
187 return NULL; 186 return NULL;
188} 187}
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 4cbb7e4b368d..74073b363c30 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -14,7 +14,7 @@ config USB_MUSB_HDRC
14 select TWL4030_USB if MACH_OMAP_3430SDP 14 select TWL4030_USB if MACH_OMAP_3430SDP
15 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 15 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
16 select USB_OTG_UTILS 16 select USB_OTG_UTILS
17 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 17 bool 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
18 help 18 help
19 Say Y here if your system has a dual role high speed USB 19 Say Y here if your system has a dual role high speed USB
20 controller based on the Mentor Graphics silicon IP. Then 20 controller based on the Mentor Graphics silicon IP. Then
@@ -30,8 +30,8 @@ config USB_MUSB_HDRC
30 30
31 If you do not know what this is, please say N. 31 If you do not know what this is, please say N.
32 32
33 To compile this driver as a module, choose M here; the 33# To compile this driver as a module, choose M here; the
34 module will be called "musb-hdrc". 34# module will be called "musb-hdrc".
35 35
36choice 36choice
37 prompt "Platform Glue Layer" 37 prompt "Platform Glue Layer"
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 9d49d1cd7ce2..8e2a1ff8a35a 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -21,6 +21,7 @@
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22 22
23#include "musb_core.h" 23#include "musb_core.h"
24#include "musbhsdma.h"
24#include "blackfin.h" 25#include "blackfin.h"
25 26
26struct bfin_glue { 27struct bfin_glue {
@@ -322,7 +323,7 @@ static void bfin_musb_try_idle(struct musb *musb, unsigned long timeout)
322 mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); 323 mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
323} 324}
324 325
325static int bfin_musb_get_vbus_status(struct musb *musb) 326static int bfin_musb_vbus_status(struct musb *musb)
326{ 327{
327 return 0; 328 return 0;
328} 329}
@@ -332,6 +333,27 @@ static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode)
332 return -EIO; 333 return -EIO;
333} 334}
334 335
336static int bfin_musb_adjust_channel_params(struct dma_channel *channel,
337 u16 packet_sz, u8 *mode,
338 dma_addr_t *dma_addr, u32 *len)
339{
340 struct musb_dma_channel *musb_channel = channel->private_data;
341
342 /*
343 * Anomaly 05000450 might cause data corruption when using DMA
344 * MODE 1 transmits with short packet. So to work around this,
345 * we truncate all MODE 1 transfers down to a multiple of the
346 * max packet size, and then do the last short packet transfer
347 * (if there is any) using MODE 0.
348 */
349 if (ANOMALY_05000450) {
350 if (musb_channel->transmit && *mode == 1)
351 *len = *len - (*len % packet_sz);
352 }
353
354 return 0;
355}
356
335static void bfin_musb_reg_init(struct musb *musb) 357static void bfin_musb_reg_init(struct musb *musb)
336{ 358{
337 if (ANOMALY_05000346) { 359 if (ANOMALY_05000346) {
@@ -430,6 +452,8 @@ static const struct musb_platform_ops bfin_ops = {
430 452
431 .vbus_status = bfin_musb_vbus_status, 453 .vbus_status = bfin_musb_vbus_status,
432 .set_vbus = bfin_musb_set_vbus, 454 .set_vbus = bfin_musb_set_vbus,
455
456 .adjust_channel_params = bfin_musb_adjust_channel_params,
433}; 457};
434 458
435static u64 bfin_dmamask = DMA_BIT_MASK(32); 459static u64 bfin_dmamask = DMA_BIT_MASK(32);
@@ -540,7 +564,7 @@ static struct dev_pm_ops bfin_pm_ops = {
540 .resume = bfin_resume, 564 .resume = bfin_resume,
541}; 565};
542 566
543#define DEV_PM_OPS &bfin_pm_op, 567#define DEV_PM_OPS &bfin_pm_ops
544#else 568#else
545#define DEV_PM_OPS NULL 569#define DEV_PM_OPS NULL
546#endif 570#endif
@@ -548,7 +572,7 @@ static struct dev_pm_ops bfin_pm_ops = {
548static struct platform_driver bfin_driver = { 572static struct platform_driver bfin_driver = {
549 .remove = __exit_p(bfin_remove), 573 .remove = __exit_p(bfin_remove),
550 .driver = { 574 .driver = {
551 .name = "musb-bfin", 575 .name = "musb-blackfin",
552 .pm = DEV_PM_OPS, 576 .pm = DEV_PM_OPS,
553 }, 577 },
554}; 578};
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index de55a3c3259a..ab434fbd8c35 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -597,12 +597,12 @@ cppi_next_tx_segment(struct musb *musb, struct cppi_channel *tx)
597 length = min(n_bds * maxpacket, length); 597 length = min(n_bds * maxpacket, length);
598 } 598 }
599 599
600 DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%x len %u\n", 600 DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%llx len %u\n",
601 tx->index, 601 tx->index,
602 maxpacket, 602 maxpacket,
603 rndis ? "rndis" : "transparent", 603 rndis ? "rndis" : "transparent",
604 n_bds, 604 n_bds,
605 addr, length); 605 (unsigned long long)addr, length);
606 606
607 cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); 607 cppi_rndis_update(tx, 0, musb->ctrl_base, rndis);
608 608
@@ -820,7 +820,7 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket)
820 length = min(n_bds * maxpacket, length); 820 length = min(n_bds * maxpacket, length);
821 821
822 DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " 822 DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) "
823 "dma 0x%x len %u %u/%u\n", 823 "dma 0x%llx len %u %u/%u\n",
824 rx->index, maxpacket, 824 rx->index, maxpacket,
825 onepacket 825 onepacket
826 ? (is_rndis ? "rndis" : "onepacket") 826 ? (is_rndis ? "rndis" : "onepacket")
@@ -829,7 +829,8 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket)
829 musb_readl(tibase, 829 musb_readl(tibase,
830 DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) 830 DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4))
831 & 0xffff, 831 & 0xffff,
832 addr, length, rx->channel.actual_len, rx->buf_len); 832 (unsigned long long)addr, length,
833 rx->channel.actual_len, rx->buf_len);
833 834
834 /* only queue one segment at a time, since the hardware prevents 835 /* only queue one segment at a time, since the hardware prevents
835 * correct queue shutdown after unexpected short packets 836 * correct queue shutdown after unexpected short packets
@@ -1039,9 +1040,9 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
1039 if (!completed && (bd->hw_options & CPPI_OWN_SET)) 1040 if (!completed && (bd->hw_options & CPPI_OWN_SET))
1040 break; 1041 break;
1041 1042
1042 DBG(5, "C/RXBD %08x: nxt %08x buf %08x " 1043 DBG(5, "C/RXBD %llx: nxt %08x buf %08x "
1043 "off.len %08x opt.len %08x (%d)\n", 1044 "off.len %08x opt.len %08x (%d)\n",
1044 bd->dma, bd->hw_next, bd->hw_bufp, 1045 (unsigned long long)bd->dma, bd->hw_next, bd->hw_bufp,
1045 bd->hw_off_len, bd->hw_options, 1046 bd->hw_off_len, bd->hw_options,
1046 rx->channel.actual_len); 1047 rx->channel.actual_len);
1047 1048
@@ -1111,11 +1112,12 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
1111 musb_ep_select(cppi->mregs, rx->index + 1); 1112 musb_ep_select(cppi->mregs, rx->index + 1);
1112 csr = musb_readw(regs, MUSB_RXCSR); 1113 csr = musb_readw(regs, MUSB_RXCSR);
1113 if (csr & MUSB_RXCSR_DMAENAB) { 1114 if (csr & MUSB_RXCSR_DMAENAB) {
1114 DBG(4, "list%d %p/%p, last %08x%s, csr %04x\n", 1115 DBG(4, "list%d %p/%p, last %llx%s, csr %04x\n",
1115 rx->index, 1116 rx->index,
1116 rx->head, rx->tail, 1117 rx->head, rx->tail,
1117 rx->last_processed 1118 rx->last_processed
1118 ? rx->last_processed->dma 1119 ? (unsigned long long)
1120 rx->last_processed->dma
1119 : 0, 1121 : 0,
1120 completed ? ", completed" : "", 1122 completed ? ", completed" : "",
1121 csr); 1123 csr);
@@ -1167,8 +1169,11 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
1167 tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); 1169 tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG);
1168 rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); 1170 rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG);
1169 1171
1170 if (!tx && !rx) 1172 if (!tx && !rx) {
1173 if (cppi->irq)
1174 spin_unlock_irqrestore(&musb->lock, flags);
1171 return IRQ_NONE; 1175 return IRQ_NONE;
1176 }
1172 1177
1173 DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); 1178 DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx);
1174 1179
@@ -1199,7 +1204,7 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
1199 */ 1204 */
1200 if (NULL == bd) { 1205 if (NULL == bd) {
1201 DBG(1, "null BD\n"); 1206 DBG(1, "null BD\n");
1202 tx_ram->tx_complete = 0; 1207 musb_writel(&tx_ram->tx_complete, 0, 0);
1203 continue; 1208 continue;
1204 } 1209 }
1205 1210
@@ -1452,7 +1457,7 @@ static int cppi_channel_abort(struct dma_channel *channel)
1452 * compare mode by writing 1 to the tx_complete register. 1457 * compare mode by writing 1 to the tx_complete register.
1453 */ 1458 */
1454 cppi_reset_tx(tx_ram, 1); 1459 cppi_reset_tx(tx_ram, 1);
1455 cppi_ch->head = 0; 1460 cppi_ch->head = NULL;
1456 musb_writel(&tx_ram->tx_complete, 0, 1); 1461 musb_writel(&tx_ram->tx_complete, 0, 1);
1457 cppi_dump_tx(5, cppi_ch, " (done teardown)"); 1462 cppi_dump_tx(5, cppi_ch, " (done teardown)");
1458 1463
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 630ae7f3cd4c..f10ff00ca09e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1030,6 +1030,7 @@ static void musb_shutdown(struct platform_device *pdev)
1030 struct musb *musb = dev_to_musb(&pdev->dev); 1030 struct musb *musb = dev_to_musb(&pdev->dev);
1031 unsigned long flags; 1031 unsigned long flags;
1032 1032
1033 pm_runtime_get_sync(musb->controller);
1033 spin_lock_irqsave(&musb->lock, flags); 1034 spin_lock_irqsave(&musb->lock, flags);
1034 musb_platform_disable(musb); 1035 musb_platform_disable(musb);
1035 musb_generic_disable(musb); 1036 musb_generic_disable(musb);
@@ -1040,6 +1041,7 @@ static void musb_shutdown(struct platform_device *pdev)
1040 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); 1041 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
1041 musb_platform_exit(musb); 1042 musb_platform_exit(musb);
1042 1043
1044 pm_runtime_put(musb->controller);
1043 /* FIXME power down */ 1045 /* FIXME power down */
1044} 1046}
1045 1047
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 4bd9e2145ee4..0e053b587960 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -261,6 +261,7 @@ enum musb_g_ep0_state {
261 * @try_ilde: tries to idle the IP 261 * @try_ilde: tries to idle the IP
262 * @vbus_status: returns vbus status if possible 262 * @vbus_status: returns vbus status if possible
263 * @set_vbus: forces vbus status 263 * @set_vbus: forces vbus status
264 * @channel_program: pre check for standard dma channel_program func
264 */ 265 */
265struct musb_platform_ops { 266struct musb_platform_ops {
266 int (*init)(struct musb *musb); 267 int (*init)(struct musb *musb);
@@ -274,6 +275,10 @@ struct musb_platform_ops {
274 275
275 int (*vbus_status)(struct musb *musb); 276 int (*vbus_status)(struct musb *musb);
276 void (*set_vbus)(struct musb *musb, int on); 277 void (*set_vbus)(struct musb *musb, int on);
278
279 int (*adjust_channel_params)(struct dma_channel *channel,
280 u16 packet_sz, u8 *mode,
281 dma_addr_t *dma_addr, u32 *len);
277}; 282};
278 283
279/* 284/*
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 5c7b321d3959..f47c20197c61 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -535,7 +535,7 @@ void musb_g_tx(struct musb *musb, u8 epnum)
535 is_dma = 1; 535 is_dma = 1;
536 csr |= MUSB_TXCSR_P_WZC_BITS; 536 csr |= MUSB_TXCSR_P_WZC_BITS;
537 csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | 537 csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN |
538 MUSB_TXCSR_TXPKTRDY); 538 MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET);
539 musb_writew(epio, MUSB_TXCSR, csr); 539 musb_writew(epio, MUSB_TXCSR, csr);
540 /* Ensure writebuffer is empty. */ 540 /* Ensure writebuffer is empty. */
541 csr = musb_readw(epio, MUSB_TXCSR); 541 csr = musb_readw(epio, MUSB_TXCSR);
@@ -1296,7 +1296,7 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
1296 } 1296 }
1297 1297
1298 /* if the hardware doesn't have the request, easy ... */ 1298 /* if the hardware doesn't have the request, easy ... */
1299 if (musb_ep->req_list.next != &request->list || musb_ep->busy) 1299 if (musb_ep->req_list.next != &req->list || musb_ep->busy)
1300 musb_g_giveback(musb_ep, request, -ECONNRESET); 1300 musb_g_giveback(musb_ep, request, -ECONNRESET);
1301 1301
1302 /* ... else abort the dma transfer ... */ 1302 /* ... else abort the dma transfer ... */
@@ -1880,18 +1880,16 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1880 if (retval < 0) { 1880 if (retval < 0) {
1881 DBG(1, "add_hcd failed, %d\n", retval); 1881 DBG(1, "add_hcd failed, %d\n", retval);
1882 goto err2; 1882 goto err2;
1883
1884 if ((musb->xceiv->last_event == USB_EVENT_ID)
1885 && musb->xceiv->set_vbus)
1886 otg_set_vbus(musb->xceiv, 1);
1887 } 1883 }
1888 1884
1889 hcd->self.uses_pio_for_control = 1; 1885 if ((musb->xceiv->last_event == USB_EVENT_ID)
1890 1886 && musb->xceiv->set_vbus)
1891 if (musb->xceiv->last_event == USB_EVENT_NONE) 1887 otg_set_vbus(musb->xceiv, 1);
1892 pm_runtime_put(musb->controller);
1893 1888
1889 hcd->self.uses_pio_for_control = 1;
1894 } 1890 }
1891 if (musb->xceiv->last_event == USB_EVENT_NONE)
1892 pm_runtime_put(musb->controller);
1895 1893
1896 return 0; 1894 return 0;
1897 1895
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 0144a2d481fd..d281792db05c 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -169,6 +169,14 @@ static int dma_channel_program(struct dma_channel *channel,
169 BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || 169 BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN ||
170 channel->status == MUSB_DMA_STATUS_BUSY); 170 channel->status == MUSB_DMA_STATUS_BUSY);
171 171
172 /* Let targets check/tweak the arguments */
173 if (musb->ops->adjust_channel_params) {
174 int ret = musb->ops->adjust_channel_params(channel,
175 packet_sz, &mode, &dma_addr, &len);
176 if (ret)
177 return ret;
178 }
179
172 /* 180 /*
173 * The DMA engine in RTL1.8 and above cannot handle 181 * The DMA engine in RTL1.8 and above cannot handle
174 * DMA addresses that are not aligned to a 4 byte boundary. 182 * DMA addresses that are not aligned to a 4 byte boundary.
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 25cb8b0003b1..e9e60b6e0583 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -259,9 +259,10 @@ static int musb_otg_notifications(struct notifier_block *nb,
259 case USB_EVENT_VBUS: 259 case USB_EVENT_VBUS:
260 DBG(4, "VBUS Connect\n"); 260 DBG(4, "VBUS Connect\n");
261 261
262#ifdef CONFIG_USB_GADGET_MUSB_HDRC
262 if (musb->gadget_driver) 263 if (musb->gadget_driver)
263 pm_runtime_get_sync(musb->controller); 264 pm_runtime_get_sync(musb->controller);
264 265#endif
265 otg_init(musb->xceiv); 266 otg_init(musb->xceiv);
266 break; 267 break;
267 268
@@ -269,7 +270,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
269 DBG(4, "VBUS Disconnect\n"); 270 DBG(4, "VBUS Disconnect\n");
270 271
271#ifdef CONFIG_USB_GADGET_MUSB_HDRC 272#ifdef CONFIG_USB_GADGET_MUSB_HDRC
272 if (is_otg_enabled(musb)) 273 if (is_otg_enabled(musb) || is_peripheral_enabled(musb))
273 if (musb->gadget_driver) 274 if (musb->gadget_driver)
274#endif 275#endif
275 { 276 {
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 2ba3b070ed0b..c47aac4a1f98 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -943,7 +943,7 @@ static void tusb_musb_enable(struct musb *musb)
943 musb_writel(tbase, TUSB_INT_CTRL_CONF, 943 musb_writel(tbase, TUSB_INT_CTRL_CONF,
944 TUSB_INT_CTRL_CONF_INT_RELCYC(0)); 944 TUSB_INT_CTRL_CONF_INT_RELCYC(0));
945 945
946 set_irq_type(musb->nIrq, IRQ_TYPE_LEVEL_LOW); 946 irq_set_irq_type(musb->nIrq, IRQ_TYPE_LEVEL_LOW);
947 947
948 /* maybe force into the Default-A OTG state machine */ 948 /* maybe force into the Default-A OTG state machine */
949 if (!(musb_readl(tbase, TUSB_DEV_OTG_STAT) 949 if (!(musb_readl(tbase, TUSB_DEV_OTG_STAT)
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index d6384e4aeef9..f7e04bf34a13 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -93,6 +93,8 @@ static int __init ux500_probe(struct platform_device *pdev)
93 } 93 }
94 94
95 musb->dev.parent = &pdev->dev; 95 musb->dev.parent = &pdev->dev;
96 musb->dev.dma_mask = pdev->dev.dma_mask;
97 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
96 98
97 glue->dev = &pdev->dev; 99 glue->dev = &pdev->dev;
98 glue->musb = musb; 100 glue->musb = musb;
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index 8c6fdef61d1c..e25700f44b6f 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -1531,7 +1531,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
1531 i2c_set_clientdata(i2c, isp); 1531 i2c_set_clientdata(i2c, isp);
1532 isp->client = i2c; 1532 isp->client = i2c;
1533 1533
1534 /* verify the chip (shouldn't be necesary) */ 1534 /* verify the chip (shouldn't be necessary) */
1535 status = isp1301_get_u16(isp, ISP1301_VENDOR_ID); 1535 status = isp1301_get_u16(isp, ISP1301_VENDOR_ID);
1536 if (status != I2C_VENDOR_ID_PHILIPS) { 1536 if (status != I2C_VENDOR_ID_PHILIPS) {
1537 dev_dbg(&i2c->dev, "not philips id: %d\n", status); 1537 dev_dbg(&i2c->dev, "not philips id: %d\n", status);
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index 7f9b8cd4514b..e973ff19c55a 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -580,7 +580,7 @@ static void langwell_otg_add_ktimer(enum langwell_otg_timer_type timers)
580 time = TB_BUS_SUSPEND; 580 time = TB_BUS_SUSPEND;
581 break; 581 break;
582 default: 582 default:
583 dev_dbg(lnw->dev, "unkown timer, cannot enable it\n"); 583 dev_dbg(lnw->dev, "unknown timer, cannot enable it\n");
584 return; 584 return;
585 } 585 }
586 586
@@ -1381,7 +1381,7 @@ static void langwell_otg_work(struct work_struct *work)
1381 } else if (!iotg->hsm.a_bus_req && iotg->otg.host && 1381 } else if (!iotg->hsm.a_bus_req && iotg->otg.host &&
1382 iotg->otg.host->b_hnp_enable) { 1382 iotg->otg.host->b_hnp_enable) {
1383 /* It is not safe enough to do a fast 1383 /* It is not safe enough to do a fast
1384 * transistion from A_WAIT_BCON to 1384 * transition from A_WAIT_BCON to
1385 * A_SUSPEND */ 1385 * A_SUSPEND */
1386 msleep(10000); 1386 msleep(10000);
1387 if (iotg->hsm.a_bus_req) 1387 if (iotg->hsm.a_bus_req)
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 0db6ace16f7b..aba201cb872c 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -16,7 +16,7 @@
16 * When reading the process is almost equal except that the header starts with 16 * When reading the process is almost equal except that the header starts with
17 * 0x00 0x20. 17 * 0x00 0x20.
18 * 18 *
19 * The device simply need some stuff to understand data comming from the usb 19 * The device simply need some stuff to understand data coming from the usb
20 * buffer: The First and Second byte is used for a Header, the Third and Fourth 20 * buffer: The First and Second byte is used for a Header, the Third and Fourth
21 * tells the device the amount of information the package holds. 21 * tells the device the amount of information the package holds.
22 * Packages are 60 bytes long Header Stuff. 22 * Packages are 60 bytes long Header Stuff.
@@ -30,7 +30,7 @@
30 * one. 30 * one.
31 * 31 *
32 * The driver registers himself with the USB-serial core and the USB Core. I had 32 * The driver registers himself with the USB-serial core and the USB Core. I had
33 * to implement a probe function agains USB-serial, because other way, the 33 * to implement a probe function against USB-serial, because other way, the
34 * driver was attaching himself to both interfaces. I have tryed with different 34 * driver was attaching himself to both interfaces. I have tryed with different
35 * configurations of usb_serial_driver with out exit, only the probe function 35 * configurations of usb_serial_driver with out exit, only the probe function
36 * could handle this correctly. 36 * could handle this correctly.
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4df3e0cecbae..0f11afdda134 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -101,7 +101,7 @@ static const struct usb_device_id id_table[] = {
101 { USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */ 101 { USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */
102 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 102 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
103 { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ 103 { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */
104 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demostration module */ 104 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
105 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesys ETRX2USB */ 105 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesys ETRX2USB */
106 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ 106 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
107 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ 107 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 987e9bf7bd02..d9906eb9d16a 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -35,7 +35,7 @@
35 * 35 *
36 * Lonnie Mendez <dignome@gmail.com> 36 * Lonnie Mendez <dignome@gmail.com>
37 * 04-10-2004 37 * 04-10-2004
38 * Driver modified to support dynamic line settings. Various improvments 38 * Driver modified to support dynamic line settings. Various improvements
39 * and features. 39 * and features.
40 * 40 *
41 * Neil Whelchel 41 * Neil Whelchel
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 65967b36365f..4de6ef0ae52a 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -17,7 +17,7 @@
17 * See Documentation/usb/usb-serial.txt for more information on using this 17 * See Documentation/usb/usb-serial.txt for more information on using this
18 * driver 18 * driver
19 * 19 *
20 * See http://ftdi-usb-sio.sourceforge.net for upto date testing info 20 * See http://ftdi-usb-sio.sourceforge.net for up to date testing info
21 * and extra documentation 21 * and extra documentation
22 * 22 *
23 * Change entries from 2004 and earlier can be found in versions of this 23 * Change entries from 2004 and earlier can be found in versions of this
@@ -151,6 +151,8 @@ static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
151 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! 151 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report!
152 */ 152 */
153static struct usb_device_id id_table_combined [] = { 153static struct usb_device_id id_table_combined [] = {
154 { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) },
155 { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) },
154 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, 156 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
155 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, 157 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
156 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, 158 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
@@ -525,6 +527,7 @@ static struct usb_device_id id_table_combined [] = {
525 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 527 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) },
526 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, 528 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) },
527 { USB_DEVICE(OCT_VID, OCT_US101_PID) }, 529 { USB_DEVICE(OCT_VID, OCT_US101_PID) },
530 { USB_DEVICE(OCT_VID, OCT_DK201_PID) },
528 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), 531 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID),
529 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, 532 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk },
530 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), 533 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID),
@@ -787,6 +790,8 @@ static struct usb_device_id id_table_combined [] = {
787 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 790 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
788 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 791 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
789 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 792 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
793 { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
794 { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
790 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, 795 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) },
791 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, 796 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) },
792 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, 797 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index c543e55bafba..efffc23723bd 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -300,6 +300,8 @@
300 * Hameg HO820 and HO870 interface (using VID 0x0403) 300 * Hameg HO820 and HO870 interface (using VID 0x0403)
301 */ 301 */
302#define HAMEG_HO820_PID 0xed74 302#define HAMEG_HO820_PID 0xed74
303#define HAMEG_HO730_PID 0xed73
304#define HAMEG_HO720_PID 0xed72
303#define HAMEG_HO870_PID 0xed71 305#define HAMEG_HO870_PID 0xed71
304 306
305/* 307/*
@@ -572,6 +574,7 @@
572/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ 574/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
573/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ 575/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
574/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ 576/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
577#define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */
575#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ 578#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
576 579
577/* 580/*
@@ -1141,3 +1144,12 @@
1141#define QIHARDWARE_VID 0x20B7 1144#define QIHARDWARE_VID 0x20B7
1142#define MILKYMISTONE_JTAGSERIAL_PID 0x0713 1145#define MILKYMISTONE_JTAGSERIAL_PID 0x0713
1143 1146
1147/*
1148 * CTI GmbH RS485 Converter http://www.cti-lean.com/
1149 */
1150/* USB-485-Mini*/
1151#define FTDI_CTI_MINI_PID 0xF608
1152/* USB-Nano-485*/
1153#define FTDI_CTI_NANO_PID 0xF60B
1154
1155
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index f1aedfa7c420..abf095be5753 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1981,7 +1981,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
1981 if (code == IOSP_STATUS_OPEN_RSP) { 1981 if (code == IOSP_STATUS_OPEN_RSP) {
1982 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); 1982 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3);
1983 edge_port->maxTxCredits = edge_port->txCredits; 1983 edge_port->maxTxCredits = edge_port->txCredits;
1984 dbg("%s - Port %u Open Response Inital MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits); 1984 dbg("%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits);
1985 handle_new_msr(edge_port, byte2); 1985 handle_new_msr(edge_port, byte2);
1986 1986
1987 /* send the current line settings to the port so we are 1987 /* send the current line settings to the port so we are
diff --git a/drivers/usb/serial/io_edgeport.h b/drivers/usb/serial/io_edgeport.h
index dced7ec65470..ad9c1d47a619 100644
--- a/drivers/usb/serial/io_edgeport.h
+++ b/drivers/usb/serial/io_edgeport.h
@@ -68,7 +68,7 @@ struct comMapper {
68#define PROC_SET_COM_ENTRY 2 68#define PROC_SET_COM_ENTRY 2
69 69
70 70
71/* The following sturcture is passed to the write */ 71/* The following structure is passed to the write */
72struct procWrite { 72struct procWrite {
73 int Command; 73 int Command;
74 union { 74 union {
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index d8434910fa7b..0aac00afb5c8 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -433,7 +433,7 @@ static int write_i2c_mem(struct edgeport_serial *serial,
433 433
434 /* We can only send a maximum of 1 aligned byte page at a time */ 434 /* We can only send a maximum of 1 aligned byte page at a time */
435 435
436 /* calulate the number of bytes left in the first page */ 436 /* calculate the number of bytes left in the first page */
437 write_length = EPROM_PAGE_SIZE - 437 write_length = EPROM_PAGE_SIZE -
438 (start_address & (EPROM_PAGE_SIZE - 1)); 438 (start_address & (EPROM_PAGE_SIZE - 1));
439 439
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index d2c019637e45..ba0d28727ccb 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -106,7 +106,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state);
106static int mct_u232_tiocmget(struct tty_struct *tty); 106static int mct_u232_tiocmget(struct tty_struct *tty);
107static int mct_u232_tiocmset(struct tty_struct *tty, 107static int mct_u232_tiocmset(struct tty_struct *tty,
108 unsigned int set, unsigned int clear); 108 unsigned int set, unsigned int clear);
109static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 109static int mct_u232_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
111static int mct_u232_get_icount(struct tty_struct *tty, 111static int mct_u232_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount); 112 struct serial_icounter_struct *icount);
@@ -874,7 +874,7 @@ static void mct_u232_unthrottle(struct tty_struct *tty)
874 } 874 }
875} 875}
876 876
877static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 877static int mct_u232_ioctl(struct tty_struct *tty,
878 unsigned int cmd, unsigned long arg) 878 unsigned int cmd, unsigned long arg)
879{ 879{
880 DEFINE_WAIT(wait); 880 DEFINE_WAIT(wait);
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 201f6096844b..1b5633f46984 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -116,7 +116,7 @@ static void opticon_read_bulk_callback(struct urb *urb)
116 } else { 116 } else {
117 if ((data[0] == 0x00) && (data[1] == 0x01)) { 117 if ((data[0] == 0x00) && (data[1] == 0x01)) {
118 spin_lock_irqsave(&priv->lock, flags); 118 spin_lock_irqsave(&priv->lock, flags);
119 /* CTS status infomation package */ 119 /* CTS status information package */
120 if (data[2] == 0x00) 120 if (data[2] == 0x00)
121 priv->cts = false; 121 priv->cts = false;
122 else 122 else
@@ -413,7 +413,7 @@ static int opticon_tiocmget(struct tty_struct *tty)
413 return result; 413 return result;
414} 414}
415 415
416static int opticon_tiocmset(struct tty_struct *tty, struct file *file, 416static int opticon_tiocmset(struct tty_struct *tty,
417 unsigned int set, unsigned int clear) 417 unsigned int set, unsigned int clear)
418{ 418{
419 struct usb_serial_port *port = tty->driver_data; 419 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 75c7f456eed5..d77ff0435896 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -407,6 +407,10 @@ static void option_instat_callback(struct urb *urb);
407/* ONDA MT825UP HSDPA 14.2 modem */ 407/* ONDA MT825UP HSDPA 14.2 modem */
408#define ONDA_MT825UP 0x000b 408#define ONDA_MT825UP 0x000b
409 409
410/* Samsung products */
411#define SAMSUNG_VENDOR_ID 0x04e8
412#define SAMSUNG_PRODUCT_GT_B3730 0x6889
413
410/* some devices interfaces need special handling due to a number of reasons */ 414/* some devices interfaces need special handling due to a number of reasons */
411enum option_blacklist_reason { 415enum option_blacklist_reason {
412 OPTION_BLACKLIST_NONE = 0, 416 OPTION_BLACKLIST_NONE = 0,
@@ -968,6 +972,7 @@ static const struct usb_device_id option_ids[] = {
968 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, 972 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
969 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ 973 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
970 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ 974 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
975 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/
971 { } /* Terminating entry */ 976 { } /* Terminating entry */
972}; 977};
973MODULE_DEVICE_TABLE(usb, option_ids); 978MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 8858201eb1d3..54a9dab1f33b 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -111,7 +111,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
111 ifnum = intf->desc.bInterfaceNumber; 111 ifnum = intf->desc.bInterfaceNumber;
112 dbg("This Interface = %d", ifnum); 112 dbg("This Interface = %d", ifnum);
113 113
114 data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), 114 data = kzalloc(sizeof(struct usb_wwan_intf_private),
115 GFP_KERNEL); 115 GFP_KERNEL);
116 if (!data) 116 if (!data)
117 return -ENOMEM; 117 return -ENOMEM;
@@ -134,8 +134,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
134 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { 134 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
135 dbg("QDL port found"); 135 dbg("QDL port found");
136 136
137 if (serial->interface->num_altsetting == 1) 137 if (serial->interface->num_altsetting == 1) {
138 return 0; 138 retval = 0; /* Success */
139 break;
140 }
139 141
140 retval = usb_set_interface(serial->dev, ifnum, 1); 142 retval = usb_set_interface(serial->dev, ifnum, 1);
141 if (retval < 0) { 143 if (retval < 0) {
@@ -145,7 +147,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
145 retval = -ENODEV; 147 retval = -ENODEV;
146 kfree(data); 148 kfree(data);
147 } 149 }
148 return retval;
149 } 150 }
150 break; 151 break;
151 152
@@ -166,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
166 "Could not set interface, error %d\n", 167 "Could not set interface, error %d\n",
167 retval); 168 retval);
168 retval = -ENODEV; 169 retval = -ENODEV;
170 kfree(data);
169 } 171 }
170 } else if (ifnum == 2) { 172 } else if (ifnum == 2) {
171 dbg("Modem port found"); 173 dbg("Modem port found");
@@ -177,7 +179,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
177 retval = -ENODEV; 179 retval = -ENODEV;
178 kfree(data); 180 kfree(data);
179 } 181 }
180 return retval;
181 } else if (ifnum==3) { 182 } else if (ifnum==3) {
182 /* 183 /*
183 * NMEA (serial line 9600 8N1) 184 * NMEA (serial line 9600 8N1)
@@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
191 "Could not set interface, error %d\n", 192 "Could not set interface, error %d\n",
192 retval); 193 retval);
193 retval = -ENODEV; 194 retval = -ENODEV;
195 kfree(data);
194 } 196 }
195 } 197 }
196 break; 198 break;
@@ -199,12 +201,27 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
199 dev_err(&serial->dev->dev, 201 dev_err(&serial->dev->dev,
200 "unknown number of interfaces: %d\n", nintf); 202 "unknown number of interfaces: %d\n", nintf);
201 kfree(data); 203 kfree(data);
202 return -ENODEV; 204 retval = -ENODEV;
203 } 205 }
204 206
207 /* Set serial->private if not returning -ENODEV */
208 if (retval != -ENODEV)
209 usb_set_serial_data(serial, data);
205 return retval; 210 return retval;
206} 211}
207 212
213static void qc_release(struct usb_serial *serial)
214{
215 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
216
217 dbg("%s", __func__);
218
219 /* Call usb_wwan release & free the private data allocated in qcprobe */
220 usb_wwan_release(serial);
221 usb_set_serial_data(serial, NULL);
222 kfree(priv);
223}
224
208static struct usb_serial_driver qcdevice = { 225static struct usb_serial_driver qcdevice = {
209 .driver = { 226 .driver = {
210 .owner = THIS_MODULE, 227 .owner = THIS_MODULE,
@@ -222,7 +239,7 @@ static struct usb_serial_driver qcdevice = {
222 .chars_in_buffer = usb_wwan_chars_in_buffer, 239 .chars_in_buffer = usb_wwan_chars_in_buffer,
223 .attach = usb_wwan_startup, 240 .attach = usb_wwan_startup,
224 .disconnect = usb_wwan_disconnect, 241 .disconnect = usb_wwan_disconnect,
225 .release = usb_wwan_release, 242 .release = qc_release,
226#ifdef CONFIG_PM 243#ifdef CONFIG_PM
227 .suspend = usb_wwan_suspend, 244 .suspend = usb_wwan_suspend,
228 .resume = usb_wwan_resume, 245 .resume = usb_wwan_resume,
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index a65ddd543869..e4fad5e643d7 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -698,8 +698,7 @@ static void play_delayed(struct usb_serial_port *port)
698 /* we have to throw away the rest */ 698 /* we have to throw away the rest */
699 do { 699 do {
700 unbusy_queued_urb(urb, portdata); 700 unbusy_queued_urb(urb, portdata);
701 //extremely dirty 701 usb_autopm_put_interface_no_suspend(port->serial->interface);
702 atomic_dec(&port->serial->interface->dev.power.usage_count);
703 } while ((urb = usb_get_from_anchor(&portdata->delayed))); 702 } while ((urb = usb_get_from_anchor(&portdata->delayed)));
704 break; 703 break;
705 } 704 }
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 08e03745e251..0e5aafda4537 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -562,7 +562,7 @@ static int ene_sd_init(struct us_data *us)
562 562
563 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); 563 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0);
564 if (result != USB_STOR_XFER_GOOD) { 564 if (result != USB_STOR_XFER_GOOD) {
565 US_DEBUGP("Exection SD Init Code Fail !!\n"); 565 US_DEBUGP("Execution SD Init Code Fail !!\n");
566 return USB_STOR_TRANSPORT_ERROR; 566 return USB_STOR_TRANSPORT_ERROR;
567 } 567 }
568 568
@@ -581,7 +581,7 @@ static int ene_sd_init(struct us_data *us)
581 581
582 result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); 582 result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0);
583 if (result != USB_STOR_XFER_GOOD) { 583 if (result != USB_STOR_XFER_GOOD) {
584 US_DEBUGP("Exection SD Init Code Fail !!\n"); 584 US_DEBUGP("Execution SD Init Code Fail !!\n");
585 return USB_STOR_TRANSPORT_ERROR; 585 return USB_STOR_TRANSPORT_ERROR;
586 } 586 }
587 587
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 6b9982cd5423..09e52ba47ddf 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1510,7 +1510,7 @@ static int isd200_Initialization(struct us_data *us)
1510 * Protocol and Transport for the ISD200 ASIC 1510 * Protocol and Transport for the ISD200 ASIC
1511 * 1511 *
1512 * This protocol and transport are for ATA devices connected to an ISD200 1512 * This protocol and transport are for ATA devices connected to an ISD200
1513 * ASIC. An ATAPI device that is conected as a slave device will be 1513 * ASIC. An ATAPI device that is connected as a slave device will be
1514 * detected in the driver initialization function and the protocol will 1514 * detected in the driver initialization function and the protocol will
1515 * be changed to an ATAPI protocol (Transparent SCSI). 1515 * be changed to an ATAPI protocol (Transparent SCSI).
1516 * 1516 *
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 689ee1fb702a..13b8bcdf3dba 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -123,7 +123,7 @@ static int slave_configure(struct scsi_device *sdev)
123{ 123{
124 struct us_data *us = host_to_us(sdev->host); 124 struct us_data *us = host_to_us(sdev->host);
125 125
126 /* Many devices have trouble transfering more than 32KB at a time, 126 /* Many devices have trouble transferring more than 32KB at a time,
127 * while others have trouble with more than 64K. At this time we 127 * while others have trouble with more than 64K. At this time we
128 * are limiting both to 32K (64 sectores). 128 * are limiting both to 32K (64 sectores).
129 */ 129 */
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index bd3f415893d8..0b00091d2ae9 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -340,7 +340,7 @@ static int usbat_check_status(struct us_data *us)
340} 340}
341 341
342/* 342/*
343 * Stores critical information in internal registers in prepartion for the execution 343 * Stores critical information in internal registers in preparation for the execution
344 * of a conditional usbat_read_blocks or usbat_write_blocks call. 344 * of a conditional usbat_read_blocks or usbat_write_blocks call.
345 */ 345 */
346static int usbat_set_shuttle_features(struct us_data *us, 346static int usbat_set_shuttle_features(struct us_data *us,
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index 827c87f10cc5..7e4bf95f8f7b 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -180,7 +180,7 @@ static void bytewise_xor(void *_bo, const void *_bi1, const void *_bi2,
180 * using the 14 bytes of @a to fill up 180 * using the 14 bytes of @a to fill up
181 * b1.{mac_header,e0,security_reserved,padding}. 181 * b1.{mac_header,e0,security_reserved,padding}.
182 * 182 *
183 * NOTE: The definiton of l(a) in WUSB1.0[6.5] vs the definition of 183 * NOTE: The definition of l(a) in WUSB1.0[6.5] vs the definition of
184 * l(m) is orthogonal, they bear no relationship, so it is not 184 * l(m) is orthogonal, they bear no relationship, so it is not
185 * in conflict with the parameter's relation that 185 * in conflict with the parameter's relation that
186 * WUSB1.0[6.4.2]) defines. 186 * WUSB1.0[6.4.2]) defines.
@@ -272,7 +272,7 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
272 272
273 /* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5] 273 /* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5]
274 * The procedure is to AES crypt the A0 block and XOR the MIC 274 * The procedure is to AES crypt the A0 block and XOR the MIC
275 * Tag agains it; we only do the first 8 bytes and place it 275 * Tag against it; we only do the first 8 bytes and place it
276 * directly in the destination buffer. 276 * directly in the destination buffer.
277 * 277 *
278 * POS Crypto API: size is assumed to be AES's block size. 278 * POS Crypto API: size is assumed to be AES's block size.
diff --git a/drivers/usb/wusbcore/reservation.c b/drivers/usb/wusbcore/reservation.c
index 4ed97360c046..6f4fafdc2401 100644
--- a/drivers/usb/wusbcore/reservation.c
+++ b/drivers/usb/wusbcore/reservation.c
@@ -71,7 +71,7 @@ static void wusbhc_rsv_complete_cb(struct uwb_rsv *rsv)
71 71
72/** 72/**
73 * wusbhc_rsv_establish - establish a reservation for the cluster 73 * wusbhc_rsv_establish - establish a reservation for the cluster
74 * @wusbhc: the WUSB HC requesting a bandwith reservation 74 * @wusbhc: the WUSB HC requesting a bandwidth reservation
75 */ 75 */
76int wusbhc_rsv_establish(struct wusbhc *wusbhc) 76int wusbhc_rsv_establish(struct wusbhc *wusbhc)
77{ 77{
diff --git a/drivers/usb/wusbcore/rh.c b/drivers/usb/wusbcore/rh.c
index c175b7300c73..39de3900ad20 100644
--- a/drivers/usb/wusbcore/rh.c
+++ b/drivers/usb/wusbcore/rh.c
@@ -133,7 +133,7 @@ static int wusbhc_rh_port_reset(struct wusbhc *wusbhc, u8 port_idx)
133 * big of a problem [and we can't make it an spinlock 133 * big of a problem [and we can't make it an spinlock
134 * because other parts need to take it and sleep] . 134 * because other parts need to take it and sleep] .
135 * 135 *
136 * @usb_hcd is refcounted, so it won't dissapear under us 136 * @usb_hcd is refcounted, so it won't disappear under us
137 * and before killing a host, the polling of the root hub 137 * and before killing a host, the polling of the root hub
138 * would be stopped anyway. 138 * would be stopped anyway.
139 */ 139 */
diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c
index 8cb9d80207fa..ca80171f42c6 100644
--- a/drivers/usb/wusbcore/wa-rpipe.c
+++ b/drivers/usb/wusbcore/wa-rpipe.c
@@ -24,7 +24,7 @@
24 * 24 *
25 * RPIPE 25 * RPIPE
26 * 26 *
27 * Targetted at different downstream endpoints 27 * Targeted at different downstream endpoints
28 * 28 *
29 * Descriptor: use to config the remote pipe. 29 * Descriptor: use to config the remote pipe.
30 * 30 *
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 84b744c428a4..6ccd93a9b909 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -61,7 +61,7 @@
61 * 61 *
62 * Two methods it could be done: 62 * Two methods it could be done:
63 * 63 *
64 * (a) set up a timer everytime an rpipe's use count drops to 1 64 * (a) set up a timer every time an rpipe's use count drops to 1
65 * (which means unused) or when a transfer ends. Reset the 65 * (which means unused) or when a transfer ends. Reset the
66 * timer when a xfer is queued. If the timer expires, release 66 * timer when a xfer is queued. If the timer expires, release
67 * the rpipe [see rpipe_ep_disable()]. 67 * the rpipe [see rpipe_ep_disable()].
@@ -140,7 +140,7 @@ struct wa_xfer {
140 140
141 struct wahc *wa; /* Wire adapter we are plugged to */ 141 struct wahc *wa; /* Wire adapter we are plugged to */
142 struct usb_host_endpoint *ep; 142 struct usb_host_endpoint *ep;
143 struct urb *urb; /* URB we are transfering for */ 143 struct urb *urb; /* URB we are transferring for */
144 struct wa_seg **seg; /* transfer segments */ 144 struct wa_seg **seg; /* transfer segments */
145 u8 segs, segs_submitted, segs_done; 145 u8 segs, segs_submitted, segs_done;
146 unsigned is_inbound:1; 146 unsigned is_inbound:1;
@@ -161,7 +161,7 @@ static inline void wa_xfer_init(struct wa_xfer *xfer)
161} 161}
162 162
163/* 163/*
164 * Destory a transfer structure 164 * Destroy a transfer structure
165 * 165 *
166 * Note that the xfer->seg[index] thingies follow the URB life cycle, 166 * Note that the xfer->seg[index] thingies follow the URB life cycle,
167 * so we need to put them, not free them. 167 * so we need to put them, not free them.
@@ -494,7 +494,7 @@ static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
494 * function does almost the same thing and they work closely 494 * function does almost the same thing and they work closely
495 * together. 495 * together.
496 * 496 *
497 * If the seg request has failed but this DTO phase has suceeded, 497 * If the seg request has failed but this DTO phase has succeeded,
498 * wa_seg_cb() has already failed the segment and moved the 498 * wa_seg_cb() has already failed the segment and moved the
499 * status to WA_SEG_ERROR, so this will go through 'case 0' and 499 * status to WA_SEG_ERROR, so this will go through 'case 0' and
500 * effectively do nothing. 500 * effectively do nothing.
diff --git a/drivers/usb/wusbcore/wusbhc.h b/drivers/usb/wusbcore/wusbhc.h
index 6bd426b7ec07..3a2d09162e70 100644
--- a/drivers/usb/wusbcore/wusbhc.h
+++ b/drivers/usb/wusbcore/wusbhc.h
@@ -231,7 +231,7 @@ struct wusb_port {
231 * 231 *
232 * Most of the times when you need to use it, it will be non-NULL, 232 * Most of the times when you need to use it, it will be non-NULL,
233 * so there is no real need to check for it (wusb_dev will 233 * so there is no real need to check for it (wusb_dev will
234 * dissapear before usb_dev). 234 * disappear before usb_dev).
235 * 235 *
236 * - The following fields need to be filled out before calling 236 * - The following fields need to be filled out before calling
237 * wusbhc_create(): ports_max, mmcies_max, mmcie_{add,rm}. 237 * wusbhc_create(): ports_max, mmcies_max, mmcie_{add,rm}.