summaryrefslogtreecommitdiff
path: root/common/usb.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-08-01 03:09:53 +0200
committerMarek Vasut <marex@denx.de>2014-08-29 11:27:42 +0200
commit97b9eb9e6a2f2cc4c79fe6c0ad7cd3bc7dbe3457 (patch)
treea65073440b99a5fc5bb5d51c39b5c7cbe2837801 /common/usb.c
parent124c5998755ef6778ca43acab27372fc470b8366 (diff)
usb: Handle -ENODEV from usb_lowlevel_init()
As we support both Host and Device mode operation, an OTG controller can return -ENODEV on a port which it found to be in Device mode during Host mode scan for devices. In case -ENODEV is returned, print that the port is not available and continue instead of screaming a bloody error message. Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'common/usb.c')
-rw-r--r--common/usb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/usb.c b/common/usb.c
index 60daa100522..bd0f8d5d180 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -34,7 +34,7 @@
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <compiler.h>
-
+#include <errno.h>
#include <usb.h>
#ifdef CONFIG_4xx
#include <asm/4xx_pci.h>
@@ -60,6 +60,7 @@ int usb_init(void)
void *ctrl;
struct usb_device *dev;
int i, start_index = 0;
+ int ret;
dev_index = 0;
asynch_allowed = 1;
@@ -75,7 +76,13 @@ int usb_init(void)
for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
/* init low_level USB */
printf("USB%d: ", i);
- if (usb_lowlevel_init(i, USB_INIT_HOST, &ctrl)) {
+ ret = usb_lowlevel_init(i, USB_INIT_HOST, &ctrl);
+ if (ret == -ENODEV) { /* No such device. */
+ puts("Port not available.\n");
+ continue;
+ }
+
+ if (ret) { /* Other error. */
puts("lowlevel init failed\n");
continue;
}