linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: hub: try old enumeration scheme first for high speed devices
@ 2018-08-10 15:01 Zeng Tao
  2018-08-10 10:50 ` Roger Quadros
  0 siblings, 1 reply; 13+ messages in thread
From: Zeng Tao @ 2018-08-10 15:01 UTC (permalink / raw)
  To: gregkh, stern, mathias.nyman, drinkcat, felipe.balbi, drake,
	mike.looijmans, joe
  Cc: Zeng Tao, linux-usb, linux-kernel

The new scheme is required just to support legacy low and full-speed
devices. For high speed devices, it will slower the enumeration speed.
So in this patch we try the "old" enumeration scheme first for high speed
devices.

Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
---
 drivers/usb/core/hub.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1fb2668..d265b19 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2661,10 +2661,13 @@ static bool use_new_scheme(struct usb_device *udev, int retry,
 	int old_scheme_first_port =
 		port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME;
 
+	int quick_enumeration = (udev->speed == USB_SPEED_HIGH);
+
 	if (udev->speed >= USB_SPEED_SUPER)
 		return false;
 
-	return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first);
+	return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first
+			      || quick_enumeration);
 }
 
 /* Is a USB 3.0 port in the Inactive or Compliance Mode state?
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH] usb: hub: try old enumeration scheme first for high speed devices
@ 2018-09-28 11:27 Zeng Tao
  0 siblings, 0 replies; 13+ messages in thread
From: Zeng Tao @ 2018-09-28 11:27 UTC (permalink / raw)
  To: gregkh, stern, mathias.nyman, drinkcat, felipe.balbi, drake,
	ravisadineni, joe
  Cc: prime.zeng, Jonathan Corbet, Thomas Gleixner, Ingo Molnar,
	Bjorn Helgaas, Kai-Heng Feng, Thymo van Beers, Jiri Kosina,
	Konrad Rzeszutek Wilk, Frederic Weisbecker, David Rientjes,
	linux-doc, linux-kernel, linux-usb

The new scheme is required just to support legacy low and full-speed
devices. For high speed devices, it will slower the enumeration speed.
So in this patch we try the "old" enumeration scheme first for high speed
devices, and this is what Windows does since Windows 8.

Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Roger Quadros <rogerq@ti.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 3 ++-
 drivers/usb/core/hub.c                          | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 92eb1f4..151c527 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4610,7 +4610,8 @@
 
 	usbcore.old_scheme_first=
 			[USB] Start with the old device initialization
-			scheme (default 0 = off).
+			scheme,  applies only to low and full-speed devices
+			 (default 0 = off).
 
 	usbcore.usbfs_memory_mb=
 			[USB] Memory limit (in MB) for buffers allocated by
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 462ce49..fb4e6bb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2660,11 +2660,13 @@ static bool use_new_scheme(struct usb_device *udev, int retry,
 {
 	int old_scheme_first_port =
 		port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME;
+	int quick_enumeration = (udev->speed == USB_SPEED_HIGH);
 
 	if (udev->speed >= USB_SPEED_SUPER)
 		return false;
 
-	return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first);
+	return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first
+			      || quick_enumeration);
 }
 
 /* Is a USB 3.0 port in the Inactive or Compliance Mode state?
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-09-28  3:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 15:01 [PATCH] usb: hub: try old enumeration scheme first for high speed devices Zeng Tao
2018-08-10 10:50 ` Roger Quadros
2018-08-10 14:19   ` Alan Stern
2018-08-14  7:35     ` Zengtao (B)
2018-08-14 14:39       ` Alan Stern
2018-08-16  6:21         ` Zengtao (B)
2018-08-16  7:16           ` Roger Quadros
2018-08-16 10:59             ` Zengtao (B)
2018-08-16 11:13               ` Roger Quadros
2018-08-17  2:15                 ` Zengtao (B)
2018-08-14  7:33   ` Zengtao (B)
2018-08-16  7:31     ` Roger Quadros
2018-09-28 11:27 Zeng Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).