[U-Boot] USB Ethernet with device model

Vignesh R vigneshr at ti.com
Mon Sep 11 05:28:19 UTC 2017


Hi,

Removing mugunthanvnm at ti.com, who is no longer working for TI.

On Wednesday 06 September 2017 02:02 AM, Maxime Ripard wrote:
> Hi,
> 
> I've been working with USB-Ethernet gadget for quite some time on the
> Allwinner SoCs, especially because most Allwinner boards lack an
> ethernet controller.
> 
> The thing is, it wasn't really upstreamable all this time since we've
> had also some boards that had a controller with DM_ETH. And usb_ether
> didn't have DM_ETH support until recently.
> 
> So I gave it a shot, and encountered a few weird things that prevented
> it from working (and still do):
> 
> 1) I converted our musb glue to support the DM even in the peripheral
>    mode. Here is the code: http://code.bulix.org/m846ni-194479
> 
>    It almost works, except that usb_scan_bus in usb-uclass.c for some
>    reason unknown to me tries to scan the peripheral device, and
>    fails. Skipping that scan makes fastboot works, so I guess the
>    peripheral is working. Is there any particular reason that the
>    DM_USB code tries to scan even peripheral devices ?
> 
> 2) I can't manage to get usb_ether to probe after that, using the
>    DM. It seems that we need to call usb_ether_init, and that it looks
>    for UCLASS_USB_DEV_GENERIC devices and binds the usb_ether gadget
>    to it.
> 
>    However, every board or arch hooks I tried seems to be much earlier
>    than the USB controller, leading to the binding failing since we
>    don't have a controller to bind to yet.
> 

am33xx probes MISC devices in arch_misc_init()
(arch/arm/mach-omap2/am33xx/board.c)

>    Adding that code right after the USB controller initialisation in
>    the musb probe solves that issue, but for some other reason, it
>    looks for a device of the USB_DEV_GENERIC uclass, while the uclass
>    for the USB controllers seems to be USB. Actually, I don't seem to
>    find any user of the USB_DEV_GENERIC uclass but the usb_ether
>    driver, so I'm not really sure how it's supposed to work either...
> 

Sorry, DM based eth gadget support is still missing for am33xx. This
patch in particular was asked to be reworked:
https://patchwork.ozlabs.org/patch/696033/

> Is there some user of this in U-Boot right now? the only call there is
> to usb_ether_init seems to be for the am33xx SoCs, whose usb glue
> don't register a peripheral controller (yet), so I don't really know
> how that can work either.
> 

Last time I tried to upstream dwc3 usb ethernet gaget and rndis boot
support, Lukasz Majewski had ideas to move towards adding DM
infrastructure for USB gadget:
https://patchwork.ozlabs.org/patch/775110/



-- 
Regards
Vignesh


More information about the U-Boot mailing list