Bind/unbind a gadget function driver to a USB gadget device doesn't work with class index, while using node path is ok. For example:
U-Boot> dm tree Class Index Probed Driver Name ----------------------------------------------------------- root 0 [ + ] root_driver root_driver simple_bus 0 [ + ] simple_bus |-- ahb simple_bus 1 [ + ] simple_bus | |-- apb ... usb 0 [ ] atmel_usba_udc | | |-- gadget@f803c000 U-Boot> bind usb 0 usb_ether Cannot find device 0 of class usb Both USB host uclass and USB gadget uclass are using the same name "usb" while they are under different class id of UCLASS_USB and UCLASS_USB_GADGET_GENERIC. bind_by_class_index() of cmd/bind.c uses uclass_get_by_name() to find class id, since both class have the same name it will get the id of UCLASS_USB instead since it is at the front of the uclass id list. Then uclass_find_device() will try to find the wrong device and fail. But fixing this issue simply by renaming gadget uclass name will break the DT alias feature DM_UC_FLAG_SEQ_ALIAS. Any idea how to fix it ? Like adding a name_seq_alias field to uclass_driver structure ?