diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-10 15:04:35 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-18 14:50:21 +0200 |
commit | 87b9bea20e922a46f661d69f7b5ae900159914f1 (patch) | |
tree | cd3b2eb1bf4427b319fd699c818f9ddac06a635f /drivers | |
parent | a7a3d9e1ae9283ee7c1aaba9a6b0ca80ebf77801 (diff) | |
download | barebox-87b9bea20e922a46f661d69f7b5ae900159914f1.tar.gz barebox-87b9bea20e922a46f661d69f7b5ae900159914f1.tar.xz |
USB: host: hub: Use usb_hub_power_on from U-Boot
U-Boots power good delay function is more conservative than
ours. Use it to be on the safe side. The U-Boot guys have
discussed a lot about it, let's hope they got it right.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/hub.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 6d5e3b97f8..9c87037888 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -70,16 +70,33 @@ 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: + * Here we Power-cycle the ports: aka, + * turning them off and turning on again. + */ + for (i = 0; i < dev->maxchild; i++) { + usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); + dev_dbg(&dev->dev, "port %d returns %lX\n", i + 1, dev->status); + } + + /* Wait at least 2 * bPwrOn2PwrGood for PP to change */ + mdelay(pgood_delay); + /* Enable power to the ports */ dev_dbg(&dev->dev, "enabling power on all ports\n"); + for (i = 0; i < dev->maxchild; i++) { usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); dev_dbg(&dev->dev, "port %d returns %lX\n", i + 1, dev->status); } + /* power on is encoded in 2ms increments -> times 2 for the actual delay */ - mdelay(hub->desc.bPwrOn2PwrGood*2); + mdelay(pgood_delay + 1000); } #define MAX_TRIES 5 |