[U-Boot] USB Ethernet with device model
Maxime Ripard
maxime.ripard at free-electrons.com
Tue Sep 5 20:32:54 UTC 2017
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.
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...
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.
Thanks!
Maxime
--
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/20170905/760e7e63/attachment.sig>
More information about the U-Boot
mailing list