diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-05-10 14:10:20 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-05-14 18:49:31 -0600 |
commit | b6de4d1093d3a30413da14c26767a9b0379924dc (patch) | |
tree | 9598966c89b00de6fd334e94a78de69853518c13 /drivers | |
parent | a24a0e91590bb7452ddf531b9ae0e93216bd1237 (diff) | |
download | u-boot-imx-b6de4d1093d3a30413da14c26767a9b0379924dc.zip u-boot-imx-b6de4d1093d3a30413da14c26767a9b0379924dc.tar.gz u-boot-imx-b6de4d1093d3a30413da14c26767a9b0379924dc.tar.bz2 |
dm: usb: Add support for companion controllers
USB companion controllers must be scanned after the main controller has
been scanned, so that any devices which the main controller which to hand
over to the companion have actually been handed over before we scan the
companion.
As there are no guarantees that this will magically happen in the right
order, split the scanning of the buses in 2 phases, first main controllers,
and then companion controllers.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/usb-uclass.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index ad778b4..749257c 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -171,6 +171,7 @@ static void usb_scan_bus(struct udevice *bus, bool recurse) int usb_init(void) { int controllers_initialized = 0; + struct usb_bus_priv *priv; struct udevice *bus; struct uclass *uc; int count = 0; @@ -198,15 +199,37 @@ int usb_init(void) printf("probe failed, error %d\n", ret); continue; } - /* - * lowlevel init is OK, now scan the bus for devices - * i.e. search HUBs and configure them - */ controllers_initialized++; - usb_scan_bus(bus, true); usb_started = true; } + /* + * lowlevel init done, now scan the bus for devices i.e. search HUBs + * and configure them, first scan primary controllers. + */ + uclass_foreach_dev(bus, uc) { + if (!device_active(bus)) + continue; + + priv = dev_get_uclass_priv(bus); + if (!priv->companion) + usb_scan_bus(bus, true); + } + + /* + * Now that the primary controllers have been scanned and have handed + * over any devices they do not understand to their companions, scan + * the companions. + */ + uclass_foreach_dev(bus, uc) { + if (!device_active(bus)) + continue; + + priv = dev_get_uclass_priv(bus); + if (priv->companion) + usb_scan_bus(bus, true); + } + debug("scan end\n"); /* if we were not able to find at least one working bus, bail out */ if (!count) |