[U-Boot] i.MX6Q USB OTG Gadget and Fastboot?

Adam Ford aford173 at gmail.com
Sat Jul 1 03:13:01 UTC 2017


On Fri, Jun 30, 2017 at 4:39 PM, Adam Ford <aford173 at gmail.com> wrote:
> I am trying to add in Android Fastboot to my i.MX6Q.
>
> I am using DM_USB to enable the USB through the device tree.  This
> device tree works in Linux, so I am assumming I've missed some
> configuration somewhere:
>
> I've added the following the defconfig file:
>
> +CONFIG_CMD_USB=y
> +CONFIG_DM_USB=y
> +CONFIG_USB=y
> +CONFIG_USB_STORAGE=y
> +CONFIG_USB_GADGET=y
> +CONFIG_CI_UDC=y
> +CONFIG_USB_GADGET_DOWNLOAD=y
> +CONFIG_G_DNL_MANUFACTURER="FSL"
> +CONFIG_G_DNL_VENDOR_NUM=0x0525
> +CONFIG_G_DNL_PRODUCT_NUM=0xa4a5
>
> Based on stuff I found in imx6q sabresd, I have also added the
> following to my configs header file:
>
> +/* USB Configs */
> +#ifdef CONFIG_CMD_USB
> +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
> +#define CONFIG_USB_HOST_ETHER
> +#define CONFIG_USB_ETHER_ASIX

It appears as if CONFIG_USB_HOST_ETHER and CONFIG_USB_ETHER_ASIX
are the problem along with CONFIG_DM_USB.

Looking at the code, the #ifdef implies the DM_USB works, but
apparently not in this case.
I get that there might be some conflicts with the USB ETHER stuff, but
does anyone have any ideas what might be wrong with DM_USB?

I had to manually setup the pin-muxing and initialization.  This is
consistent with some of the Freescale boards, but I was hoping to
reduce the some of that initialization code.

adam

> +#define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
> +#define CONFIG_MXC_USB_FLAGS            0
> +#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 /* Enabled USB controller number */
> +#endif
> +
> +#ifndef CONFIG_SPL
> +#define CONFIG_USBD_HS
> +#define CONFIG_USB_FUNCTION_MASS_STORAGE
> +#define CONFIG_USB_FUNCTION_FASTBOOT
> +#define CONFIG_CMD_FASTBOOT
> +#define CONFIG_ANDROID_BOOT_IMAGE
> +#define CONFIG_FASTBOOT_BUF_ADDR   CONFIG_SYS_LOAD_ADDR
> +#define CONFIG_FASTBOOT_BUF_SIZE   0x07000000
> +#endif
>
>
> I can start the USB system and it appears to find 2 USB controllers.
> I have the OTG and USB H1 enabled in my device tree.
>
> When I start the board, the USB log on my host Ubuntu PC shows:
> [26450.012906] usb 3-2: new high-speed USB device number 37 using xhci_hcd
> [26455.176596] usb 3-2: device descriptor read/64, error -110
>
> But it doesn't appear to be working correctly.
>
> i.MX6 Logic # usb start
> starting USB...
> USB0:   USB1:   USB EHCI 1.00
> scanning bus 0 for devices... 1 USB Device(s) found
> scanning bus 1 for devices... 1 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
> i.MX6 Logic #
>
> USB Info seems to show the same controller twice:
>
> i.MX6 Logic # usb info
> 1: Hub,  USB Revision 2.0
>  - u-boot EHCI Host Controller
>  - Class: Hub
>  - PacketSize: 64  Configurations: 1
>  - Vendor: 0x0000  Product 0x0000 Version 1.0
>    Configuration: 1
>    - Interfaces: 1 Self Powered 0mA
>      Interface: 0
>      - Alternate Setting 0, Endpoints: 1
>      - Class Hub
>      - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms
>
> 1: Hub,  USB Revision 2.0
>  - u-boot EHCI Host Controller
>  - Class: Hub
>  - PacketSize: 64  Configurations: 1
>  - Vendor: 0x0000  Product 0x0000 Version 1.0
>    Configuration: 1
>    - Interfaces: 1 Self Powered 0mA
>      Interface: 0
>      - Alternate Setting 0, Endpoints: 1
>      - Class Hub
>      - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms
>
> And the Ubuntu Host machine shows more errors:
> [26507.789535] xhci_hcd 0000:00:14.0: Timeout while waiting for setup
> device command
> [26513.165249] xhci_hcd 0000:00:14.0: Timeout while waiting for setup
> device command
> [26513.373225] usb 3-2: device not accepting address 40, error -62
> [26513.373252] usb usb3-port2: unable to enumerate USB device
>
> I am wondering if I need to do something special to initialize the OTG
> controller beyond DM_USB.  I am guessing that once I get the gadget
> working, the Fastboot would follow.
>
> My endgame is to use the Fastboot gadget to load the Android images,
> so attempted to run Fastboot from U-boot:
>
> i.MX6 Logic # fastboot USB0
> g_dnl_register: failed!, error: -19
> exit not allowed from main input shell.
> i.MX6 Logic #
>
> Maybe I am not using the correct syntax, but if I fun fastboot by
> itself, it requests a USB bus.
>
> Does anyone have any suggestions?
> adam


More information about the U-Boot mailing list