X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_usb.c;h=6bdbbc5c05286e765abd1a901ef675499926d4ca;hb=9aa1280a5644a1d05859b862ebc7b60a862e0ef3;hp=ca06826901feb9d1a5d2e044fcb55115bf66044b;hpb=c27b329054a42bcfb19d3b192dc44e1182fea264;p=u-boot diff --git a/common/cmd_usb.c b/common/cmd_usb.c index ca06826901..6bdbbc5c05 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -22,8 +23,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) */ @@ -532,8 +533,14 @@ static void do_usb_start(void) #endif #endif #ifdef CONFIG_USB_HOST_ETHER +# ifdef CONFIG_DM_ETH +# ifndef CONFIG_DM_USB +# error "You must use CONFIG_DM_USB if you want to use CONFIG_USB_HOST_ETHER with CONFIG_DM_ETH" +# endif +# else /* 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(); @@ -630,12 +637,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); } }