Skip to content

Commit da1b404

Browse files
committed
Merge tag 'usb-5.18-rc5' 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 5.18-rc5 for some reported issues and new quirks. They include: - dwc3 driver fixes - xhci driver fixes - typec driver fixes - new usb-serial driver ids - added new USB devices to existing quirk tables - other tiny fixes All of these have been in linux-next for a while with no reported issues" * tag 'usb-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (31 commits) usb: phy: generic: Get the vbus supply usb: dwc3: gadget: Return proper request status usb: dwc3: pci: add support for the Intel Meteor Lake-P usb: dwc3: core: Only handle soft-reset in DCTL usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind() usb: misc: eud: Fix an error handling path in eud_probe() usb: core: Don't hold the device lock while sleeping in do_proc_control() usb: dwc3: Try usb-role-switch first in dwc3_drd_init usb: dwc3: core: Fix tx/rx threshold settings usb: mtu3: fix USB 3.0 dual-role-switch from device to host xhci: Enable runtime PM on second Alderlake controller usb: dwc3: fix backwards compat with rockchip devices dt-bindings: usb: samsung,exynos-usb2: add missing required reg usb: misc: fix improper handling of refcount in uss720_probe() USB: Fix ehci infinite suspend-resume loop issue in zhaoxin usb: typec: tcpm: Fix undefined behavior due to shift overflowing the constant usb: typec: rt1719: Fix build error without CONFIG_POWER_SUPPLY usb: typec: ucsi: Fix role swapping usb: typec: ucsi: Fix reuse of completion structure usb: xhci: tegra:Fix PM usage reference leak of tegra_xusb_unpowergate_partitions ...
2 parents e9512f3 + 03e607c commit da1b404

File tree

28 files changed

+193
-45
lines changed

28 files changed

+193
-45
lines changed

Documentation/devicetree/bindings/usb/samsung,exynos-usb2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ required:
6262
- interrupts
6363
- phys
6464
- phy-names
65+
- reg
6566

6667
allOf:
6768
- if:

drivers/usb/cdns3/cdns3-gadget.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,6 +2684,7 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
26842684
struct usb_request *request;
26852685
struct cdns3_request *priv_req;
26862686
struct cdns3_trb *trb = NULL;
2687+
struct cdns3_trb trb_tmp;
26872688
int ret;
26882689
int val;
26892690

@@ -2693,8 +2694,10 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
26932694
if (request) {
26942695
priv_req = to_cdns3_request(request);
26952696
trb = priv_req->trb;
2696-
if (trb)
2697+
if (trb) {
2698+
trb_tmp = *trb;
26972699
trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE);
2700+
}
26982701
}
26992702

27002703
writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
@@ -2709,7 +2712,7 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
27092712

27102713
if (request) {
27112714
if (trb)
2712-
trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE);
2715+
*trb = trb_tmp;
27132716

27142717
cdns3_rearm_transfer(priv_ep, 1);
27152718
}

drivers/usb/core/devio.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,12 +1209,16 @@ static int do_proc_control(struct usb_dev_state *ps,
12091209

12101210
usb_unlock_device(dev);
12111211
i = usbfs_start_wait_urb(urb, tmo, &actlen);
1212+
1213+
/* Linger a bit, prior to the next control message. */
1214+
if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
1215+
msleep(200);
12121216
usb_lock_device(dev);
12131217
snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, tbuf, actlen);
12141218
if (!i && actlen) {
12151219
if (copy_to_user(ctrl->data, tbuf, actlen)) {
12161220
ret = -EFAULT;
1217-
goto recv_fault;
1221+
goto done;
12181222
}
12191223
}
12201224
} else {
@@ -1231,6 +1235,10 @@ static int do_proc_control(struct usb_dev_state *ps,
12311235

12321236
usb_unlock_device(dev);
12331237
i = usbfs_start_wait_urb(urb, tmo, &actlen);
1238+
1239+
/* Linger a bit, prior to the next control message. */
1240+
if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
1241+
msleep(200);
12341242
usb_lock_device(dev);
12351243
snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, NULL, 0);
12361244
}
@@ -1242,10 +1250,6 @@ static int do_proc_control(struct usb_dev_state *ps,
12421250
}
12431251
ret = (i < 0 ? i : actlen);
12441252

