[U-Boot] Starting u-boot in USB otg mode

Hello u-booters!
I want to load u-boot-sunxi-with-spl.bin and make it operate the USB in otg mode. (Where the host can still be connected to the board).
How can I achieve this?
(I have attempted to use: "usb0:dr_mode=otg,phy_type=utmi\0" without success).
Thank you,
Michael

Hi Michael,
There is no 'otg_mode' in U-Boot, the driver framework is different with kernel.
If you want to use usb device, you can use cmd like this:
ums 0 mmc 0
If you want to use usb host, you can use:
usb start
this command will enumerate all the device connect to the host port.
But there no support for work as host or device which depends on what's the usb id pin in the cable.
Thanks, - Kever On 09/06/2017 05:56 PM, rivael_il wrote:
Hello u-booters!
I want to load u-boot-sunxi-with-spl.bin and make it operate the USB in otg mode. (Where the host can still be connected to the board).
How can I achieve this?
(I have attempted to use: "usb0:dr_mode=otg,phy_type=utmi\0" without success).
Thank you,
Michael
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hello Kever Yang,
Thank you for your prompt response.
This is an important feature, as 'otg' mode allow the board to stay responsive to the computer driving it. Especially sunxi-fel and ttyusb.
I might be interested in implementing it in u-boot. How can I do that? What is the code size consequences here?
Thank you,
Michael

Hi,
On Thu, Sep 07, 2017 at 12:05:20PM +0300, rivael_il wrote:
Hello Kever Yang,
Thank you for your prompt response.
This is an important feature, as 'otg' mode allow the board to stay responsive to the computer driving it. Especially sunxi-fel and ttyusb.
Both are peripheral-only features, not OTG. OTG is about switching from peripheral to host based on the ID-pin, and this what is not supported in U-Boot.
However, peripheral is, and it's already supported for the Allwinner SoCs. We use it for things like fastboot. I'm not sure what this has to do with fel though.
Maxime

Hello Maxime!
Thank you for your answer. How can I set "peripheral" mode on the USB in u-boot?
Thank you,
Michael

On Thu, Sep 07, 2017 at 01:23:32PM +0300, rivael_il wrote:
Hello Maxime!
Thank you for your answer. How can I set "peripheral" mode on the USB in u-boot?
Enable CONFIG_USB_MUSB_GADGET instead of HOST.
Maxime

Thank you Maxime!
I have removed the USB_HOST configuration. Now I get:
LD u-boot drivers/usb/host/built-in.o: In function `ehci_usb_remove': /home/pi/otg/mikboot/u-boot/drivers/usb/host/ehci-sunxi.c:78: undefined reference to `ehci_deregister' drivers/usb/host/built-in.o: In function `ehci_usb_probe': /home/pi/otg/mikboot/u-boot/drivers/usb/host/ehci-sunxi.c:69: undefined reference to `ehci_register' drivers/usb/host/built-in.o:(.u_boot_list_2_driver_2_ehci_sunxi+0x3c): undefined reference to `ehci_usb_ops' arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Raspbian) 2.25 assertion fail ../../bfd/elf32-arm.c:7827 arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Raspbian) 2.25 assertion fail ../../bfd/elf32-arm.c:7827 arm-linux-gnueabihf-ld.bfd: error: required section '.rel.plt' not found in the linker script arm-linux-gnueabihf-ld.bfd: final link failed: Invalid operation Makefile:1255: recipe for target 'u-boot' failed make: *** [u-boot] Error 1
Here is my .config USB reference: --------------------------------- CONFIG_INITIAL_USB_SCAN_DELAY=0 CONFIG_USB0_VBUS_PIN="" CONFIG_USB0_VBUS_DET="" CONFIG_USB0_ID_DET="" CONFIG_USB1_VBUS_PIN="" CONFIG_USB2_VBUS_PIN="" CONFIG_USB3_VBUS_PIN="" # CONFIG_SPL_MUSB_NEW_SUPPORT is not set # CONFIG_SPL_USB_HOST_SUPPORT is not set # CONFIG_SPL_USB_GADGET_SUPPORT is not set CONFIG_CMD_USB=y # CONFIG_CMD_USB_MASS_STORAGE is not set CONFIG_USB=y CONFIG_DM_USB=y # USB Host Controller Drivers # CONFIG_USB_XHCI_HCD is not set # CONFIG_USB_EHCI_HCD is not set # CONFIG_USB_OHCI_HCD is not set # CONFIG_USB_UHCI_HCD is not set # CONFIG_USB_DWC2 is not set # CONFIG_USB_DWC3 is not set # MUSB Controller Driver # CONFIG_USB_MUSB_HOST is not set CONFIG_USB_MUSB_GADGET=y # CONFIG_USB_MUSB_TI is not set CONFIG_USB_MUSB_SUNXI=y # USB peripherals CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_ATMEL_USBA is not set # CONFIG_USB_GADGET_BCM_UDC_OTG_PHY is not set # CONFIG_USB_GADGET_DWC2_OTG is not set CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_DUALSPEED=y # CONFIG_USB_GADGET_DOWNLOAD is not set # USB to Ethernet Controller Drivers # CONFIG_USB_ETHER_LAN75XX is not set # CONFIG_USB_ETHER_LAN78XX is not set
Can you tell me how to fix this?
Michael

