summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-06-17 21:33:53 +0200
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:36 -0600
commitfd1bd21bf07d0770bff7b477d501b706dac9987d (patch)
tree445fde217c90b8eb340f8a4599bf2947e544920e /common
parentb2f219b081de964583a5621bc59d43eb75521598 (diff)
downloadu-boot-imx-fd1bd21bf07d0770bff7b477d501b706dac9987d.zip
u-boot-imx-fd1bd21bf07d0770bff7b477d501b706dac9987d.tar.gz
u-boot-imx-fd1bd21bf07d0770bff7b477d501b706dac9987d.tar.bz2
dm: usb: Do not assume that first child is always a hub
On some single port (otg) controllers there is no emulated root hub, so the first child (if any) may be one of: UCLASS_MASS_STORAGE, UCLASS_USB_DEV_GENERIC or UCLASS_USB_HUB. All three of these (and in the future others) are suitable for our purposes, remove the check for the device being a hub, and add a check to deal with the fact that there may be no child-dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_usb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index ca06826..2ed4cb4 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -630,12 +630,11 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
bus;
uclass_next_device(&bus)) {
struct usb_device *udev;
- struct udevice *hub;
+ struct udevice *dev;
- device_find_first_child(bus, &hub);
- if (device_get_uclass_id(hub) == UCLASS_USB_HUB &&
- device_active(hub)) {
- udev = dev_get_parentdata(hub);
+ device_find_first_child(bus, &dev);
+ if (dev && device_active(dev)) {
+ udev = dev_get_parentdata(dev);
usb_show_tree(udev);
}
}