1245-
recv_fault:
1246-
/* Linger a bit, prior to the next control message. */
1247-
if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
1248-
msleep(200);
12491253
done:
12501254
kfree(dr);
12511255
usb_free_urb(urb);

drivers/usb/core/quirks.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ static const struct usb_device_id usb_quirk_list[] = {
404404
{ USB_DEVICE(0x0b05, 0x17e0), .driver_info =
405405
USB_QUIRK_IGNORE_REMOTE_WAKEUP },
406406

407+
/* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/
408+
{ USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
409+
407410
/* Realtek hub in Dell WD19 (Type-C) */
408411
{ USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
409412

@@ -507,6 +510,9 @@ static const struct usb_device_id usb_quirk_list[] = {
507510
/* DJI CineSSD */
508511
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
509512

513+
/* VCOM device */
514+
{ USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
515+
510516
/* INTEL VALUE SSD */
511517
{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
512518

drivers/usb/dwc3/core.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
274274

275275
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
276276
reg |= DWC3_DCTL_CSFTRST;
277-
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
277+
reg &= ~DWC3_DCTL_RUN_STOP;
278+
dwc3_gadget_dctl_write_safe(dwc, reg);
278279

279280
/*
280281
* For DWC_usb31 controller 1.90a and later, the DCTL.CSFRST bit
@@ -1377,10 +1378,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
13771378
u8 lpm_nyet_threshold;
13781379
u8 tx_de_emphasis;
13791380
u8 hird_threshold;
1380-
u8 rx_thr_num_pkt_prd;
1381-
u8 rx_max_burst_prd;
1382-
u8 tx_thr_num_pkt_prd;
1383-
u8 tx_max_burst_prd;
1381+
u8 rx_thr_num_pkt_prd = 0;
1382+
u8 rx_max_burst_prd = 0;
1383+
u8 tx_thr_num_pkt_prd = 0;
1384+
u8 tx_max_burst_prd = 0;
13841385
u8 tx_fifo_resize_max_num;
13851386
const char *usb_psy_name;
13861387
int ret;
@@ -1690,21 +1691,44 @@ static int dwc3_probe(struct platform_device *pdev)
16901691
/*
16911692
* Clocks are optional, but new DT platforms should support all
16921693
* clocks as required by the DT-binding.
1694+
* Some devices have different clock names in legacy device trees,
1695+
* check for them to retain backwards compatibility.
16931696
*/
16941697
dwc->bus_clk = devm_clk_get_optional(dev, "bus_early");
16951698
if (IS_ERR(dwc->bus_clk))
16961699
return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
16971700
"could not get bus clock\n");
16981701

1702+
if (dwc->bus_clk == NULL) {
1703+
dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk");
1704+
if (IS_ERR(dwc->bus_clk))
1705+
return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
1706+
"could not get bus clock\n");
1707+
}
1708+
16991709
dwc->ref_clk = devm_clk_get_optional(dev, "ref");
17001710
if (IS_ERR(dwc->ref_clk))
17011711
return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
17021712
"could not get ref clock\n");
17031713

1714+
if (dwc->ref_clk == NULL) {
1715+
dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk");
1716+
if (IS_ERR(dwc->ref_clk))
1717+
return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
1718+
"could not get ref clock\n");
1719+
}
1720+
17041721
dwc->susp_clk = devm_clk_get_optional(dev, "suspend");
17051722
if (IS_ERR(dwc->susp_clk))
17061723
return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
17071724
"could not get suspend clock\n");
1725+
1726+
if (dwc->susp_clk == NULL) {
1727+
dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk");
1728+
if (IS_ERR(dwc->susp_clk))
1729+
return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
1730+
"could not get suspend clock\n");
1731+
}
17081732
}
17091733

17101734
ret = reset_control_deassert(dwc->reset);

drivers/usb/dwc3/drd.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,16 +584,15 @@ int dwc3_drd_init(struct dwc3 *dwc)
584584
{
585585
int ret, irq;
586586

587+
if (ROLE_SWITCH &&
588+
device_property_read_bool(dwc->dev, "usb-role-switch"))
589+
return dwc3_setup_role_switch(dwc);
590+
587591
dwc->edev = dwc3_get_extcon(dwc);
588592
if (IS_ERR(dwc->edev))
589593
return PTR_ERR(dwc->edev);
590594

591-
if (ROLE_SWITCH &&
592-
device_property_read_bool(dwc->dev, "usb-role-switch")) {
593-
ret = dwc3_setup_role_switch(dwc);
594-
if (ret < 0)
595-
return ret;
596-
} else if (dwc->edev) {
595+
if (dwc->edev) {
597596
dwc->edev_nb.notifier_call = dwc3_drd_notifier;
598597
ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
599598
&dwc->edev_nb);

drivers/usb/dwc3/dwc3-pci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#define PCI_DEVICE_ID_INTEL_ADLM 0x54ee
4646
#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
4747
#define PCI_DEVICE_ID_INTEL_RPLS 0x7a61
48+
#define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1
49+
#define PCI_DEVICE_ID_INTEL_MTL 0x7e7e
4850
#define PCI_DEVICE_ID_INTEL_TGL 0x9a15
4951
#define PCI_DEVICE_ID_AMD_MR 0x163a
5052

@@ -456,6 +458,12 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
456458
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
457459
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
458460

461+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLP),
462+
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
463+
464+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL),
465+
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
466+
459467
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
460468
(kernel_ulong_t) &dwc3_pci_intel_swnode, },
461469

drivers/usb/dwc3/gadget.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
32743274
const struct dwc3_event_depevt *event,
32753275
struct dwc3_request *req, int status)
32763276
{
3277+
int request_status;
32773278
int ret;
32783279

32793280
if (req->request.num_mapped_sgs)
@@ -3294,7 +3295,35 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
32943295
req->needs_extra_trb = false;
32953296
}
32963297

3297-
dwc3_gadget_giveback(dep, req, status);
3298+
/*
3299+
* The event status only reflects the status of the TRB with IOC set.
3300+
* For the requests that don't set interrupt on completion, the driver
3301+
* needs to check and return the status of the completed TRBs associated
3302+
* with the request. Use the status of the last TRB of the request.
3303+
*/
3304+
if (req->request.no_interrupt) {
3305+
struct dwc3_trb *trb;
3306+
3307+
trb = dwc3_ep_prev_trb(dep, dep->trb_dequeue);
3308+
switch (DWC3_TRB_SIZE_TRBSTS(trb->size)) {
3309+
case DWC3_TRBSTS_MISSED_ISOC:
3310+
/* Isoc endpoint only */
3311+
request_status = -EXDEV;
3312+
break;
3313+
case DWC3_TRB_STS_XFER_IN_PROG:
3314+
/* Applicable when End Transfer with ForceRM=0 */
3315+
case DWC3_TRBSTS_SETUP_PENDING:
3316+
/* Control endpoint only */
3317+
case DWC3_TRBSTS_OK:
3318+
default:
3319+
request_status = 0;
3320+
break;
3321+
}
3322+
} else {
3323+
request_status = status;
3324+
}
3325+
3326+
dwc3_gadget_giveback(dep, req, request_status);
32983327

32993328
out:
33003329
return ret;

drivers/usb/gadget/configfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,8 @@ static void configfs_composite_unbind(struct usb_gadget *gadget)
14381438
usb_ep_autoconfig_reset(cdev->gadget);
14391439
spin_lock_irqsave(&gi->spinlock, flags);
14401440
cdev->gadget = NULL;
1441+
cdev->deactivations = 0;
1442+
gadget->deactivated = false;
14411443
set_gadget_data(gadget, NULL);
14421444
spin_unlock_irqrestore(&gi->spinlock, flags);
14431445
}

drivers/usb/gadget/function/uvc_queue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect)
264264
buf->state = UVC_BUF_STATE_ERROR;
265265
vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR);
266266
}
267+
queue->buf_used = 0;
268+
267269
/* This must be protected by the irqlock spinlock to avoid race
268270
* conditions between uvc_queue_buffer and the disconnection event that
269271
* could result in an interruptible wait in uvc_dequeue_buffer. Do not

0 commit comments

Comments
 (0)