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-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are a number of small USB driver fixes for 4.9-rc3.

There is the usual number of gadget and xhci patches in here to
resolved reported issues, as well as some usb-serial driver fixes and
new device ids.

All have been in linux-next with no reported issues"

* tag 'usb-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (26 commits)
usb: chipidea: host: fix NULL ptr dereference during shutdown
usb: renesas_usbhs: add wait after initialization for R-Car Gen3
usb: increase ohci watchdog delay to 275 msec
usb: musb: Call pm_runtime from musb_gadget_queue
usb: musb: Fix hardirq-safe hardirq-unsafe lock order error
usb: ehci-platform: increase EHCI_MAX_RSTS to 4
usb: ohci-at91: Set RemoteWakeupConnected bit explicitly.
USB: serial: fix potential NULL-dereference at probe
xhci: use default USB_RESUME_TIMEOUT when resuming ports.
xhci: workaround for hosts missing CAS bit
xhci: add restart quirk for Intel Wildcatpoint PCH
USB: serial: cp210x: fix tiocmget error handling
wusb: fix error return code in wusb_prf()
Revert "Documentation: devicetree: dwc2: Deprecate g-tx-fifo-size"
Revert "usb: dwc2: gadget: fix TX FIFO size and address initialization"
Revert "usb: dwc2: gadget: change variable name to more meaningful"
USB: serial: ftdi_sio: add support for Infineon TriBoard TC2X7
wusb: Stop using the stack for sg crypto scratch space
usb: dwc3: Fix size used in dma_free_coherent()
usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable
...

