]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
USB: relax usbcore reset timings
authorWolfgang Grandegger <wg@denx.de>
Wed, 21 Dec 2011 00:01:09 +0000 (00:01 +0000)
committerWolfgang Denk <wd@denx.de>
Sat, 3 Mar 2012 15:56:35 +0000 (16:56 +0100)
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 <linux@bohmer.net>
CC: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Wolfgang Grandegger <wg@denx.de>
common/usb_hub.c

index 576e0e6a932eb68c719850bf4d4cc2d861370997..84d0d3f9c1881933a5acb7bd8caa631625f8684f 100644 (file)
@@ -109,6 +109,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 */
@@ -116,8 +117,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)