From patchwork Wed Dec 21 10:01:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Grandegger X-Patchwork-Id: 132609 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 A9E83B711B for ; Wed, 21 Dec 2011 21:01:22 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 93AAE280F0; Wed, 21 Dec 2011 11:01:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 zyGAgA0T08L7; Wed, 21 Dec 2011 11:01:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8DA18280D8; Wed, 21 Dec 2011 11:01:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 132B6280D8 for ; Wed, 21 Dec 2011 11:01:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 zEJgXEn-tz-N for ; Wed, 21 Dec 2011 11:01:13 +0100 (CET) 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 ngcobalt02.manitu.net (ngcobalt02.manitu.net [217.11.48.102]) by theia.denx.de (Postfix) with ESMTP id 145DC28093 for ; Wed, 21 Dec 2011 11:01:11 +0100 (CET) Received: from [10.0.30.2] (p4FD63BA5.dip.t-dialin.net [79.214.59.165]) (authenticated as wg with PLAIN) by ngcobalt02.manitu.net (8.10.2/8.10.2) with ESMTP id pBLA1Bg26484; Wed, 21 Dec 2011 11:01:12 +0100 X-manitu-Original-Sender-IP: 79.214.59.165 X-manitu-Original-Receiver-Name: ngcobalt02.manitu.net Message-ID: <4EF1AE65.2070208@grandegger.com> Date: Wed, 21 Dec 2011 11:01:09 +0100 From: Wolfgang Grandegger User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: u-boot X-Enigmail-Version: 1.1.1 Cc: Vincent Palatin Subject: [U-Boot] [PATCH] USB: relax usbcore reset timings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Wolfgang Grandegger Following the corresponding Linux code, this patch relaxes reset timings waiting at least 100ms after power to the ports. There are some reports that it helps make enumeration work better on some high speed devices. Furthermore, the wait is only done once after power has been enabled on all ports. CC: Remy Bohmer CC: Vincent Palatin Signed-off-by: Wolfgang Grandegger --- common/usb.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/common/usb.c b/common/usb.c index 63a11c8..d13dab8 100644 --- a/common/usb.c +++ b/common/usb.c @@ -1035,6 +1035,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; dev = hub->pusb_dev; /* Enable power to the ports */ @@ -1042,8 +1043,10 @@ static void usb_hub_power_on(struct usb_hub_device *hub) for (i = 0; i < dev->maxchild; i++) { usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status); - wait_ms(hub->desc.bPwrOn2PwrGood * 2); } + + /* Wait at least 100 msec for power to become stable */ + wait_ms(max(pgood_delay, (unsigned)100)); } void usb_hub_reset(void)