+296 -84
+1 -4
Documentation/devicetree/bindings/usb/dwc2.txt
··· 28 28 - g-use-dma: enable dma usage in gadget driver. 29 29 - g-rx-fifo-size: size of rx fifo size in gadget mode. 30 30 - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. 31 - 32 - Deprecated properties: 33 - - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) 34 - in gadget mode. 31 + - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. 35 32 36 33 Example: 37 34
+2
drivers/usb/chipidea/host.c
··· 188 188 189 189 if (hcd) { 190 190 usb_remove_hcd(hcd); 191 + ci->role = CI_ROLE_END; 192 + synchronize_irq(ci->irq); 191 193 usb_put_hcd(hcd); 192 194 if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && 193 195 (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON))
+10 -1
drivers/usb/dwc2/core.c
··· 463 463 */ 464 464 void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) 465 465 { 466 + bool ret; 467 + 466 468 switch (hsotg->dr_mode) { 467 469 case USB_DR_MODE_HOST: 468 - dwc2_force_mode(hsotg, true); 470 + ret = dwc2_force_mode(hsotg, true); 471 + /* 472 + * NOTE: This is required for some rockchip soc based 473 + * platforms on their host-only dwc2. 474 + */ 475 + if (!ret) 476 + msleep(50); 477 + 469 478 break; 470 479 case USB_DR_MODE_PERIPHERAL: 471 480 dwc2_force_mode(hsotg, false);
+7
drivers/usb/dwc2/core.h
··· 259 259 DWC2_L3, /* Off state */ 260 260 }; 261 261 262 + /* 263 + * Gadget periodic tx fifo sizes as used by legacy driver 264 + * EP0 is not included 265 + */ 266 + #define DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, \ 267 + 768, 0, 0, 0, 0, 0, 0, 0} 268 + 262 269 /* Gadget ep0 states */ 263 270 enum dwc2_ep0_state { 264 271 DWC2_EP0_SETUP,
+42 -11
drivers/usb/dwc2/gadget.c
··· 186 186 */ 187 187 static void dwc2_hsotg_init_fifo(struct dwc2_hsotg *hsotg) 188 188 { 189 - unsigned int fifo; 189 + unsigned int ep; 190 190 unsigned int addr; 191 191 int timeout; 192 - u32 dptxfsizn; 193 192 u32 val; 194 193 195 194 /* Reset fifo map if not correctly cleared during previous session */ ··· 216 217 * them to endpoints dynamically according to maxpacket size value of 217 218 * given endpoint. 218 219 */ 219 - for (fifo = 1; fifo < MAX_EPS_CHANNELS; fifo++) { 220 - dptxfsizn = dwc2_readl(hsotg->regs + DPTXFSIZN(fifo)); 220 + for (ep = 1; ep < MAX_EPS_CHANNELS; ep++) { 221 + if (!hsotg->g_tx_fifo_sz[ep]) 222 + continue; 223 + val = addr; 224 + val |= hsotg->g_tx_fifo_sz[ep] << FIFOSIZE_DEPTH_SHIFT; 225 + WARN_ONCE(addr + hsotg->g_tx_fifo_sz[ep] > hsotg->fifo_mem, 226 + "insufficient fifo memory"); 227 + addr += hsotg->g_tx_fifo_sz[ep]; 221 228 222 - val = (dptxfsizn & FIFOSIZE_DEPTH_MASK) | addr; 223 - addr += dptxfsizn >> FIFOSIZE_DEPTH_SHIFT; 224 - 225 - if (addr > hsotg->fifo_mem) 226 - break; 227 - 228 - dwc2_writel(val, hsotg->regs + DPTXFSIZN(fifo)); 229 + dwc2_writel(val, hsotg->regs + DPTXFSIZN(ep)); 229 230 } 230 231 231 232 /* ··· 3806 3807 static void dwc2_hsotg_of_probe(struct dwc2_hsotg *hsotg) 3807 3808 { 3808 3809 struct device_node *np = hsotg->dev->of_node; 3810 + u32 len = 0; 3811 + u32 i = 0; 3809 3812 3810 3813 /* Enable dma if requested in device tree */ 3811 3814 hsotg->g_using_dma = of_property_read_bool(np, "g-use-dma"); 3812 3815 3816 + /* 3817 + * Register TX periodic fifo size per endpoint. 3818 + * EP0 is excluded since it has no fifo configuration. 3819 + */ 3820 + if (!of_find_property(np, "g-tx-fifo-size", &len)) 3821 + goto rx_fifo; 3822 + 3823 + len /= sizeof(u32); 3824 + 3825 + /* Read tx fifo sizes other than ep0 */ 3826 + if (of_property_read_u32_array(np, "g-tx-fifo-size", 3827 + &hsotg->g_tx_fifo_sz[1], len)) 3828 + goto rx_fifo; 3829 + 3830 + /* Add ep0 */ 3831 + len++; 3832 + 3833 + /* Make remaining TX fifos unavailable */ 3834 + if (len < MAX_EPS_CHANNELS) { 3835 + for (i = len; i < MAX_EPS_CHANNELS; i++) 3836 + hsotg->g_tx_fifo_sz[i] = 0; 3837 + } 3838 + 3839 + rx_fifo: 3813 3840 /* Register RX fifo size */ 3814 3841 of_property_read_u32(np, "g-rx-fifo-size", &hsotg->g_rx_fifo_sz); 3815 3842 ··· 3857 3832 struct device *dev = hsotg->dev; 3858 3833 int epnum; 3859 3834 int ret; 3835 + int i; 3836 + u32 p_tx_fifo[] = DWC2_G_P_LEGACY_TX_FIFO_SIZE; 3860 3837 3861 3838 /* Initialize to legacy fifo configuration values */ 3862 3839 hsotg->g_rx_fifo_sz = 2048; 3863 3840 hsotg->g_np_g_tx_fifo_sz = 1024; 3841 + memcpy(&hsotg->g_tx_fifo_sz[1], p_tx_fifo, sizeof(p_tx_fifo)); 3864 3842 /* Device tree specific probe */ 3865 3843 dwc2_hsotg_of_probe(hsotg); 3866 3844 ··· 3881 3853 dev_dbg(dev, "NonPeriodic TXFIFO size: %d\n", 3882 3854 hsotg->g_np_g_tx_fifo_sz); 3883 3855 dev_dbg(dev, "RXFIFO size: %d\n", hsotg->g_rx_fifo_sz); 3856 + for (i = 0; i < MAX_EPS_CHANNELS; i++) 3857 + dev_dbg(dev, "Periodic TXFIFO%2d size: %d\n", i, 3858 + hsotg->g_tx_fifo_sz[i]); 3884 3859 3885 3860 hsotg->gadget.max_speed = USB_SPEED_HIGH; 3886 3861 hsotg->gadget.ops = &dwc2_hsotg_gadget_ops;
+18 -8
drivers/usb/dwc3/gadget.c
··· 783 783 req->trb = trb; 784 784 req->trb_dma = dwc3_trb_dma_offset(dep, trb); 785 785 req->first_trb_index = dep->trb_enqueue; 786 + dep->queued_requests++; 786 787 } 787 788 788 789 dwc3_ep_inc_enq(dep); ··· 833 832 trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id); 834 833 835 834 trb->ctrl |= DWC3_TRB_CTRL_HWO; 836 - 837 - dep->queued_requests++; 838 835 839 836 trace_dwc3_prepare_trb(dep, trb); 840 837 } ··· 1073 1074 1074 1075 list_add_tail(&req->list, &dep->pending_list); 1075 1076 1076 - if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && 1077 - dep->flags & DWC3_EP_PENDING_REQUEST) { 1078 - if (list_empty(&dep->started_list)) { 1077 + /* 1078 + * NOTICE: Isochronous endpoints should NEVER be prestarted. We must 1079 + * wait for a XferNotReady event so we will know what's the current 1080 + * (micro-)frame number. 1081 + * 1082 + * Without this trick, we are very, very likely gonna get Bus Expiry 1083 + * errors which will force us issue EndTransfer command. 1084 + */ 1085 + if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { 1086 + if ((dep->flags & DWC3_EP_PENDING_REQUEST) && 1087 + list_empty(&dep->started_list)) { 1079 1088 dwc3_stop_active_transfer(dwc, dep->number, true); 1080 1089 dep->flags = DWC3_EP_ENABLED; 1081 1090 } ··· 1868 1861 unsigned int s_pkt = 0; 1869 1862 unsigned int trb_status; 1870 1863 1871 - dep->queued_requests--; 1872 1864 dwc3_ep_inc_deq(dep); 1865 + 1866 + if (req->trb == trb) 1867 + dep->queued_requests--; 1868 + 1873 1869 trace_dwc3_complete_trb(dep, trb); 1874 1870 1875 1871 /* ··· 2990 2980 kfree(dwc->setup_buf); 2991 2981 2992 2982 err2: 2993 - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb), 2983 + dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, 2994 2984 dwc->ep0_trb, dwc->ep0_trb_addr); 2995 2985 2996 2986 err1: ··· 3015 3005 kfree(dwc->setup_buf); 3016 3006 kfree(dwc->zlp_buf); 3017 3007 3018 - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb), 3008 + dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, 3019 3009 dwc->ep0_trb, dwc->ep0_trb_addr); 3020 3010 3021 3011 dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req),
+92 -15
drivers/usb/gadget/function/f_fs.c
··· 136 136 /* 137 137 * Buffer for holding data from partial reads which may happen since 138 138 * we’re rounding user read requests to a multiple of a max packet size. 139 + * 140 + * The pointer is initialised with NULL value and may be set by 141 + * __ffs_epfile_read_data function to point to a temporary buffer. 142 + * 143 + * In normal operation, calls to __ffs_epfile_read_buffered will consume 144 + * data from said buffer and eventually free it. Importantly, while the 145 + * function is using the buffer, it sets the pointer to NULL. This is 146 + * all right since __ffs_epfile_read_data and __ffs_epfile_read_buffered 147 + * can never run concurrently (they are synchronised by epfile->mutex) 148 + * so the latter will not assign a new value to the pointer. 149 + * 150 + * Meanwhile ffs_func_eps_disable frees the buffer (if the pointer is 151 + * valid) and sets the pointer to READ_BUFFER_DROP value. This special 152 + * value is crux of the synchronisation between ffs_func_eps_disable and 153 + * __ffs_epfile_read_data. 154 + * 155 + * Once __ffs_epfile_read_data is about to finish it will try to set the 156 + * pointer back to its old value (as described above), but seeing as the 157 + * pointer is not-NULL (namely READ_BUFFER_DROP) it will instead free 158 + * the buffer. 159 + * 160 + * == State transitions == 161 + * 162 + * • ptr == NULL: (initial state) 163 + * ◦ __ffs_epfile_read_buffer_free: go to ptr == DROP 164 + * ◦ __ffs_epfile_read_buffered: nop 165 + * ◦ __ffs_epfile_read_data allocates temp buffer: go to ptr == buf 166 + * ◦ reading finishes: n/a, not in ‘and reading’ state 167 + * • ptr == DROP: 168 + * ◦ __ffs_epfile_read_buffer_free: nop 169 + * ◦ __ffs_epfile_read_buffered: go to ptr == NULL 170 + * ◦ __ffs_epfile_read_data allocates temp buffer: free buf, nop 171 + * ◦ reading finishes: n/a, not in ‘and reading’ state 172 + * • ptr == buf: 173 + * ◦ __ffs_epfile_read_buffer_free: free buf, go to ptr == DROP 174 + * ◦ __ffs_epfile_read_buffered: go to ptr == NULL and reading 175 + * ◦ __ffs_epfile_read_data: n/a, __ffs_epfile_read_buffered 176 + * is always called first 177 + * ◦ reading finishes: n/a, not in ‘and reading’ state 178 + * • ptr == NULL and reading: 179 + * ◦ __ffs_epfile_read_buffer_free: go to ptr == DROP and reading 180 + * ◦ __ffs_epfile_read_buffered: n/a, mutex is held 181 + * ◦ __ffs_epfile_read_data: n/a, mutex is held 182 + * ◦ reading finishes and … 183 + * … all data read: free buf, go to ptr == NULL 184 + * … otherwise: go to ptr == buf and reading 185 + * • ptr == DROP and reading: 186 + * ◦ __ffs_epfile_read_buffer_free: nop 187 + * ◦ __ffs_epfile_read_buffered: n/a, mutex is held 188 + * ◦ __ffs_epfile_read_data: n/a, mutex is held 189 + * ◦ reading finishes: free buf, go to ptr == DROP 139 190 */ 140 - struct ffs_buffer *read_buffer; /* P: epfile->mutex */ 191 + struct ffs_buffer *read_buffer; 192 + #define READ_BUFFER_DROP ((struct ffs_buffer *)ERR_PTR(-ESHUTDOWN)) 141 193 142 194 char name[5]; 143 195 ··· 788 736 schedule_work(&io_data->work); 789 737 } 790 738 739 + static void __ffs_epfile_read_buffer_free(struct ffs_epfile *epfile) 740 + { 741 + /* 742 + * See comment in struct ffs_epfile for full read_buffer pointer 743 + * synchronisation story. 744 + */ 745 + struct ffs_buffer *buf = xchg(&epfile->read_buffer, READ_BUFFER_DROP); 746 + if (buf && buf != READ_BUFFER_DROP) 747 + kfree(buf); 748 + } 749 + 791 750 /* Assumes epfile->mutex is held. */ 792 751 static ssize_t __ffs_epfile_read_buffered(struct ffs_epfile *epfile, 793 752 struct iov_iter *iter) 794 753 { 795 - struct ffs_buffer *buf = epfile->read_buffer; 754 + /* 755 + * Null out epfile->read_buffer so ffs_func_eps_disable does not free 756 + * the buffer while we are using it. See comment in struct ffs_epfile 757 + * for full read_buffer pointer synchronisation story. 758 + */ 759 + struct ffs_buffer *buf = xchg(&epfile->read_buffer, NULL); 796 760 ssize_t ret; 797 - if (!buf) 761 + if (!buf || buf == READ_BUFFER_DROP) 798 762 return 0; 799 763 800 764 ret = copy_to_iter(buf->data, buf->length, iter); 801 765 if (buf->length == ret) { 802 766 kfree(buf); 803 - epfile->read_buffer = NULL; 804 - } else if (unlikely(iov_iter_count(iter))) { 767 + return ret; 768 + } 769 + 770 + if (unlikely(iov_iter_count(iter))) { 805 771 ret = -EFAULT; 806 772 } else { 807 773 buf->length -= ret; 808 774 buf->data += ret; 809 775 } 776 + 777 + if (cmpxchg(&epfile->read_buffer, NULL, buf)) 778 + kfree(buf); 779 + 810 780 return ret; 811 781 } 812 782 ··· 857 783 buf->length = data_len; 858 784 buf->data = buf->storage; 859 785 memcpy(buf->storage, data + ret, data_len); 860 - epfile->read_buffer = buf; 786 + 787 + /* 788 + * At this point read_buffer is NULL or READ_BUFFER_DROP (if 789 + * ffs_func_eps_disable has been called in the meanwhile). See comment 790 + * in struct ffs_epfile for full read_buffer pointer synchronisation 791 + * story. 792 + */ 793 + if (unlikely(cmpxchg(&epfile->read_buffer, NULL, buf))) 794 + kfree(buf); 861 795 862 796 return ret; 863 797 } ··· 1179 1097 1180 1098 ENTER(); 1181 1099 1182 - kfree(epfile->read_buffer); 1183 - epfile->read_buffer = NULL; 1100 + __ffs_epfile_read_buffer_free(epfile); 1184 1101 ffs_data_closed(epfile->ffs); 1185 1102 1186 1103 return 0; ··· 1805 1724 unsigned count = func->ffs->eps_count; 1806 1725 unsigned long flags; 1807 1726 1727 + spin_lock_irqsave(&func->ffs->eps_lock, flags); 1808 1728 do { 1809 - if (epfile) 1810 - mutex_lock(&epfile->mutex); 1811 - spin_lock_irqsave(&func->ffs->eps_lock, flags); 1812 1729 /* pending requests get nuked */ 1813 1730 if (likely(ep->ep)) 1814 1731 usb_ep_disable(ep->ep); 1815 1732 ++ep; 1816 - spin_unlock_irqrestore(&func->ffs->eps_lock, flags); 1817 1733 1818 1734 if (epfile) { 1819 1735 epfile->ep = NULL; 1820 - kfree(epfile->read_buffer); 1821 - epfile->read_buffer = NULL; 1822 - mutex_unlock(&epfile->mutex); 1736 + __ffs_epfile_read_buffer_free(epfile); 1823 1737 ++epfile; 1824 1738 } 1825 1739 } while (--count); 1740 + spin_unlock_irqrestore(&func->ffs->eps_lock, flags); 1826 1741 } 1827 1742 1828 1743 static int ffs_func_eps_enable(struct ffs_function *func)
+3 -2
drivers/usb/gadget/function/u_ether.c
··· 590 590 591 591 /* throttle high/super speed IRQ rate back slightly */ 592 592 if (gadget_is_dualspeed(dev->gadget)) 593 - req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH || 594 - dev->gadget->speed == USB_SPEED_SUPER) 593 + req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH || 594 + dev->gadget->speed == USB_SPEED_SUPER)) && 595 + !list_empty(&dev->tx_reqs)) 595 596 ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0) 596 597 : 0; 597 598
+1 -1
drivers/usb/gadget/udc/atmel_usba_udc.c
··· 1978 1978 dev_err(&pdev->dev, "of_probe: name error(%d)\n", ret); 1979 1979 goto err; 1980 1980 } 1981 - ep->ep.name = name; 1981 + ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", ep->index); 1982 1982 1983 1983 ep->ep_regs = udc->regs + USBA_EPT_BASE(i); 1984 1984 ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
+1 -1
drivers/usb/host/ehci-platform.c
··· 39 39 40 40 #define DRIVER_DESC "EHCI generic platform driver" 41 41 #define EHCI_MAX_CLKS 4 42 - #define EHCI_MAX_RSTS 3 42 + #define EHCI_MAX_RSTS 4 43 43 #define hcd_to_ehci_priv(h) ((struct ehci_platform_priv *)hcd_to_ehci(h)->priv) 44 44 45 45 struct ehci_platform_priv {
+6 -3
drivers/usb/host/ohci-at91.c
··· 221 221 ohci->num_ports = board->ports; 222 222 at91_start_hc(pdev); 223 223 224 + /* 225 + * The RemoteWakeupConnected bit has to be set explicitly 226 + * before calling ohci_run. The reset value of this bit is 0. 227 + */ 228 + ohci->hc_control = OHCI_CTRL_RWC; 229 + 224 230 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); 225 231 if (retval == 0) { 226 232 device_wakeup_enable(hcd->self.controller); ··· 683 677 * REVISIT: some boards will be able to turn VBUS off... 684 678 */ 685 679 if (!ohci_at91->wakeup) { 686 - ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); 687 - ohci->hc_control &= OHCI_CTRL_RWC; 688 - ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); 689 680 ohci->rh_state = OHCI_RH_HALTED; 690 681 691 682 /* flush the writes */
+1 -1
drivers/usb/host/ohci-hcd.c
··· 72 72 static const char hcd_name [] = "ohci_hcd"; 73 73 74 74 #define STATECHANGE_DELAY msecs_to_jiffies(300) 75 - #define IO_WATCHDOG_DELAY msecs_to_jiffies(250) 75 + #define IO_WATCHDOG_DELAY msecs_to_jiffies(275) 76 76 77 77 #include "ohci.h" 78 78 #include "pci-quirks.h"
+39 -2
drivers/usb/host/xhci-hub.c
··· 1166 1166 xhci_set_link_state(xhci, port_array, wIndex, 1167 1167 XDEV_RESUME); 1168 1168 spin_unlock_irqrestore(&xhci->lock, flags); 1169 - msleep(20); 1169 + msleep(USB_RESUME_TIMEOUT); 1170 1170 spin_lock_irqsave(&xhci->lock, flags); 1171 1171 xhci_set_link_state(xhci, port_array, wIndex, 1172 1172 XDEV_U0); ··· 1355 1355 return 0; 1356 1356 } 1357 1357 1358 + /* 1359 + * Workaround for missing Cold Attach Status (CAS) if device re-plugged in S3. 1360 + * warm reset a USB3 device stuck in polling or compliance mode after resume. 1361 + * See Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8 1362 + */ 1363 + static bool xhci_port_missing_cas_quirk(int port_index, 1364 + __le32 __iomem **port_array) 1365 + { 1366 + u32 portsc; 1367 + 1368 + portsc = readl(port_array[port_index]); 1369 + 1370 + /* if any of these are set we are not stuck */ 1371 + if (portsc & (PORT_CONNECT | PORT_CAS)) 1372 + return false; 1373 + 1374 + if (((portsc & PORT_PLS_MASK) != XDEV_POLLING) && 1375 + ((portsc & PORT_PLS_MASK) != XDEV_COMP_MODE)) 1376 + return false; 1377 + 1378 + /* clear wakeup/change bits, and do a warm port reset */ 1379 + portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); 1380 + portsc |= PORT_WR; 1381 + writel(portsc, port_array[port_index]); 1382 + /* flush write */ 1383 + readl(port_array[port_index]); 1384 + return true; 1385 + } 1386 + 1358 1387 int xhci_bus_resume(struct usb_hcd *hcd) 1359 1388 { 1360 1389 struct xhci_hcd *xhci = hcd_to_xhci(hcd); ··· 1421 1392 u32 temp; 1422 1393 1423 1394 temp = readl(port_array[port_index]); 1395 + 1396 + /* warm reset CAS limited ports stuck in polling/compliance */ 1397 + if ((xhci->quirks & XHCI_MISSING_CAS) && 1398 + (hcd->speed >= HCD_USB3) && 1399 + xhci_port_missing_cas_quirk(port_index, port_array)) { 1400 + xhci_dbg(xhci, "reset stuck port %d\n", port_index); 1401 + continue; 1402 + } 1424 1403 if (DEV_SUPERSPEED_ANY(temp)) 1425 1404 temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); 1426 1405 else ··· 1447 1410 1448 1411 if (need_usb2_u3_exit) { 1449 1412 spin_unlock_irqrestore(&xhci->lock, flags); 1450 - msleep(20); 1413 + msleep(USB_RESUME_TIMEOUT); 1451 1414 spin_lock_irqsave(&xhci->lock, flags); 1452 1415 } 1453 1416
+9 -1
drivers/usb/host/xhci-pci.c
··· 45 45 46 46 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 47 47 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 48 + #define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI 0x9cb1 48 49 #define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 49 50 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f 50 51 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f 51 52 #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 52 53 #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 54 + #define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 53 55 54 56 static const char hcd_name[] = "xhci_hcd"; 55 57 ··· 155 153 xhci->quirks |= XHCI_SPURIOUS_REBOOT; 156 154 } 157 155 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 158 - pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { 156 + (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI || 157 + pdev->device == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI)) { 159 158 xhci->quirks |= XHCI_SPURIOUS_REBOOT; 160 159 xhci->quirks |= XHCI_SPURIOUS_WAKEUP; 161 160 } ··· 172 169 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { 173 170 xhci->quirks |= XHCI_SSIC_PORT_UNUSED; 174 171 } 172 + if (pdev->vendor == PCI_VENDOR_ID_INTEL && 173 + (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 174 + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) 175 + xhci->quirks |= XHCI_MISSING_CAS; 176 + 175 177 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 176 178 pdev->device == PCI_DEVICE_ID_EJ168) { 177 179 xhci->quirks |= XHCI_RESET_ON_RESUME;
+3
drivers/usb/host/xhci.h
··· 314 314 #define XDEV_U2 (0x2 << 5) 315 315 #define XDEV_U3 (0x3 << 5) 316 316 #define XDEV_INACTIVE (0x6 << 5) 317 + #define XDEV_POLLING (0x7 << 5) 318 + #define XDEV_COMP_MODE (0xa << 5) 317 319 #define XDEV_RESUME (0xf << 5) 318 320 /* true: port has power (see HCC_PPC) */ 319 321 #define PORT_POWER (1 << 9) ··· 1655 1653 #define XHCI_MTK_HOST (1 << 21) 1656 1654 #define XHCI_SSIC_PORT_UNUSED (1 << 22) 1657 1655 #define XHCI_NO_64BIT_SUPPORT (1 << 23) 1656 + #define XHCI_MISSING_CAS (1 << 24) 1658 1657 unsigned int num_active_eps; 1659 1658 unsigned int limit_active_eps; 1660 1659 /* There are two roothubs to keep track of bus suspend info for */
+4
drivers/usb/musb/musb_gadget.c
··· 1255 1255 1256 1256 map_dma_buffer(request, musb, musb_ep); 1257 1257 1258 + pm_runtime_get_sync(musb->controller); 1258 1259 spin_lock_irqsave(&musb->lock, lockflags); 1259 1260 1260 1261 /* don't queue if the ep is down */ ··· 1276 1275 1277 1276 unlock: 1278 1277 spin_unlock_irqrestore(&musb->lock, lockflags); 1278 + pm_runtime_mark_last_busy(musb->controller); 1279 + pm_runtime_put_autosuspend(musb->controller); 1280 + 1279 1281 return status; 1280 1282 } 1281 1283
+2 -5
drivers/usb/musb/omap2430.c
··· 287 287 } 288 288 musb->isr = omap2430_musb_interrupt; 289 289 phy_init(musb->phy); 290 + phy_power_on(musb->phy); 290 291 291 292 l = musb_readl(musb->mregs, OTG_INTERFSEL); 292 293 ··· 324 323 struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev); 325 324 struct omap_musb_board_data *data = pdata->board_data; 326 325 327 - if (!WARN_ON(!musb->phy)) 328 - phy_power_on(musb->phy); 329 326 330 327 switch (glue->status) { 331 328 ··· 360 361 struct device *dev = musb->controller; 361 362 struct omap2430_glue *glue = dev_get_drvdata(dev->parent); 362 363 363 - if (!WARN_ON(!musb->phy)) 364 - phy_power_off(musb->phy); 365 - 366 364 if (glue->status != MUSB_UNKNOWN) 367 365 omap_control_usb_set_mode(glue->control_otghs, 368 366 USB_MODE_DISCONNECT); ··· 371 375 struct omap2430_glue *glue = dev_get_drvdata(dev->parent); 372 376 373 377 omap2430_low_level_exit(musb); 378 + phy_power_off(musb->phy); 374 379 phy_exit(musb->phy); 375 380 musb->phy = NULL; 376 381 cancel_work_sync(&glue->omap_musb_mailbox_work);
+6 -2
drivers/usb/renesas_usbhs/rcar3.c
··· 9 9 * 10 10 */ 11 11 12 + #include <linux/delay.h> 12 13 #include <linux/io.h> 13 14 #include "common.h" 14 15 #include "rcar3.h" ··· 36 35 37 36 usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG); 38 37 39 - if (enable) 38 + if (enable) { 40 39 usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM); 41 - else 40 + /* The controller on R-Car Gen3 needs to wait up to 45 usec */ 41 + udelay(45); 42 + } else { 42 43 usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0); 44 + } 43 45 44 46 return 0; 45 47 }
+3 -1
drivers/usb/serial/cp210x.c
··· 1077 1077 u8 control; 1078 1078 int result; 1079 1079 1080 - cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control); 1080 + result = cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control); 1081 + if (result) 1082 + return result; 1081 1083 1082 1084 result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0) 1083 1085 |((control & CONTROL_RTS) ? TIOCM_RTS : 0)
+2 -1
drivers/usb/serial/ftdi_sio.c
··· 986 986 /* ekey Devices */ 987 987 { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, 988 988 /* Infineon Devices */ 989 - { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, 989 + { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_TC1798_PID, 1) }, 990 + { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_TC2X7_PID, 1) }, 990 991 /* GE Healthcare devices */ 991 992 { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, 992 993 /* Active Research (Actisense) devices */
+3 -2
drivers/usb/serial/ftdi_sio_ids.h
··· 626 626 /* 627 627 * Infineon Technologies 628 628 */ 629 - #define INFINEON_VID 0x058b 630 - #define INFINEON_TRIBOARD_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ 629 + #define INFINEON_VID 0x058b 630 + #define INFINEON_TRIBOARD_TC1798_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ 631 + #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */ 631 632 632 633 /* 633 634 * Acton Research Corp.
+2 -1
drivers/usb/serial/usb-serial.c
··· 1078 1078 1079 1079 serial->disconnected = 0; 1080 1080 1081 - usb_serial_console_init(serial->port[0]->minor); 1081 + if (num_ports > 0) 1082 + usb_serial_console_init(serial->port[0]->minor); 1082 1083 exit: 1083 1084 module_put(type->driver.owner); 1084 1085 return 0;
+39 -22
drivers/usb/wusbcore/crypto.c
··· 133 133 bo[itr] = bi1[itr] ^ bi2[itr]; 134 134 } 135 135 136 + /* Scratch space for MAC calculations. */ 137 + struct wusb_mac_scratch { 138 + struct aes_ccm_b0 b0; 139 + struct aes_ccm_b1 b1; 140 + struct aes_ccm_a ax; 141 + }; 142 + 136 143 /* 137 144 * CC-MAC function WUSB1.0[6.5] 138 145 * ··· 204 197 * what sg[4] is for. Maybe there is a smarter way to do this. 205 198 */ 206 199 static int wusb_ccm_mac(struct crypto_skcipher *tfm_cbc, 207 - struct crypto_cipher *tfm_aes, void *mic, 200 + struct crypto_cipher *tfm_aes, 201 + struct wusb_mac_scratch *scratch, 202 + void *mic, 208 203 const struct aes_ccm_nonce *n, 209 204 const struct aes_ccm_label *a, const void *b, 210 205 size_t blen) 211 206 { 212 207 int result = 0; 213 208 SKCIPHER_REQUEST_ON_STACK(req, tfm_cbc); 214 - struct aes_ccm_b0 b0; 215 - struct aes_ccm_b1 b1; 216 - struct aes_ccm_a ax; 217 209 struct scatterlist sg[4], sg_dst; 218 210 void *dst_buf; 219 211 size_t dst_size; ··· 224 218 * These checks should be compile time optimized out 225 219 * ensure @a fills b1's mac_header and following fields 226 220 */ 227 - WARN_ON(sizeof(*a) != sizeof(b1) - sizeof(b1.la)); 228 - WARN_ON(sizeof(b0) != sizeof(struct aes_ccm_block)); 229 - WARN_ON(sizeof(b1) != sizeof(struct aes_ccm_block)); 230 - WARN_ON(sizeof(ax) != sizeof(struct aes_ccm_block)); 221 + WARN_ON(sizeof(*a) != sizeof(scratch->b1) - sizeof(scratch->b1.la)); 222 + WARN_ON(sizeof(scratch->b0) != sizeof(struct aes_ccm_block)); 223 + WARN_ON(sizeof(scratch->b1) != sizeof(struct aes_ccm_block)); 224 + WARN_ON(sizeof(scratch->ax) != sizeof(struct aes_ccm_block)); 231 225 232 226 result = -ENOMEM; 233 227 zero_padding = blen % sizeof(struct aes_ccm_block); 234 228 if (zero_padding) 235 229 zero_padding = sizeof(struct aes_ccm_block) - zero_padding; 236 - dst_size = blen + sizeof(b0) + sizeof(b1) + zero_padding; 230 + dst_size = blen + sizeof(scratch->b0) + sizeof(scratch->b1) + 231 + zero_padding; 237 232 dst_buf = kzalloc(dst_size, GFP_KERNEL); 238 233 if (!dst_buf) 239 234 goto error_dst_buf; ··· 242 235 memset(iv, 0, sizeof(iv)); 243 236 244 237 /* Setup B0 */ 245 - b0.flags = 0x59; /* Format B0 */ 246 - b0.ccm_nonce = *n; 247 - b0.lm = cpu_to_be16(0); /* WUSB1.0[6.5] sez l(m) is 0 */ 238 + scratch->b0.flags = 0x59; /* Format B0 */ 239 + scratch->b0.ccm_nonce = *n; 240 + scratch->b0.lm = cpu_to_be16(0); /* WUSB1.0[6.5] sez l(m) is 0 */ 248 241 249 242 /* Setup B1 250 243 * ··· 253 246 * 14'--after clarification, it means to use A's contents 254 247 * for MAC Header, EO, sec reserved and padding. 255 248 */ 256 - b1.la = cpu_to_be16(blen + 14); 257 - memcpy(&b1.mac_header, a, sizeof(*a)); 249 + scratch->b1.la = cpu_to_be16(blen + 14); 250 + memcpy(&scratch->b1.mac_header, a, sizeof(*a)); 258 251 259 252 sg_init_table(sg, ARRAY_SIZE(sg)); 260 - sg_set_buf(&sg[0], &b0, sizeof(b0)); 261 - sg_set_buf(&sg[1], &b1, sizeof(b1)); 253 + sg_set_buf(&sg[0], &scratch->b0, sizeof(scratch->b0)); 254 + sg_set_buf(&sg[1], &scratch->b1, sizeof(scratch->b1)); 262 255 sg_set_buf(&sg[2], b, blen); 263 256 /* 0 if well behaved :) */ 264 257 sg_set_buf(&sg[3], bzero, zero_padding); ··· 283 276 * POS Crypto API: size is assumed to be AES's block size. 284 277 * Thanks for documenting it -- tip taken from airo.c 285 278 */ 286 - ax.flags = 0x01; /* as per WUSB 1.0 spec */ 287 - ax.ccm_nonce = *n; 288 - ax.counter = 0; 289 - crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax); 290 - bytewise_xor(mic, &ax, iv, 8); 279 + scratch->ax.flags = 0x01; /* as per WUSB 1.0 spec */ 280 + scratch->ax.ccm_nonce = *n; 281 + scratch->ax.counter = 0; 282 + crypto_cipher_encrypt_one(tfm_aes, (void *)&scratch->ax, 283 + (void *)&scratch->ax); 284 + bytewise_xor(mic, &scratch->ax, iv, 8); 291 285 result = 8; 292 286 error_cbc_crypt: 293 287 kfree(dst_buf); ··· 311 303 struct aes_ccm_nonce n = *_n; 312 304 struct crypto_skcipher *tfm_cbc; 313 305 struct crypto_cipher *tfm_aes; 306 + struct wusb_mac_scratch *scratch; 314 307 u64 sfn = 0; 315 308 __le64 sfn_le; 316 309 ··· 338 329 printk(KERN_ERR "E: can't set AES key: %d\n", (int)result); 339 330 goto error_setkey_aes; 340 331 } 332 + scratch = kmalloc(sizeof(*scratch), GFP_KERNEL); 333 + if (!scratch) { 334 + result = -ENOMEM; 335 + goto error_alloc_scratch; 336 + } 341 337 342 338 for (bitr = 0; bitr < (len + 63) / 64; bitr++) { 343 339 sfn_le = cpu_to_le64(sfn++); 344 340 memcpy(&n.sfn, &sfn_le, sizeof(n.sfn)); /* n.sfn++... */ 345 - result = wusb_ccm_mac(tfm_cbc, tfm_aes, out + bytes, 341 + result = wusb_ccm_mac(tfm_cbc, tfm_aes, scratch, out + bytes, 346 342 &n, a, b, blen); 347 343 if (result < 0) 348 344 goto error_ccm_mac; 349 345 bytes += result; 350 346 } 351 347 result = bytes; 348 + 349 + kfree(scratch); 350 + error_alloc_scratch: 352 351 error_ccm_mac: 353 352 error_setkey_aes: 354 353 crypto_free_cipher(tfm_aes);