Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB patches from Greg Kroah-Hartman:
"Here are a number of USB patches, a bit more than I normally like this
late in the -rc series, but given people's vacations (myself
included), and the kernel summit, it seems to have happened this way.

All are tiny, but they add up. A number of gadget and xhci fixes, and
a few new device ids. All have been tested in linux-next.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'usb-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (33 commits)
usb: chipidea: udc: don't stall endpoint if request list is empty in isr_tr_complete_low
usb: chipidea: cleanup dma_pool if udc_start() fails
usb: chipidea: udc: fix error path in udc_start()
usb: chipidea: udc: add pullup fuction, needed by the uvc gadget
usb: chipidea: udc: fix setup of endpoint maxpacket size
USB: option: replace ZTE K5006-Z entry with vendor class rule
EHCI: Update qTD next pointer in QH overlay region during unlink
USB: cdc-wdm: fix wdm_find_device* return value
USB: ftdi_sio: do not claim CDC ACM function
usb: dwc3: gadget: fix pending isoc handling
usb: renesas_usbhs: fixup DMA transport data alignment
usb: gadget: at91udc: Don't check for ep->ep.desc
usb: gadget: at91udc: don't overwrite driver data
usb: dwc3: core: fix incorrect usage of resource pointer
usb: musb: musbhsdma: fix IRQ check
usb: musb: tusb6010: fix error path in tusb_probe()
usb: musb: host: fix for musb_start_urb Oops
usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh
usb: gadget: dummy_hcd: fixup error probe path
usb: gadget: s3c-hsotg.c: fix error return code
...

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