Skip to contentSkip to conversation

usb: Add extra delay for device scan

PATCH In review Christian Eggers 3 participants 4 messages Mar 9, 2020 – Mar 11, 2020 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: Add extra delay for device scan

Since b1d9837182, detection of various USB flash drives stopped working. While the changes itself look correct, probably the HUB requires some "recovery time" between the GET_STATUS commands in order to be able to detect devices.

Our configuration: i.MX6ULL (USB-OTG) with only one port on the root HUB. This port is connected to a Microchip USB4916 hub (permanently attached). The USB4916 is configured with it's power on defaults which means that bPwrOn2PwrGood is set to the maximum (0xFF = 510 ms).

Fixes b1d9837182 ("b1d9837182d2b20232234adb36ada2129c3a8152")
---
 drivers/usb/core/hub.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/core/hub.c +3 -0
index 8874775f17..466bbe527b 100644
@@ -406,6 +406,9 @@ static int usb_device_list_scan(void)
 			if (ret)
 				goto out;
 		}
+
+		/* Avoid hammering the HUB with port scans */
+		mdelay(25);
 	}
 
 out:
Signature · 14 lines
Christian Eggers
Embedded software developer

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918
Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477
Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 11 lines · Christian Eggers

Since b1d9837182, detection of various USB flash drives stopped working. While the changes itself look correct, probably the HUB requires some "recovery time" between the GET_STATUS commands in order to be able to detect devices.

Our configuration: i.MX6ULL (USB-OTG) with only one port on the root HUB. This port is connected to a Microchip USB4916 hub (permanently attached). The USB4916 is configured with it's power on defaults which means that bPwrOn2PwrGood is set to the maximum (0xFF = 510 ms).

Fixes b1d9837182 ("b1d9837182d2b20232234adb36ada2129c3a8152")

This should probably be:?

Fixes b1d9837182 ("usb: Change power-on / scanning timeout handling")

- Roland

Quoted 35 lines
---
 drivers/usb/core/hub.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/core/hub.c +3 -0
index 8874775f17..466bbe527b 100644
@@ -406,6 +406,9 @@ static int usb_device_list_scan(void)
 			if (ret)
 				goto out;
 		}
+
+		/* Avoid hammering the HUB with port scans */
+		mdelay(25);
 	}
 
 out:
Signature · 14 lines
Christian Eggers
Embedded software developer

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918
Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477
Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Roland Hieber, Pengutronix e.K.          | [email protected]     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi Roland,

Am Dienstag, 10. März 2020, 10:42:25 CET schrieb Roland Hieber:

Quoted 6 lines

This should probably be:?

Fixes b1d9837182 ("usb: Change power-on / scanning timeout handling")

- Roland

I definitely isolated the regression to that particular commit. Additionally I would like to note, that the scanning timeout is more than long enough. It seems that if the USB hub is queried within a loop without any sleep in between, it has no "resources" left to detecting new devices itself. The scanning timeout itself should not be affected by the additional sleep.

Regards
Christian

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
In reply to Christian Eggers
Quoted 10 lines · Christian Eggers

Since b1d9837182, detection of various USB flash drives stopped working. While the changes itself look correct, probably the HUB requires some "recovery time" between the GET_STATUS commands in order to be able to detect devices.

Our configuration: i.MX6ULL (USB-OTG) with only one port on the root HUB. This port is connected to a Microchip USB4916 hub (permanently attached). The USB4916 is configured with it's power on defaults which means that bPwrOn2PwrGood is set to the maximum (0xFF = 510 ms).

Quoted 5 lines
Fixes b1d9837182 ("b1d9837182d2b20232234adb36ada2129c3a8152")
---
 drivers/usb/core/hub.c | 3 +++
 1 file changed, 3 insertions(+)

Applied with the fixes tag fixed.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox