aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-05-28 02:32:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-31 06:48:17 -0400
commitaa071a92bbf09d993ff0dbf3b1f2b53ac93ad654 (patch)
treea6c57deabc0ca7ac0eb080aa3a0d061db8517945
parent25244227158e1502062041365a439a54cb8fe673 (diff)
usb: hub: Per-port setting to reduce TRSTRCY to 10 ms
Currently, the USB hub core waits for 50 ms after enumerating the device. This was added to help "some high speed devices" to enumerate (b789696af8 "[PATCH] USB: relax usbcore reset timings"). On some devices, the time-to-active is important, so we provide a per-port option to reduce the time to what the USB specification requires: 10 ms. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb4
-rw-r--r--drivers/usb/core/hub.c6
-rw-r--r--include/linux/usb.h3
3 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index a31a66d62cbb..08d456e07b53 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -206,6 +206,10 @@ Description:
206 using /sys/module/usbcore/parameters/old_scheme_first, but 206 using /sys/module/usbcore/parameters/old_scheme_first, but
207 it is often not desirable as the new scheme was introduced to 207 it is often not desirable as the new scheme was introduced to
208 increase compatibility with more devices. 208 increase compatibility with more devices.
209 - Bit 1 reduces TRSTRCY to the 10 ms that are required by the
210 USB 2.0 specification, instead of the 50 ms that are normally
211 used to help make enumeration work better on some high speed
212 devices.
209 213
210What: /sys/bus/usb/devices/.../(hub interface)/portX/over_current_count 214What: /sys/bus/usb/devices/.../(hub interface)/portX/over_current_count
211Date: February 2018 215Date: February 2018
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f900f66a6285..26c2438d2889 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2879,7 +2879,11 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
2879done: 2879done:
2880 if (status == 0) { 2880 if (status == 0) {
2881 /* TRSTRCY = 10 ms; plus some extra */ 2881 /* TRSTRCY = 10 ms; plus some extra */
2882 msleep(10 + 40); 2882 if (port_dev->quirks & USB_PORT_QUIRK_FAST_ENUM)
2883 usleep_range(10000, 12000);
2884 else
2885 msleep(10 + 40);
2886
2883 if (udev) { 2887 if (udev) {
2884 struct usb_hcd *hcd = bus_to_hcd(udev->bus); 2888 struct usb_hcd *hcd = bus_to_hcd(udev->bus);
2885 2889
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 2ade17992ed6..4cdd515a4385 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -496,6 +496,9 @@ enum usb_port_connect_type {
496/* For the given port, prefer the old (faster) enumeration scheme. */ 496/* For the given port, prefer the old (faster) enumeration scheme. */
497#define USB_PORT_QUIRK_OLD_SCHEME BIT(0) 497#define USB_PORT_QUIRK_OLD_SCHEME BIT(0)
498 498
499/* Decrease TRSTRCY to 10ms during device enumeration. */
500#define USB_PORT_QUIRK_FAST_ENUM BIT(1)
501
499/* 502/*
500 * USB 2.0 Link Power Management (LPM) parameters. 503 * USB 2.0 Link Power Management (LPM) parameters.
501 */ 504 */