[U-Boot,v9,3/5] usb: hub: make minimum power-on delay configurable

Message ID 1368602964-20687-4-git-send-email-dantesu@gmail.com
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Commit Message

Kuo-Jung Su May 15, 2013, 7:29 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

This patch makes the minimum power-on delay for USB HUB
become configurable. The original design waits at least
100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
are known to require much longer delay interval.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Marek Vasut <marex@denx.de>
Changes for v9:
   - Nothing updates

Changes for v8:
   - Nothing updates

Changes for v7:
   - Rebase to u-boot-bbd0f7e3ba66d288a2f146f1c7797801e04598ae

Changes for v6:
   - Simplify CONFIG_USB_HUB_MIN_POWER_ON_DELAY default value setup.

Changes for v5:
   - Split up from Faraday EHCI patch
   - Replace the Faraday EHCI ifdef for the long delay
     in usb_hub_configure() with the new configuration option:
     USB_HUB_MIN_POWER_ON_DELAY, which is used in usb_hub_power_on()
     to control the minimum usb hub power-on delay.

Changes for v2 - v4:
   - See 'usb: ehci: add Faraday USB 2.0 EHCI support'

 README           |    3 +++
 common/usb_hub.c |    8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)



diff --git a/README b/README
index defdedb..5bf4791 100644
--- a/README
+++ b/README
@@ -1245,6 +1245,9 @@  The following options need to be configured:
 		CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
 		txfilltuning field in the EHCI controller on reset.

+		CONFIG_USB_HUB_MIN_POWER_ON_DELAY defines the minimum
+		interval for usb hub power-on delay.(minimum 100msec)
 - USB Device:
 		Define the below if you wish to use the USB console.
 		Once firmware is rebuilt from a serial console issue the
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 0d79ec3..fc3a8c1 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -53,6 +53,10 @@ 
 #include <asm/4xx_pci.h>

 #define USB_BUFSIZ	512

 static struct usb_hub_device hub_dev[USB_MAX_HUB];
@@ -148,8 +152,8 @@  static void usb_hub_power_on(struct usb_hub_device *hub)
 		debug("port %d returns %lX\n", i + 1, dev->status);

-	/* Wait at least 100 msec for power to become stable */
-	mdelay(max(pgood_delay, (unsigned)100));
+	/* Wait for power to become stable */
+	mdelay(max(pgood_delay, CONFIG_USB_HUB_MIN_POWER_ON_DELAY));

 void usb_hub_reset(void)