usb: Use the first available device for ehci_gadget
PATCH 1/1 usb: Use the first available device for ehci_gadget
For whatever reason, usb_setup_ehci_gadget removes and probes USB device
0. However, not all systems have a device 0. Use the first device instead.
The device probed should probably have something to do with the controller (as specified by e.g. ums <controller> or fastboot <controller>). In fact, I find it odd that we probe the USB device in the first place, because this is just to set up the gadget itself. Presumably, the controller should be probed by usb_gadget_initialize somehow.
---
drivers/usb/host/usb-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/usb-uclass.c +2 -2
@@ -396,7 +396,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)int ret;/* Find the old device and remove it */ - ret =uclass_find_device_by_seq (UCLASS_USB ,0 , &dev); + ret =uclass_find_first_device (UCLASS_USB , &dev);if (ret)return ret; ret =device_remove (dev,DM_REMOVE_NORMAL );
@@ -419,7 +419,7 @@ int usb_remove_ehci_gadget(struct ehci_ctrl **ctlrp)int ret;/* Find the old device and remove it */ - ret =uclass_find_device_by_seq (UCLASS_USB ,0 , &dev); + ret =uclass_find_first_device (UCLASS_USB , &dev);if (ret)return ret; ret =device_remove (dev,DM_REMOVE_NORMAL );
Signature · 1 line
2.25.1
Quoted 12 lines · Sean Anderson
For whatever reason,
usb_setup_ehci_gadgetremoves and probes USB device
0. However, not all systems have a device 0. Use the first device instead.The device probed should probably have something to do with the controller (as specified by e.g. ums <controller> or fastboot <controller>). In fact, I find it odd that we probe the USB device in the first place, because this is just to set up the gadget itself. Presumably, the controller should be probed by
usb_gadget_initializesomehow.
Quoted 5 lines
Signed-off-by Sean Anderson <[email protected]>---
drivers/usb/host/usb-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Simon Glass
Reviewed-byQuoted 12 lines · Sean Anderson
For whatever reason,
usb_setup_ehci_gadgetremoves and probes USB device
0. However, not all systems have a device 0. Use the first device instead.The device probed should probably have something to do with the controller (as specified by e.g. ums <controller> or fastboot <controller>). In fact, I find it odd that we probe the USB device in the first place, because this is just to set up the gadget itself. Presumably, the controller should be probed by
usb_gadget_initializesomehow.
Quoted 5 lines
Signed-off-by Sean Anderson <[email protected]>---
drivers/usb/host/usb-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-dm, thanks!