aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/chipidea/udc.c59
-rw-r--r--drivers/usb/class/cdc-wdm.c12
-rw-r--r--drivers/usb/core/quirks.c4
-rw-r--r--drivers/usb/dwc3/core.c9
-rw-r--r--drivers/usb/dwc3/ep0.c1
-rw-r--r--drivers/usb/dwc3/gadget.c19
-rw-r--r--drivers/usb/gadget/at91_udc.c6
-rw-r--r--drivers/usb/gadget/dummy_hcd.c41
-rw-r--r--drivers/usb/gadget/f_fs.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c3
-rw-r--r--drivers/usb/gadget/u_serial.c4
-rw-r--r--drivers/usb/host/ehci-q.c12
-rw-r--r--drivers/usb/host/ohci-at91.c10
-rw-r--r--drivers/usb/host/pci-quirks.c42
-rw-r--r--drivers/usb/host/pci-quirks.h1
-rw-r--r--drivers/usb/host/xhci-hub.c42
-rw-r--r--drivers/usb/host/xhci-plat.c2
-rw-r--r--drivers/usb/host/xhci.c123
-rw-r--r--drivers/usb/host/xhci.h6
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/musbhsdma.c2
-rw-r--r--drivers/usb/musb/tusb6010.c2
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c22
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h29
-rw-r--r--drivers/usb/serial/option.c6
26 files changed, 410 insertions, 57 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index c7a032a4f0c..d214448b677 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n)
78} 78}
79 79
80/** 80/**
81 * hw_device_state: enables/disables interrupts & starts/stops device (execute 81 * hw_device_state: enables/disables interrupts (execute without interruption)
82 * without interruption)
83 * @dma: 0 => disable, !0 => enable and set dma engine 82 * @dma: 0 => disable, !0 => enable and set dma engine
84 * 83 *
85 * This function returns an error code 84 * This function returns an error code
@@ -91,9 +90,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
91 /* interrupt, error, port change, reset, sleep/suspend */ 90 /* interrupt, error, port change, reset, sleep/suspend */
92 hw_write(ci, OP_USBINTR, ~0, 91 hw_write(ci, OP_USBINTR, ~0,
93 USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); 92 USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
94 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
95 } else { 93 } else {
96 hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
97 hw_write(ci, OP_USBINTR, ~0, 0); 94 hw_write(ci, OP_USBINTR, ~0, 0);
98 } 95 }
99 return 0; 96 return 0;
@@ -774,10 +771,7 @@ __acquires(mEp->lock)
774{ 771{
775 struct ci13xxx_req *mReq, *mReqTemp; 772 struct ci13xxx_req *mReq, *mReqTemp;
776 struct ci13xxx_ep *mEpTemp = mEp; 773 struct ci13xxx_ep *mEpTemp = mEp;
777 int uninitialized_var(retval); 774 int retval = 0;
778
779 if (list_empty(&mEp->qh.queue))
780 return -EINVAL;
781 775
782 list_for_each_entry_safe(mReq, mReqTemp, &mEp->qh.queue, 776 list_for_each_entry_safe(mReq, mReqTemp, &mEp->qh.queue,
783 queue) { 777 queue) {
@@ -1420,6 +1414,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
1420 return -ENOTSUPP; 1414 return -ENOTSUPP;
1421} 1415}
1422 1416
1417/* Change Data+ pullup status
1418 * this func is used by usb_gadget_connect/disconnet
1419 */
1420static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
1421{
1422 struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
1423
1424 if (is_on)
1425 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
1426 else
1427 hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
1428
1429 return 0;
1430}
1431
1423static int ci13xxx_start(struct usb_gadget *gadget, 1432static int ci13xxx_start(struct usb_gadget *gadget,
1424 struct usb_gadget_driver *driver); 1433 struct usb_gadget_driver *driver);
1425static int ci13xxx_stop(struct usb_gadget *gadget, 1434static int ci13xxx_stop(struct usb_gadget *gadget,
@@ -1432,6 +1441,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
1432static const struct usb_gadget_ops usb_gadget_ops = { 1441static const struct usb_gadget_ops usb_gadget_ops = {
1433 .vbus_session = ci13xxx_vbus_session, 1442 .vbus_session = ci13xxx_vbus_session,
1434 .wakeup = ci13xxx_wakeup, 1443 .wakeup = ci13xxx_wakeup,
1444 .pullup = ci13xxx_pullup,
1435 .vbus_draw = ci13xxx_vbus_draw, 1445 .vbus_draw = ci13xxx_vbus_draw,
1436 .udc_start = ci13xxx_start, 1446 .udc_start = ci13xxx_start,
1437 .udc_stop = ci13xxx_stop, 1447 .udc_stop = ci13xxx_stop,
@@ -1455,7 +1465,12 @@ static int init_eps(struct ci13xxx *ci)
1455 1465
1456 mEp->ep.name = mEp->name; 1466 mEp->ep.name = mEp->name;
1457 mEp->ep.ops = &usb_ep_ops; 1467 mEp->ep.ops = &usb_ep_ops;
1458 mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; 1468 /*
1469 * for ep0: maxP defined in desc, for other
1470 * eps, maxP is set by epautoconfig() called
1471 * by gadget layer
1472 */
1473 mEp->ep.maxpacket = (unsigned short)~0;
1459 1474
1460 INIT_LIST_HEAD(&mEp->qh.queue); 1475 INIT_LIST_HEAD(&mEp->qh.queue);
1461 mEp->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL, 1476 mEp->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL,
@@ -1475,6 +1490,7 @@ static int init_eps(struct ci13xxx *ci)
1475 else 1490 else
1476 ci->ep0in = mEp; 1491 ci->ep0in = mEp;
1477 1492
1493 mEp->ep.maxpacket = CTRL_PAYLOAD_MAX;
1478 continue; 1494 continue;
1479 } 1495 }
1480 1496
@@ -1484,6 +1500,17 @@ static int init_eps(struct ci13xxx *ci)
1484 return retval; 1500 return retval;
1485} 1501}
1486 1502
1503static void destroy_eps(struct ci13xxx *ci)
1504{
1505 int i;
1506
1507 for (i = 0; i < ci->hw_ep_max; i++) {
1508 struct ci13xxx_ep *mEp = &ci->ci13xxx_ep[i];
1509
1510 dma_pool_free(ci->qh_pool, mEp->qh.ptr, mEp->qh.dma);
1511 }
1512}
1513
1487/** 1514/**
1488 * ci13xxx_start: register a gadget driver 1515 * ci13xxx_start: register a gadget driver
1489 * @gadget: our gadget 1516 * @gadget: our gadget
@@ -1691,7 +1718,7 @@ static int udc_start(struct ci13xxx *ci)
1691 if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { 1718 if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
1692 if (ci->transceiver == NULL) { 1719 if (ci->transceiver == NULL) {
1693 retval = -ENODEV; 1720 retval = -ENODEV;
1694 goto free_pools; 1721 goto destroy_eps;
1695 } 1722 }
1696 } 1723 }
1697 1724
@@ -1729,7 +1756,7 @@ static int udc_start(struct ci13xxx *ci)
1729 1756
1730remove_trans: 1757remove_trans:
1731 if (!IS_ERR_OR_NULL(ci->transceiver)) { 1758 if (!IS_ERR_OR_NULL(ci->transceiver)) {
1732 otg_set_peripheral(ci->transceiver->otg, &ci->gadget); 1759 otg_set_peripheral(ci->transceiver->otg, NULL);
1733 if (ci->global_phy) 1760 if (ci->global_phy)
1734 usb_put_phy(ci->transceiver); 1761 usb_put_phy(ci->transceiver);
1735 } 1762 }
@@ -1742,6 +1769,8 @@ unreg_device:
1742put_transceiver: 1769put_transceiver:
1743 if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy) 1770 if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy)
1744 usb_put_phy(ci->transceiver); 1771 usb_put_phy(ci->transceiver);
1772destroy_eps:
1773 destroy_eps(ci);
1745free_pools: 1774free_pools:
1746 dma_pool_destroy(ci->td_pool); 1775 dma_pool_destroy(ci->td_pool);
1747free_qh_pool: 1776free_qh_pool:
@@ -1756,18 +1785,12 @@ free_qh_pool:
1756 */ 1785 */
1757static void udc_stop(struct ci13xxx *ci) 1786static void udc_stop(struct ci13xxx *ci)
1758{ 1787{
1759 int i;
1760
1761 if (ci == NULL) 1788 if (ci == NULL)
1762 return; 1789 return;
1763 1790
1764 usb_del_gadget_udc(&ci->gadget); 1791 usb_del_gadget_udc(&ci->gadget);
1765 1792
1766 for (i = 0; i < ci->hw_ep_max; i++) { 1793 destroy_eps(ci);
1767 struct ci13xxx_ep *mEp = &ci->ci13xxx_ep[i];
1768
1769 dma_pool_free(ci->qh_pool, mEp->qh.ptr, mEp->qh.dma);
1770 }
1771 1794
1772 dma_pool_destroy(ci->td_pool); 1795 dma_pool_destroy(ci->td_pool);
1773 dma_pool_destroy(ci->qh_pool); 1796 dma_pool_destroy(ci->qh_pool);
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 65a55abb791..5f0cb417b73 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -109,12 +109,14 @@ static struct usb_driver wdm_driver;
109/* return intfdata if we own the interface, else look up intf in the list */ 109/* return intfdata if we own the interface, else look up intf in the list */
110static struct wdm_device *wdm_find_device(struct usb_interface *intf) 110static struct wdm_device *wdm_find_device(struct usb_interface *intf)
111{ 111{
112 struct wdm_device *desc = NULL; 112 struct wdm_device *desc;
113 113
114 spin_lock(&wdm_device_list_lock); 114 spin_lock(&wdm_device_list_lock);
115 list_for_each_entry(desc, &wdm_device_list, device_list) 115 list_for_each_entry(desc, &wdm_device_list, device_list)
116 if (desc->intf == intf) 116 if (desc->intf == intf)
117 break; 117 goto found;
118 desc = NULL;
119found:
118 spin_unlock(&wdm_device_list_lock); 120 spin_unlock(&wdm_device_list_lock);
119 121
120 return desc; 122 return desc;
@@ -122,12 +124,14 @@ static struct wdm_device *wdm_find_device(struct usb_interface *intf)
122 124
123static struct wdm_device *wdm_find_device_by_minor(int minor) 125static struct wdm_device *wdm_find_device_by_minor(int minor)
124{ 126{
125 struct wdm_device *desc = NULL; 127 struct wdm_device *desc;
126 128
127 spin_lock(&wdm_device_list_lock); 129 spin_lock(&wdm_device_list_lock);
128 list_for_each_entry(desc, &wdm_device_list, device_list) 130 list_for_each_entry(desc, &wdm_device_list, device_list)
129 if (desc->intf->minor == minor) 131 if (desc->intf->minor == minor)
130 break; 132 goto found;
133 desc = NULL;
134found:
131 spin_unlock(&wdm_device_list_lock); 135 spin_unlock(&wdm_device_list_lock);
132 136
133 return desc; 137 return desc;
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f15501f4c58..e77a8e8eaa2 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -71,6 +71,10 @@ static const struct usb_device_id usb_quirk_list[] = {
71 { USB_DEVICE(0x04b4, 0x0526), .driver_info = 71 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
72 USB_QUIRK_CONFIG_INTF_STRINGS }, 72 USB_QUIRK_CONFIG_INTF_STRINGS },
73 73
74 /* Microchip Joss Optical infrared touchboard device */
75 { USB_DEVICE(0x04d8, 0x000c), .driver_info =
76 USB_QUIRK_CONFIG_INTF_STRINGS },
77
74 /* Samsung Android phone modem - ID conflict with SPH-I500 */ 78 /* Samsung Android phone modem - ID conflict with SPH-I500 */
75 { USB_DEVICE(0x04e8, 0x6601), .driver_info = 79 { USB_DEVICE(0x04e8, 0x6601), .driver_info =
76 USB_QUIRK_CONFIG_INTF_STRINGS }, 80 USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index c34452a7304..a68ff53124d 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -436,16 +436,21 @@ static int __devinit dwc3_probe(struct platform_device *pdev)
436 dev_err(dev, "missing IRQ\n"); 436 dev_err(dev, "missing IRQ\n");
437 return -ENODEV; 437 return -ENODEV;
438 } 438 }
439 dwc->xhci_resources[1] = *res; 439 dwc->xhci_resources[1].start = res->start;
440 dwc->xhci_resources[1].end = res->end;
441 dwc->xhci_resources[1].flags = res->flags;
442 dwc->xhci_resources[1].name = res->name;
440 443
441 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 444 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
442 if (!res) { 445 if (!res) {
443 dev_err(dev, "missing memory resource\n"); 446 dev_err(dev, "missing memory resource\n");
444 return -ENODEV; 447 return -ENODEV;
445 } 448 }
446 dwc->xhci_resources[0] = *res; 449 dwc->xhci_resources[0].start = res->start;
447 dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + 450 dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
448 DWC3_XHCI_REGS_END; 451 DWC3_XHCI_REGS_END;
452 dwc->xhci_resources[0].flags = res->flags;
453 dwc->xhci_resources[0].name = res->name;
449 454
450 /* 455 /*
451 * Request memory region but exclude xHCI regs, 456 * Request memory region but exclude xHCI regs,
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 9b94886b66e..e4d5ca86b9d 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -720,7 +720,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
720 transferred = min_t(u32, ur->length, 720 transferred = min_t(u32, ur->length,
721 transfer_size - length); 721 transfer_size - length);
722 memcpy(ur->buf, dwc->ep0_bounce, transferred); 722 memcpy(ur->buf, dwc->ep0_bounce, transferred);
723 dwc->ep0_bounced = false;
724 } else { 723 } else {
725 transferred = ur->length - length; 724 transferred = ur->length - length;
726 } 725 }
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 58fdfad96b4..c2813c2b005 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -263,8 +263,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
263 if (req->request.status == -EINPROGRESS) 263 if (req->request.status == -EINPROGRESS)
264 req->request.status = status; 264 req->request.status = status;
265 265
266 usb_gadget_unmap_request(&dwc->gadget, &req->request, 266 if (dwc->ep0_bounced && dep->number == 0)
267 req->direction); 267 dwc->ep0_bounced = false;
268 else
269 usb_gadget_unmap_request(&dwc->gadget, &req->request,
270 req->direction);
268 271
269 dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n", 272 dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n",
270 req, dep->name, req->request.actual, 273 req, dep->name, req->request.actual,
@@ -1026,6 +1029,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
1026 if (list_empty(&dep->request_list)) { 1029 if (list_empty(&dep->request_list)) {
1027 dev_vdbg(dwc->dev, "ISOC ep %s run out for requests.\n", 1030 dev_vdbg(dwc->dev, "ISOC ep %s run out for requests.\n",
1028 dep->name); 1031 dep->name);
1032 dep->flags |= DWC3_EP_PENDING_REQUEST;
1029 return; 1033 return;
1030 } 1034 }
1031 1035
@@ -1089,6 +1093,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
1089 if (dep->flags & DWC3_EP_PENDING_REQUEST) { 1093 if (dep->flags & DWC3_EP_PENDING_REQUEST) {
1090 int ret; 1094 int ret;
1091 1095
1096 /*
1097 * If xfernotready is already elapsed and it is a case
1098 * of isoc transfer, then issue END TRANSFER, so that
1099 * you can receive xfernotready again and can have
1100 * notion of current microframe.
1101 */
1102 if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
1103 dwc3_stop_active_transfer(dwc, dep->number);
1104 return 0;
1105 }
1106
1092 ret = __dwc3_gadget_kick_transfer(dep, 0, true); 1107 ret = __dwc3_gadget_kick_transfer(dep, 0, true);
1093 if (ret && ret != -EBUSY) { 1108 if (ret && ret != -EBUSY) {
1094 struct dwc3 *dwc = dep->dwc; 1109 struct dwc3 *dwc = dep->dwc;
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index c9e66dfb02e..1e35963bd4e 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -475,8 +475,7 @@ static int at91_ep_enable(struct usb_ep *_ep,
475 unsigned long flags; 475 unsigned long flags;
476 476
477 if (!_ep || !ep 477 if (!_ep || !ep
478 || !desc || ep->ep.desc 478 || !desc || _ep->name == ep0name
479 || _ep->name == ep0name
480 || desc->bDescriptorType != USB_DT_ENDPOINT 479 || desc->bDescriptorType != USB_DT_ENDPOINT
481 || (maxpacket = usb_endpoint_maxp(desc)) == 0 480 || (maxpacket = usb_endpoint_maxp(desc)) == 0
482 || maxpacket > ep->maxpacket) { 481 || maxpacket > ep->maxpacket) {
@@ -530,7 +529,6 @@ ok:
530 tmp |= AT91_UDP_EPEDS; 529 tmp |= AT91_UDP_EPEDS;
531 __raw_writel(tmp, ep->creg); 530 __raw_writel(tmp, ep->creg);
532 531
533 ep->ep.desc = desc;
534 ep->ep.maxpacket = maxpacket; 532 ep->ep.maxpacket = maxpacket;
535 533
536 /* 534 /*
@@ -1635,7 +1633,6 @@ static int at91_start(struct usb_gadget *gadget,
1635 udc->driver = driver; 1633 udc->driver = driver;
1636 udc->gadget.dev.driver = &driver->driver; 1634 udc->gadget.dev.driver = &driver->driver;
1637 udc->gadget.dev.of_node = udc->pdev->dev.of_node; 1635 udc->gadget.dev.of_node = udc->pdev->dev.of_node;
1638 dev_set_drvdata(&udc->gadget.dev, &driver->driver);
1639 udc->enabled = 1; 1636 udc->enabled = 1;
1640 udc->selfpowered = 1; 1637 udc->selfpowered = 1;
1641 1638
@@ -1656,7 +1653,6 @@ static int at91_stop(struct usb_gadget *gadget,
1656 spin_unlock_irqrestore(&udc->lock, flags); 1653 spin_unlock_irqrestore(&udc->lock, flags);
1657 1654
1658 udc->gadget.dev.driver = NULL; 1655 udc->gadget.dev.driver = NULL;
1659 dev_set_drvdata(&udc->gadget.dev, NULL);
1660 udc->driver = NULL; 1656 udc->driver = NULL;
1661 1657
1662 DBG("unbound from %s\n", driver->driver.name); 1658 DBG("unbound from %s\n", driver->driver.name);
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index b799106027a..afdbb1cbf5d 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1916,6 +1916,27 @@ done:
1916 return retval; 1916 return retval;
1917} 1917}
1918 1918
1919/* usb 3.0 root hub device descriptor */
1920struct {
1921 struct usb_bos_descriptor bos;
1922 struct usb_ss_cap_descriptor ss_cap;
1923} __packed usb3_bos_desc = {
1924
1925 .bos = {
1926 .bLength = USB_DT_BOS_SIZE,
1927 .bDescriptorType = USB_DT_BOS,
1928 .wTotalLength = cpu_to_le16(sizeof(usb3_bos_desc)),
1929 .bNumDeviceCaps = 1,
1930 },
1931 .ss_cap = {
1932 .bLength = USB_DT_USB_SS_CAP_SIZE,
1933 .bDescriptorType = USB_DT_DEVICE_CAPABILITY,
1934 .bDevCapabilityType = USB_SS_CAP_TYPE,
1935 .wSpeedSupported = cpu_to_le16(USB_5GBPS_OPERATION),
1936 .bFunctionalitySupport = ilog2(USB_5GBPS_OPERATION),
1937 },
1938};
1939
1919static inline void 1940static inline void
1920ss_hub_descriptor(struct usb_hub_descriptor *desc) 1941ss_hub_descriptor(struct usb_hub_descriptor *desc)
1921{ 1942{
@@ -2006,6 +2027,18 @@ static int dummy_hub_control(
2006 else 2027 else
2007 hub_descriptor((struct usb_hub_descriptor *) buf); 2028 hub_descriptor((struct usb_hub_descriptor *) buf);
2008 break; 2029 break;
2030
2031 case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
2032 if (hcd->speed != HCD_USB3)
2033 goto error;
2034
2035 if ((wValue >> 8) != USB_DT_BOS)
2036 goto error;
2037
2038 memcpy(buf, &usb3_bos_desc, sizeof(usb3_bos_desc));
2039 retval = sizeof(usb3_bos_desc);
2040 break;
2041
2009 case GetHubStatus: 2042 case GetHubStatus:
2010 *(__le32 *) buf = cpu_to_le32(0); 2043 *(__le32 *) buf = cpu_to_le32(0);
2011 break; 2044 break;
@@ -2503,10 +2536,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2503 hs_hcd->has_tt = 1; 2536 hs_hcd->has_tt = 1;
2504 2537
2505 retval = usb_add_hcd(hs_hcd, 0, 0); 2538 retval = usb_add_hcd(hs_hcd, 0, 0);
2506 if (retval != 0) { 2539 if (retval)
2507 usb_put_hcd(hs_hcd); 2540 goto put_usb2_hcd;
2508 return retval;
2509 }
2510 2541
2511 if (mod_data.is_super_speed) { 2542 if (mod_data.is_super_speed) {
2512 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev, 2543 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev,
@@ -2525,6 +2556,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2525put_usb3_hcd: 2556put_usb3_hcd:
2526 usb_put_hcd(ss_hcd); 2557 usb_put_hcd(ss_hcd);
2527dealloc_usb2_hcd: 2558dealloc_usb2_hcd:
2559 usb_remove_hcd(hs_hcd);
2560put_usb2_hcd:
2528 usb_put_hcd(hs_hcd); 2561 usb_put_hcd(hs_hcd);
2529 the_controller.hs_hcd = the_controller.ss_hcd = NULL; 2562 the_controller.hs_hcd = the_controller.ss_hcd = NULL;
2530 return retval; 2563 return retval;
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 8adc79d1b40..829aba75a6d 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -34,11 +34,15 @@
34/* Debugging ****************************************************************/ 34/* Debugging ****************************************************************/
35 35
36#ifdef VERBOSE_DEBUG 36#ifdef VERBOSE_DEBUG
37#ifndef pr_vdebug
37# define pr_vdebug pr_debug 38# define pr_vdebug pr_debug
39#endif /* pr_vdebug */
38# define ffs_dump_mem(prefix, ptr, len) \ 40# define ffs_dump_mem(prefix, ptr, len) \
39 print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len) 41 print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len)
40#else 42#else
43#ifndef pr_vdebug
41# define pr_vdebug(...) do { } while (0) 44# define pr_vdebug(...) do { } while (0)
45#endif /* pr_vdebug */
42# define ffs_dump_mem(prefix, ptr, len) do { } while (0) 46# define ffs_dump_mem(prefix, ptr, len) do { } while (0)
43#endif /* VERBOSE_DEBUG */ 47#endif /* VERBOSE_DEBUG */
44 48
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index b13e0bb5f5b..0bb617e1dda 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3599,6 +3599,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3599 3599
3600 if (hsotg->num_of_eps == 0) { 3600 if (hsotg->num_of_eps == 0) {
3601 dev_err(dev, "wrong number of EPs (zero)\n"); 3601 dev_err(dev, "wrong number of EPs (zero)\n");
3602 ret = -EINVAL;
3602 goto err_supplies; 3603 goto err_supplies;
3603 } 3604 }
3604 3605
@@ -3606,6 +3607,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3606 GFP_KERNEL); 3607 GFP_KERNEL);
3607 if (!eps) { 3608 if (!eps) {
3608 dev_err(dev, "cannot get memory\n"); 3609 dev_err(dev, "cannot get memory\n");
3610 ret = -ENOMEM;
3609 goto err_supplies; 3611 goto err_supplies;
3610 } 3612 }
3611 3613
@@ -3622,6 +3624,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3622 GFP_KERNEL); 3624 GFP_KERNEL);
3623 if (!hsotg->ctrl_req) { 3625 if (!hsotg->ctrl_req) {
3624 dev_err(dev, "failed to allocate ctrl req\n"); 3626 dev_err(dev, "failed to allocate ctrl req\n");
3627 ret = -ENOMEM;
3625 goto err_ep_mem; 3628 goto err_ep_mem;
3626 } 3629 }
3627 3630
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 5b3f5fffea9..da6d479ff9a 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -132,11 +132,15 @@ static unsigned n_ports;
132 132
133 133
134#ifdef VERBOSE_DEBUG 134#ifdef VERBOSE_DEBUG
135#ifndef pr_vdebug
135#define pr_vdebug(fmt, arg...) \ 136#define pr_vdebug(fmt, arg...) \
136 pr_debug(fmt, ##arg) 137 pr_debug(fmt, ##arg)
138#endif /* pr_vdebug */
137#else 139#else
140#ifndef pr_vdebig
138#define pr_vdebug(fmt, arg...) \ 141#define pr_vdebug(fmt, arg...) \
139 ({ if (0) pr_debug(fmt, ##arg); }) 142 ({ if (0) pr_debug(fmt, ##arg); })
143#endif /* pr_vdebug */
140#endif 144#endif
141 145
142/*-------------------------------------------------------------------------*/ 146/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 9bc39ca460c..4b66374bdc8 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -128,9 +128,17 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
128 else { 128 else {
129 qtd = list_entry (qh->qtd_list.next, 129 qtd = list_entry (qh->qtd_list.next,
130 struct ehci_qtd, qtd_list); 130 struct ehci_qtd, qtd_list);
131 /* first qtd may already be partially processed */ 131 /*
132 if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) 132 * first qtd may already be partially processed.
133 * If we come here during unlink, the QH overlay region
134 * might have reference to the just unlinked qtd. The
135 * qtd is updated in qh_completions(). Update the QH
136 * overlay here.
137 */
138 if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) {
139 qh->hw->hw_qtd_next = qtd->hw_next;
133 qtd = NULL; 140 qtd = NULL;
141 }
134 } 142 }
135 143
136 if (qtd) 144 if (qtd)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a665b3eaa74..aaa8d2bce21 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -570,6 +570,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
570 570
571 if (pdata) { 571 if (pdata) {
572 at91_for_each_port(i) { 572 at91_for_each_port(i) {
573 /*
574 * do not configure PIO if not in relation with
575 * real USB port on board
576 */
577 if (i >= pdata->ports) {
578 pdata->vbus_pin[i] = -EINVAL;
579 pdata->overcurrent_pin[i] = -EINVAL;
580 break;
581 }
582
573 if (!gpio_is_valid(pdata->vbus_pin[i])) 583 if (!gpio_is_valid(pdata->vbus_pin[i]))
574 continue; 584 continue;
575 gpio = pdata->vbus_pin[i]; 585 gpio = pdata->vbus_pin[i];
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index c5e9e4a76f1..966d1484ee7 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -75,7 +75,9 @@
75#define NB_PIF0_PWRDOWN_1 0x01100013 75#define NB_PIF0_PWRDOWN_1 0x01100013
76 76
77#define USB_INTEL_XUSB2PR 0xD0 77#define USB_INTEL_XUSB2PR 0xD0
78#define USB_INTEL_USB2PRM 0xD4
78#define USB_INTEL_USB3_PSSEN 0xD8 79#define USB_INTEL_USB3_PSSEN 0xD8
80#define USB_INTEL_USB3PRM 0xDC
79 81
80static struct amd_chipset_info { 82static struct amd_chipset_info {
81 struct pci_dev *nb_dev; 83 struct pci_dev *nb_dev;
@@ -772,10 +774,18 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
772 return; 774 return;
773 } 775 }
774 776
775 ports_available = 0xffffffff; 777 /* Read USB3PRM, the USB 3.0 Port Routing Mask Register
778 * Indicate the ports that can be changed from OS.
779 */
780 pci_read_config_dword(xhci_pdev, USB_INTEL_USB3PRM,
781 &ports_available);
782
783 dev_dbg(&xhci_pdev->dev, "Configurable ports to enable SuperSpeed: 0x%x\n",
784 ports_available);
785
776 /* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable 786 /* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable
777 * Register, to turn on SuperSpeed terminations for all 787 * Register, to turn on SuperSpeed terminations for the
778 * available ports. 788 * switchable ports.
779 */ 789 */
780 pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, 790 pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN,
781 cpu_to_le32(ports_available)); 791 cpu_to_le32(ports_available));
@@ -785,7 +795,16 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
785 dev_dbg(&xhci_pdev->dev, "USB 3.0 ports that are now enabled " 795 dev_dbg(&xhci_pdev->dev, "USB 3.0 ports that are now enabled "
786 "under xHCI: 0x%x\n", ports_available); 796 "under xHCI: 0x%x\n", ports_available);
787 797
788 ports_available = 0xffffffff; 798 /* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register
799 * Indicate the USB 2.0 ports to be controlled by the xHCI host.
800 */
801
802 pci_read_config_dword(xhci_pdev, USB_INTEL_USB2PRM,
803 &ports_available);
804
805 dev_dbg(&xhci_pdev->dev, "Configurable USB 2.0 ports to hand over to xCHI: 0x%x\n",
806 ports_available);
807
789 /* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to 808 /* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to
790 * switch the USB 2.0 power and data lines over to the xHCI 809 * switch the USB 2.0 power and data lines over to the xHCI
791 * host. 810 * host.
@@ -822,12 +841,12 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
822 void __iomem *op_reg_base; 841 void __iomem *op_reg_base;
823 u32 val; 842 u32 val;
824 int timeout; 843 int timeout;
844 int len = pci_resource_len(pdev, 0);
825 845
826 if (!mmio_resource_enabled(pdev, 0)) 846 if (!mmio_resource_enabled(pdev, 0))
827 return; 847 return;
828 848
829 base = ioremap_nocache(pci_resource_start(pdev, 0), 849 base = ioremap_nocache(pci_resource_start(pdev, 0), len);
830 pci_resource_len(pdev, 0));
831 if (base == NULL) 850 if (base == NULL)
832 return; 851 return;
833 852
@@ -837,9 +856,17 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
837 */ 856 */
838 ext_cap_offset = xhci_find_next_cap_offset(base, XHCI_HCC_PARAMS_OFFSET); 857 ext_cap_offset = xhci_find_next_cap_offset(base, XHCI_HCC_PARAMS_OFFSET);
839 do { 858 do {
859 if ((ext_cap_offset + sizeof(val)) > len) {
860 /* We're reading garbage from the controller */
861 dev_warn(&pdev->dev,
862 "xHCI controller failing to respond");
863 return;
864 }
865
840 if (!ext_cap_offset) 866 if (!ext_cap_offset)
841 /* We've reached the end of the extended capabilities */ 867 /* We've reached the end of the extended capabilities */
842 goto hc_init; 868 goto hc_init;
869
843 val = readl(base + ext_cap_offset); 870 val = readl(base + ext_cap_offset);
844 if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY) 871 if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY)
845 break; 872 break;
@@ -870,9 +897,10 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
870 /* Disable any BIOS SMIs and clear all SMI events*/ 897 /* Disable any BIOS SMIs and clear all SMI events*/
871 writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); 898 writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
872 899
900hc_init:
873 if (usb_is_intel_switchable_xhci(pdev)) 901 if (usb_is_intel_switchable_xhci(pdev))
874 usb_enable_xhci_ports(pdev); 902 usb_enable_xhci_ports(pdev);
875hc_init: 903
876 op_reg_base = base + XHCI_HC_LENGTH(readl(base)); 904 op_reg_base = base + XHCI_HC_LENGTH(readl(base));
877 905
878 /* Wait for the host controller to be ready before writing any 906 /* Wait for the host controller to be ready before writing any
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index ef004a5de20..7f69a39163c 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -15,6 +15,7 @@ void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
15static inline void usb_amd_quirk_pll_disable(void) {} 15static inline void usb_amd_quirk_pll_disable(void) {}
16static inline void usb_amd_quirk_pll_enable(void) {} 16static inline void usb_amd_quirk_pll_enable(void) {}
17static inline void usb_amd_dev_put(void) {} 17static inline void usb_amd_dev_put(void) {}
18static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
18#endif /* CONFIG_PCI */ 19#endif /* CONFIG_PCI */
19 20
20#endif /* __LINUX_USB_PCI_QUIRKS_H */ 21#endif /* __LINUX_USB_PCI_QUIRKS_H */
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 74bfc868b7a..d5eb357aa5c 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -493,11 +493,48 @@ static void xhci_hub_report_link_state(u32 *status, u32 status_reg)
493 * when this bit is set. 493 * when this bit is set.
494 */ 494 */
495 pls |= USB_PORT_STAT_CONNECTION; 495 pls |= USB_PORT_STAT_CONNECTION;
496 } else {
497 /*
498 * If CAS bit isn't set but the Port is already at
499 * Compliance Mode, fake a connection so the USB core
500 * notices the Compliance state and resets the port.
501 * This resolves an issue generated by the SN65LVPE502CP
502 * in which sometimes the port enters compliance mode
503 * caused by a delay on the host-device negotiation.
504 */
505 if (pls == USB_SS_PORT_LS_COMP_MOD)
506 pls |= USB_PORT_STAT_CONNECTION;
496 } 507 }
508
497 /* update status field */ 509 /* update status field */
498 *status |= pls; 510 *status |= pls;
499} 511}
500 512
513/*
514 * Function for Compliance Mode Quirk.
515 *
516 * This Function verifies if all xhc USB3 ports have entered U0, if so,
517 * the compliance mode timer is deleted. A port won't enter
518 * compliance mode if it has previously entered U0.
519 */
520void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 status, u16 wIndex)
521{
522 u32 all_ports_seen_u0 = ((1 << xhci->num_usb3_ports)-1);
523 bool port_in_u0 = ((status & PORT_PLS_MASK) == XDEV_U0);
524
525 if (!(xhci->quirks & XHCI_COMP_MODE_QUIRK))
526 return;
527
528 if ((xhci->port_status_u0 != all_ports_seen_u0) && port_in_u0) {
529 xhci->port_status_u0 |= 1 << wIndex;
530 if (xhci->port_status_u0 == all_ports_seen_u0) {
531 del_timer_sync(&xhci->comp_mode_recovery_timer);
532 xhci_dbg(xhci, "All USB3 ports have entered U0 already!\n");
533 xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted.\n");
534 }
535 }
536}
537
501int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, 538int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
502 u16 wIndex, char *buf, u16 wLength) 539 u16 wIndex, char *buf, u16 wLength)
503{ 540{
@@ -651,6 +688,11 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
651 /* Update Port Link State for super speed ports*/ 688 /* Update Port Link State for super speed ports*/
652 if (hcd->speed == HCD_USB3) { 689 if (hcd->speed == HCD_USB3) {
653 xhci_hub_report_link_state(&status, temp); 690 xhci_hub_report_link_state(&status, temp);
691 /*
692 * Verify if all USB3 Ports Have entered U0 already.
693 * Delete Compliance Mode Timer if so.
694 */
695 xhci_del_comp_mod_timer(xhci, temp, wIndex);
654 } 696 }
655 if (bus_state->port_c_suspend & (1 << wIndex)) 697 if (bus_state->port_c_suspend & (1 << wIndex))
656 status |= 1 << USB_PORT_FEAT_C_SUSPEND; 698 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 689bc18b051..df90fe51b4a 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -118,7 +118,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
118 goto put_hcd; 118 goto put_hcd;
119 } 119 }
120 120
121 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); 121 hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
122 if (!hcd->regs) { 122 if (!hcd->regs) {
123 dev_dbg(&pdev->dev, "error mapping memory\n"); 123 dev_dbg(&pdev->dev, "error mapping memory\n");
124 ret = -EFAULT; 124 ret = -EFAULT;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c59d5b5b6c7..6ece0ed288d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -26,6 +26,7 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/dmi.h>
29 30
30#include "xhci.h" 31#include "xhci.h"
31 32
@@ -398,6 +399,95 @@ static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
398 399
399#endif 400#endif
400 401
402static void compliance_mode_recovery(unsigned long arg)
403{
404 struct xhci_hcd *xhci;
405 struct usb_hcd *hcd;
406 u32 temp;
407 int i;
408
409 xhci = (struct xhci_hcd *)arg;
410
411 for (i = 0; i < xhci->num_usb3_ports; i++) {
412 temp = xhci_readl(xhci, xhci->usb3_ports[i]);
413 if ((temp & PORT_PLS_MASK) == USB_SS_PORT_LS_COMP_MOD) {
414 /*
415 * Compliance Mode Detected. Letting USB Core
416 * handle the Warm Reset
417 */
418 xhci_dbg(xhci, "Compliance Mode Detected->Port %d!\n",
419 i + 1);
420 xhci_dbg(xhci, "Attempting Recovery routine!\n");
421 hcd = xhci->shared_hcd;
422
423 if (hcd->state == HC_STATE_SUSPENDED)
424 usb_hcd_resume_root_hub(hcd);
425
426 usb_hcd_poll_rh_status(hcd);
427 }
428 }
429
430 if (xhci->port_status_u0 != ((1 << xhci->num_usb3_ports)-1))
431 mod_timer(&xhci->comp_mode_recovery_timer,
432 jiffies + msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
433}
434
435/*
436 * Quirk to work around issue generated by the SN65LVPE502CP USB3.0 re-driver
437 * that causes ports behind that hardware to enter compliance mode sometimes.
438 * The quirk creates a timer that polls every 2 seconds the link state of
439 * each host controller's port and recovers it by issuing a Warm reset
440 * if Compliance mode is detected, otherwise the port will become "dead" (no
441 * device connections or disconnections will be detected anymore). Becasue no
442 * status event is generated when entering compliance mode (per xhci spec),
443 * this quirk is needed on systems that have the failing hardware installed.
444 */
445static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci)
446{
447 xhci->port_status_u0 = 0;
448 init_timer(&xhci->comp_mode_recovery_timer);
449
450 xhci->comp_mode_recovery_timer.data = (unsigned long) xhci;
451 xhci->comp_mode_recovery_timer.function = compliance_mode_recovery;
452 xhci->comp_mode_recovery_timer.expires = jiffies +
453 msecs_to_jiffies(COMP_MODE_RCVRY_MSECS);
454
455 set_timer_slack(&xhci->comp_mode_recovery_timer,
456 msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
457 add_timer(&xhci->comp_mode_recovery_timer);
458 xhci_dbg(xhci, "Compliance Mode Recovery Timer Initialized.\n");
459}
460
461/*
462 * This function identifies the systems that have installed the SN65LVPE502CP
463 * USB3.0 re-driver and that need the Compliance Mode Quirk.
464 * Systems:
465 * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820
466 */
467static bool compliance_mode_recovery_timer_quirk_check(void)
468{
469 const char *dmi_product_name, *dmi_sys_vendor;
470
471 dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
472 dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
473
474 if (!(strstr(dmi_sys_vendor, "Hewlett-Packard")))
475 return false;
476
477 if (strstr(dmi_product_name, "Z420") ||
478 strstr(dmi_product_name, "Z620") ||
479 strstr(dmi_product_name, "Z820"))
480 return true;
481
482 return false;
483}
484
485static int xhci_all_ports_seen_u0(struct xhci_hcd *xhci)
486{
487 return (xhci->port_status_u0 == ((1 << xhci->num_usb3_ports)-1));
488}
489
490
401/* 491/*
402 * Initialize memory for HCD and xHC (one-time init). 492 * Initialize memory for HCD and xHC (one-time init).
403 * 493 *
@@ -421,6 +511,12 @@ int xhci_init(struct usb_hcd *hcd)
421 retval = xhci_mem_init(xhci, GFP_KERNEL); 511 retval = xhci_mem_init(xhci, GFP_KERNEL);
422 xhci_dbg(xhci, "Finished xhci_init\n"); 512 xhci_dbg(xhci, "Finished xhci_init\n");
423 513
514 /* Initializing Compliance Mode Recovery Data If Needed */
515 if (compliance_mode_recovery_timer_quirk_check()) {
516 xhci->quirks |= XHCI_COMP_MODE_QUIRK;
517 compliance_mode_recovery_timer_init(xhci);
518 }
519
424 return retval; 520 return retval;
425} 521}
426 522
@@ -629,6 +725,11 @@ void xhci_stop(struct usb_hcd *hcd)
629 del_timer_sync(&xhci->event_ring_timer); 725 del_timer_sync(&xhci->event_ring_timer);
630#endif 726#endif
631 727
728 /* Deleting Compliance Mode Recovery Timer */
729 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
730 (!(xhci_all_ports_seen_u0(xhci))))
731 del_timer_sync(&xhci->comp_mode_recovery_timer);
732
632 if (xhci->quirks & XHCI_AMD_PLL_FIX) 733 if (xhci->quirks & XHCI_AMD_PLL_FIX)
633 usb_amd_dev_put(); 734 usb_amd_dev_put();
634 735
@@ -659,7 +760,7 @@ void xhci_shutdown(struct usb_hcd *hcd)
659{ 760{
660 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 761 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
661 762
662 if (xhci->quirks && XHCI_SPURIOUS_REBOOT) 763 if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
663 usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); 764 usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
664 765
665 spin_lock_irq(&xhci->lock); 766 spin_lock_irq(&xhci->lock);
@@ -806,6 +907,16 @@ int xhci_suspend(struct xhci_hcd *xhci)
806 } 907 }
807 spin_unlock_irq(&xhci->lock); 908 spin_unlock_irq(&xhci->lock);
808 909
910 /*
911 * Deleting Compliance Mode Recovery Timer because the xHCI Host
912 * is about to be suspended.
913 */
914 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
915 (!(xhci_all_ports_seen_u0(xhci)))) {
916 del_timer_sync(&xhci->comp_mode_recovery_timer);
917 xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted!\n");
918 }
919
809 /* step 5: remove core well power */ 920 /* step 5: remove core well power */
810 /* synchronize irq when using MSI-X */ 921 /* synchronize irq when using MSI-X */
811 xhci_msix_sync_irqs(xhci); 922 xhci_msix_sync_irqs(xhci);
@@ -938,6 +1049,16 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
938 usb_hcd_resume_root_hub(hcd); 1049 usb_hcd_resume_root_hub(hcd);
939 usb_hcd_resume_root_hub(xhci->shared_hcd); 1050 usb_hcd_resume_root_hub(xhci->shared_hcd);
940 } 1051 }
1052
1053 /*
1054 * If system is subject to the Quirk, Compliance Mode Timer needs to
1055 * be re-initialized Always after a system resume. Ports are subject
1056 * to suffer the Compliance Mode issue again. It doesn't matter if
1057 * ports have entered previously to U0 before system's suspension.
1058 */
1059 if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
1060 compliance_mode_recovery_timer_init(xhci);
1061
941 return retval; 1062 return retval;
942} 1063}
943#endif /* CONFIG_PM */ 1064#endif /* CONFIG_PM */
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index c713256297a..1a05908c667 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1495,6 +1495,7 @@ struct xhci_hcd {
1495#define XHCI_LPM_SUPPORT (1 << 11) 1495#define XHCI_LPM_SUPPORT (1 << 11)
1496#define XHCI_INTEL_HOST (1 << 12) 1496#define XHCI_INTEL_HOST (1 << 12)
1497#define XHCI_SPURIOUS_REBOOT (1 << 13) 1497#define XHCI_SPURIOUS_REBOOT (1 << 13)
1498#define XHCI_COMP_MODE_QUIRK (1 << 14)
1498 unsigned int num_active_eps; 1499 unsigned int num_active_eps;
1499 unsigned int limit_active_eps; 1500 unsigned int limit_active_eps;
1500 /* There are two roothubs to keep track of bus suspend info for */ 1501 /* There are two roothubs to keep track of bus suspend info for */
@@ -1511,6 +1512,11 @@ struct xhci_hcd {
1511 unsigned sw_lpm_support:1; 1512 unsigned sw_lpm_support:1;
1512 /* support xHCI 1.0 spec USB2 hardware LPM */ 1513 /* support xHCI 1.0 spec USB2 hardware LPM */
1513 unsigned hw_lpm_support:1; 1514 unsigned hw_lpm_support:1;
1515 /* Compliance Mode Recovery Data */
1516 struct timer_list comp_mode_recovery_timer;
1517 u32 port_status_u0;
1518/* Compliance Mode Timer Triggered every 2 seconds */
1519#define COMP_MODE_RCVRY_MSECS 2000
1514}; 1520};
1515 1521
1516/* convert between an HCD pointer and the corresponding EHCI_HCD */ 1522/* convert between an HCD pointer and the corresponding EHCI_HCD */
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 4bb717d0bd4..1ae378d5fc6 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2049,7 +2049,7 @@ static int musb_urb_enqueue(
2049 * we only have work to do in the former case. 2049 * we only have work to do in the former case.
2050 */ 2050 */
2051 spin_lock_irqsave(&musb->lock, flags); 2051 spin_lock_irqsave(&musb->lock, flags);
2052 if (hep->hcpriv) { 2052 if (hep->hcpriv || !next_urb(qh)) {
2053 /* some concurrent activity submitted another urb to hep... 2053 /* some concurrent activity submitted another urb to hep...
2054 * odd, rare, error prone, but legal. 2054 * odd, rare, error prone, but legal.
2055 */ 2055 */
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 57a608584e1..c1be687e00e 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -388,7 +388,7 @@ dma_controller_create(struct musb *musb, void __iomem *base)
388 struct platform_device *pdev = to_platform_device(dev); 388 struct platform_device *pdev = to_platform_device(dev);
389 int irq = platform_get_irq_byname(pdev, "dma"); 389 int irq = platform_get_irq_byname(pdev, "dma");
390 390
391 if (irq == 0) { 391 if (irq <= 0) {
392 dev_err(dev, "No DMA interrupt line!\n"); 392 dev_err(dev, "No DMA interrupt line!\n");
393 return NULL; 393 return NULL;
394 } 394 }
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 1a1bd9cf40c..34162544237 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1215,7 +1215,7 @@ static int __devinit tusb_probe(struct platform_device *pdev)
1215 ret = platform_device_add(musb); 1215 ret = platform_device_add(musb);
1216 if (ret) { 1216 if (ret) {
1217 dev_err(&pdev->dev, "failed to register musb device\n"); 1217 dev_err(&pdev->dev, "failed to register musb device\n");
1218 goto err1; 1218 goto err2;
1219 } 1219 }
1220 1220
1221 return 0; 1221 return 0;
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index ecd173032fd..143c4e9e1be 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -818,7 +818,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
818 usbhs_pipe_is_dcp(pipe)) 818 usbhs_pipe_is_dcp(pipe))
819 goto usbhsf_pio_prepare_push; 819 goto usbhsf_pio_prepare_push;
820 820
821 if (len % 4) /* 32bit alignment */ 821 if (len & 0x7) /* 8byte alignment */
822 goto usbhsf_pio_prepare_push; 822 goto usbhsf_pio_prepare_push;
823 823
824 if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ 824 if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
@@ -905,7 +905,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)
905 /* use PIO if packet is less than pio_dma_border */ 905 /* use PIO if packet is less than pio_dma_border */
906 len = usbhsf_fifo_rcv_len(priv, fifo); 906 len = usbhsf_fifo_rcv_len(priv, fifo);
907 len = min(pkt->length - pkt->actual, len); 907 len = min(pkt->length - pkt->actual, len);
908 if (len % 4) /* 32bit alignment */ 908 if (len & 0x7) /* 8byte alignment */
909 goto usbhsf_pio_prepare_pop_unselect; 909 goto usbhsf_pio_prepare_pop_unselect;
910 910
911 if (len < usbhs_get_dparam(priv, pio_dma_border)) 911 if (len < usbhs_get_dparam(priv, pio_dma_border))
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 5620db6469e..f906b3aec21 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -704,6 +704,7 @@ static struct usb_device_id id_table_combined [] = {
704 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 704 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
705 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, 705 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
706 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 706 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
707 { USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) },
707 { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, 708 { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
708 { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, 709 { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
709 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, 710 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
@@ -804,13 +805,32 @@ static struct usb_device_id id_table_combined [] = {
804 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 805 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
805 { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), 806 { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
806 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 807 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
807 { USB_DEVICE(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID) }, 808 { USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID,
809 USB_CLASS_VENDOR_SPEC,
810 USB_SUBCLASS_VENDOR_SPEC, 0x00) },
808 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 811 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
809 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), 812 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
810 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 813 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
811 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, 814 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
812 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, 815 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
816 { USB_DEVICE(FTDI_VID, PI_C865_PID) },
817 { USB_DEVICE(FTDI_VID, PI_C857_PID) },
818 { USB_DEVICE(PI_VID, PI_C866_PID) },
819 { USB_DEVICE(PI_VID, PI_C663_PID) },
820 { USB_DEVICE(PI_VID, PI_C725_PID) },
821 { USB_DEVICE(PI_VID, PI_E517_PID) },
822 { USB_DEVICE(PI_VID, PI_C863_PID) },
813 { USB_DEVICE(PI_VID, PI_E861_PID) }, 823 { USB_DEVICE(PI_VID, PI_E861_PID) },
824 { USB_DEVICE(PI_VID, PI_C867_PID) },
825 { USB_DEVICE(PI_VID, PI_E609_PID) },
826 { USB_DEVICE(PI_VID, PI_E709_PID) },
827 { USB_DEVICE(PI_VID, PI_100F_PID) },
828 { USB_DEVICE(PI_VID, PI_1011_PID) },
829 { USB_DEVICE(PI_VID, PI_1012_PID) },
830 { USB_DEVICE(PI_VID, PI_1013_PID) },
831 { USB_DEVICE(PI_VID, PI_1014_PID) },
832 { USB_DEVICE(PI_VID, PI_1015_PID) },
833 { USB_DEVICE(PI_VID, PI_1016_PID) },
814 { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) }, 834 { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
815 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 835 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
816 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 836 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 5dd96ca6c38..41fe5826100 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -75,6 +75,9 @@
75#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB 75#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
76#define FTDI_OPENDCC_GBM_PID 0xBFDC 76#define FTDI_OPENDCC_GBM_PID 0xBFDC
77 77
78/* NZR SEM 16+ USB (http://www.nzr.de) */
79#define FTDI_NZR_SEM_USB_PID 0xC1E0 /* NZR SEM-LOG16+ */
80
78/* 81/*
79 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) 82 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
80 */ 83 */
@@ -539,7 +542,10 @@
539/* 542/*
540 * Microchip Technology, Inc. 543 * Microchip Technology, Inc.
541 * 544 *
542 * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are also used by: 545 * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are
546 * used by single function CDC ACM class based firmware demo
547 * applications. The VID/PID has also been used in firmware
548 * emulating FTDI serial chips by:
543 * Hornby Elite - Digital Command Control Console 549 * Hornby Elite - Digital Command Control Console
544 * http://www.hornby.com/hornby-dcc/controllers/ 550 * http://www.hornby.com/hornby-dcc/controllers/
545 */ 551 */
@@ -791,8 +797,27 @@
791 * Physik Instrumente 797 * Physik Instrumente
792 * http://www.physikinstrumente.com/en/products/ 798 * http://www.physikinstrumente.com/en/products/
793 */ 799 */
800/* These two devices use the VID of FTDI */
801#define PI_C865_PID 0xe0a0 /* PI C-865 Piezomotor Controller */
802#define PI_C857_PID 0xe0a1 /* PI Encoder Trigger Box */
803
794#define PI_VID 0x1a72 /* Vendor ID */ 804#define PI_VID 0x1a72 /* Vendor ID */
795#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */ 805#define PI_C866_PID 0x1000 /* PI C-866 Piezomotor Controller */
806#define PI_C663_PID 0x1001 /* PI C-663 Mercury-Step */
807#define PI_C725_PID 0x1002 /* PI C-725 Piezomotor Controller */
808#define PI_E517_PID 0x1005 /* PI E-517 Digital Piezo Controller Operation Module */
809#define PI_C863_PID 0x1007 /* PI C-863 */
810#define PI_E861_PID 0x1008 /* PI E-861 Piezomotor Controller */
811#define PI_C867_PID 0x1009 /* PI C-867 Piezomotor Controller */
812#define PI_E609_PID 0x100D /* PI E-609 Digital Piezo Controller */
813#define PI_E709_PID 0x100E /* PI E-709 Digital Piezo Controller */
814#define PI_100F_PID 0x100F /* PI Digital Piezo Controller */
815#define PI_1011_PID 0x1011 /* PI Digital Piezo Controller */
816#define PI_1012_PID 0x1012 /* PI Motion Controller */
817#define PI_1013_PID 0x1013 /* PI Motion Controller */
818#define PI_1014_PID 0x1014 /* PI Device */
819#define PI_1015_PID 0x1015 /* PI Device */
820#define PI_1016_PID 0x1016 /* PI Digital Servo Module */
796 821
797/* 822/*
798 * Kondo Kagaku Co.Ltd. 823 * Kondo Kagaku Co.Ltd.
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index cc40f47ecea..5ce88d1bc6f 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -886,8 +886,6 @@ static const struct usb_device_id option_ids[] = {
886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
887 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 887 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff),
890 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, 889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, 890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1092,6 +1090,10 @@ static const struct usb_device_id option_ids[] = {
1092 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, 1090 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1093 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), 1091 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1094 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, 1092 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1093 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
1094 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
1095 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
1096
1095 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, 1097 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
1096 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, 1098 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
1097 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ 1099 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */