History

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

Pull USB/Thunderbolt driver fixes from Greg KH: "Here are a lot of small USB and Thunderbolt driver fixes for 6.0-rc4 for reported problems. Included in here are: - new usb-serial driver ids - dwc3 driver bugfixes for reported problems with 6.0-rc1 - new device quirks, and reverts of some quirks that were incorrect - gadget driver bugfixes for reported problems - USB host controller bugfixes (xhci and others) - other small USB fixes, details in the shortlog - small thunderbolt driver fixes All of these have been in linux-next with no reported issues" * tag 'usb-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (51 commits) Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" usb: storage: Add ASUS <0x0b05:0x1932> to IGNORE_UAS USB: serial: ch341: fix disabled rx timer on older devices USB: serial: ch341: fix lost character on LCR updates USB: serial: cp210x: add Decagon UCA device id Revert "usb: add quirks for Lenovo OneLink+ Dock" usb: cdns3: fix issue with rearming ISO OUT endpoint usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS media: mceusb: Use new usb_control_msg_*() routines USB: core: Prevent nested device-reset calls USB: gadget: Fix obscure lockdep violation for udc_mutex usb: dwc2: fix wrong order of phy_power_on and phy_init usb: gadget: udc-xilinx: replace memcpy with memcpy_toio usb: typec: Remove retimers properly usb: dwc3: disable USB core PHY management usb: add quirks for Lenovo OneLink+ Dock USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id USB: serial: option: add Quectel EM060K modem ...

Linus Torvalds committed 4 years ago

Commit fd595852 parents 1a2f6a3 fe0a2ac38 files · +303 −167Browse files

Unified · Split

38 files
  1. Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml +1 −0
  2. Documentation/devicetree/bindings/usb/qcom,dwc3.yaml +6 −0
  3. drivers/media/rc/mceusb.c +14 −21
  4. drivers/thunderbolt/ctl.c +1 −1
  5. drivers/thunderbolt/switch.c +5 −1
  6. drivers/usb/cdns3/cdns3-gadget.c +3 −1
  7. drivers/usb/class/cdc-acm.c +3 −0
  8. drivers/usb/core/hub.c +10 −0
  9. drivers/usb/dwc2/platform.c +4 −4
  10. drivers/usb/dwc3/core.c +12 −12
  11. drivers/usb/dwc3/dwc3-pci.c +4 −0
  12. drivers/usb/dwc3/dwc3-qcom.c +58 −38
  13. drivers/usb/dwc3/gadget.c +5 −3
  14. drivers/usb/dwc3/host.c +11 −0
  15. drivers/usb/gadget/function/f_uac2.c +14 −2
  16. drivers/usb/gadget/function/storage_common.c +4 −2
  17. drivers/usb/gadget/udc/core.c +16 −10
  18. drivers/usb/host/xhci-hub.c +12 −1
  19. drivers/usb/host/xhci-mtk-sch.c +4 −11
  20. drivers/usb/host/xhci-plat.c +8 −3
  21. drivers/usb/host/xhci.c +5 −14
  22. drivers/usb/host/xhci.h +1 −3
  23. drivers/usb/misc/onboard_usb_hub.c +1 −4
  24. drivers/usb/musb/Kconfig +1 −1
  25. drivers/usb/serial/ch341.c +14 −2
  26. drivers/usb/serial/cp210x.c +1 −0
  27. drivers/usb/serial/ftdi_sio.c +2 −0
  28. drivers/usb/serial/ftdi_sio_ids.h +6 −0
  29. drivers/usb/serial/option.c +15 −0
  30. drivers/usb/storage/unusual_devs.h +7 −0
  31. drivers/usb/storage/unusual_uas.h +7 −0
  32. drivers/usb/typec/altmodes/displayport.c +2 −2
  33. drivers/usb/typec/class.c +1 −0
  34. drivers/usb/typec/mux/intel_pmc_mux.c +7 −2
  35. drivers/usb/typec/tcpm/tcpm.c +7 −0
  36. drivers/usb/typec/ucsi/ucsi.c +24 −29
  37. include/linux/usb.h +2 −0
  38. include/linux/usb/typec_dp.h +5 −0
Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml+1−0
@@ -24,6 +24,7 @@ properties: · 23 unmodified lines
2424 - mediatek,mt2712-mtu3
2525 - mediatek,mt8173-mtu3
2626 - mediatek,mt8183-mtu3
27+ - mediatek,mt8188-mtu3
2728 - mediatek,mt8192-mtu3
2829 - mediatek,mt8195-mtu3
2930 - const: mediatek,mtu3
Documentation/devicetree/bindings/usb/qcom,dwc3.yaml+6−0
@@ -33,6 +33,7 @@ properties: · 32 unmodified lines
3333 - qcom,sm6115-dwc3
3434 - qcom,sm6125-dwc3
3535 - qcom,sm6350-dwc3
36+ - qcom,sm6375-dwc3
3637 - qcom,sm8150-dwc3
3738 - qcom,sm8250-dwc3
3839 - qcom,sm8350-dwc3
@@ -108,12 +109,17 @@ properties: · 69 unmodified lines
108109 HS/FS/LS modes are supported.
109110 type: boolean
110111
112+ wakeup-source: true
113+
111114 # Required child node:
112115
113116 patternProperties:
114117 "^usb@[0-9a-f]+$":
115118 $ref: snps,dwc3.yaml#
116119
120+ properties:
121+ wakeup-source: false
122+
117123 required:
118124 - compatible
119125 - reg
drivers/media/rc/mceusb.c+14−21
@@ -1416,42 +1416,37 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) · 1415 unmodified lines
14161416 {
14171417 int ret;
14181418 struct device *dev = ir->dev;
1419− char *data;
1420−
1421− data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL);
1422− if (!data) {
1423− dev_err(dev, "%s: memory allocation failed!", __func__);
1424− return;
1425− }
1419+ char data[USB_CTRL_MSG_SZ];
14261420
14271421 /*
14281422 * This is a strange one. Windows issues a set address to the device
14291423 * on the receive control pipe and expect a certain value pair back
14301424 */
1431− ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
1432− USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
1433− data, USB_CTRL_MSG_SZ, 3000);
1425+ ret = usb_control_msg_recv(ir->usbdev, 0, USB_REQ_SET_ADDRESS,
1426+ USB_DIR_IN | USB_TYPE_VENDOR,
1427+ 0, 0, data, USB_CTRL_MSG_SZ, 3000,
1428+ GFP_KERNEL);
14341429 dev_dbg(dev, "set address - ret = %d", ret);
14351430 dev_dbg(dev, "set address - data[0] = %d, data[1] = %d",
14361431 data[0], data[1]);
14371432
14381433 /* set feature: bit rate 38400 bps */
1439− ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1440− USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
1441− 0xc04e, 0x0000, NULL, 0, 3000);
1434+ ret = usb_control_msg_send(ir->usbdev, 0,
1435+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
1436+ 0xc04e, 0x0000, NULL, 0, 3000, GFP_KERNEL);
14421437
14431438 dev_dbg(dev, "set feature - ret = %d", ret);
14441439
14451440 /* bRequest 4: set char length to 8 bits */
1446− ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1447− 4, USB_TYPE_VENDOR,
1448− 0x0808, 0x0000, NULL, 0, 3000);
1441+ ret = usb_control_msg_send(ir->usbdev, 0,
1442+ 4, USB_TYPE_VENDOR,
1443+ 0x0808, 0x0000, NULL, 0, 3000, GFP_KERNEL);
14491444 dev_dbg(dev, "set char length - retB = %d", ret);
14501445
14511446 /* bRequest 2: set handshaking to use DTR/DSR */
1452− ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1453− 2, USB_TYPE_VENDOR,
1454− 0x0000, 0x0100, NULL, 0, 3000);
1447+ ret = usb_control_msg_send(ir->usbdev, 0,
1448+ 2, USB_TYPE_VENDOR,
1449+ 0x0000, 0x0100, NULL, 0, 3000, GFP_KERNEL);
14551450 dev_dbg(dev, "set handshake - retC = %d", ret);
14561451
14571452 /* device resume */
@@ -1459,8 +1454,6 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) · 1 unmodified line
14591454
14601455 /* get hw/sw revision? */
14611456 mce_command_out(ir, GET_REVISION, sizeof(GET_REVISION));
1462−
1463− kfree(data);
14641457 }
14651458
14661459 static void mceusb_gen2_init(struct mceusb_dev *ir)
drivers/thunderbolt/ctl.c+1−1
@@ -407,7 +407,7 @@ static void tb_ctl_rx_submit(struct ctl_pkg *pkg) · 406 unmodified lines
407407
408408 static int tb_async_error(const struct ctl_pkg *pkg)
409409 {
410− const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg;
410+ const struct cfg_error_pkg *error = pkg->buffer;
411411
412412 if (pkg->frame.eof != TB_CFG_PKG_ERROR)
413413 return false;
drivers/thunderbolt/switch.c+5−1
@@ -3786,14 +3786,18 @@ int tb_switch_pcie_l1_enable(struct tb_switch *sw) · 3785 unmodified lines
37863786 */
37873787 int tb_switch_xhci_connect(struct tb_switch *sw)
37883788 {
3789− bool usb_port1, usb_port3, xhci_port1, xhci_port3;
37903789 struct tb_port *port1, *port3;
37913790 int ret;
37923791
3792+ if (sw->generation != 3)
3793+ return 0;
3794+
37933795 port1 = &sw->ports[1];
37943796 port3 = &sw->ports[3];
37953797
37963798 if (tb_switch_is_alpine_ridge(sw)) {
3799+ bool usb_port1, usb_port3, xhci_port1, xhci_port3;
3800+
37973801 usb_port1 = tb_lc_is_usb_plugged(port1);
37983802 usb_port3 = tb_lc_is_usb_plugged(port3);
37993803 xhci_port1 = tb_lc_is_xhci_connected(port1);
drivers/usb/cdns3/cdns3-gadget.c+3−1
@@ -1530,7 +1530,8 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev, · 1529 unmodified lines
15301530 TRB_LEN(le32_to_cpu(trb->length));
15311531
15321532 if (priv_req->num_of_trb > 1 &&
1533− le32_to_cpu(trb->control) & TRB_SMM)
1533+ le32_to_cpu(trb->control) & TRB_SMM &&
1534+ le32_to_cpu(trb->control) & TRB_CHAIN)
15341535 transfer_end = true;
15351536
15361537 cdns3_ep_inc_deq(priv_ep);
@@ -1690,6 +1691,7 @@ static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep) · 153 unmodified lines
16901691 ep_cfg &= ~EP_CFG_ENABLE;
16911692 writel(ep_cfg, &priv_dev->regs->ep_cfg);
16921693 priv_ep->flags &= ~EP_QUIRK_ISO_OUT_EN;
1694+ priv_ep->flags |= EP_UPDATE_EP_TRBADDR;
16931695 }
16941696 cdns3_transfer_completed(priv_dev, priv_ep);
16951697 } else if (!(priv_ep->flags & EP_STALLED) &&
drivers/usb/class/cdc-acm.c+3−0
@@ -1810,6 +1810,9 @@ static const struct usb_device_id acm_ids[] = { · 1809 unmodified lines
18101810 { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */
18111811 .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */
18121812 },
1813+ { USB_DEVICE(0x0c26, 0x0020), /* Icom ICF3400 Serie */
1814+ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1815+ },
18131816 { USB_DEVICE(0x0ca6, 0xa050), /* Castles VEGA3000 */
18141817 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
18151818 },
drivers/usb/core/hub.c+10−0
@@ -6038,6 +6038,11 @@ re_enumerate: · 6037 unmodified lines
60386038 * the reset is over (using their post_reset method).
60396039 *
60406040 * Return: The same as for usb_reset_and_verify_device().
6041+ * However, if a reset is already in progress (for instance, if a
6042+ * driver doesn't have pre_ or post_reset() callbacks, and while
6043+ * being unbound or re-bound during the ongoing reset its disconnect()
6044+ * or probe() routine tries to perform a second, nested reset), the
6045+ * routine returns -EINPROGRESS.
60416046 *
60426047 * Note:
60436048 * The caller must own the device lock. For example, it's safe to use
@@ -6071,6 +6076,10 @@ int usb_reset_device(struct usb_device *udev) · 27 unmodified lines
60716076 return -EISDIR;
60726077 }
60736078
6079+ if (udev->reset_in_progress)
6080+ return -EINPROGRESS;
6081+ udev->reset_in_progress = 1;
6082+
60746083 port_dev = hub->ports[udev->portnum - 1];
60756084
60766085 /*
@@ -6135,6 +6144,7 @@ int usb_reset_device(struct usb_device *udev) · 58 unmodified lines
61356144
61366145 usb_autosuspend_device(udev);
61376146 memalloc_noio_restore(noio_flag);
6147+ udev->reset_in_progress = 0;
61386148 return ret;
61396149 }
61406150 EXPORT_SYMBOL_GPL(usb_reset_device);
drivers/usb/dwc2/platform.c+4−4
@@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) · 153 unmodified lines
154154 } else if (hsotg->plat && hsotg->plat->phy_init) {
155155 ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
156156 } else {
157− ret = phy_power_on(hsotg->phy);
157+ ret = phy_init(hsotg->phy);
158158 if (ret == 0)
159− ret = phy_init(hsotg->phy);
159+ ret = phy_power_on(hsotg->phy);
160160 }
161161
162162 return ret;
@@ -188,9 +188,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) · 25 unmodified lines
188188 } else if (hsotg->plat && hsotg->plat->phy_exit) {
189189 ret = hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
190190 } else {
191− ret = phy_exit(hsotg->phy);
191+ ret = phy_power_off(hsotg->phy);
192192 if (ret == 0)
193− ret = phy_power_off(hsotg->phy);
193+ ret = phy_exit(hsotg->phy);
194194 }
195195 if (ret)
196196 return ret;
drivers/usb/dwc3/core.c+12−12
@@ -833,15 +833,16 @@ static void dwc3_core_exit(struct dwc3 *dwc) · 832 unmodified lines
833833 {
834834 dwc3_event_buffers_cleanup(dwc);
835835
836+ usb_phy_set_suspend(dwc->usb2_phy, 1);
837+ usb_phy_set_suspend(dwc->usb3_phy, 1);
838+ phy_power_off(dwc->usb2_generic_phy);
839+ phy_power_off(dwc->usb3_generic_phy);
840+
836841 usb_phy_shutdown(dwc->usb2_phy);
837842 usb_phy_shutdown(dwc->usb3_phy);
838843 phy_exit(dwc->usb2_generic_phy);
839844 phy_exit(dwc->usb3_generic_phy);
840845
841− usb_phy_set_suspend(dwc->usb2_phy, 1);
842− usb_phy_set_suspend(dwc->usb3_phy, 1);
843− phy_power_off(dwc->usb2_generic_phy);
844− phy_power_off(dwc->usb3_generic_phy);
845846 dwc3_clk_disable(dwc);
846847 reset_control_assert(dwc->reset);
847848 }
@@ -1821,7 +1822,6 @@ static int dwc3_probe(struct platform_device *pdev) · 973 unmodified lines
18211822
18221823 platform_set_drvdata(pdev, dwc);
18231824 dwc3_cache_hwparams(dwc);
1824− device_init_wakeup(&pdev->dev, of_property_read_bool(dev->of_node, "wakeup-source"));
18251825
18261826 spin_lock_init(&dwc->lock);
18271827 mutex_init(&dwc->mutex);
@@ -1879,16 +1879,16 @@ err5: · 51 unmodified lines
18791879 dwc3_debugfs_exit(dwc);
18801880 dwc3_event_buffers_cleanup(dwc);
18811881
1882− usb_phy_shutdown(dwc->usb2_phy);
1883− usb_phy_shutdown(dwc->usb3_phy);
1884− phy_exit(dwc->usb2_generic_phy);
1885− phy_exit(dwc->usb3_generic_phy);
1886−
18871882 usb_phy_set_suspend(dwc->usb2_phy, 1);
18881883 usb_phy_set_suspend(dwc->usb3_phy, 1);
18891884 phy_power_off(dwc->usb2_generic_phy);
18901885 phy_power_off(dwc->usb3_generic_phy);
18911886
1887+ usb_phy_shutdown(dwc->usb2_phy);
1888+ usb_phy_shutdown(dwc->usb3_phy);
1889+ phy_exit(dwc->usb2_generic_phy);
1890+ phy_exit(dwc->usb3_generic_phy);
1891+
18921892 dwc3_ulpi_exit(dwc);
18931893
18941894 err4:
@@ -1983,7 +1983,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) · 88 unmodified lines
19831983 dwc3_core_exit(dwc);
19841984 break;
19851985 case DWC3_GCTL_PRTCAP_HOST:
1986− if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) {
1986+ if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
19871987 dwc3_core_exit(dwc);
19881988 break;
19891989 }
@@ -2044,7 +2044,7 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) · 54 unmodified lines
20442044 spin_unlock_irqrestore(&dwc->lock, flags);
20452045 break;
20462046 case DWC3_GCTL_PRTCAP_HOST:
2047− if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) {
2047+ if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
20482048 ret = dwc3_core_init_for_resume(dwc);
20492049 if (ret)
20502050 return ret;
drivers/usb/dwc3/dwc3-pci.c+4−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444 #define PCI_DEVICE_ID_INTEL_ADLP 0x51ee
4545 #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee
4646 #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
47+#define PCI_DEVICE_ID_INTEL_RPL 0x460e
4748 #define PCI_DEVICE_ID_INTEL_RPLS 0x7a61
4849 #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1
4950 #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e
@@ -456,6 +457,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 406 unmodified lines
456457 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
457458 (kernel_ulong_t) &dwc3_pci_intel_swnode, },
458459
460+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL),
461+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
462+
459463 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
460464 (kernel_ulong_t) &dwc3_pci_intel_swnode, },
461465
drivers/usb/dwc3/dwc3-qcom.c+58−38
@@ -17,7 +17,6 @@ · 16 unmodified lines
1717 #include <linux/of_platform.h>
1818 #include <linux/platform_device.h>
1919 #include <linux/phy/phy.h>
20−#include <linux/pm_domain.h>
2120 #include <linux/usb/of.h>
2221 #include <linux/reset.h>
2322 #include <linux/iopoll.h>
@@ -299,11 +298,24 @@ static void dwc3_qcom_interconnect_exit(struct dwc3_qcom *qcom) · 275 unmodified lines
299298 icc_put(qcom->icc_path_apps);
300299 }
301300
301+/* Only usable in contexts where the role can not change. */
302+static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom)
303+{
304+ struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
305+
306+ return dwc->xhci;
307+}
308+
302309 static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom)
303310 {
304311 struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
305− struct usb_hcd *hcd = platform_get_drvdata(dwc->xhci);
306312 struct usb_device *udev;
313+ struct usb_hcd __maybe_unused *hcd;
314+
315+ /*
316+ * FIXME: Fix this layering violation.
317+ */
318+ hcd = platform_get_drvdata(dwc->xhci);
307319
308320 /*
309321 * It is possible to query the speed of all children of
@@ -311,8 +323,11 @@ static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom) · 1 unmodified line
311323 * currently supports only 1 port per controller. So
312324 * this is sufficient.
313325 */
326+#ifdef CONFIG_USB
314327 udev = usb_hub_find_child(hcd->self.root_hub, 1);
315−
328+#else
329+ udev = NULL;
330+#endif
316331 if (!udev)
317332 return USB_SPEED_UNKNOWN;
318333
@@ -387,7 +402,7 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) · 68 unmodified lines
387402 dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0);
388403 }
389404
390−static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
405+static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
391406 {
392407 u32 val;
393408 int i, ret;
@@ -406,7 +421,11 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) · 12 unmodified lines
406421 if (ret)
407422 dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret);
408423
409− if (device_may_wakeup(qcom->dev)) {
424+ /*
425+ * The role is stable during suspend as role switching is done from a
426+ * freezable workqueue.
427+ */
428+ if (dwc3_qcom_is_host(qcom) && wakeup) {
410429 qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom);
411430 dwc3_qcom_enable_interrupts(qcom);
412431 }
@@ -416,7 +435,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) · 3 unmodified lines
416435 return 0;
417436 }
418437
419−static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
438+static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
420439 {
421440 int ret;
422441 int i;
@@ -424,7 +443,7 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) · 1 unmodified line
424443 if (!qcom->is_suspended)
425444 return 0;
426445
427− if (device_may_wakeup(qcom->dev))
446+ if (dwc3_qcom_is_host(qcom) && wakeup)
428447 dwc3_qcom_disable_interrupts(qcom);
429448
430449 for (i = 0; i < qcom->num_clocks; i++) {
@@ -458,7 +477,11 @@ static irqreturn_t qcom_dwc3_resume_irq(int irq, void *data) · 27 unmodified lines
458477 if (qcom->pm_suspended)
459478 return IRQ_HANDLED;
460479
461− if (dwc->xhci)
480+ /*
481+ * This is safe as role switching is done from a freezable workqueue
482+ * and the wakeup interrupts are disabled as part of resume.
483+ */
484+ if (dwc3_qcom_is_host(qcom))
462485 pm_runtime_resume(&dwc->xhci->dev);
463486
464487 return IRQ_HANDLED;
@@ -757,13 +780,13 @@ dwc3_qcom_create_urs_usb_platdev(struct device *dev) · 292 unmodified lines
757780
758781 static int dwc3_qcom_probe(struct platform_device *pdev)
759782 {
760− struct device_node *np = pdev->dev.of_node;
761− struct device *dev = &pdev->dev;
762− struct dwc3_qcom *qcom;
763− struct resource *res, *parent_res = NULL;
764− int ret, i;
765− bool ignore_pipe_clk;
766− struct generic_pm_domain *genpd;
783+ struct device_node *np = pdev->dev.of_node;
784+ struct device *dev = &pdev->dev;
785+ struct dwc3_qcom *qcom;
786+ struct resource *res, *parent_res = NULL;
787+ int ret, i;
788+ bool ignore_pipe_clk;
789+ bool wakeup_source;
767790
768791 qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
769792 if (!qcom)
@@ -772,8 +795,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev) · 2 unmodified lines
772795 platform_set_drvdata(pdev, qcom);
773796 qcom->dev = &pdev->dev;
774797
775− genpd = pd_to_genpd(qcom->dev->pm_domain);
776−
777798 if (has_acpi_companion(dev)) {
778799 qcom->acpi_pdata = acpi_device_get_match_data(dev);
779800 if (!qcom->acpi_pdata) {
@@ -881,16 +902,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev) · 101 unmodified lines
881902 if (ret)
882903 goto interconnect_exit;
883904
884− if (device_can_wakeup(&qcom->dwc3->dev)) {
885− /*
886− * Setting GENPD_FLAG_ALWAYS_ON flag takes care of keeping
887− * genpd on in both runtime suspend and system suspend cases.
888− */
889− genpd->flags |= GENPD_FLAG_ALWAYS_ON;
890− device_init_wakeup(&pdev->dev, true);
891− } else {
892− genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON;
893− }
905+ wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
906+ device_init_wakeup(&pdev->dev, wakeup_source);
907+ device_init_wakeup(&qcom->dwc3->dev, wakeup_source);
894908
895909 qcom->is_suspended = false;
896910 pm_runtime_set_active(dev);
@@ -944,39 +958,45 @@ static int dwc3_qcom_remove(struct platform_device *pdev) · 47 unmodified lines
944958 static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
945959 {
946960 struct dwc3_qcom *qcom = dev_get_drvdata(dev);
947− int ret = 0;
961+ bool wakeup = device_may_wakeup(dev);
962+ int ret;
948963
949− ret = dwc3_qcom_suspend(qcom);
950− if (!ret)
951− qcom->pm_suspended = true;
964+ ret = dwc3_qcom_suspend(qcom, wakeup);
965+ if (ret)
966+ return ret;
952967
953− return ret;
968+ qcom->pm_suspended = true;
969+
970+ return 0;
954971 }
955972
956973 static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
957974 {
958975 struct dwc3_qcom *qcom = dev_get_drvdata(dev);
976+ bool wakeup = device_may_wakeup(dev);
959977 int ret;
960978
961− ret = dwc3_qcom_resume(qcom);
962− if (!ret)
963− qcom->pm_suspended = false;
979+ ret = dwc3_qcom_resume(qcom, wakeup);
980+ if (ret)
981+ return ret;
964982
965− return ret;
983+ qcom->pm_suspended = false;
984+
985+ return 0;
966986 }
967987
968988 static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)
969989 {
970990 struct dwc3_qcom *qcom = dev_get_drvdata(dev);
971991
972− return dwc3_qcom_suspend(qcom);
992+ return dwc3_qcom_suspend(qcom, true);
973993 }
974994
975995 static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev)
976996 {
977997 struct dwc3_qcom *qcom = dev_get_drvdata(dev);
978998
979− return dwc3_qcom_resume(qcom);
999+ return dwc3_qcom_resume(qcom, true);
9801000 }
9811001
9821002 static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = {
drivers/usb/dwc3/gadget.c+5−3
@@ -2539,9 +2539,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 2538 unmodified lines
25392539
25402540 is_on = !!is_on;
25412541
2542− if (dwc->pullups_connected == is_on)
2543− return 0;
2544−
25452542 dwc->softconnect = is_on;
25462543
25472544 /*
@@ -2566,6 +2563,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 18 unmodified lines
25662563 return 0;
25672564 }
25682565
2566+ if (dwc->pullups_connected == is_on) {
2567+ pm_runtime_put(dwc->dev);
2568+ return 0;
2569+ }
2570+
25692571 if (!is_on) {
25702572 ret = dwc3_gadget_soft_disconnect(dwc);
25712573 } else {
drivers/usb/dwc3/host.c+11−0
@@ -11,8 +11,13 @@ · 10 unmodified lines
1111 #include <linux/of.h>
1212 #include <linux/platform_device.h>
1313
14+#include "../host/xhci-plat.h"
1415 #include "core.h"
1516
17+static const struct xhci_plat_priv dwc3_xhci_plat_priv = {
18+ .quirks = XHCI_SKIP_PHY_INIT,
19+};
20+
1621 static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc,
1722 int irq, char *name)
1823 {
@@ -92,6 +97,11 @@ int dwc3_host_init(struct dwc3 *dwc) · 73 unmodified lines
9297 goto err;
9398 }
9499
100+ ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv,
101+ sizeof(dwc3_xhci_plat_priv));
102+ if (ret)
103+ goto err;
104+
95105 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
96106
97107 if (dwc->usb3_lpm_capable)
@@ -135,4 +145,5 @@ err: · 37 unmodified lines
135145 void dwc3_host_exit(struct dwc3 *dwc)
136146 {
137147 platform_device_unregister(dwc->xhci);
148+ dwc->xhci = NULL;
138149 }
drivers/usb/gadget/function/f_uac2.c+14−2
@@ -291,6 +291,12 @@ static struct usb_endpoint_descriptor ss_ep_int_desc = { · 290 unmodified lines
291291 .bInterval = 4,
292292 };
293293
294+static struct usb_ss_ep_comp_descriptor ss_ep_int_desc_comp = {
295+ .bLength = sizeof(ss_ep_int_desc_comp),
296+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
297+ .wBytesPerInterval = cpu_to_le16(6),
298+};
299+
294300 /* Audio Streaming OUT Interface - Alt0 */
295301 static struct usb_interface_descriptor std_as_out_if0_desc = {
296302 .bLength = sizeof std_as_out_if0_desc,
@@ -604,7 +610,8 @@ static struct usb_descriptor_header *ss_audio_desc[] = { · 307 unmodified lines
604610 (struct usb_descriptor_header *)&in_feature_unit_desc,
605611 (struct usb_descriptor_header *)&io_out_ot_desc,
606612
607− (struct usb_descriptor_header *)&ss_ep_int_desc,
613+ (struct usb_descriptor_header *)&ss_ep_int_desc,
614+ (struct usb_descriptor_header *)&ss_ep_int_desc_comp,
608615
609616 (struct usb_descriptor_header *)&std_as_out_if0_desc,
610617 (struct usb_descriptor_header *)&std_as_out_if1_desc,
@@ -800,6 +807,7 @@ static void setup_headers(struct f_uac2_opts *opts, · 189 unmodified lines
800807 struct usb_ss_ep_comp_descriptor *epout_desc_comp = NULL;
801808 struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL;
802809 struct usb_ss_ep_comp_descriptor *epin_fback_desc_comp = NULL;
810+ struct usb_ss_ep_comp_descriptor *ep_int_desc_comp = NULL;
803811 struct usb_endpoint_descriptor *epout_desc;
804812 struct usb_endpoint_descriptor *epin_desc;
805813 struct usb_endpoint_descriptor *epin_fback_desc;
@@ -827,6 +835,7 @@ static void setup_headers(struct f_uac2_opts *opts, · 21 unmodified lines
827835 epin_fback_desc = &ss_epin_fback_desc;
828836 epin_fback_desc_comp = &ss_epin_fback_desc_comp;
829837 ep_int_desc = &ss_ep_int_desc;
838+ ep_int_desc_comp = &ss_ep_int_desc_comp;
830839 }
831840
832841 i = 0;
@@ -855,8 +864,11 @@ static void setup_headers(struct f_uac2_opts *opts, · 22 unmodified lines
855864 if (EPOUT_EN(opts))
856865 headers[i++] = USBDHDR(&io_out_ot_desc);
857866
858− if (FUOUT_EN(opts) || FUIN_EN(opts))
867+ if (FUOUT_EN(opts) || FUIN_EN(opts)) {
859868 headers[i++] = USBDHDR(ep_int_desc);
869+ if (ep_int_desc_comp)
870+ headers[i++] = USBDHDR(ep_int_desc_comp);
871+ }
860872
861873 if (EPOUT_EN(opts)) {
862874 headers[i++] = USBDHDR(&std_as_out_if0_desc);
drivers/usb/gadget/function/storage_common.c+4−2
@@ -294,8 +294,10 @@ EXPORT_SYMBOL_GPL(fsg_lun_fsync_sub); · 293 unmodified lines
294294 void store_cdrom_address(u8 *dest, int msf, u32 addr)
295295 {
296296 if (msf) {
297− /* Convert to Minutes-Seconds-Frames */
298− addr >>= 2; /* Convert to 2048-byte frames */
297+ /*
298+ * Convert to Minutes-Seconds-Frames.
299+ * Sector size is already set to 2048 bytes.
300+ */
299301 addr += 2*75; /* Lead-in occupies 2 seconds */
300302 dest[3] = addr % 75; /* Frames */
301303 addr /= 75;
drivers/usb/gadget/udc/core.c+16−10
@@ -736,7 +736,10 @@ int usb_gadget_disconnect(struct usb_gadget *gadget) · 735 unmodified lines
736736 ret = gadget->ops->pullup(gadget, 0);
737737 if (!ret) {
738738 gadget->connected = 0;
739− gadget->udc->driver->disconnect(gadget);
739+ mutex_lock(&udc_lock);
740+ if (gadget->udc->driver)
741+ gadget->udc->driver->disconnect(gadget);
742+ mutex_unlock(&udc_lock);
740743 }
741744
742745 out:
@@ -1489,7 +1492,6 @@ static int gadget_bind_driver(struct device *dev) · 746 unmodified lines
14891492
14901493 usb_gadget_udc_set_speed(udc, driver->max_speed);
14911494
1492− mutex_lock(&udc_lock);
14931495 ret = driver->bind(udc->gadget, driver);
14941496 if (ret)
14951497 goto err_bind;
@@ -1499,7 +1501,6 @@ static int gadget_bind_driver(struct device *dev) · 3 unmodified lines
14991501 goto err_start;
15001502 usb_gadget_enable_async_callbacks(udc);
15011503 usb_udc_connect_control(udc);
1502− mutex_unlock(&udc_lock);
15031504
15041505 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
15051506 return 0;
@@ -1512,6 +1513,7 @@ static int gadget_bind_driver(struct device *dev) · 6 unmodified lines
15121513 dev_err(&udc->dev, "failed to start %s: %d\n",
15131514 driver->function, ret);
15141515
1516+ mutex_lock(&udc_lock);
15151517 udc->driver = NULL;
15161518 driver->is_bound = false;
15171519 mutex_unlock(&udc_lock);
@@ -1529,7 +1531,6 @@ static void gadget_unbind_driver(struct device *dev) · 11 unmodified lines
15291531
15301532 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
15311533
1532− mutex_lock(&udc_lock);
15331534 usb_gadget_disconnect(gadget);
15341535 usb_gadget_disable_async_callbacks(udc);
15351536 if (gadget->irq)
@@ -1537,6 +1538,7 @@ static void gadget_unbind_driver(struct device *dev) · 1 unmodified line
15371538 udc->driver->unbind(gadget);
15381539 usb_gadget_udc_stop(udc);
15391540
1541+ mutex_lock(&udc_lock);
15401542 driver->is_bound = false;
15411543 udc->driver = NULL;
15421544 mutex_unlock(&udc_lock);
@@ -1612,7 +1614,7 @@ static ssize_t soft_connect_store(struct device *dev, · 69 unmodified lines
16121614 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
16131615 ssize_t ret;
16141616
1615− mutex_lock(&udc_lock);
1617+ device_lock(&udc->gadget->dev);
16161618 if (!udc->driver) {
16171619 dev_err(dev, "soft-connect without a gadget driver\n");
16181620 ret = -EOPNOTSUPP;
@@ -1633,7 +1635,7 @@ static ssize_t soft_connect_store(struct device *dev, · 14 unmodified lines
16331635
16341636 ret = n;
16351637 out:
1636− mutex_unlock(&udc_lock);
1638+ device_unlock(&udc->gadget->dev);
16371639 return ret;
16381640 }
16391641 static DEVICE_ATTR_WO(soft_connect);
@@ -1652,11 +1654,15 @@ static ssize_t function_show(struct device *dev, struct device_attribute *attr, · 12 unmodified lines
16521654 char *buf)
16531655 {
16541656 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
1655− struct usb_gadget_driver *drv = udc->driver;
1657+ struct usb_gadget_driver *drv;
1658+ int rc = 0;
16561659
1657− if (!drv || !drv->function)
1658− return 0;
1659− return scnprintf(buf, PAGE_SIZE, "%s\n", drv->function);
1660+ mutex_lock(&udc_lock);
1661+ drv = udc->driver;
1662+ if (drv && drv->function)
1663+ rc = scnprintf(buf, PAGE_SIZE, "%s\n", drv->function);
1664+ mutex_unlock(&udc_lock);
1665+ return rc;
16601666 }
16611667 static DEVICE_ATTR_RO(function);
16621668
drivers/usb/host/xhci-hub.c+12−1
@@ -652,7 +652,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd) · 651 unmodified lines
652652 * It will release and re-aquire the lock while calling ACPI
653653 * method.
654654 */
655−void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
655+static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
656656 u16 index, bool on, unsigned long *flags)
657657 __must_hold(&xhci->lock)
658658 {
@@ -1648,6 +1648,17 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) · 989 unmodified lines
16481648
16491649 status = bus_state->resuming_ports;
16501650
1651+ /*
1652+ * SS devices are only visible to roothub after link training completes.
1653+ * Keep polling roothubs for a grace period after xHC start
1654+ */
1655+ if (xhci->run_graceperiod) {
1656+ if (time_before(jiffies, xhci->run_graceperiod))
1657+ status = 1;
1658+ else
1659+ xhci->run_graceperiod = 0;
1660+ }
1661+
16511662 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
16521663
16531664 /* For each port, did anything change? If so, set that bit in buf. */
drivers/usb/host/xhci-mtk-sch.c+4−11
@@ -425,7 +425,6 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset) · 424 unmodified lines
425425
426426 static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
427427 {
428− u32 extra_cs_count;
429428 u32 start_ss, last_ss;
430429 u32 start_cs, last_cs;
431430
@@ -461,18 +460,12 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) · 29 unmodified lines
461460 if (last_cs > 7)
462461 return -ESCH_CS_OVERFLOW;
463462
464− if (sch_ep->ep_type == ISOC_IN_EP)
465− extra_cs_count = (last_cs == 7) ? 1 : 2;
466− else /* ep_type : INTR IN / INTR OUT */
467− extra_cs_count = 1;
468−
469− cs_count += extra_cs_count;
470463 if (cs_count > 7)
471464 cs_count = 7; /* HW limit */
472465
473466 sch_ep->cs_count = cs_count;
474− /* one for ss, the other for idle */
475− sch_ep->num_budget_microframes = cs_count + 2;
467+ /* ss, idle are ignored */
468+ sch_ep->num_budget_microframes = cs_count;
476469
477470 /*
478471 * if interval=1, maxp >752, num_budge_micoframe is larger
@@ -771,8 +764,8 @@ int xhci_mtk_drop_ep(struct usb_hcd *hcd, struct usb_device *udev, · 292 unmodified lines
771764 if (ret)
772765 return ret;
773766
774− if (ep->hcpriv)
775− drop_ep_quirk(hcd, udev, ep);
767+ /* needn't check @ep->hcpriv, xhci_endpoint_disable set it NULL */
768+ drop_ep_quirk(hcd, udev, ep);
776769
777770 return 0;
778771 }
drivers/usb/host/xhci-plat.c+8−3
@@ -398,12 +398,17 @@ static int xhci_plat_remove(struct platform_device *dev) · 397 unmodified lines
398398 pm_runtime_get_sync(&dev->dev);
399399 xhci->xhc_state |= XHCI_STATE_REMOVING;
400400
401− usb_remove_hcd(shared_hcd);
402− xhci->shared_hcd = NULL;
401+ if (shared_hcd) {
402+ usb_remove_hcd(shared_hcd);
403+ xhci->shared_hcd = NULL;
404+ }
405+
403406 usb_phy_shutdown(hcd->usb_phy);
404407
405408 usb_remove_hcd(hcd);
406− usb_put_hcd(shared_hcd);
409+
410+ if (shared_hcd)
411+ usb_put_hcd(shared_hcd);
407412
408413 clk_disable_unprepare(clk);
409414 clk_disable_unprepare(reg_clk);
drivers/usb/host/xhci.c+5−14
@@ -151,9 +151,11 @@ int xhci_start(struct xhci_hcd *xhci) · 150 unmodified lines
151151 xhci_err(xhci, "Host took too long to start, "
152152 "waited %u microseconds.\n",
153153 XHCI_MAX_HALT_USEC);
154− if (!ret)
154+ if (!ret) {
155155 /* clear state flags. Including dying, halted or removing */
156156 xhci->xhc_state = 0;
157+ xhci->run_graceperiod = jiffies + msecs_to_jiffies(500);
158+ }
157159
158160 return ret;
159161 }
@@ -791,8 +793,6 @@ static void xhci_stop(struct usb_hcd *hcd) · 631 unmodified lines
791793 void xhci_shutdown(struct usb_hcd *hcd)
792794 {
793795 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
794− unsigned long flags;
795− int i;
796796
797797 if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
798798 usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
@@ -808,21 +808,12 @@ void xhci_shutdown(struct usb_hcd *hcd) · 9 unmodified lines
808808 del_timer_sync(&xhci->shared_hcd->rh_timer);
809809 }
810810
811− spin_lock_irqsave(&xhci->lock, flags);
811+ spin_lock_irq(&xhci->lock);
812812 xhci_halt(xhci);
813−
814− /* Power off USB2 ports*/
815− for (i = 0; i < xhci->usb2_rhub.num_ports; i++)
816− xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags);
817−
818− /* Power off USB3 ports*/
819− for (i = 0; i < xhci->usb3_rhub.num_ports; i++)
820− xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags);
821−
822813 /* Workaround for spurious wakeups at shutdown with HSW */
823814 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
824815 xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
825− spin_unlock_irqrestore(&xhci->lock, flags);
816+ spin_unlock_irq(&xhci->lock);
826817
827818 xhci_cleanup_msix(xhci);
828819
drivers/usb/host/xhci.h+1−3
@@ -1826,7 +1826,7 @@ struct xhci_hcd { · 1825 unmodified lines
18261826
18271827 /* Host controller watchdog timer structures */
18281828 unsigned int xhc_state;
1829−
1829+ unsigned long run_graceperiod;
18301830 u32 command;
18311831 struct s3_save s3;
18321832 /* Host controller is dying - not responding to commands. "I'm not dead yet!"
@@ -2196,8 +2196,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, · 363 unmodified lines
21962196 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
21972197 int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
21982198 struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
2199−void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index,
2200− bool on, unsigned long *flags);
22012199
22022200 void xhci_hc_died(struct xhci_hcd *xhci);
22032201
drivers/usb/misc/onboard_usb_hub.c+1−4
@@ -71,10 +71,7 @@ static int onboard_hub_power_off(struct onboard_hub *hub) · 70 unmodified lines
7171 {
7272 int err;
7373
74− if (hub->reset_gpio) {
75− gpiod_set_value_cansleep(hub->reset_gpio, 1);
76− fsleep(hub->pdata->reset_us);
77− }
74+ gpiod_set_value_cansleep(hub->reset_gpio, 1);
7875
7976 err = regulator_disable(hub->vdd);
8077 if (err) {
drivers/usb/musb/Kconfig+1−1
@@ -86,7 +86,7 @@ config USB_MUSB_TUSB6010 · 85 unmodified lines
8686 tristate "TUSB6010"
8787 depends on HAS_IOMEM
8888 depends on ARCH_OMAP2PLUS || COMPILE_TEST
89− depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules
89+ depends on NOP_USB_XCEIV!=m || USB_MUSB_HDRC=m
9090
9191 config USB_MUSB_OMAP2PLUS
9292 tristate "OMAP2430 and onwards"
drivers/usb/serial/ch341.c+14−2
@@ -97,7 +97,10 @@ struct ch341_private { · 96 unmodified lines
9797 u8 mcr;
9898 u8 msr;
9999 u8 lcr;
100+
100101 unsigned long quirks;
102+ u8 version;
103+
101104 unsigned long break_end;
102105 };
103106
@@ -250,8 +253,12 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev, · 146 unmodified lines
250253 /*
251254 * CH341A buffers data until a full endpoint-size packet (32 bytes)
252255 * has been received unless bit 7 is set.
256+ *
257+ * At least one device with version 0x27 appears to have this bit
258+ * inverted.
253259 */
254− val |= BIT(7);
260+ if (priv->version > 0x27)
261+ val |= BIT(7);
255262
256263 r = ch341_control_out(dev, CH341_REQ_WRITE_REG,
257264 CH341_REG_DIVISOR << 8 | CH341_REG_PRESCALER,
@@ -265,6 +272,9 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev, · 7 unmodified lines
265272 * (stop bits, parity and word length). Version 0x30 and above use
266273 * CH341_REG_LCR only and CH341_REG_LCR2 is always set to zero.
267274 */
275+ if (priv->version < 0x30)
276+ return 0;
277+
268278 r = ch341_control_out(dev, CH341_REQ_WRITE_REG,
269279 CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
270280 if (r)
@@ -308,7 +318,9 @@ static int ch341_configure(struct usb_device *dev, struct ch341_private *priv) · 37 unmodified lines
308318 r = ch341_control_in(dev, CH341_REQ_READ_VERSION, 0, 0, buffer, size);
309319 if (r)
310320 return r;
311− dev_dbg(&dev->dev, "Chip version: 0x%02x\n", buffer[0]);
321+
322+ priv->version = buffer[0];
323+ dev_dbg(&dev->dev, "Chip version: 0x%02x\n", priv->version);
312324
313325 r = ch341_control_out(dev, CH341_REQ_SERIAL_INIT, 0, 0);
314326 if (r < 0)
drivers/usb/serial/cp210x.c+1−0
@@ -130,6 +130,7 @@ static const struct usb_device_id id_table[] = { · 129 unmodified lines
130130 { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */
131131 { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */
132132 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
133+ { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */
133134 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
134135 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
135136 { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
drivers/usb/serial/ftdi_sio.c+2−0
@@ -1045,6 +1045,8 @@ static const struct usb_device_id id_table_combined[] = { · 1044 unmodified lines
10451045 /* IDS GmbH devices */
10461046 { USB_DEVICE(IDS_VID, IDS_SI31A_PID) },
10471047 { USB_DEVICE(IDS_VID, IDS_CM31A_PID) },
1048+ /* Omron devices */
1049+ { USB_DEVICE(OMRON_VID, OMRON_CS1W_CIF31_PID) },
10481050 /* U-Blox devices */
10491051 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) },
10501052 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) },
drivers/usb/serial/ftdi_sio_ids.h+6−0
@@ -661,6 +661,12 @@ · 660 unmodified lines
661661 #define INFINEON_TRIBOARD_TC1798_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */
662662 #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */
663663
664+/*
665+ * Omron corporation (https://www.omron.com)
666+ */
667+ #define OMRON_VID 0x0590
668+ #define OMRON_CS1W_CIF31_PID 0x00b2
669+
664670 /*
665671 * Acton Research Corp.
666672 */
drivers/usb/serial/option.c+15−0
@@ -253,6 +253,7 @@ static void option_instat_callback(struct urb *urb); · 252 unmodified lines
253253 #define QUECTEL_PRODUCT_BG96 0x0296
254254 #define QUECTEL_PRODUCT_EP06 0x0306
255255 #define QUECTEL_PRODUCT_EM05G 0x030a
256+#define QUECTEL_PRODUCT_EM060K 0x030b
256257 #define QUECTEL_PRODUCT_EM12 0x0512
257258 #define QUECTEL_PRODUCT_RM500Q 0x0800
258259 #define QUECTEL_PRODUCT_EC200S_CN 0x6002
@@ -438,6 +439,8 @@ static void option_instat_callback(struct urb *urb); · 179 unmodified lines
438439 #define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9
439440 #define CINTERION_PRODUCT_MV32_WA 0x00f1
440441 #define CINTERION_PRODUCT_MV32_WB 0x00f2
442+#define CINTERION_PRODUCT_MV32_WA_RMNET 0x00f3
443+#define CINTERION_PRODUCT_MV32_WB_RMNET 0x00f4
441444
442445 /* Olivetti products */
443446 #define OLIVETTI_VENDOR_ID 0x0b3c
@@ -573,6 +576,10 @@ static void option_instat_callback(struct urb *urb); · 129 unmodified lines
573576 #define WETELECOM_PRODUCT_6802 0x6802
574577 #define WETELECOM_PRODUCT_WMD300 0x6803
575578
579+/* OPPO products */
580+#define OPPO_VENDOR_ID 0x22d9
581+#define OPPO_PRODUCT_R11 0x276c
582+
576583
577584 /* Device flags */
578585
@@ -1138,6 +1145,9 @@ static const struct usb_device_id option_ids[] = { · 559 unmodified lines
11381145 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
11391146 { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
11401147 .driver_info = RSVD(6) | ZLP },
1148+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
1149+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) },
1150+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) },
11411151 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
11421152 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11431153 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
@@ -1993,8 +2003,12 @@ static const struct usb_device_id option_ids[] = { · 849 unmodified lines
19932003 .driver_info = RSVD(0)},
19942004 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff),
19952005 .driver_info = RSVD(3)},
2006+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA_RMNET, 0xff),
2007+ .driver_info = RSVD(0) },
19962008 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
19972009 .driver_info = RSVD(3)},
2010+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB_RMNET, 0xff),
2011+ .driver_info = RSVD(0) },
19982012 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
19992013 .driver_info = RSVD(4) },
20002014 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
@@ -2155,6 +2169,7 @@ static const struct usb_device_id option_ids[] = { · 154 unmodified lines
21552169 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */
21562170 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
21572171 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */
2172+ { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) },
21582173 { } /* Terminating entry */
21592174 };
21602175 MODULE_DEVICE_TABLE(usb, option_ids);
drivers/usb/storage/unusual_devs.h+7−0
@@ -2294,6 +2294,13 @@ UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000, · 2293 unmodified lines
22942294 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
22952295 US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
22962296
2297+/* Reported by Witold Lipieta <witold.lipieta@thaumatec.com> */
2298+UNUSUAL_DEV( 0x1fc9, 0x0117, 0x0100, 0x0100,
2299+ "NXP Semiconductors",
2300+ "PN7462AU",
2301+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2302+ US_FL_IGNORE_RESIDUE ),
2303+
22972304 /* Supplied with some Castlewood ORB removable drives */
22982305 UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999,
22992306 "Double-H Technology",
drivers/usb/storage/unusual_uas.h+7−0
@@ -62,6 +62,13 @@ UNUSUAL_DEV(0x0984, 0x0301, 0x0128, 0x0128, · 61 unmodified lines
6262 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
6363 US_FL_IGNORE_UAS),
6464
65+/* Reported-by: Tom Hu <huxiaoying@kylinos.cn> */
66+UNUSUAL_DEV(0x0b05, 0x1932, 0x0000, 0x9999,
67+ "ASUS",
68+ "External HDD",
69+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
70+ US_FL_IGNORE_UAS),
71+
6572 /* Reported-by: David Webb <djw@noc.ac.uk> */
6673 UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999,
6774 "Seagate",
drivers/usb/typec/altmodes/displayport.c+2−2
@@ -99,8 +99,8 @@ static int dp_altmode_configure(struct dp_altmode *dp, u8 con) · 98 unmodified lines
9999 case DP_STATUS_CON_UFP_D:
100100 case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */
101101 conf |= DP_CONF_UFP_U_AS_UFP_D;
102− pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) &
103− DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo);
102+ pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) &
103+ DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo);
104104 break;
105105 default:
106106 break;
drivers/usb/typec/class.c+1−0
@@ -2346,6 +2346,7 @@ static void __exit typec_exit(void) · 2345 unmodified lines
23462346 ida_destroy(&typec_index_ida);
23472347 bus_unregister(&typec_bus);
23482348 class_unregister(&typec_mux_class);
2349+ class_unregister(&retimer_class);
23492350 }
23502351 module_exit(typec_exit);
23512352
drivers/usb/typec/mux/intel_pmc_mux.c+7−2
@@ -571,9 +571,11 @@ err_unregister_switch: · 570 unmodified lines
571571
572572 static int is_memory(struct acpi_resource *res, void *data)
573573 {
574− struct resource r;
574+ struct resource_win win = {};
575+ struct resource *r = &win.res;
575576
576− return !acpi_dev_resource_memory(res, &r);
577+ return !(acpi_dev_resource_memory(res, r) ||
578+ acpi_dev_resource_address_space(res, &win));
577579 }
578580
579581 /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */
@@ -583,6 +585,9 @@ static const struct acpi_device_id iom_acpi_ids[] = { · 3 unmodified lines
583585
584586 /* AlderLake */
585587 { "INTC1079", 0x160, },
588+
589+ /* Meteor Lake */
590+ { "INTC107A", 0x160, },
586591 {}
587592 };
588593
drivers/usb/typec/tcpm/tcpm.c+7−0
@@ -6320,6 +6320,13 @@ static int tcpm_psy_set_prop(struct power_supply *psy, · 6319 unmodified lines
63206320 struct tcpm_port *port = power_supply_get_drvdata(psy);
63216321 int ret;
63226322
6323+ /*
6324+ * All the properties below are related to USB PD. The check needs to be
6325+ * property specific when a non-pd related property is added.
6326+ */
6327+ if (!port->pd_supported)
6328+ return -EOPNOTSUPP;
6329+
63236330 switch (psp) {
63246331 case POWER_SUPPLY_PROP_ONLINE:
63256332 ret = tcpm_psy_set_online(port, val);
drivers/usb/typec/ucsi/ucsi.c+24−29
@@ -1200,32 +1200,6 @@ out_unlock: · 1199 unmodified lines
12001200 return ret;
12011201 }
12021202
1203−static void ucsi_unregister_connectors(struct ucsi *ucsi)
1204−{
1205− struct ucsi_connector *con;
1206− int i;
1207−
1208− if (!ucsi->connector)
1209− return;
1210−
1211− for (i = 0; i < ucsi->cap.num_connectors; i++) {
1212− con = &ucsi->connector[i];
1213−
1214− if (!con->wq)
1215− break;
1216−
1217− cancel_work_sync(&con->work);
1218− ucsi_unregister_partner(con);
1219− ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON);
1220− ucsi_unregister_port_psy(con);
1221− destroy_workqueue(con->wq);
1222− typec_unregister_port(con->port);
1223− }
1224−
1225− kfree(ucsi->connector);
1226− ucsi->connector = NULL;
1227−}
1228−
12291203 /**
12301204 * ucsi_init - Initialize UCSI interface
12311205 * @ucsi: UCSI to be initialized
@@ -1234,6 +1208,7 @@ static void ucsi_unregister_connectors(struct ucsi *ucsi) · 2 unmodified lines
12341208 */
12351209 static int ucsi_init(struct ucsi *ucsi)
12361210 {
1211+ struct ucsi_connector *con;
12371212 u64 command;
12381213 int ret;
12391214 int i;
@@ -1264,7 +1239,7 @@ static int ucsi_init(struct ucsi *ucsi) · 24 unmodified lines
12641239 }
12651240
12661241 /* Allocate the connectors. Released in ucsi_unregister() */
1267− ucsi->connector = kcalloc(ucsi->cap.num_connectors,
1242+ ucsi->connector = kcalloc(ucsi->cap.num_connectors + 1,
12681243 sizeof(*ucsi->connector), GFP_KERNEL);
12691244 if (!ucsi->connector) {
12701245 ret = -ENOMEM;
@@ -1288,7 +1263,15 @@ static int ucsi_init(struct ucsi *ucsi) · 17 unmodified lines
12881263 return 0;
12891264
12901265 err_unregister:
1291− ucsi_unregister_connectors(ucsi);
1266+ for (con = ucsi->connector; con->port; con++) {
1267+ ucsi_unregister_partner(con);
1268+ ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON);
1269+ ucsi_unregister_port_psy(con);
1270+ if (con->wq)
1271+ destroy_workqueue(con->wq);
1272+ typec_unregister_port(con->port);
1273+ con->port = NULL;
1274+ }
12921275
12931276 err_reset:
12941277 memset(&ucsi->cap, 0, sizeof(ucsi->cap));
@@ -1402,6 +1385,7 @@ EXPORT_SYMBOL_GPL(ucsi_register); · 107 unmodified lines
14021385 void ucsi_unregister(struct ucsi *ucsi)
14031386 {
14041387 u64 cmd = UCSI_SET_NOTIFICATION_ENABLE;
1388+ int i;
14051389
14061390 /* Make sure that we are not in the middle of driver initialization */
14071391 cancel_delayed_work_sync(&ucsi->work);
@@ -1409,7 +1393,18 @@ void ucsi_unregister(struct ucsi *ucsi) · 1 unmodified line
14091393 /* Disable notifications */
14101394 ucsi->ops->async_write(ucsi, UCSI_CONTROL, &cmd, sizeof(cmd));
14111395
1412− ucsi_unregister_connectors(ucsi);
1396+ for (i = 0; i < ucsi->cap.num_connectors; i++) {
1397+ cancel_work_sync(&ucsi->connector[i].work);
1398+ ucsi_unregister_partner(&ucsi->connector[i]);
1399+ ucsi_unregister_altmodes(&ucsi->connector[i],
1400+ UCSI_RECIPIENT_CON);
1401+ ucsi_unregister_port_psy(&ucsi->connector[i]);
1402+ if (ucsi->connector[i].wq)
1403+ destroy_workqueue(ucsi->connector[i].wq);
1404+ typec_unregister_port(ucsi->connector[i].port);
1405+ }
1406+
1407+ kfree(ucsi->connector);
14131408 }
14141409 EXPORT_SYMBOL_GPL(ucsi_unregister);
14151410
include/linux/usb.h+2−0
@@ -575,6 +575,7 @@ struct usb3_lpm_parameters { · 574 unmodified lines
575575 * @devaddr: device address, XHCI: assigned by HW, others: same as devnum
576576 * @can_submit: URBs may be submitted
577577 * @persist_enabled: USB_PERSIST enabled for this device
578+ * @reset_in_progress: the device is being reset
578579 * @have_langid: whether string_langid is valid
579580 * @authorized: policy has said we can use it;
580581 * (user space) policy determines if we authorize this device to be
@@ -662,6 +663,7 @@ struct usb_device { · 81 unmodified lines
662663
663664 unsigned can_submit:1;
664665 unsigned persist_enabled:1;
666+ unsigned reset_in_progress:1;
665667 unsigned have_langid:1;
666668 unsigned authorized:1;
667669 unsigned authenticated:1;
include/linux/usb/typec_dp.h+5−0
@@ -73,6 +73,11 @@ enum { · 72 unmodified lines
7373 #define DP_CAP_USB BIT(7)
7474 #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
7575 #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16)
76+/* Get pin assignment taking plug & receptacle into consideration */
77+#define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
78+ DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_))
79+#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
80+ DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_))
7681
7782 /* DisplayPort Status Update VDO bits */
7883 #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)