diff options
Diffstat (limited to 'common/cmd_usb.c')
-rw-r--r-- | common/cmd_usb.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/common/cmd_usb.c b/common/cmd_usb.c index eab55cd674..0ade7759f0 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -22,8 +22,8 @@ #ifdef CONFIG_USB_STORAGE static int usb_stor_curr_dev = -1; /* current device */ #endif -#ifdef CONFIG_USB_HOST_ETHER -static int usb_ether_curr_dev = -1; /* current ethernet device */ +#if defined(CONFIG_USB_HOST_ETHER) && !defined(CONFIG_DM_ETH) +static int __maybe_unused usb_ether_curr_dev = -1; /* current ethernet device */ #endif /* some display routines (info command) */ @@ -355,12 +355,12 @@ static void usb_show_tree_graph(struct usb_device *dev, char *pre) #endif /* check if we are the last one */ #ifdef CONFIG_DM_USB - last_child = device_is_last_sibling(dev->dev); + /* Not the root of the usb tree? */ + if (device_get_uclass_id(dev->dev->parent) != UCLASS_USB) { + last_child = device_is_last_sibling(dev->dev); #else - last_child = (dev->parent != NULL); -#endif - if (last_child) { -#ifndef CONFIG_DM_USB + if (dev->parent != NULL) { /* not root? */ + last_child = 1; for (i = 0; i < dev->parent->maxchild; i++) { /* search for children */ if (dev->parent->children[i] == dev) { @@ -530,11 +530,14 @@ static void do_usb_start(void) /* try to recognize storage devices immediately */ usb_stor_curr_dev = usb_stor_scan(1); #endif -#endif #ifdef CONFIG_USB_HOST_ETHER +# ifdef CONFIG_DM_ETH +# error "You must use CONFIG_DM_USB if you want to use CONFIG_USB_HOST_ETHER with CONFIG_DM_ETH" +# endif /* try to recognize ethernet devices immediately */ usb_ether_curr_dev = usb_host_eth_scan(1); #endif +#endif #ifdef CONFIG_USB_KEYBOARD drv_usb_kbd_init(); #endif @@ -630,12 +633,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); } } |