From patchwork Wed Apr 8 19:21:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 459429 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BBCD71401E7 for ; Thu, 9 Apr 2015 05:21:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34943A7432; Wed, 8 Apr 2015 21:21:29 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id erVOMuv3SIrs; Wed, 8 Apr 2015 21:21:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B649BA7422; Wed, 8 Apr 2015 21:21:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7ACD0A7422 for ; Wed, 8 Apr 2015 21:21:26 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OuRwYpJMmcbf for ; Wed, 8 Apr 2015 21:21:26 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by theia.denx.de (Postfix) with ESMTPS id 098D3A7421 for ; Wed, 8 Apr 2015 21:21:23 +0200 (CEST) Received: by pdbqa5 with SMTP id qa5so68180348pdb.1 for ; Wed, 08 Apr 2015 12:21:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J+dGYkg1VQYER4esUM/3DtWb68okIdBQ6N8YHcBzRSc=; b=UVzFN39y+9gOBzQIs2BMdful9rYCJ55qBMYliOrGU7UJw4I93iaw6VZzb9L82wNeuN +2WdMkhnS4tsl5XGsPTe1AbDYMex/48gv6GvYbWswvzr7V5K0XAo3+gS1y120IN7eKj3 231ZM5Pkvcl2Mm8GaAVqyEbllEc7pq/vfHI78TfCtgsjVy7I7boVruL7X1LJZkOjFl2x QzFO4RpKBeXhHTkI1YK6TznfDpG8NLZ7xCU3/FBCY1z/40jBMMOYzC/c/n/FxzgrHKNg T1S8HnmzJ85Whjo7fEA4tRdl8HZwepx6GZEEL94kvjIBMLw/007vQlMybLCjvrtzeAr7 KPZA== X-Gm-Message-State: ALoCoQlSr+QQfn3uAI18rKgv4yDPArJ5KHBbocDMoJPC8VDMHWxG+8ZL5WPT9ql8/KTCxU04BuNX X-Received: by 10.70.118.100 with SMTP id kl4mr20561640pdb.19.1428520881650; Wed, 08 Apr 2015 12:21:21 -0700 (PDT) Received: from tharvey.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by mx.google.com with ESMTPSA id t5sm12084690pde.51.2015.04.08.12.21.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Apr 2015 12:21:21 -0700 (PDT) From: Tim Harvey To: Marek Vasut Date: Wed, 8 Apr 2015 12:21:12 -0700 Message-Id: <1428520872-5247-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: u-boot@lists.denx.de, Stephen Warren Subject: [U-Boot] [PATCH v2] usb: hub: allow pgood_delay to be specified via env X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some USB devices break the spec and require longer warm-up times. Allow the usb_pgood_delay env variable to override the calculated time. Signed-off-by: Tim Harvey --- v2: - added cast to fix compiler warning --- common/usb_hub.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/usb_hub.c b/common/usb_hub.c index 66b4a72..f54a404 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,14 @@ 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, + (unsigned)simple_strtol(env, NULL, 0)); + debug("pgood_delay=%dms\n", pgood_delay); mdelay(pgood_delay + 1000); }