Skip to content

Commit 2d5c7fe

Browse files
committed
Merge tag 'usb-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB driver fixes and new device ids for 6.15-rc4. Nothing major in here, just the normal set of issues that have cropped up after -rc1: - new device ids for usb-serial drivers - new device quirks added - typec driver fixes - chipidea driver fixes - xhci driver fixes - wdm driver fixes - cdns3 driver fixes - MAINTAINERS file update All of these, except for the MAINTAINERS file update, have been in linux-next for a while with no reported issues" * tag 'usb-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (27 commits) MAINTAINERS: Assign maintainer for the port controller drivers USB: serial: simple: add OWON HDS200 series oscilloscope support USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe USB: serial: option: add Sierra Wireless EM9291 usb: typec: class: Unlocked on error in typec_register_partner() usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive USB: wdm: add annotation USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context USB: wdm: close race between wdm_open and wdm_wwan_port_stop USB: wdm: handle IO errors in wdm_wwan_port_start USB: VLI disk crashes if LPM is used usb: dwc3: gadget: check that event count does not exceed event buffer length USB: storage: quirk for ADATA Portable HDD CH94 usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02) usb: dwc3: xilinx: Prevent spike in reset signal usb: cdns3: Fix deadlock when using NCM gadget usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines usb: chipidea: ci_hdrc_imx: fix usbmisc handling ...
2 parents 3648af4 + 3dfc044 commit 2d5c7fe

File tree

19 files changed

+167
-63
lines changed

19 files changed

+167
-63
lines changed

MAINTAINERS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25204,9 +25204,13 @@ S: Maintained
2520425204
F: drivers/usb/typec/mux/pi3usb30532.c
2520525205

2520625206
USB TYPEC PORT CONTROLLER DRIVERS
25207+
M: Badhri Jagan Sridharan <badhri@google.com>
2520725208
L: linux-usb@vger.kernel.org
25208-
S: Orphan
25209-
F: drivers/usb/typec/tcpm/
25209+
S: Maintained
25210+
F: drivers/usb/typec/tcpm/tcpci.c
25211+
F: drivers/usb/typec/tcpm/tcpm.c
25212+
F: include/linux/usb/tcpci.h
25213+
F: include/linux/usb/tcpm.h
2521025214

2521125215
USB TYPEC TUSB1046 MUX DRIVER
2521225216
M: Romain Gantois <romain.gantois@bootlin.com>

drivers/usb/cdns3/cdns3-gadget.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
19631963
unsigned int bit;
19641964
unsigned long reg;
19651965

1966+
local_bh_disable();
19661967
spin_lock_irqsave(&priv_dev->lock, flags);
19671968

19681969
reg = readl(&priv_dev->regs->usb_ists);
@@ -2004,6 +2005,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
20042005
irqend:
20052006
writel(~0, &priv_dev->regs->ep_ien);
20062007
spin_unlock_irqrestore(&priv_dev->lock, flags);
2008+
local_bh_enable();
20072009

20082010
return ret;
20092011
}

drivers/usb/chipidea/ci_hdrc_imx.c

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,13 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event)
336336
return ret;
337337
}
338338

339+
static void ci_hdrc_imx_disable_regulator(void *arg)
340+
{
341+
struct ci_hdrc_imx_data *data = arg;
342+
343+
regulator_disable(data->hsic_pad_regulator);
344+
}
345+
339346
static int ci_hdrc_imx_probe(struct platform_device *pdev)
340347
{
341348
struct ci_hdrc_imx_data *data;
@@ -394,6 +401,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
394401
"Failed to enable HSIC pad regulator\n");
395402
goto err_put;
396403
}
404+
ret = devm_add_action_or_reset(dev,
405+
ci_hdrc_imx_disable_regulator, data);
406+
if (ret) {
407+
dev_err(dev,
408+
"Failed to add regulator devm action\n");
409+
goto err_put;
410+
}
397411
}
398412
}
399413

@@ -432,11 +446,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
432446

433447
ret = imx_get_clks(dev);
434448
if (ret)
435-
goto disable_hsic_regulator;
449+
goto qos_remove_request;
436450

437451
ret = imx_prepare_enable_clks(dev);
438452
if (ret)
439-
goto disable_hsic_regulator;
453+
goto qos_remove_request;
440454

441455
ret = clk_prepare_enable(data->clk_wakeup);
442456
if (ret)
@@ -470,7 +484,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
470484
of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) {
471485
pdata.flags |= CI_HDRC_OVERRIDE_PHY_CONTROL;
472486
data->override_phy_control = true;
473-
usb_phy_init(pdata.usb_phy);
487+
ret = usb_phy_init(pdata.usb_phy);
488+
if (ret) {
489+
dev_err(dev, "Failed to init phy\n");
490+
goto err_clk;
491+
}
474492
}
475493

