aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-30 13:26:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-30 13:26:36 -0400
commit8d02a9a89729605c3026674e4a245839be98c913 (patch)
treefaf6c952c0348ea3cb4cac14a4c4e692eb39ee1b
parent782492a7a4807317319a0b1832594d07ba79747d (diff)
parentd65d25b84f1f19cc35819a733576cafc54adc275 (diff)
Merge tag 'usb-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 5.1-rc3. Nothing major at all here, just a small collection of fixes for reported issues, and potential problems with error handling paths. Also a few new device ids, as normal. All of these have been in linux-next with no reported issues" * tag 'usb-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits) USB: serial: option: add Olicard 600 USB: serial: cp210x: add new device id usb: u132-hcd: fix resource leak usb: cdc-acm: fix race during wakeup blocking TX traffic usb: mtu3: fix EXTCON dependency usb: usb251xb: fix to avoid potential NULL pointer dereference usb: core: Try generic PHY_MODE_USB_HOST if usb_phy_roothub_set_mode fails phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs xhci: Don't let USB3 ports stuck in polling state prevent suspend usb: xhci: dbc: Don't free all memory with spinlock held xhci: Fix port resume done detection for SS ports with LPM enabled USB: serial: mos7720: fix mos_parport refcount imbalance on error path USB: gadget: f_hid: fix deadlock in f_hidg_write() usb: gadget: net2272: Fix net2272_dequeue() usb: gadget: net2280: Fix net2280_dequeue() usb: gadget: net2280: Fix overrun of OUT messages usb: dwc3: pci: add support for Comet Lake PCH ID usb: usb251xb: Remove unnecessary comparison of unsigned integer with >= 0 usb: common: Consider only available nodes for dr_mode usb: typec: tcpm: Try PD-2.0 if sink does not respond to 3.0 source-caps ...
-rw-r--r--drivers/phy/allwinner/phy-sun4i-usb.c5
-rw-r--r--drivers/usb/class/cdc-acm.c4
-rw-r--r--drivers/usb/common/common.c2
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c4
-rw-r--r--drivers/usb/gadget/function/f_hid.c6
-rw-r--r--drivers/usb/gadget/udc/net2272.c1
-rw-r--r--drivers/usb/gadget/udc/net2280.c8
-rw-r--r--drivers/usb/host/u132-hcd.c3
-rw-r--r--drivers/usb/host/xhci-dbgcap.c5
-rw-r--r--drivers/usb/host/xhci-hub.c19
-rw-r--r--drivers/usb/host/xhci-rcar.c1
-rw-r--r--drivers/usb/host/xhci-ring.c9
-rw-r--r--drivers/usb/host/xhci.h8
-rw-r--r--drivers/usb/misc/usb251xb.c4
-rw-r--r--drivers/usb/mtu3/Kconfig1
-rw-r--r--drivers/usb/serial/cp210x.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h4
-rw-r--r--drivers/usb/serial/mos7720.c4
-rw-r--r--drivers/usb/serial/option.c17
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c27
-rw-r--r--drivers/usb/typec/tcpm/wcove.c9
23 files changed, 110 insertions, 37 deletions
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 5163097b43df..4bbd9ede38c8 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy,
485 struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); 485 struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
486 int new_mode; 486 int new_mode;
487 487
488 if (phy->index != 0) 488 if (phy->index != 0) {
489 if (mode == PHY_MODE_USB_HOST)
490 return 0;
489 return -EINVAL; 491 return -EINVAL;
492 }
490 493
491 switch (mode) { 494 switch (mode) {
492 case PHY_MODE_USB_HOST: 495 case PHY_MODE_USB_HOST:
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 739f8960811a..ec666eb4b7b4 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -558,10 +558,8 @@ static void acm_softint(struct work_struct *work)
558 clear_bit(EVENT_RX_STALL, &acm->flags); 558 clear_bit(EVENT_RX_STALL, &acm->flags);
559 } 559 }
560 560
561 if (test_bit(EVENT_TTY_WAKEUP, &acm->flags)) { 561 if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags))
562 tty_port_tty_wakeup(&acm->port); 562 tty_port_tty_wakeup(&acm->port);
563 clear_bit(EVENT_TTY_WAKEUP, &acm->flags);
564 }
565} 563}
566 564
567/* 565/*
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 48277bbc15e4..73c8e6591746 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -145,6 +145,8 @@ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0)
145 145
146 do { 146 do {
147 controller = of_find_node_with_property(controller, "phys"); 147 controller = of_find_node_with_property(controller, "phys");
148 if (!of_device_is_available(controller))
149 continue;
148 index = 0; 150 index = 0;
149 do { 151 do {
150 if (arg0 == -1) { 152 if (arg0 == -1) {
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3189181bb628..975d7c1288e3 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2742,6 +2742,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
2742 retval = usb_phy_roothub_set_mode(hcd->phy_roothub, 2742 retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
2743 PHY_MODE_USB_HOST_SS); 2743 PHY_MODE_USB_HOST_SS);
2744 if (retval) 2744 if (retval)
2745 retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
2746 PHY_MODE_USB_HOST);
2747 if (retval)
2745 goto err_usb_phy_roothub_power_on; 2748 goto err_usb_phy_roothub_power_on;
2746 2749
2747 retval = usb_phy_roothub_power_on(hcd->phy_roothub); 2750 retval = usb_phy_roothub_power_on(hcd->phy_roothub);
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index fdc6e4e403e8..8cced3609e24 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -29,6 +29,7 @@
29#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa 29#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
30#define PCI_DEVICE_ID_INTEL_APL 0x5aaa 30#define PCI_DEVICE_ID_INTEL_APL 0x5aaa
31#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 31#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
32#define PCI_DEVICE_ID_INTEL_CMLH 0x02ee
32#define PCI_DEVICE_ID_INTEL_GLK 0x31aa 33#define PCI_DEVICE_ID_INTEL_GLK 0x31aa
33#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee 34#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee
34#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e 35#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
@@ -305,6 +306,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
305 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD), 306 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
306 (kernel_ulong_t) &dwc3_pci_mrfld_properties, }, 307 (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
307 308
309 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
310 (kernel_ulong_t) &dwc3_pci_intel_properties, },
311
308 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP), 312 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
309 (kernel_ulong_t) &dwc3_pci_intel_properties, }, 313 (kernel_ulong_t) &dwc3_pci_intel_properties, },
310 314
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 75b113a5b25c..f3816a5c861e 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -391,20 +391,20 @@ try_again:
391 req->complete = f_hidg_req_complete; 391 req->complete = f_hidg_req_complete;
392 req->context = hidg; 392 req->context = hidg;
393 393
394 spin_unlock_irqrestore(&hidg->write_spinlock, flags);
395
394 status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); 396 status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC);
395 if (status < 0) { 397 if (status < 0) {
396 ERROR(hidg->func.config->cdev, 398 ERROR(hidg->func.config->cdev,
397 "usb_ep_queue error on int endpoint %zd\n", status); 399 "usb_ep_queue error on int endpoint %zd\n", status);
398 goto release_write_pending_unlocked; 400 goto release_write_pending;
399 } else { 401 } else {
400 status = count; 402 status = count;
401 } 403 }
402 spin_unlock_irqrestore(&hidg->write_spinlock, flags);
403 404
404 return status; 405 return status;
405release_write_pending: 406release_write_pending:
406 spin_lock_irqsave(&hidg->write_spinlock, flags); 407 spin_lock_irqsave(&hidg->write_spinlock, flags);
407release_write_pending_unlocked:
408 hidg->write_pending = 0; 408 hidg->write_pending = 0;
409 spin_unlock_irqrestore(&hidg->write_spinlock, flags); 409 spin_unlock_irqrestore(&hidg->write_spinlock, flags);
410 410
diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index b77f3126580e..c2011cd7df8c 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -945,6 +945,7 @@ net2272_dequeue(struct usb_ep *_ep, struct usb_request *_req)
945 break; 945 break;
946 } 946 }
947 if (&req->req != _req) { 947 if (&req->req != _req) {
948 ep->stopped = stopped;
948 spin_unlock_irqrestore(&ep->dev->lock, flags); 949 spin_unlock_irqrestore(&ep->dev->lock, flags);
949 return -EINVAL; 950 return -EINVAL;
950 } 951 }
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index f63f82450bf4..898339e5df10 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -866,9 +866,6 @@ static void start_queue(struct net2280_ep *ep, u32 dmactl, u32 td_dma)
866 (void) readl(&ep->dev->pci->pcimstctl); 866 (void) readl(&ep->dev->pci->pcimstctl);
867 867
868 writel(BIT(DMA_START), &dma->dmastat); 868 writel(BIT(DMA_START), &dma->dmastat);
869
870 if (!ep->is_in)
871 stop_out_naking(ep);
872} 869}
873 870
874static void start_dma(struct net2280_ep *ep, struct net2280_request *req) 871static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
@@ -907,6 +904,7 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
907 writel(BIT(DMA_START), &dma->dmastat); 904 writel(BIT(DMA_START), &dma->dmastat);
908 return; 905 return;
909 } 906 }
907 stop_out_naking(ep);
910 } 908 }
911 909
912 tmp = dmactl_default; 910 tmp = dmactl_default;
@@ -1275,9 +1273,9 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1275 break; 1273 break;
1276 } 1274 }
1277 if (&req->req != _req) { 1275 if (&req->req != _req) {
1276 ep->stopped = stopped;
1278 spin_unlock_irqrestore(&ep->dev->lock, flags); 1277 spin_unlock_irqrestore(&ep->dev->lock, flags);
1279 dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n", 1278 ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
1280 __func__);
1281 return -EINVAL; 1279 return -EINVAL;
1282 } 1280 }
1283 1281
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 934584f0a20a..6343fbacd244 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3204,6 +3204,9 @@ static int __init u132_hcd_init(void)
3204 printk(KERN_INFO "driver %s\n", hcd_name); 3204 printk(KERN_INFO "driver %s\n", hcd_name);
3205 workqueue = create_singlethread_workqueue("u132"); 3205 workqueue = create_singlethread_workqueue("u132");
3206 retval = platform_driver_register(&u132_platform_driver); 3206 retval = platform_driver_register(&u132_platform_driver);
3207 if (retval)
3208 destroy_workqueue(workqueue);
3209
3207 return retval; 3210 return retval;
3208} 3211}
3209 3212
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index c78be578abb0..d932cc31711e 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -516,7 +516,6 @@ static int xhci_do_dbc_stop(struct xhci_hcd *xhci)
516 return -1; 516 return -1;
517 517
518 writel(0, &dbc->regs->control); 518 writel(0, &dbc->regs->control);
519 xhci_dbc_mem_cleanup(xhci);
520 dbc->state = DS_DISABLED; 519 dbc->state = DS_DISABLED;
521 520
522 return 0; 521 return 0;
@@ -562,8 +561,10 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
562 ret = xhci_do_dbc_stop(xhci); 561 ret = xhci_do_dbc_stop(xhci);
563 spin_unlock_irqrestore(&dbc->lock, flags); 562 spin_unlock_irqrestore(&dbc->lock, flags);
564 563
565 if (!ret) 564 if (!ret) {
565 xhci_dbc_mem_cleanup(xhci);
566 pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller); 566 pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
567 }
567} 568}
568 569
569static void 570static void
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index e2eece693655..96a740543183 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1545,20 +1545,25 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
1545 port_index = max_ports; 1545 port_index = max_ports;
1546 while (port_index--) { 1546 while (port_index--) {
1547 u32 t1, t2; 1547 u32 t1, t2;
1548 1548 int retries = 10;
1549retry:
1549 t1 = readl(ports[port_index]->addr); 1550 t1 = readl(ports[port_index]->addr);
1550 t2 = xhci_port_state_to_neutral(t1); 1551 t2 = xhci_port_state_to_neutral(t1);
1551 portsc_buf[port_index] = 0; 1552 portsc_buf[port_index] = 0;
1552 1553
1553 /* Bail out if a USB3 port has a new device in link training */ 1554 /*
1554 if ((hcd->speed >= HCD_USB3) && 1555 * Give a USB3 port in link training time to finish, but don't
1556 * prevent suspend as port might be stuck
1557 */
1558 if ((hcd->speed >= HCD_USB3) && retries-- &&
1555 (t1 & PORT_PLS_MASK) == XDEV_POLLING) { 1559 (t1 & PORT_PLS_MASK) == XDEV_POLLING) {
1556 bus_state->bus_suspended = 0;
1557 spin_unlock_irqrestore(&xhci->lock, flags); 1560 spin_unlock_irqrestore(&xhci->lock, flags);
1558 xhci_dbg(xhci, "Bus suspend bailout, port in polling\n"); 1561 msleep(XHCI_PORT_POLLING_LFPS_TIME);
1559 return -EBUSY; 1562 spin_lock_irqsave(&xhci->lock, flags);
1563 xhci_dbg(xhci, "port %d polling in bus suspend, waiting\n",
1564 port_index);
1565 goto retry;
1560 } 1566 }
1561
1562 /* suspend ports in U0, or bail out for new connect changes */ 1567 /* suspend ports in U0, or bail out for new connect changes */
1563 if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { 1568 if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) {
1564 if ((t1 & PORT_CSC) && wake_enabled) { 1569 if ((t1 & PORT_CSC) && wake_enabled) {
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index a6e463715779..671bce18782c 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -246,6 +246,7 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd)
246 if (!xhci_rcar_wait_for_pll_active(hcd)) 246 if (!xhci_rcar_wait_for_pll_active(hcd))
247 return -ETIMEDOUT; 247 return -ETIMEDOUT;
248 248
249 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
249 return xhci_rcar_download_firmware(hcd); 250 return xhci_rcar_download_firmware(hcd);
250} 251}
251 252
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 40fa25c4d041..9215a28dad40 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1647,10 +1647,13 @@ static void handle_port_status(struct xhci_hcd *xhci,
1647 } 1647 }
1648 } 1648 }
1649 1649
1650 if ((portsc & PORT_PLC) && (portsc & PORT_PLS_MASK) == XDEV_U0 && 1650 if ((portsc & PORT_PLC) &&
1651 DEV_SUPERSPEED_ANY(portsc)) { 1651 DEV_SUPERSPEED_ANY(portsc) &&
1652 ((portsc & PORT_PLS_MASK) == XDEV_U0 ||
1653 (portsc & PORT_PLS_MASK) == XDEV_U1 ||
1654 (portsc & PORT_PLS_MASK) == XDEV_U2)) {
1652 xhci_dbg(xhci, "resume SS port %d finished\n", port_id); 1655 xhci_dbg(xhci, "resume SS port %d finished\n", port_id);
1653 /* We've just brought the device into U0 through either the 1656 /* We've just brought the device into U0/1/2 through either the
1654 * Resume state after a device remote wakeup, or through the 1657 * Resume state after a device remote wakeup, or through the
1655 * U3Exit state after a host-initiated resume. If it's a device 1658 * U3Exit state after a host-initiated resume. If it's a device
1656 * initiated remote wake, don't pass up the link state change, 1659 * initiated remote wake, don't pass up the link state change,
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 652dc36e3012..9334cdee382a 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -452,6 +452,14 @@ struct xhci_op_regs {
452 */ 452 */
453#define XHCI_DEFAULT_BESL 4 453#define XHCI_DEFAULT_BESL 4
454 454
455/*
456 * USB3 specification define a 360ms tPollingLFPSTiemout for USB3 ports
457 * to complete link training. usually link trainig completes much faster
458 * so check status 10 times with 36ms sleep in places we need to wait for
459 * polling to complete.
460 */
461#define XHCI_PORT_POLLING_LFPS_TIME 36
462
455/** 463/**
456 * struct xhci_intr_reg - Interrupt Register Set 464 * struct xhci_intr_reg - Interrupt Register Set
457 * @irq_pending: IMAN - Interrupt Management Register. Used to enable 465 * @irq_pending: IMAN - Interrupt Management Register. Used to enable
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 4d72b7d1d383..04684849d683 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -547,7 +547,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
547 */ 547 */
548 hub->port_swap = USB251XB_DEF_PORT_SWAP; 548 hub->port_swap = USB251XB_DEF_PORT_SWAP;
549 of_property_for_each_u32(np, "swap-dx-lanes", prop, p, port) { 549 of_property_for_each_u32(np, "swap-dx-lanes", prop, p, port) {
550 if ((port >= 0) && (port <= data->port_cnt)) 550 if (port <= data->port_cnt)
551 hub->port_swap |= BIT(port); 551 hub->port_swap |= BIT(port);
552 } 552 }
553 553
@@ -612,7 +612,7 @@ static int usb251xb_probe(struct usb251xb *hub)
612 dev); 612 dev);
613 int err; 613 int err;
614 614
615 if (np) { 615 if (np && of_id) {
616 err = usb251xb_get_ofdata(hub, 616 err = usb251xb_get_ofdata(hub,
617 (struct usb251xb_data *)of_id->data); 617 (struct usb251xb_data *)of_id->data);
618 if (err) { 618 if (err) {
diff --git a/drivers/usb/mtu3/Kconfig b/drivers/usb/mtu3/Kconfig
index bcc23486c4ed..928c2cd6fc00 100644
--- a/drivers/usb/mtu3/Kconfig
+++ b/drivers/usb/mtu3/Kconfig
@@ -6,6 +6,7 @@ config USB_MTU3
6 tristate "MediaTek USB3 Dual Role controller" 6 tristate "MediaTek USB3 Dual Role controller"
7 depends on USB || USB_GADGET 7 depends on USB || USB_GADGET
8 depends on ARCH_MEDIATEK || COMPILE_TEST 8 depends on ARCH_MEDIATEK || COMPILE_TEST
9 depends on EXTCON || !EXTCON
9 select USB_XHCI_MTK if USB_SUPPORT && USB_XHCI_HCD 10 select USB_XHCI_MTK if USB_SUPPORT && USB_XHCI_HCD
10 help 11 help
11 Say Y or M here if your system runs on MediaTek SoCs with 12 Say Y or M here if your system runs on MediaTek SoCs with
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index fffe23ab0189..979bef9bfb6b 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -80,6 +80,7 @@ static const struct usb_device_id id_table[] = {
80 { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */ 80 { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */
81 { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ 81 { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */
82 { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */ 82 { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */
83 { USB_DEVICE(0x10C4, 0x8056) }, /* Lorenz Messtechnik devices */
83 { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ 84 { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
84 { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */ 85 { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */
85 { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ 86 { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8f5b17471759..1d8461ae2c34 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -609,6 +609,8 @@ static const struct usb_device_id id_table_combined[] = {
609 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 609 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
610 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), 610 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
611 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 611 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
612 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) },
613 { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) },
612 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, 614 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
613 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, 615 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) },
614 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, 616 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index b863bedb55a1..5755f0df0025 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -567,7 +567,9 @@
567/* 567/*
568 * NovaTech product ids (FTDI_VID) 568 * NovaTech product ids (FTDI_VID)
569 */ 569 */
570#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ 570#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */
571#define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */
572#define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */
571 573
572/* 574/*
573 * Synapse Wireless product ids (FTDI_VID) 575 * Synapse Wireless product ids (FTDI_VID)
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index fc52ac75fbf6..18110225d506 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -366,8 +366,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
366 if (!urbtrack) 366 if (!urbtrack)
367 return -ENOMEM; 367 return -ENOMEM;
368 368
369 kref_get(&mos_parport->ref_count);
370 urbtrack->mos_parport = mos_parport;
371 urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); 369 urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC);
372 if (!urbtrack->urb) { 370 if (!urbtrack->urb) {
373 kfree(urbtrack); 371 kfree(urbtrack);
@@ -388,6 +386,8 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
388 usb_sndctrlpipe(usbdev, 0), 386 usb_sndctrlpipe(usbdev, 0),
389 (unsigned char *)urbtrack->setup, 387 (unsigned char *)urbtrack->setup,
390 NULL, 0, async_complete, urbtrack); 388 NULL, 0, async_complete, urbtrack);
389 kref_get(&mos_parport->ref_count);
390 urbtrack->mos_parport = mos_parport;
391 kref_init(&urbtrack->ref_count); 391 kref_init(&urbtrack->ref_count);
392 INIT_LIST_HEAD(&urbtrack->urblist_entry); 392 INIT_LIST_HEAD(&urbtrack->urblist_entry);
393 393
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 11b21d9410f3..83869065b802 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -246,6 +246,7 @@ static void option_instat_callback(struct urb *urb);
246#define QUECTEL_PRODUCT_EC25 0x0125 246#define QUECTEL_PRODUCT_EC25 0x0125
247#define QUECTEL_PRODUCT_BG96 0x0296 247#define QUECTEL_PRODUCT_BG96 0x0296
248#define QUECTEL_PRODUCT_EP06 0x0306 248#define QUECTEL_PRODUCT_EP06 0x0306
249#define QUECTEL_PRODUCT_EM12 0x0512
249 250
250#define CMOTECH_VENDOR_ID 0x16d8 251#define CMOTECH_VENDOR_ID 0x16d8
251#define CMOTECH_PRODUCT_6001 0x6001 252#define CMOTECH_PRODUCT_6001 0x6001
@@ -1066,7 +1067,8 @@ static const struct usb_device_id option_ids[] = {
1066 .driver_info = RSVD(3) }, 1067 .driver_info = RSVD(3) },
1067 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 1068 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1068 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ 1069 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
1069 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ 1070 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */
1071 .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) },
1070 /* Quectel products using Qualcomm vendor ID */ 1072 /* Quectel products using Qualcomm vendor ID */
1071 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, 1073 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
1072 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), 1074 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
@@ -1087,6 +1089,9 @@ static const struct usb_device_id option_ids[] = {
1087 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), 1089 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
1088 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1090 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
1089 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, 1091 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
1092 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
1093 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
1094 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
1090 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, 1095 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1091 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, 1096 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1092 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), 1097 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
@@ -1940,10 +1945,12 @@ static const struct usb_device_id option_ids[] = {
1940 .driver_info = RSVD(4) }, 1945 .driver_info = RSVD(4) },
1941 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */ 1946 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */
1942 .driver_info = RSVD(4) }, 1947 .driver_info = RSVD(4) },
1943 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ 1948 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
1944 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ 1949 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
1945 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ 1950 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
1946 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ 1951 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */
1952 .driver_info = RSVD(4) },
1953 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
1947 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, 1954 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
1948 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, 1955 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
1949 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) }, 1956 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) },
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0f62db091d8d..a2233d72ae7c 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -37,6 +37,7 @@
37 S(SRC_ATTACHED), \ 37 S(SRC_ATTACHED), \
38 S(SRC_STARTUP), \ 38 S(SRC_STARTUP), \
39 S(SRC_SEND_CAPABILITIES), \ 39 S(SRC_SEND_CAPABILITIES), \
40 S(SRC_SEND_CAPABILITIES_TIMEOUT), \
40 S(SRC_NEGOTIATE_CAPABILITIES), \ 41 S(SRC_NEGOTIATE_CAPABILITIES), \
41 S(SRC_TRANSITION_SUPPLY), \ 42 S(SRC_TRANSITION_SUPPLY), \
42 S(SRC_READY), \ 43 S(SRC_READY), \
@@ -2966,10 +2967,34 @@ static void run_state_machine(struct tcpm_port *port)
2966 /* port->hard_reset_count = 0; */ 2967 /* port->hard_reset_count = 0; */
2967 port->caps_count = 0; 2968 port->caps_count = 0;
2968 port->pd_capable = true; 2969 port->pd_capable = true;
2969 tcpm_set_state_cond(port, hard_reset_state(port), 2970 tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
2970 PD_T_SEND_SOURCE_CAP); 2971 PD_T_SEND_SOURCE_CAP);
2971 } 2972 }
2972 break; 2973 break;
2974 case SRC_SEND_CAPABILITIES_TIMEOUT:
2975 /*
2976 * Error recovery for a PD_DATA_SOURCE_CAP reply timeout.
2977 *
2978 * PD 2.0 sinks are supposed to accept src-capabilities with a
2979 * 3.0 header and simply ignore any src PDOs which the sink does
2980 * not understand such as PPS but some 2.0 sinks instead ignore
2981 * the entire PD_DATA_SOURCE_CAP message, causing contract
2982 * negotiation to fail.
2983 *
2984 * After PD_N_HARD_RESET_COUNT hard-reset attempts, we try
2985 * sending src-capabilities with a lower PD revision to
2986 * make these broken sinks work.
2987 */
2988 if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) {
2989 tcpm_set_state(port, HARD_RESET_SEND, 0);
2990 } else if (port->negotiated_rev > PD_REV20) {
2991 port->negotiated_rev--;
2992 port->hard_reset_count = 0;
2993 tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);
2994 } else {
2995 tcpm_set_state(port, hard_reset_state(port), 0);
2996 }
2997 break;
2973 case SRC_NEGOTIATE_CAPABILITIES: 2998 case SRC_NEGOTIATE_CAPABILITIES:
2974 ret = tcpm_pd_check_request(port); 2999 ret = tcpm_pd_check_request(port);
2975 if (ret < 0) { 3000 if (ret < 0) {
diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c
index 423208e19383..6770afd40765 100644
--- a/drivers/usb/typec/tcpm/wcove.c
+++ b/drivers/usb/typec/tcpm/wcove.c
@@ -615,8 +615,13 @@ static int wcove_typec_probe(struct platform_device *pdev)
615 wcove->dev = &pdev->dev; 615 wcove->dev = &pdev->dev;
616 wcove->regmap = pmic->regmap; 616 wcove->regmap = pmic->regmap;
617 617
618 irq = regmap_irq_get_virq(pmic->irq_chip_data_chgr, 618 irq = platform_get_irq(pdev, 0);
619 platform_get_irq(pdev, 0)); 619 if (irq < 0) {
620 dev_err(&pdev->dev, "Failed to get IRQ: %d\n", irq);
621 return irq;
622 }
623
624 irq = regmap_irq_get_virq(pmic->irq_chip_data_chgr, irq);
620 if (irq < 0) 625 if (irq < 0)
621 return irq; 626 return irq;
622 627