X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fusb.c;h=32e15cd8ddb93320c5758635268daac68e7196f7;hb=51f4999bc5ad5f8430da0297d12c1abef9c05568;hp=7d33a0f086915d6cf99169a328b2a4de783138a1;hpb=6393c43c18a1aadcdcdd8551826eef15f50353d5;p=u-boot diff --git a/common/usb.c b/common/usb.c index 7d33a0f086..32e15cd8dd 100644 --- a/common/usb.c +++ b/common/usb.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #ifdef CONFIG_4xx @@ -60,6 +59,7 @@ int usb_init(void) void *ctrl; struct usb_device *dev; int i, start_index = 0; + int controllers_initialized = 0; int ret; dev_index = 0; @@ -79,6 +79,7 @@ int usb_init(void) ret = usb_lowlevel_init(i, USB_INIT_HOST, &ctrl); if (ret == -ENODEV) { /* No such device. */ puts("Port not available.\n"); + controllers_initialized++; continue; } @@ -90,6 +91,7 @@ int usb_init(void) * lowlevel init is OK, now scan the bus for devices * i.e. search HUBs and configure them */ + controllers_initialized++; start_index = dev_index; printf("scanning bus %d for devices... ", i); dev = usb_alloc_new_device(ctrl); @@ -111,12 +113,10 @@ int usb_init(void) debug("scan end\n"); /* if we were not able to find at least one working bus, bail out */ - if (!usb_started) { + if (controllers_initialized == 0) puts("USB error: all controllers failed lowlevel init\n"); - return -1; - } - return 0; + return usb_started ? 0 : -1; } /****************************************************************************** @@ -970,6 +970,8 @@ int usb_new_device(struct usb_device *dev) printf("\n Couldn't reset port %i\n", dev->portnr); return 1; } + } else { + usb_reset_root_port(); } #endif