public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] usb: hub: fix power good delay timing
@ 2014-05-19 20:21 Stephen Warren
  2014-05-19 20:21 ` [U-Boot] [PATCH 2/2] usb: hub: remove CONFIG_USB_HUB_MIN_POWER_ON_DELAY Stephen Warren
  2014-05-29 21:25 ` [U-Boot] [PATCH 1/2] usb: hub: fix power good delay timing Stephen Warren
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Warren @ 2014-05-19 20:21 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

usb_hub_power_on() currently waits for the maximum of (a) the hub port's
power output to become good, (b) the max time the USB specification
allows a device to take to connect.

However, these two operations must occur in series rather than in
parallel. First, the power supply ramps up to the level required to
power the USB device, and then the device may take a certain amount of
time to connect (assert D+/D- pullups).

Related, the maximum time that a device has to assert pullups is 1s not
100ms.

This is explained in "Connect Timing ECN.pdf", itself part of
usb_20_042814.zip from www.usb.org.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 common/usb_hub.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index ffac0e743cef..4875a51aceaf 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -36,7 +36,7 @@
 #endif
 
 #ifndef CONFIG_USB_HUB_MIN_POWER_ON_DELAY
-#define CONFIG_USB_HUB_MIN_POWER_ON_DELAY	100
+#define CONFIG_USB_HUB_MIN_POWER_ON_DELAY	1000
 #endif
 
 #define USB_BUFSIZ	512
@@ -138,8 +138,11 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 		debug("port %d returns %lX\n", i + 1, dev->status);
 	}
 
-	/* Wait for power to become stable */
-	mdelay(max(pgood_delay, CONFIG_USB_HUB_MIN_POWER_ON_DELAY));
+	/*
+	 * Wait for power to become stable,
+	 * plus spec-defined max time for device to connect
+	 */
+	mdelay(pgood_delay + CONFIG_USB_HUB_MIN_POWER_ON_DELAY);
 }
 
 void usb_hub_reset(void)
-- 
1.8.1.5

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

end of thread, other threads:[~2014-06-03 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19 20:21 [U-Boot] [PATCH 1/2] usb: hub: fix power good delay timing Stephen Warren
2014-05-19 20:21 ` [U-Boot] [PATCH 2/2] usb: hub: remove CONFIG_USB_HUB_MIN_POWER_ON_DELAY Stephen Warren
2014-06-03 16:17   ` Tim Harvey
2014-06-03 16:38     ` Stephen Warren
2014-06-03 17:38       ` Marek Vasut
2014-06-03 18:11       ` Tim Harvey
2014-05-29 21:25 ` [U-Boot] [PATCH 1/2] usb: hub: fix power good delay timing Stephen Warren
2014-06-01 17:20   ` Marek Vasut

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