aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/usb/usb-xhci.txt5
-rw-r--r--Documentation/driver-api/usb/typec.rst2
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/core/hcd.c19
-rw-r--r--drivers/usb/core/hub.c10
-rw-r--r--drivers/usb/core/phy.c93
-rw-r--r--drivers/usb/core/phy.h22
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/host/xhci-dbgtty.c8
-rw-r--r--drivers/usb/host/xhci-pci.c5
-rw-r--r--drivers/usb/host/xhci-plat.c32
-rw-r--r--drivers/usb/host/xhci.h3
-rw-r--r--drivers/usb/musb/musb_dsps.c2
-rw-r--r--drivers/usb/musb/musb_host.c1
-rw-r--r--drivers/usb/serial/Kconfig1
-rw-r--r--drivers/usb/serial/cp210x.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/usb-serial-simple.c7
-rw-r--r--drivers/usb/typec/ucsi/Makefile2
-rw-r--r--drivers/usb/typec/ucsi/ucsi.c2
-rw-r--r--drivers/usb/usbip/stub_main.c5
-rw-r--r--drivers/usb/usbip/usbip_common.h2
-rw-r--r--drivers/usb/usbip/usbip_event.c4
-rw-r--r--drivers/usb/usbip/vhci_hcd.c13
24 files changed, 185 insertions, 61 deletions
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index c4c00dff4b56..bd1dd316fb23 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -28,7 +28,10 @@ Required properties:
28 - interrupts: one XHCI interrupt should be described here. 28 - interrupts: one XHCI interrupt should be described here.
29 29
30Optional properties: 30Optional properties:
31 - clocks: reference to a clock 31 - clocks: reference to the clocks
32 - clock-names: mandatory if there is a second clock, in this case
33 the name must be "core" for the first clock and "reg" for the
34 second one
32 - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM 35 - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
33 - usb3-lpm-capable: determines if platform is USB3 LPM capable 36 - usb3-lpm-capable: determines if platform is USB3 LPM capable
34 - quirk-broken-port-ped: set if the controller has broken port disable mechanism 37 - quirk-broken-port-ped: set if the controller has broken port disable mechanism
diff --git a/Documentation/driver-api/usb/typec.rst b/Documentation/driver-api/usb/typec.rst
index feb31946490b..48ff58095f11 100644
--- a/Documentation/driver-api/usb/typec.rst
+++ b/Documentation/driver-api/usb/typec.rst
@@ -210,7 +210,7 @@ If the connector is dual-role capable, there may also be a switch for the data
210role. USB Type-C Connector Class does not supply separate API for them. The 210role. USB Type-C Connector Class does not supply separate API for them. The
211port drivers can use USB Role Class API with those. 211port drivers can use USB Role Class API with those.
212 212
213Illustration of the muxes behind a connector that supports an alternate mode: 213Illustration of the muxes behind a connector that supports an alternate mode::
214 214
215 ------------------------ 215 ------------------------
216 | Connector | 216 | Connector |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 75f7fb151f71..987fc5ba6321 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -207,5 +207,6 @@ config USB_ULPI_BUS
207 207
208config USB_ROLE_SWITCH 208config USB_ROLE_SWITCH
209 tristate 209 tristate
210 select USB_COMMON
210 211
211endif # USB_SUPPORT 212endif # USB_SUPPORT
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 777036ae6367..0a42c5df3c0f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2262,7 +2262,8 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
2262 hcd->state = HC_STATE_SUSPENDED; 2262 hcd->state = HC_STATE_SUSPENDED;
2263 2263
2264 if (!PMSG_IS_AUTO(msg)) 2264 if (!PMSG_IS_AUTO(msg))
2265 usb_phy_roothub_power_off(hcd->phy_roothub); 2265 usb_phy_roothub_suspend(hcd->self.sysdev,
2266 hcd->phy_roothub);
2266 2267
2267 /* Did we race with a root-hub wakeup event? */ 2268 /* Did we race with a root-hub wakeup event? */
2268 if (rhdev->do_remote_wakeup) { 2269 if (rhdev->do_remote_wakeup) {
@@ -2302,7 +2303,8 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
2302 } 2303 }
2303 2304
2304 if (!PMSG_IS_AUTO(msg)) { 2305 if (!PMSG_IS_AUTO(msg)) {
2305 status = usb_phy_roothub_power_on(hcd->phy_roothub); 2306 status = usb_phy_roothub_resume(hcd->self.sysdev,
2307 hcd->phy_roothub);
2306 if (status) 2308 if (status)
2307 return status; 2309 return status;
2308 } 2310 }
@@ -2344,7 +2346,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
2344 } 2346 }
2345 } else { 2347 } else {
2346 hcd->state = old_state; 2348 hcd->state = old_state;
2347 usb_phy_roothub_power_off(hcd->phy_roothub); 2349 usb_phy_roothub_suspend(hcd->self.sysdev, hcd->phy_roothub);
2348 dev_dbg(&rhdev->dev, "bus %s fail, err %d\n", 2350 dev_dbg(&rhdev->dev, "bus %s fail, err %d\n",
2349 "resume", status); 2351 "resume", status);
2350 if (status != -ESHUTDOWN) 2352 if (status != -ESHUTDOWN)
@@ -2377,6 +2379,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
2377 2379
2378 spin_lock_irqsave (&hcd_root_hub_lock, flags); 2380 spin_lock_irqsave (&hcd_root_hub_lock, flags);
2379 if (hcd->rh_registered) { 2381 if (hcd->rh_registered) {
2382 pm_wakeup_event(&hcd->self.root_hub->dev, 0);
2380 set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); 2383 set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
2381 queue_work(pm_wq, &hcd->wakeup_work); 2384 queue_work(pm_wq, &hcd->wakeup_work);
2382 } 2385 }
@@ -2758,12 +2761,16 @@ int usb_add_hcd(struct usb_hcd *hcd,
2758 } 2761 }
2759 2762
2760 if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { 2763 if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
2761 hcd->phy_roothub = usb_phy_roothub_init(hcd->self.sysdev); 2764 hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
2762 if (IS_ERR(hcd->phy_roothub)) { 2765 if (IS_ERR(hcd->phy_roothub)) {
2763 retval = PTR_ERR(hcd->phy_roothub); 2766 retval = PTR_ERR(hcd->phy_roothub);
2764 goto err_phy_roothub_init; 2767 goto err_phy_roothub_alloc;
2765 } 2768 }
2766 2769
2770 retval = usb_phy_roothub_init(hcd->phy_roothub);
2771 if (retval)
2772 goto err_phy_roothub_alloc;
2773
2767 retval = usb_phy_roothub_power_on(hcd->phy_roothub); 2774 retval = usb_phy_roothub_power_on(hcd->phy_roothub);
2768 if (retval) 2775 if (retval)
2769 goto err_usb_phy_roothub_power_on; 2776 goto err_usb_phy_roothub_power_on;
@@ -2936,7 +2943,7 @@ err_create_buf:
2936 usb_phy_roothub_power_off(hcd->phy_roothub); 2943 usb_phy_roothub_power_off(hcd->phy_roothub);
2937err_usb_phy_roothub_power_on: 2944err_usb_phy_roothub_power_on:
2938 usb_phy_roothub_exit(hcd->phy_roothub); 2945 usb_phy_roothub_exit(hcd->phy_roothub);
2939err_phy_roothub_init: 2946err_phy_roothub_alloc:
2940 if (hcd->remove_phy && hcd->usb_phy) { 2947 if (hcd->remove_phy && hcd->usb_phy) {
2941 usb_phy_shutdown(hcd->usb_phy); 2948 usb_phy_shutdown(hcd->usb_phy);
2942 usb_put_phy(hcd->usb_phy); 2949 usb_put_phy(hcd->usb_phy);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f6ea16e9f6bb..aa9968d90a48 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -653,12 +653,17 @@ void usb_wakeup_notification(struct usb_device *hdev,
653 unsigned int portnum) 653 unsigned int portnum)
654{ 654{
655 struct usb_hub *hub; 655 struct usb_hub *hub;
656 struct usb_port *port_dev;
656 657
657 if (!hdev) 658 if (!hdev)
658 return; 659 return;
659 660
660 hub = usb_hub_to_struct_hub(hdev); 661 hub = usb_hub_to_struct_hub(hdev);
661 if (hub) { 662 if (hub) {
663 port_dev = hub->ports[portnum - 1];
664 if (port_dev && port_dev->child)
665 pm_wakeup_event(&port_dev->child->dev, 0);
666
662 set_bit(portnum, hub->wakeup_bits); 667 set_bit(portnum, hub->wakeup_bits);
663 kick_hub_wq(hub); 668 kick_hub_wq(hub);
664 } 669 }
@@ -3434,8 +3439,11 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
3434 3439
3435 /* Skip the initial Clear-Suspend step for a remote wakeup */ 3440 /* Skip the initial Clear-Suspend step for a remote wakeup */
3436 status = hub_port_status(hub, port1, &portstatus, &portchange); 3441 status = hub_port_status(hub, port1, &portstatus, &portchange);
3437 if (status == 0 && !port_is_suspended(hub, portstatus)) 3442 if (status == 0 && !port_is_suspended(hub, portstatus)) {
3443 if (portchange & USB_PORT_STAT_C_SUSPEND)
3444 pm_wakeup_event(&udev->dev, 0);
3438 goto SuspendCleared; 3445 goto SuspendCleared;
3446 }
3439 3447
3440 /* see 7.1.7.7; affects power usage, but not budgeting */ 3448 /* see 7.1.7.7; affects power usage, but not budgeting */
3441 if (hub_is_superspeed(hub->hdev)) 3449 if (hub_is_superspeed(hub->hdev))
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
index 09b7c43c0ea4..9879767452a2 100644
--- a/drivers/usb/core/phy.c
+++ b/drivers/usb/core/phy.c
@@ -19,19 +19,6 @@ struct usb_phy_roothub {
19 struct list_head list; 19 struct list_head list;
20}; 20};
21 21
22static struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev)
23{
24 struct usb_phy_roothub *roothub_entry;
25
26 roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL);
27 if (!roothub_entry)
28 return ERR_PTR(-ENOMEM);
29
30 INIT_LIST_HEAD(&roothub_entry->list);
31
32 return roothub_entry;
33}
34
35static int usb_phy_roothub_add_phy(struct device *dev, int index, 22static int usb_phy_roothub_add_phy(struct device *dev, int index,
36 struct list_head *list) 23 struct list_head *list)
37{ 24{
@@ -45,9 +32,11 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index,
45 return PTR_ERR(phy); 32 return PTR_ERR(phy);
46 } 33 }
47 34
48 roothub_entry = usb_phy_roothub_alloc(dev); 35 roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL);
49 if (IS_ERR(roothub_entry)) 36 if (!roothub_entry)
50 return PTR_ERR(roothub_entry); 37 return -ENOMEM;
38
39 INIT_LIST_HEAD(&roothub_entry->list);
51 40
52 roothub_entry->phy = phy; 41 roothub_entry->phy = phy;
53 42
@@ -56,28 +45,44 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index,
56 return 0; 45 return 0;
57} 46}
58 47
59struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev) 48struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev)
60{ 49{
61 struct usb_phy_roothub *phy_roothub; 50 struct usb_phy_roothub *phy_roothub;
62 struct usb_phy_roothub *roothub_entry;
63 struct list_head *head;
64 int i, num_phys, err; 51 int i, num_phys, err;
65 52
53 if (!IS_ENABLED(CONFIG_GENERIC_PHY))
54 return NULL;
55
66 num_phys = of_count_phandle_with_args(dev->of_node, "phys", 56 num_phys = of_count_phandle_with_args(dev->of_node, "phys",
67 "#phy-cells"); 57 "#phy-cells");
68 if (num_phys <= 0) 58 if (num_phys <= 0)
69 return NULL; 59 return NULL;
70 60
71 phy_roothub = usb_phy_roothub_alloc(dev); 61 phy_roothub = devm_kzalloc(dev, sizeof(*phy_roothub), GFP_KERNEL);
72 if (IS_ERR(phy_roothub)) 62 if (!phy_roothub)
73 return phy_roothub; 63 return ERR_PTR(-ENOMEM);
64
65 INIT_LIST_HEAD(&phy_roothub->list);
74 66
75 for (i = 0; i < num_phys; i++) { 67 for (i = 0; i < num_phys; i++) {
76 err = usb_phy_roothub_add_phy(dev, i, &phy_roothub->list); 68 err = usb_phy_roothub_add_phy(dev, i, &phy_roothub->list);
77 if (err) 69 if (err)
78 goto err_out; 70 return ERR_PTR(err);
79 } 71 }
80 72
73 return phy_roothub;
74}
75EXPORT_SYMBOL_GPL(usb_phy_roothub_alloc);
76
77int usb_phy_roothub_init(struct usb_phy_roothub *phy_roothub)
78{
79 struct usb_phy_roothub *roothub_entry;
80 struct list_head *head;
81 int err;
82
83 if (!phy_roothub)
84 return 0;
85
81 head = &phy_roothub->list; 86 head = &phy_roothub->list;
82 87
83 list_for_each_entry(roothub_entry, head, list) { 88 list_for_each_entry(roothub_entry, head, list) {
@@ -86,14 +91,13 @@ struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev)
86 goto err_exit_phys; 91 goto err_exit_phys;
87 } 92 }
88 93
89 return phy_roothub; 94 return 0;
90 95
91err_exit_phys: 96err_exit_phys:
92 list_for_each_entry_continue_reverse(roothub_entry, head, list) 97 list_for_each_entry_continue_reverse(roothub_entry, head, list)
93 phy_exit(roothub_entry->phy); 98 phy_exit(roothub_entry->phy);
94 99
95err_out: 100 return err;
96 return ERR_PTR(err);
97} 101}
98EXPORT_SYMBOL_GPL(usb_phy_roothub_init); 102EXPORT_SYMBOL_GPL(usb_phy_roothub_init);
99 103
@@ -111,7 +115,7 @@ int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub)
111 list_for_each_entry(roothub_entry, head, list) { 115 list_for_each_entry(roothub_entry, head, list) {
112 err = phy_exit(roothub_entry->phy); 116 err = phy_exit(roothub_entry->phy);
113 if (err) 117 if (err)
114 ret = ret; 118 ret = err;
115 } 119 }
116 120
117 return ret; 121 return ret;
@@ -156,3 +160,38 @@ void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub)
156 phy_power_off(roothub_entry->phy); 160 phy_power_off(roothub_entry->phy);
157} 161}
158EXPORT_SYMBOL_GPL(usb_phy_roothub_power_off); 162EXPORT_SYMBOL_GPL(usb_phy_roothub_power_off);
163
164int usb_phy_roothub_suspend(struct device *controller_dev,
165 struct usb_phy_roothub *phy_roothub)
166{
167 usb_phy_roothub_power_off(phy_roothub);
168
169 /* keep the PHYs initialized so the device can wake up the system */
170 if (device_may_wakeup(controller_dev))
171 return 0;
172
173 return usb_phy_roothub_exit(phy_roothub);
174}
175EXPORT_SYMBOL_GPL(usb_phy_roothub_suspend);
176
177int usb_phy_roothub_resume(struct device *controller_dev,
178 struct usb_phy_roothub *phy_roothub)
179{
180 int err;
181
182 /* if the device can't wake up the system _exit was called */
183 if (!device_may_wakeup(controller_dev)) {
184 err = usb_phy_roothub_init(phy_roothub);
185 if (err)
186 return err;
187 }
188
189 err = usb_phy_roothub_power_on(phy_roothub);
190
191 /* undo _init if _power_on failed */
192 if (err && !device_may_wakeup(controller_dev))
193 usb_phy_roothub_exit(phy_roothub);
194
195 return err;
196}
197EXPORT_SYMBOL_GPL(usb_phy_roothub_resume);
diff --git a/drivers/usb/core/phy.h b/drivers/usb/core/phy.h
index 6fde59bfbff8..88a3c037e9df 100644
--- a/drivers/usb/core/phy.h
+++ b/drivers/usb/core/phy.h
@@ -1,7 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * USB roothub wrapper
4 *
5 * Copyright (C) 2018 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
6 */
7
8#ifndef __USB_CORE_PHY_H_
9#define __USB_CORE_PHY_H_
10
11struct device;
1struct usb_phy_roothub; 12struct usb_phy_roothub;
2 13
3struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev); 14struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev);
15
16int usb_phy_roothub_init(struct usb_phy_roothub *phy_roothub);
4int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub); 17int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub);
5 18
6int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub); 19int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub);
7void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub); 20void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub);
21
22int usb_phy_roothub_suspend(struct device *controller_dev,
23 struct usb_phy_roothub *phy_roothub);
24int usb_phy_roothub_resume(struct device *controller_dev,
25 struct usb_phy_roothub *phy_roothub);
26
27#endif /* __USB_CORE_PHY_H_ */
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 920f48a49a87..c55def2f1320 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -186,6 +186,9 @@ static const struct usb_device_id usb_quirk_list[] = {
186 { USB_DEVICE(0x03f0, 0x0701), .driver_info = 186 { USB_DEVICE(0x03f0, 0x0701), .driver_info =
187 USB_QUIRK_STRING_FETCH_255 }, 187 USB_QUIRK_STRING_FETCH_255 },
188 188
189 /* HP v222w 16GB Mini USB Drive */
190 { USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT },
191
189 /* Creative SB Audigy 2 NX */ 192 /* Creative SB Audigy 2 NX */
190 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, 193 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
191 194
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 48779c44c361..eb494ec547e8 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -320,9 +320,11 @@ int xhci_dbc_tty_register_driver(struct xhci_hcd *xhci)
320 320
321void xhci_dbc_tty_unregister_driver(void) 321void xhci_dbc_tty_unregister_driver(void)
322{ 322{
323 tty_unregister_driver(dbc_tty_driver); 323 if (dbc_tty_driver) {
324 put_tty_driver(dbc_tty_driver); 324 tty_unregister_driver(dbc_tty_driver);
325 dbc_tty_driver = NULL; 325 put_tty_driver(dbc_tty_driver);
326 dbc_tty_driver = NULL;
327 }
326} 328}
327 329
328static void dbc_rx_push(unsigned long _port) 330static void dbc_rx_push(unsigned long _port)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index f17b7eab66cf..85ffda85f8ab 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -126,7 +126,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
126 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) 126 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
127 xhci->quirks |= XHCI_AMD_PLL_FIX; 127 xhci->quirks |= XHCI_AMD_PLL_FIX;
128 128
129 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb) 129 if (pdev->vendor == PCI_VENDOR_ID_AMD &&
130 (pdev->device == 0x15e0 ||
131 pdev->device == 0x15e1 ||
132 pdev->device == 0x43bb))
130 xhci->quirks |= XHCI_SUSPEND_DELAY; 133 xhci->quirks |= XHCI_SUSPEND_DELAY;
131 134
132 if (pdev->vendor == PCI_VENDOR_ID_AMD) 135 if (pdev->vendor == PCI_VENDOR_ID_AMD)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index df327dcc2bac..c1b22fc64e38 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -157,6 +157,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
157 struct resource *res; 157 struct resource *res;
158 struct usb_hcd *hcd; 158 struct usb_hcd *hcd;
159 struct clk *clk; 159 struct clk *clk;
160 struct clk *reg_clk;
160 int ret; 161 int ret;
161 int irq; 162 int irq;
162 163
@@ -226,17 +227,27 @@ static int xhci_plat_probe(struct platform_device *pdev)
226 hcd->rsrc_len = resource_size(res); 227 hcd->rsrc_len = resource_size(res);
227 228
228 /* 229 /*
229 * Not all platforms have a clk so it is not an error if the 230 * Not all platforms have clks so it is not an error if the
230 * clock does not exists. 231 * clock do not exist.
231 */ 232 */
233 reg_clk = devm_clk_get(&pdev->dev, "reg");
234 if (!IS_ERR(reg_clk)) {
235 ret = clk_prepare_enable(reg_clk);
236 if (ret)
237 goto put_hcd;
238 } else if (PTR_ERR(reg_clk) == -EPROBE_DEFER) {
239 ret = -EPROBE_DEFER;
240 goto put_hcd;
241 }
242
232 clk = devm_clk_get(&pdev->dev, NULL); 243 clk = devm_clk_get(&pdev->dev, NULL);
233 if (!IS_ERR(clk)) { 244 if (!IS_ERR(clk)) {
234 ret = clk_prepare_enable(clk); 245 ret = clk_prepare_enable(clk);
235 if (ret) 246 if (ret)
236 goto put_hcd; 247 goto disable_reg_clk;
237 } else if (PTR_ERR(clk) == -EPROBE_DEFER) { 248 } else if (PTR_ERR(clk) == -EPROBE_DEFER) {
238 ret = -EPROBE_DEFER; 249 ret = -EPROBE_DEFER;
239 goto put_hcd; 250 goto disable_reg_clk;
240 } 251 }
241 252
242 xhci = hcd_to_xhci(hcd); 253 xhci = hcd_to_xhci(hcd);
@@ -252,6 +263,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
252 device_wakeup_enable(hcd->self.controller); 263 device_wakeup_enable(hcd->self.controller);
253 264
254 xhci->clk = clk; 265 xhci->clk = clk;
266 xhci->reg_clk = reg_clk;
255 xhci->main_hcd = hcd; 267 xhci->main_hcd = hcd;
256 xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, 268 xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev,
257 dev_name(&pdev->dev), hcd); 269 dev_name(&pdev->dev), hcd);
@@ -320,8 +332,10 @@ put_usb3_hcd:
320 usb_put_hcd(xhci->shared_hcd); 332 usb_put_hcd(xhci->shared_hcd);
321 333
322disable_clk: 334disable_clk:
323 if (!IS_ERR(clk)) 335 clk_disable_unprepare(clk);
324 clk_disable_unprepare(clk); 336
337disable_reg_clk:
338 clk_disable_unprepare(reg_clk);
325 339
326put_hcd: 340put_hcd:
327 usb_put_hcd(hcd); 341 usb_put_hcd(hcd);
@@ -338,6 +352,7 @@ static int xhci_plat_remove(struct platform_device *dev)
338 struct usb_hcd *hcd = platform_get_drvdata(dev); 352 struct usb_hcd *hcd = platform_get_drvdata(dev);
339 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 353 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
340 struct clk *clk = xhci->clk; 354 struct clk *clk = xhci->clk;
355 struct clk *reg_clk = xhci->reg_clk;
341 356
342 xhci->xhc_state |= XHCI_STATE_REMOVING; 357 xhci->xhc_state |= XHCI_STATE_REMOVING;
343 358
@@ -347,8 +362,8 @@ static int xhci_plat_remove(struct platform_device *dev)
347 usb_remove_hcd(hcd); 362 usb_remove_hcd(hcd);
348 usb_put_hcd(xhci->shared_hcd); 363 usb_put_hcd(xhci->shared_hcd);
349 364
350 if (!IS_ERR(clk)) 365 clk_disable_unprepare(clk);
351 clk_disable_unprepare(clk); 366 clk_disable_unprepare(reg_clk);
352 usb_put_hcd(hcd); 367 usb_put_hcd(hcd);
353 368
354 pm_runtime_set_suspended(&dev->dev); 369 pm_runtime_set_suspended(&dev->dev);
@@ -420,7 +435,6 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
420static struct platform_driver usb_xhci_driver = { 435static struct platform_driver usb_xhci_driver = {
421 .probe = xhci_plat_probe, 436 .probe = xhci_plat_probe,
422 .remove = xhci_plat_remove, 437 .remove = xhci_plat_remove,
423 .shutdown = usb_hcd_platform_shutdown,
424 .driver = { 438 .driver = {
425 .name = "xhci-hcd", 439 .name = "xhci-hcd",
426 .pm = &xhci_plat_pm_ops, 440 .pm = &xhci_plat_pm_ops,
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 05c909b04f14..6dfc4867dbcf 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1729,8 +1729,9 @@ struct xhci_hcd {
1729 int page_shift; 1729 int page_shift;
1730 /* msi-x vectors */ 1730 /* msi-x vectors */
1731 int msix_count; 1731 int msix_count;
1732 /* optional clock */ 1732 /* optional clocks */
1733 struct clk *clk; 1733 struct clk *clk;
1734 struct clk *reg_clk;
1734 /* data structures */ 1735 /* data structures */
1735 struct xhci_device_context_array *dcbaa; 1736 struct xhci_device_context_array *dcbaa;
1736 struct xhci_ring *cmd_ring; 1737 struct xhci_ring *cmd_ring;
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 05a679d5e3a2..6a60bc0490c5 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -451,7 +451,6 @@ static int dsps_musb_init(struct musb *musb)
451 if (!rev) 451 if (!rev)
452 return -ENODEV; 452 return -ENODEV;
453 453
454 usb_phy_init(musb->xceiv);
455 if (IS_ERR(musb->phy)) { 454 if (IS_ERR(musb->phy)) {
456 musb->phy = NULL; 455 musb->phy = NULL;
457 } else { 456 } else {
@@ -501,7 +500,6 @@ static int dsps_musb_exit(struct musb *musb)
501 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 500 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
502 501
503 del_timer_sync(&musb->dev_timer); 502 del_timer_sync(&musb->dev_timer);
504 usb_phy_shutdown(musb->xceiv);
505 phy_power_off(musb->phy); 503 phy_power_off(musb->phy);
506 phy_exit(musb->phy); 504 phy_exit(musb->phy);
507 debugfs_remove_recursive(glue->dbgfs_root); 505 debugfs_remove_recursive(glue->dbgfs_root);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 3a8451a15f7f..4fa372c845e1 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2754,6 +2754,7 @@ int musb_host_setup(struct musb *musb, int power_budget)
2754 hcd->self.otg_port = 1; 2754 hcd->self.otg_port = 1;
2755 musb->xceiv->otg->host = &hcd->self; 2755 musb->xceiv->otg->host = &hcd->self;
2756 hcd->power_budget = 2 * (power_budget ? : 250); 2756 hcd->power_budget = 2 * (power_budget ? : 250);
2757 hcd->skip_phy_initialization = 1;
2757 2758
2758 ret = usb_add_hcd(hcd, 0, 0); 2759 ret = usb_add_hcd(hcd, 0, 0);
2759 if (ret < 0) 2760 if (ret < 0)
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index a646820f5a78..533f127c30ad 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -62,6 +62,7 @@ config USB_SERIAL_SIMPLE
62 - Fundamental Software dongle. 62 - Fundamental Software dongle.
63 - Google USB serial devices 63 - Google USB serial devices
64 - HP4x calculators 64 - HP4x calculators
65 - Libtransistor USB console
65 - a number of Motorola phones 66 - a number of Motorola phones
66 - Motorola Tetra devices 67 - Motorola Tetra devices
67 - Novatel Wireless GPS receivers 68 - Novatel Wireless GPS receivers
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index de1e759dd512..eb6c26cbe579 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -214,6 +214,7 @@ static const struct usb_device_id id_table[] = {
214 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ 214 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
215 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ 215 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
216 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ 216 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
217 { USB_DEVICE(0x3923, 0x7A0B) }, /* National Instruments USB Serial Console */
217 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 218 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
218 { } /* Terminating Entry */ 219 { } /* Terminating Entry */
219}; 220};
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 87202ad5a50d..7ea221d42dba 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1898,7 +1898,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
1898 return ftdi_jtag_probe(serial); 1898 return ftdi_jtag_probe(serial);
1899 1899
1900 if (udev->product && 1900 if (udev->product &&
1901 (!strcmp(udev->product, "BeagleBone/XDS100V2") || 1901 (!strcmp(udev->product, "Arrow USB Blaster") ||
1902 !strcmp(udev->product, "BeagleBone/XDS100V2") ||
1902 !strcmp(udev->product, "SNAP Connect E10"))) 1903 !strcmp(udev->product, "SNAP Connect E10")))
1903 return ftdi_jtag_probe(serial); 1904 return ftdi_jtag_probe(serial);
1904 1905
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
index 4ef79e29cb26..40864c2bd9dc 100644
--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -63,6 +63,11 @@ DEVICE(flashloader, FLASHLOADER_IDS);
63 0x01) } 63 0x01) }
64DEVICE(google, GOOGLE_IDS); 64DEVICE(google, GOOGLE_IDS);
65 65
66/* Libtransistor USB console */
67#define LIBTRANSISTOR_IDS() \
68 { USB_DEVICE(0x1209, 0x8b00) }
69DEVICE(libtransistor, LIBTRANSISTOR_IDS);
70
66/* ViVOpay USB Serial Driver */ 71/* ViVOpay USB Serial Driver */
67#define VIVOPAY_IDS() \ 72#define VIVOPAY_IDS() \
68 { USB_DEVICE(0x1d5f, 0x1004) } /* ViVOpay 8800 */ 73 { USB_DEVICE(0x1d5f, 0x1004) } /* ViVOpay 8800 */
@@ -110,6 +115,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
110 &funsoft_device, 115 &funsoft_device,
111 &flashloader_device, 116 &flashloader_device,
112 &google_device, 117 &google_device,
118 &libtransistor_device,
113 &vivopay_device, 119 &vivopay_device,
114 &moto_modem_device, 120 &moto_modem_device,
115 &motorola_tetra_device, 121 &motorola_tetra_device,
@@ -126,6 +132,7 @@ static const struct usb_device_id id_table[] = {
126 FUNSOFT_IDS(), 132 FUNSOFT_IDS(),
127 FLASHLOADER_IDS(), 133 FLASHLOADER_IDS(),
128 GOOGLE_IDS(), 134 GOOGLE_IDS(),
135 LIBTRANSISTOR_IDS(),
129 VIVOPAY_IDS(), 136 VIVOPAY_IDS(),
130 MOTO_IDS(), 137 MOTO_IDS(),
131 MOTOROLA_TETRA_IDS(), 138 MOTOROLA_TETRA_IDS(),
diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile
index b57891c1fd31..7afbea512207 100644
--- a/drivers/usb/typec/ucsi/Makefile
+++ b/drivers/usb/typec/ucsi/Makefile
@@ -5,6 +5,6 @@ obj-$(CONFIG_TYPEC_UCSI) += typec_ucsi.o
5 5
6typec_ucsi-y := ucsi.o 6typec_ucsi-y := ucsi.o
7 7
8typec_ucsi-$(CONFIG_FTRACE) += trace.o 8typec_ucsi-$(CONFIG_TRACING) += trace.o
9 9
10obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o 10obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index bf0977fbd100..bd5cca5632b3 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -28,7 +28,7 @@
28 * difficult to estimate the time it takes for the system to process the command 28 * difficult to estimate the time it takes for the system to process the command
29 * before it is actually passed to the PPM. 29 * before it is actually passed to the PPM.
30 */ 30 */
31#define UCSI_TIMEOUT_MS 1000 31#define UCSI_TIMEOUT_MS 5000
32 32
33/* 33/*
34 * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests 34 * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index c31c8402a0c5..d41d0cdeec0f 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -186,7 +186,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
186 if (!bid) 186 if (!bid)
187 return -ENODEV; 187 return -ENODEV;
188 188
189 /* device_attach() callers should hold parent lock for USB */
190 if (bid->udev->dev.parent)
191 device_lock(bid->udev->dev.parent);
189 ret = device_attach(&bid->udev->dev); 192 ret = device_attach(&bid->udev->dev);
193 if (bid->udev->dev.parent)
194 device_unlock(bid->udev->dev.parent);
190 if (ret < 0) { 195 if (ret < 0) {
191 dev_err(&bid->udev->dev, "rebind failed\n"); 196 dev_err(&bid->udev->dev, "rebind failed\n");
192 return ret; 197 return ret;
diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h
index 473fb8a87289..bf8afe9b5883 100644
--- a/drivers/usb/usbip/usbip_common.h
+++ b/drivers/usb/usbip/usbip_common.h
@@ -243,7 +243,7 @@ enum usbip_side {
243#define VUDC_EVENT_ERROR_USB (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) 243#define VUDC_EVENT_ERROR_USB (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
244#define VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) 244#define VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
245 245
246#define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_BYE) 246#define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_RESET | USBIP_EH_BYE)
247#define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) 247#define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
248#define VDEV_EVENT_ERROR_TCP (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) 248#define VDEV_EVENT_ERROR_TCP (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
249#define VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) 249#define VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c
index 5b4c0864ad92..5d88917c9631 100644
--- a/drivers/usb/usbip/usbip_event.c
+++ b/drivers/usb/usbip/usbip_event.c
@@ -91,10 +91,6 @@ static void event_handler(struct work_struct *work)
91 unset_event(ud, USBIP_EH_UNUSABLE); 91 unset_event(ud, USBIP_EH_UNUSABLE);
92 } 92 }
93 93
94 /* Stop the error handler. */
95 if (ud->event & USBIP_EH_BYE)
96 usbip_dbg_eh("removed %p\n", ud);
97
98 wake_up(&ud->eh_waitq); 94 wake_up(&ud->eh_waitq);
99 } 95 }
100} 96}
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 20e3d4609583..d11f3f8dad40 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -354,6 +354,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
354 usbip_dbg_vhci_rh(" ClearHubFeature\n"); 354 usbip_dbg_vhci_rh(" ClearHubFeature\n");
355 break; 355 break;
356 case ClearPortFeature: 356 case ClearPortFeature:
357 if (rhport < 0)
358 goto error;
357 switch (wValue) { 359 switch (wValue) {
358 case USB_PORT_FEAT_SUSPEND: 360 case USB_PORT_FEAT_SUSPEND:
359 if (hcd->speed == HCD_USB3) { 361 if (hcd->speed == HCD_USB3) {
@@ -511,11 +513,16 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
511 goto error; 513 goto error;
512 } 514 }
513 515
516 if (rhport < 0)
517 goto error;
518
514 vhci_hcd->port_status[rhport] |= USB_PORT_STAT_SUSPEND; 519 vhci_hcd->port_status[rhport] |= USB_PORT_STAT_SUSPEND;
515 break; 520 break;
516 case USB_PORT_FEAT_POWER: 521 case USB_PORT_FEAT_POWER:
517 usbip_dbg_vhci_rh( 522 usbip_dbg_vhci_rh(
518 " SetPortFeature: USB_PORT_FEAT_POWER\n"); 523 " SetPortFeature: USB_PORT_FEAT_POWER\n");
524 if (rhport < 0)
525 goto error;
519 if (hcd->speed == HCD_USB3) 526 if (hcd->speed == HCD_USB3)
520 vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER; 527 vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER;
521 else 528 else
@@ -524,6 +531,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
524 case USB_PORT_FEAT_BH_PORT_RESET: 531 case USB_PORT_FEAT_BH_PORT_RESET:
525 usbip_dbg_vhci_rh( 532 usbip_dbg_vhci_rh(
526 " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n"); 533 " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n");
534 if (rhport < 0)
535 goto error;
527 /* Applicable only for USB3.0 hub */ 536 /* Applicable only for USB3.0 hub */
528 if (hcd->speed != HCD_USB3) { 537 if (hcd->speed != HCD_USB3) {
529 pr_err("USB_PORT_FEAT_BH_PORT_RESET req not " 538 pr_err("USB_PORT_FEAT_BH_PORT_RESET req not "
@@ -534,6 +543,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
534 case USB_PORT_FEAT_RESET: 543 case USB_PORT_FEAT_RESET:
535 usbip_dbg_vhci_rh( 544 usbip_dbg_vhci_rh(
536 " SetPortFeature: USB_PORT_FEAT_RESET\n"); 545 " SetPortFeature: USB_PORT_FEAT_RESET\n");
546 if (rhport < 0)
547 goto error;
537 /* if it's already enabled, disable */ 548 /* if it's already enabled, disable */
538 if (hcd->speed == HCD_USB3) { 549 if (hcd->speed == HCD_USB3) {
539 vhci_hcd->port_status[rhport] = 0; 550 vhci_hcd->port_status[rhport] = 0;
@@ -554,6 +565,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
554 default: 565 default:
555 usbip_dbg_vhci_rh(" SetPortFeature: default %d\n", 566 usbip_dbg_vhci_rh(" SetPortFeature: default %d\n",
556 wValue); 567 wValue);
568 if (rhport < 0)
569 goto error;
557 if (hcd->speed == HCD_USB3) { 570 if (hcd->speed == HCD_USB3) {
558 if ((vhci_hcd->port_status[rhport] & 571 if ((vhci_hcd->port_status[rhport] &
559 USB_SS_PORT_STAT_POWER) != 0) { 572 USB_SS_PORT_STAT_POWER) != 0) {