476494
if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM)
@@ -479,7 +497,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
479497
ret = imx_usbmisc_init(data->usbmisc_data);
480498
if (ret) {
481499
dev_err(dev, "usbmisc init failed, ret=%d\n", ret);
482-
goto err_clk;
500+
goto phy_shutdown;
483501
}
484502

485503
data->ci_pdev = ci_hdrc_add_device(dev,
@@ -488,7 +506,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
488506
if (IS_ERR(data->ci_pdev)) {
489507
ret = PTR_ERR(data->ci_pdev);
490508
dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n");
491-
goto err_clk;
509+
goto phy_shutdown;
492510
}
493511

494512
if (data->usbmisc_data) {
@@ -522,19 +540,20 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
522540

523541
disable_device:
524542
ci_hdrc_remove_device(data->ci_pdev);
543+
phy_shutdown:
544+
if (data->override_phy_control)
545+
usb_phy_shutdown(data->phy);
525546
err_clk:
526547
clk_disable_unprepare(data->clk_wakeup);
527548
err_wakeup_clk:
528549
imx_disable_unprepare_clks(dev);
529-
disable_hsic_regulator:
530-
if (data->hsic_pad_regulator)
531-
/* don't overwrite original ret (cf. EPROBE_DEFER) */
532-
regulator_disable(data->hsic_pad_regulator);
550+
qos_remove_request:
533551
if (pdata.flags & CI_HDRC_PMQOS)
534552
cpu_latency_qos_remove_request(&data->pm_qos_req);
535553
data->ci_pdev = NULL;
536554
err_put:
537-
put_device(data->usbmisc_data->dev);
555+
if (data->usbmisc_data)
556+
put_device(data->usbmisc_data->dev);
538557
return ret;
539558
}
540559

@@ -556,10 +575,9 @@ static void ci_hdrc_imx_remove(struct platform_device *pdev)
556575
clk_disable_unprepare(data->clk_wakeup);
557576
if (data->plat_data->flags & CI_HDRC_PMQOS)
558577
cpu_latency_qos_remove_request(&data->pm_qos_req);
559-
if (data->hsic_pad_regulator)
560-
regulator_disable(data->hsic_pad_regulator);
561578
}
562-
put_device(data->usbmisc_data->dev);
579+
if (data->usbmisc_data)
580+
put_device(data->usbmisc_data->dev);
563581
}
564582

565583
static void ci_hdrc_imx_shutdown(struct platform_device *pdev)

drivers/usb/class/cdc-wdm.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ static int wdm_open(struct inode *inode, struct file *file)
726726
rv = -EBUSY;
727727
goto out;
728728
}
729-
729+
smp_rmb(); /* ordered against wdm_wwan_port_stop() */
730730
rv = usb_autopm_get_interface(desc->intf);
731731
if (rv < 0) {
732732
dev_err(&desc->intf->dev, "Error autopm - %d\n", rv);
@@ -829,6 +829,7 @@ static struct usb_class_driver wdm_class = {
829829
static int wdm_wwan_port_start(struct wwan_port *port)
830830
{
831831
struct wdm_device *desc = wwan_port_get_drvdata(port);
832+
int rv;
832833

833834
/* The interface is both exposed via the WWAN framework and as a
834835
* legacy usbmisc chardev. If chardev is already open, just fail
@@ -848,7 +849,15 @@ static int wdm_wwan_port_start(struct wwan_port *port)
848849
wwan_port_txon(port);
849850

850851
/* Start getting events */
851-
return usb_submit_urb(desc->validity, GFP_KERNEL);
852+
rv = usb_submit_urb(desc->validity, GFP_KERNEL);
853+
if (rv < 0) {
854+
wwan_port_txoff(port);
855+
desc->manage_power(desc->intf, 0);
856+
/* this must be last lest we race with chardev open */
857+
clear_bit(WDM_WWAN_IN_USE, &desc->flags);
858+
}
859+
860+
return rv;
852861
}
853862

854863
static void wdm_wwan_port_stop(struct wwan_port *port)
@@ -859,16 +868,18 @@ static void wdm_wwan_port_stop(struct wwan_port *port)
859868
poison_urbs(desc);
860869
desc->manage_power(desc->intf, 0);
861870
clear_bit(WDM_READ, &desc->flags);
862-
clear_bit(WDM_WWAN_IN_USE, &desc->flags);
863871
unpoison_urbs(desc);
872+
smp_wmb(); /* ordered against wdm_open() */
873+
/* this must be last lest we open a poisoned device */
874+
clear_bit(WDM_WWAN_IN_USE, &desc->flags);
864875
}
865876

866877
static void wdm_wwan_port_tx_complete(struct urb *urb)
867878
{
868879
struct sk_buff *skb = urb->context;
869880
struct wdm_device *desc = skb_shinfo(skb)->destructor_arg;
870881

871-
usb_autopm_put_interface(desc->intf);
882+
usb_autopm_put_interface_async(desc->intf);
872883
wwan_port_txon(desc->wwanp);
873884
kfree_skb(skb);
874885
}
@@ -898,7 +909,7 @@ static int wdm_wwan_port_tx(struct wwan_port *port, struct sk_buff *skb)
898909
req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
899910
req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
900911
req->wValue = 0;
901-
req->wIndex = desc->inum;
912+
req->wIndex = desc->inum; /* already converted */
902913
req->wLength = cpu_to_le16(skb->len);
903914

904915
skb_shinfo(skb)->destructor_arg = desc;

drivers/usb/core/quirks.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ static const struct usb_device_id usb_quirk_list[] = {
369369
{ USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM },
370370
{ USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM },
371371

372+
/* SanDisk Corp. SanDisk 3.2Gen1 */
373+
{ USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT },
374+
372375
/* Realforce 87U Keyboard */
373376
{ USB_DEVICE(0x0853, 0x011b), .driver_info = USB_QUIRK_NO_LPM },
374377

@@ -383,6 +386,9 @@ static const struct usb_device_id usb_quirk_list[] = {
383386
{ USB_DEVICE(0x0904, 0x6103), .driver_info =
384387
USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
385388

389+
/* Silicon Motion Flash Drive */
390+
{ USB_DEVICE(0x090c, 0x1000), .driver_info = USB_QUIRK_DELAY_INIT },
391+
386392
/* Sound Devices USBPre2 */
387393
{ USB_DEVICE(0x0926, 0x0202), .driver_info =
388394
USB_QUIRK_ENDPOINT_IGNORE },
@@ -539,6 +545,9 @@ static const struct usb_device_id usb_quirk_list[] = {
539545
{ USB_DEVICE(0x2040, 0x7200), .driver_info =
540546
USB_QUIRK_CONFIG_INTF_STRINGS },
541547

548+
/* VLI disk */
549+
{ USB_DEVICE(0x2109, 0x0711), .driver_info = USB_QUIRK_NO_LPM },
550+
542551
/* Raydium Touchscreen */
543552
{ USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM },
544553

drivers/usb/dwc3/dwc3-xilinx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
207207

208208
skip_usb3_phy:
209209
/* ulpi reset via gpio-modepin or gpio-framework driver */
210-
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
210+
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
211211
if (IS_ERR(reset_gpio)) {
212212
return dev_err_probe(dev, PTR_ERR(reset_gpio),
213213
"Failed to request reset GPIO\n");
214214
}
215215

216216
if (reset_gpio) {
217-
/* Toggle ulpi to reset the phy. */
218-
gpiod_set_value_cansleep(reset_gpio, 1);
219217
usleep_range(5000, 10000);
220218
gpiod_set_value_cansleep(reset_gpio, 0);
221219
usleep_range(5000, 10000);

drivers/usb/dwc3/gadget.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,6 +4617,12 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
46174617
if (!count)
46184618
return IRQ_NONE;
46194619

4620+
if (count > evt->length) {
4621+
dev_err_ratelimited(dwc->dev, "invalid count(%u) > evt->length(%u)\n",
4622+
count, evt->length);
4623+
return IRQ_NONE;
4624+
}
4625+
46204626
evt->count = count;
46214627
evt->flags |= DWC3_EVENT_PENDING;
46224628

drivers/usb/host/ohci-pci.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,25 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
165165
return 0;
166166
}
167167

168+
static int ohci_quirk_loongson(struct usb_hcd *hcd)
169+
{
170+
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
171+
172+
/*
173+
* Loongson's LS7A OHCI controller (rev 0x02) has a
174+
* flaw. MMIO register with offset 0x60/64 is treated
175+
* as legacy PS2-compatible keyboard/mouse interface.
176+
* Since OHCI only use 4KB BAR resource, LS7A OHCI's
177+
* 32KB BAR is wrapped around (the 2nd 4KB BAR space
178+
* is the same as the 1st 4KB internally). So add 4KB
179+
* offset (0x1000) to the OHCI registers as a quirk.
180+
*/
181+
if (pdev->revision == 0x2)
182+
hcd->regs += SZ_4K; /* SZ_4K = 0x1000 */
183+
184+
return 0;
185+
}
186+
168187
static int ohci_quirk_qemu(struct usb_hcd *hcd)
169188
{
170189
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
@@ -224,6 +243,10 @@ static const struct pci_device_id ohci_pci_quirks[] = {
224243
PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
225244
.driver_data = (unsigned long)ohci_quirk_amd700,
226245
},
246+
{
247+
PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, 0x7a24),
248+
.driver_data = (unsigned long)ohci_quirk_loongson,
249+
},
227250
{
228251
.vendor = PCI_VENDOR_ID_APPLE,
229252
.device = 0x003f,

drivers/usb/host/xhci-hub.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,10 @@ int xhci_bus_resume(struct usb_hcd *hcd)
18781878
int max_ports, port_index;
18791879
int sret;
18801880
u32 next_state;
1881-
u32 temp, portsc;
1881+
u32 portsc;
18821882
struct xhci_hub *rhub;
18831883
struct xhci_port **ports;
1884+
bool disabled_irq = false;
18841885

18851886
rhub = xhci_get_rhub(hcd);
18861887
ports = rhub->ports;
@@ -1896,17 +1897,20 @@ int xhci_bus_resume(struct usb_hcd *hcd)
18961897
return -ESHUTDOWN;
18971898
}
18981899

1899-
/* delay the irqs */
1900-
temp = readl(&xhci->op_regs->command);
1901-
temp &= ~CMD_EIE;
1902-
writel(temp, &xhci->op_regs->command);
1903-
19041900
/* bus specific resume for ports we suspended at bus_suspend */
1905-
if (hcd->speed >= HCD_USB3)
1901+
if (hcd->speed >= HCD_USB3) {
19061902
next_state = XDEV_U0;
1907-
else
1903+
} else {
19081904
next_state = XDEV_RESUME;
1909-
1905+
if (bus_state->bus_suspended) {
1906+
/*
1907+
* prevent port event interrupts from interfering
1908+
* with usb2 port resume process
1909+
*/
1910+
xhci_disable_interrupter(xhci->interrupters[0]);
1911+
disabled_irq = true;
1912+
}
1913+
}
19101914
port_index = max_ports;
19111915
while (port_index--) {
19121916
portsc = readl(ports[port_index]->addr);
@@ -1974,11 +1978,9 @@ int xhci_bus_resume(struct usb_hcd *hcd)
19741978
(void) readl(&xhci->op_regs->command);
19751979

19761980
bus_state->next_statechange = jiffies + msecs_to_jiffies(5);
1977-
/* re-enable irqs */
1978-
temp = readl(&xhci->op_regs->command);
1979-
temp |= CMD_EIE;
1980-
writel(temp, &xhci->op_regs->command);
1981-
temp = readl(&xhci->op_regs->command);
1981+
/* re-enable interrupter */
1982+
if (disabled_irq)
1983+
xhci_enable_interrupter(xhci->interrupters[0]);
19821984

19831985
spin_unlock_irqrestore(&xhci->lock, flags);
19841986
return 0;

drivers/usb/host/xhci-ring.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
561561
* pointer command pending because the device can choose to start any
562562
* stream once the endpoint is on the HW schedule.
563563
*/
564-
if (ep_state & (EP_STOP_CMD_PENDING | SET_DEQ_PENDING | EP_HALTED |
565-
EP_CLEARING_TT | EP_STALLED))
564+
if ((ep_state & EP_STOP_CMD_PENDING) || (ep_state & SET_DEQ_PENDING) ||
565+
(ep_state & EP_HALTED) || (ep_state & EP_CLEARING_TT))
566566
return;
567567

568568
trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id));
@@ -2573,9 +2573,6 @@ static void process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,
25732573

25742574
xhci_handle_halted_endpoint(xhci, ep, td, EP_SOFT_RESET);
25752575
return;
2576-
case COMP_STALL_ERROR:
2577-
ep->ep_state |= EP_STALLED;
2578-
break;
25792576
default:
25802577
/* do nothing */
25812578
break;
@@ -2916,7 +2913,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
29162913
if (xhci_spurious_success_tx_event(xhci, ep_ring)) {
29172914
xhci_dbg(xhci, "Spurious event dma %pad, comp_code %u after %u\n",
29182915
&ep_trb_dma, trb_comp_code, ep_ring->old_trb_comp_code);
2919-
ep_ring->old_trb_comp_code = trb_comp_code;
2916+
ep_ring->old_trb_comp_code = 0;
29202917
return 0;
29212918
}
29222919

@@ -3780,7 +3777,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
37803777
* enqueue a No Op TRB, this can prevent the Setup and Data Stage
37813778
* TRB to be breaked by the Link TRB.
37823779
*/
3783-
if (trb_is_link(ep_ring->enqueue + 1)) {
3780+
if (last_trb_on_seg(ep_ring->enq_seg, ep_ring->enqueue + 1)) {
37843781
field = TRB_TYPE(TRB_TR_NOOP) | ep_ring->cycle_state;
37853782
queue_trb(xhci, ep_ring, false, 0, 0,
37863783
TRB_INTR_TARGET(0), field);

0 commit comments

Comments
 (0)