X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fusb_hub.c;h=652a104361f63ee715a99e924ccd1145a2c66224;hb=d1b8c7a8b72fefa7d67dc42fbd20a9de147d8907;hp=7aac2201166300c2dab5a72a053c33ec408fab68;hpb=f3067c7c63bd6c2c2609c26ec2b2f3503cfd0a92;p=karo-tx-uboot.git diff --git a/common/usb_hub.c b/common/usb_hub.c index 7aac220116..652a104361 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -79,7 +79,7 @@ static int usb_get_hub_status(struct usb_device *dev, void *data) data, sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT); } -static int usb_get_port_status(struct usb_device *dev, int port, void *data) +int usb_get_port_status(struct usb_device *dev, int port, void *data) { return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port, @@ -271,7 +271,8 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port) /* Reset the port */ ret = legacy_hub_port_reset(dev, port, &portstatus); if (ret < 0) { - printf("cannot reset port %i!?\n", port + 1); + if (ret != -ENXIO) + printf("cannot reset port %i!?\n", port + 1); return ret; } @@ -488,11 +489,15 @@ static int usb_hub_configure(struct usb_device *dev) portstatus = le16_to_cpu(portsts->wPortStatus); portchange = le16_to_cpu(portsts->wPortChange); - if ((portchange & USB_PORT_STAT_C_CONNECTION) == - (portstatus & USB_PORT_STAT_CONNECTION)) + /* No connection change happened, wait a bit more. */ + if (!(portchange & USB_PORT_STAT_C_CONNECTION)) + continue; + + /* Test if the connection came up, and if so, exit. */ + if (portstatus & USB_PORT_STAT_CONNECTION) break; - } while (get_timer(start) < CONFIG_SYS_HZ * 10); + } while (get_timer(start) < CONFIG_SYS_HZ * 1); if (ret < 0) continue; @@ -651,6 +656,6 @@ static const struct usb_device_id hub_id_table[] = { { } /* Terminating entry */ }; -USB_DEVICE(usb_generic_hub, hub_id_table); +U_BOOT_USB_DEVICE(usb_generic_hub, hub_id_table); #endif