mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb: Add extra delay for device scan
@ 2020-03-09 14:20 Christian Eggers
  2020-03-10  9:42 ` Roland Hieber
  2020-03-11 15:04 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Eggers @ 2020-03-09 14:20 UTC (permalink / raw)
  To: barebox; +Cc: Christian Eggers, Primoz Fiser

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")
Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 drivers/usb/core/hub.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8874775f17..466bbe527b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -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:
-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] usb: Add extra delay for device scan
  2020-03-09 14:20 [PATCH] usb: Add extra delay for device scan Christian Eggers
@ 2020-03-10  9:42 ` Roland Hieber
  2020-03-10 10:32   ` Christian Eggers
  2020-03-11 15:04 ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Roland Hieber @ 2020-03-10  9:42 UTC (permalink / raw)
  To: Christian Eggers; +Cc: barebox, Primoz Fiser

On Mon, Mar 09, 2020 at 03:20:26PM +0100, Christian Eggers wrote:
> 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

> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---
>  drivers/usb/core/hub.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 8874775f17..466bbe527b 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -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:
> -- 
> 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
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] usb: Add extra delay for device scan
  2020-03-10  9:42 ` Roland Hieber
@ 2020-03-10 10:32   ` Christian Eggers
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Eggers @ 2020-03-10 10:32 UTC (permalink / raw)
  To: Roland Hieber; +Cc: barebox, Primoz Fiser

Hi Roland,

Am Dienstag, 10. März 2020, 10:42:25 CET schrieb Roland Hieber:
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] usb: Add extra delay for device scan
  2020-03-09 14:20 [PATCH] usb: Add extra delay for device scan Christian Eggers
  2020-03-10  9:42 ` Roland Hieber
@ 2020-03-11 15:04 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-03-11 15:04 UTC (permalink / raw)
  To: Christian Eggers; +Cc: barebox, Primoz Fiser

On Mon, Mar 09, 2020 at 03:20:26PM +0100, Christian Eggers wrote:
> 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")
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---
>  drivers/usb/core/hub.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied with the fixes tag fixed.

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-03-11 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 14:20 [PATCH] usb: Add extra delay for device scan Christian Eggers
2020-03-10  9:42 ` Roland Hieber
2020-03-10 10:32   ` Christian Eggers
2020-03-11 15:04 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox