mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
dm: usb: Do not assume that first child is always a hub
On some single port (otg) controllers there is no emulated root hub, so the first child (if any) may be one of: UCLASS_MASS_STORAGE, UCLASS_USB_DEV_GENERIC or UCLASS_USB_HUB. All three of these (and in the future others) are suitable for our purposes, remove the check for the device being a hub, and add a check to deal with the fact that there may be no child-dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
b2f219b081
commit
fd1bd21bf0
@@ -303,14 +303,14 @@ static struct usb_device *find_child_devnum(struct udevice *parent, int devnum)
|
||||
|
||||
struct usb_device *usb_get_dev_index(struct udevice *bus, int index)
|
||||
{
|
||||
struct udevice *hub;
|
||||
struct udevice *dev;
|
||||
int devnum = index + 1; /* Addresses are allocated from 1 on USB */
|
||||
|
||||
device_find_first_child(bus, &hub);
|
||||
if (device_get_uclass_id(hub) == UCLASS_USB_HUB)
|
||||
return find_child_devnum(hub, devnum);
|
||||
device_find_first_child(bus, &dev);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
return find_child_devnum(dev, devnum);
|
||||
}
|
||||
|
||||
int usb_post_bind(struct udevice *dev)
|
||||
|
Reference in New Issue
Block a user