summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Boichat2018-05-28 08:32:19 +0200
committerGreg Kroah-Hartman2018-05-31 12:48:17 +0200
commitaa071a92bbf09d993ff0dbf3b1f2b53ac93ad654 (patch)
treea6c57deabc0ca7ac0eb080aa3a0d061db8517945
parentusb: hub: Per-port setting to use old enumeration scheme (diff)
downloadkernel-qcow2-linux-aa071a92bbf09d993ff0dbf3b1f2b53ac93ad654.tar.gz
kernel-qcow2-linux-aa071a92bbf09d993ff0dbf3b1f2b53ac93ad654.tar.xz
kernel-qcow2-linux-aa071a92bbf09d993ff0dbf3b1f2b53ac93ad654.zip
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:
using /sys/module/usbcore/parameters/old_scheme_first, but
it is often not desirable as the new scheme was introduced to
increase compatibility with more devices.
+ - Bit 1 reduces TRSTRCY to the 10 ms that are required by the
+ USB 2.0 specification, instead of the 50 ms that are normally
+ used to help make enumeration work better on some high speed
+ devices.
What: /sys/bus/usb/devices/.../(hub interface)/portX/over_current_count
Date: 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,
done:
if (status == 0) {
/* TRSTRCY = 10 ms; plus some extra */
- msleep(10 + 40);
+ if (port_dev->quirks & USB_PORT_QUIRK_FAST_ENUM)
+ usleep_range(10000, 12000);
+ else
+ msleep(10 + 40);
+
if (udev) {
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
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 {
/* For the given port, prefer the old (faster) enumeration scheme. */
#define USB_PORT_QUIRK_OLD_SCHEME BIT(0)
+/* Decrease TRSTRCY to 10ms during device enumeration. */
+#define USB_PORT_QUIRK_FAST_ENUM BIT(1)
+
/*
* USB 2.0 Link Power Management (LPM) parameters.
*/