On Fri, Sep 08, 2017 at 03:38:42PM +0300, rivael_il wrote:
Thank you Maxime!
I have removed the USB_HOST configuration. Now I get:
LD u-boot drivers/usb/host/built-in.o: In function `ehci_usb_remove': /home/pi/otg/mikboot/u-boot/drivers/usb/host/ehci-sunxi.c:78: undefined reference to `ehci_deregister' drivers/usb/host/built-in.o: In function `ehci_usb_probe': /home/pi/otg/mikboot/u-boot/drivers/usb/host/ehci-sunxi.c:69: undefined reference to `ehci_register' drivers/usb/host/built-in.o:(.u_boot_list_2_driver_2_ehci_sunxi+0x3c): undefined reference to `ehci_usb_ops' arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Raspbian) 2.25 assertion fail ../../bfd/elf32-arm.c:7827 arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Raspbian) 2.25 assertion fail ../../bfd/elf32-arm.c:7827 arm-linux-gnueabihf-ld.bfd: error: required section '.rel.plt' not found in the linker script arm-linux-gnueabihf-ld.bfd: final link failed: Invalid operation Makefile:1255: recipe for target 'u-boot' failed make: *** [u-boot] Error 1
You should keep USB_HOST.
Maxime

It got compiled. But the u-boot-sunxi-with-spl.bin still generate HOST controller rather than Peripheral USB. I can't see it in lsusb.
Here is the u-boot console:
=> usb stop stopping USB.. => usb tree USB is stopped. Please issue 'usb start' first. => usb start starting USB... USB0: USB EHCI 1.00 USB1: USB OHCI 1.0 USB2: USB EHCI 1.00 USB3: USB OHCI 1.0 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found => usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA) u-boot EHCI Host Controller
=> U-Boot SPL 2017.09-rc2-00168-g90ae53c-dirty (Sep 08 2017 - 11:26:35) DRAM: 1024 MiB

On Fri, Sep 08, 2017 at 04:45:31PM +0300, rivael_il wrote:
It got compiled. But the u-boot-sunxi-with-spl.bin still generate HOST controller rather than Peripheral USB. I can't see it in lsusb.
Here is the u-boot console:
=> usb stop stopping USB.. => usb tree USB is stopped. Please issue 'usb start' first. => usb start starting USB... USB0: USB EHCI 1.00 USB1: USB OHCI 1.0 USB2: USB EHCI 1.00 USB3: USB OHCI 1.0 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found => usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA) u-boot EHCI Host Controller
Those are all host only commands. What are you trying to do, and which gadgets are you trying to use?
Maxime

Maxime Ripard wrote
On Thu, Sep 07, 2017 at 01:23:32PM +0300, rivael_il wrote:
Hello Maxime!
Thank you for your answer. How can I set "peripheral" mode on the USB in u-boot?
Enable CONFIG_USB_MUSB_GADGET instead of HOST.
Maxime
In which file should this be done? I need this for enabling the fastboot feature in u-boot itself, what are the next steps after this?
-- Sent from: http://u-boot.10912.n7.nabble.com/

Maxime Ripard wrote
Both are peripheral-only features, not OTG. OTG is about switching from peripheral to host based on the ID-pin, and this what is not supported in U-Boot.
However, peripheral is, and it's already supported for the Allwinner SoCs. We use it for things like fastboot. I'm not sure what this has to do with fel though.
Maxime
It would be really helpful if you could guide me to enable the fastboot feature in u-boot for linux & NOT android.
-- Sent from: http://u-boot.10912.n7.nabble.com/
participants (5)
-
'Maxime Ripard'
-
Kever Yang
-
Maxime Ripard
-
mRbinG
-
rivael_il