[U-Boot] changing of fastboot index

Hi Jean-Jacques,
After commit aec0081093e7 ("configs: am57xx_evm: Enable DM_USB and DM_USB_DEV") I noticed that "fastboot 1" command doesn't work anymore on BeagleBoard X15. Instead, "fastboot 0" works.
I can see that this happens because in dwc3_glue_bind() we only register usb@488d0000 as OTG controller ("dwc3-generic-peripheral"), and usb@48890000 is registered as HOST controller ("xhci-dwc3"). This leads for dwc3_glue_probe() to be only called once (for OTG controller), so now we only have registered controller with index = 0, when we are calling usb_gadget_initialize() from do_fastboot_usb().
The reason why I'm bringing this up is that we still have CONFIG_FASTBOOT_USB_DEV=1 for AM57x-based boards, and "fastboot reboot-bootloader" won't work, and all documentation needs to be changed.
In "help fastboot" output it only says that <controller> must be passed. Do we actually understand which controller is referred here? Frankly, I never thought about this before. Is it OTG controller number, or USB controller number? As I understand it, it should be USB controller index, so on X15 it actually should be "fastboot 1". But I can be mistaken :) Is this an intended behavior or should we fix it? If so, can you please help me here?
Thanks!

On 12/12/2018 21:52, Sam Protsenko wrote:
Hi Jean-Jacques,
After commit aec0081093e7 ("configs: am57xx_evm: Enable DM_USB and DM_USB_DEV") I noticed that "fastboot 1" command doesn't work anymore on BeagleBoard X15. Instead, "fastboot 0" works.
I can see that this happens because in dwc3_glue_bind() we only register usb@488d0000 as OTG controller ("dwc3-generic-peripheral"), and usb@48890000 is registered as HOST controller ("xhci-dwc3"). This leads for dwc3_glue_probe() to be only called once (for OTG controller), so now we only have registered controller with index = 0, when we are calling usb_gadget_initialize() from do_fastboot_usb().
The reason why I'm bringing this up is that we still have CONFIG_FASTBOOT_USB_DEV=1 for AM57x-based boards, and "fastboot reboot-bootloader" won't work, and all documentation needs to be changed.
Right. I understand why this may be a problem.
Currently with DM Gadget, the index is referring the index the UCLASS_USB_GADGET_GENERIC uclass list, not the USB port number.
If there is only 1 usb gadget port, then the index should be 0. Even if it is on physical port #1 and not port #0
I'll try to come up with something. I think it should be possible to achieve using aliases and the SEQ number.
JJ
In "help fastboot" output it only says that <controller> must be passed. Do we actually understand which controller is referred here? Frankly, I never thought about this before. Is it OTG controller number, or USB controller number? As I understand it, it should be USB controller index, so on X15 it actually should be "fastboot 1". But I can be mistaken :) Is this an intended behavior or should we fix it? If so, can you please help me here?
Thanks!
participants (2)
-
Jean-Jacques Hiblot
-
Sam Protsenko