Skip to contentSkip to conversation

Starting u-boot in USB otg mode

U-Boot rivael_il 4 participants 12 messages Sep 6, 2017 – Feb 27, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

rivael_il

author
#1 lore raw

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

#2 lore raw

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

Quoted 17 lines · rivael_il

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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#3 lore raw

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

#4 lore raw

Hi,

Quoted 7 lines · rivael_il

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

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170907/60c3775c/attachment.sig>
author
#5 lore raw

Hello Maxime!

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

Thank you,

Michael

#6 lore raw
Quoted 5 lines · rivael_il

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

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170907/543f502f/attachment.sig>
author
#7 lore raw

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

#8 lore raw
Quoted 14 lines · rivael_il

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

Quoted 8 lines

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

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170908/6b2888b1/attachment.sig>
author
#9 lore raw

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

#10 lore raw
Quoted 24 lines · rivael_il

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

Quoted 2 lines

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

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170908/d2992121/attachment.sig>
#11 lore raw
In reply to 'Maxime Ripard'

Maxime Ripard wrote

Quoted 10 lines · rivael_il
Quoted 5 lines

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/

#12 lore raw
In reply to Maxime Ripard

Maxime Ripard wrote

Quoted 9 lines

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/