From: Tim Harvey Date: Mon, 6 Apr 2015 07:05:07 -0700 Subject: [U-Boot] [PATCH] usb: hub: allow pgood_delay to be specified via env Message-ID: <1428329107-2294-1-git-send-email-tharvey@gateworks.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Some USB devices break the spec and require longer warm-up times. Allow the usb_pgood_delay env variable to override the calculated time. I have encountered this specficically with several different sized/branded USB sticks with VID:PID 058f:6387 (Alcor Micro Corp. Transcend JetFlash) where I need to set usb_pgood_delay to 2000ms to make them detectable. Signed-off-by: Tim Harvey --- common/usb_hub.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/usb_hub.c b/common/usb_hub.c index 66b4a72..a0ef058 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -86,6 +86,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub) int i; struct usb_device *dev; unsigned pgood_delay = hub->desc.bPwrOn2PwrGood * 2; + const char *env; dev = hub->pusb_dev; @@ -98,7 +99,13 @@ static void usb_hub_power_on(struct usb_hub_device *hub) /* * Wait for power to become stable, * plus spec-defined max time for device to connect + * but allow this time to be increased via env variable as some + * devices break the spec and require longer warm-up times */ + env = getenv("usb_pgood_delay"); + if (env) + pgood_delay = max(pgood_delay, simple_strtol(env, NULL, 0)); + debug("pgood_delay=%dms\n", pgood_delay); mdelay(pgood_delay + 1000); } -- 1.9.1