Skip to content

Commit 44aa31a

Browse files
committed
Merge tag 'usb-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB driver fixes from Greg KH: "Here are some small USB driver fixes for 5.17-rc2 that resolve a number of reported problems. These include: - typec driver fixes - xhci platform driver fixes for suspending - ulpi core fix - role.h build fix - new device ids - syzbot-reported bugfixes - gadget driver fixes - dwc3 driver fixes - other small fixes All of these have been in linux-next this week with no reported issues" * tag 'usb-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: cdnsp: Fix segmentation fault in cdns_lost_power function usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend usb: gadget: at91_udc: fix incorrect print type usb: dwc3: xilinx: Fix error handling when getting USB3 PHY usb: dwc3: xilinx: Skip resets and USB3 register settings for USB2.0 mode usb: xhci-plat: fix crash when suspend if remote wake enable usb: common: ulpi: Fix crash in ulpi_match() usb: gadget: f_sourcesink: Fix isoc transfer for USB_SPEED_SUPER_PLUS ucsi_ccg: Check DEV_INT bit only when starting CCG4 USB: core: Fix hang in usb_kill_urb by adding memory barriers usb-storage: Add unusual-devs entry for VL817 USB-SATA bridge usb: typec: tcpm: Do not disconnect when receiving VSAFE0V usb: typec: tcpm: Do not disconnect while receiving VBUS off usb: typec: Don't try to register component master without components usb: typec: Only attempt to link USB ports if there is fwnode usb: typec: tcpci: don't touch CC line if it's Vconn source usb: roles: fix include/linux/usb/role.h compile issue
2 parents cb323ee + 79aa3e1 commit 44aa31a

File tree

16 files changed

+115
-15
lines changed

16 files changed

+115
-15
lines changed

drivers/usb/cdns3/drd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns)
483483
/* Indicate the cdns3 core was power lost before */
484484
bool cdns_power_is_lost(struct cdns *cdns)
485485
{
486-
if (cdns->version == CDNS3_CONTROLLER_V1) {
487-
if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
486+
if (cdns->version == CDNS3_CONTROLLER_V0) {
487+
if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
488488
return true;
489489
} else {
490-
if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
490+
if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
491491
return true;
492492
}
493493
return false;

drivers/usb/common/ulpi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)
3939
struct ulpi *ulpi = to_ulpi_dev(dev);
4040
const struct ulpi_device_id *id;
4141

42-
/* Some ULPI devices don't have a vendor id so rely on OF match */
43-
if (ulpi->id.vendor == 0)
42+
/*
43+
* Some ULPI devices don't have a vendor id
44+
* or provide an id_table so rely on OF match.
45+
*/
46+
if (ulpi->id.vendor == 0 || !drv->id_table)
4447
return of_driver_match_device(dev, driver);
4548

4649
for (id = drv->id_table; id->vendor; id++)

drivers/usb/core/hcd.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,13 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
15631563
urb->hcpriv = NULL;
15641564
INIT_LIST_HEAD(&urb->urb_list);
15651565
atomic_dec(&urb->use_count);
1566+
/*
1567+
* Order the write of urb->use_count above before the read
1568+
* of urb->reject below. Pairs with the memory barriers in
1569+
* usb_kill_urb() and usb_poison_urb().
1570+
*/
1571+
smp_mb__after_atomic();
1572+
15661573
atomic_dec(&urb->dev->urbnum);
15671574
if (atomic_read(&urb->reject))
15681575
wake_up(&usb_kill_urb_queue);
@@ -1665,6 +1672,13 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
16651672

16661673
usb_anchor_resume_wakeups(anchor);
16671674
atomic_dec(&urb->use_count);
1675+
/*
1676+
* Order the write of urb->use_count above before the read
1677+
* of urb->reject below. Pairs with the memory barriers in
1678+
* usb_kill_urb() and usb_poison_urb().
1679+
*/
1680+
smp_mb__after_atomic();
1681+
16681682
if (unlikely(atomic_read(&urb->reject)))
16691683
wake_up(&usb_kill_urb_queue);
16701684
usb_put_urb(urb);

drivers/usb/core/urb.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,12 @@ void usb_kill_urb(struct urb *urb)
715715
if (!(urb && urb->dev && urb->ep))
716716
return;
717717
atomic_inc(&urb->reject);
718+
/*
719+
* Order the write of urb->reject above before the read
720+
* of urb->use_count below. Pairs with the barriers in
721+
* __usb_hcd_giveback_urb() and usb_hcd_submit_urb().
722+
*/
723+
smp_mb__after_atomic();
718724

719725
usb_hcd_unlink_urb(urb, -ENOENT);
720726
wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
@@ -756,6 +762,12 @@ void usb_poison_urb(struct urb *urb)
756762
if (!urb)
757763
return;
758764
atomic_inc(&urb->reject);
765+
/*
766+
* Order the write of urb->reject above before the read
767+
* of urb->use_count below. Pairs with the barriers in
768+
* __usb_hcd_giveback_urb() and usb_hcd_submit_urb().
769+
*/
770+
smp_mb__after_atomic();
759771

760772
if (!urb->dev || !urb->ep)
761773
return;

drivers/usb/dwc2/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5097,7 +5097,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
50975097
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
50985098
spin_unlock_irqrestore(&hsotg->lock, flags);
50995099

5100-
for (ep = 0; ep < hsotg->num_of_eps; ep++) {
5100+
for (ep = 1; ep < hsotg->num_of_eps; ep++) {
51015101
if (hsotg->eps_in[ep])
51025102
dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
51035103
if (hsotg->eps_out[ep])

drivers/usb/dwc3/dwc3-xilinx.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,26 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
102102
int ret;
103103
u32 reg;
104104

105-
usb3_phy = devm_phy_get(dev, "usb3-phy");
106-
if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) {
107-
ret = -EPROBE_DEFER;
105+
usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
106+
if (IS_ERR(usb3_phy)) {
107+
ret = PTR_ERR(usb3_phy);
108+
dev_err_probe(dev, ret,
109+
"failed to get USB3 PHY\n");
108110
goto err;
109-
} else if (IS_ERR(usb3_phy)) {
110-
usb3_phy = NULL;
111111
}
112112

113+
/*
114+
* The following core resets are not required unless a USB3 PHY
115+
* is used, and the subsequent register settings are not required
116+
* unless a core reset is performed (they should be set properly
117+
* by the first-stage boot loader, but may be reverted by a core
118+
* reset). They may also break the configuration if USB3 is actually
119+
* in use but the usb3-phy entry is missing from the device tree.
120+
* Therefore, skip these operations in this case.
121+
*/
122+
if (!usb3_phy)
123+
goto skip_usb3_phy;
124+
113125
crst = devm_reset_control_get_exclusive(dev, "usb_crst");
114126
if (IS_ERR(crst)) {
115127
ret = PTR_ERR(crst);
@@ -188,6 +200,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
188200
goto err;
189201
}
190202

203+
skip_usb3_phy:
191204
/*
192205
* This routes the USB DMA traffic to go through FPD path instead
193206
* of reaching DDR directly. This traffic routing is needed to

drivers/usb/gadget/function/f_sourcesink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in,
584584

585585
if (is_iso) {
586586
switch (speed) {
587+
case USB_SPEED_SUPER_PLUS:
587588
case USB_SPEED_SUPER:
588589
size = ss->isoc_maxpacket *
589590
(ss->isoc_mult + 1) *

drivers/usb/gadget/udc/at91_udc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ static int at91udc_probe(struct platform_device *pdev)
18951895
at91_vbus_irq, 0, driver_name, udc);
18961896
if (retval) {
18971897
DBG("request vbus irq %d failed\n",
1898-
udc->board.vbus_pin);
1898+
desc_to_gpio(udc->board.vbus_pin));
18991899
goto err_unprepare_iclk;
19001900
}
19011901
}

drivers/usb/host/xhci-plat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
437437
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
438438
int ret;
439439

440+
if (pm_runtime_suspended(dev))
441+
pm_runtime_resume(dev);
442+
440443
ret = xhci_priv_suspend_quirk(hcd);
441444
if (ret)
442445
return ret;

drivers/usb/storage/unusual_devs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,16 @@ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999,
23012301
USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
23022302
US_FL_SCM_MULT_TARG ),
23032303

2304+
/*
2305+
* Reported by DocMAX <[email protected]>
2306+
* and Thomas Weißschuh <[email protected]>
2307+
*/
2308+
UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999,
2309+
"VIA Labs, Inc.",
2310+
"VL817 SATA Bridge",
2311+
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2312+
US_FL_IGNORE_UAS),
2313+
23042314
UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
23052315
"ST",
23062316
"2A",

0 commit comments

Comments
 (0)