usbotg: otg_set_mode() can only be called once

Christian Eggers ceggers at
Thu Aug 24 04:30:46 PDT 2023


1. Try to boot via fastboot (usb device)
2. Try to boot via usb drive (usb host)


barebox at i.MX6ULL:/ setenv otg.mode=host
imx-usb 2184000.usb at 2184000.of: USB EHCI 1.00
barebox at i.MX6ULL:/ setenv otg.mode=peripheral
Cannot set parameter otg.mode: Device or resource busy


The otgdev core maintains one `struct otg_mode` per device.  The function
checks whether the current mode is equal to USB_DR_MODE_OTG.  If not, it
returns -EBUSY.  There is currently no way to reset the current mode back to
USB_DR_MODE_OTG after it has been set to peripheral or host mode once.

More information about the barebox mailing list