[PATCH] usb: gadget: ether: Handle gadget driver registration in start and stop

Mattijs Korpershoek mkorpershoek at baylibre.com
Wed Aug 7 08:34:35 CEST 2024


Hi Zixun,

On mar., août 06, 2024 at 22:28, Zixun LI <admin at hifiphile.com> wrote:

> Hi Mattijs,
>
> On Tue, Aug 6, 2024 at 4:00 PM Mattijs Korpershoek
> <mkorpershoek at baylibre.com> wrote:
>>
>> I'd like to test this on my end as well. Could you please give some
>> details on how this has been tested?
>>
>> A sequence of U-Boot commands would be helpful, for example.
>
> My tests are done on a custom ATMEL SAM9G25 board powered
> by USB Gadget port.
>
> Gadget is enabled in the DT:
> &usb2 {
> status = "okay";
> };
>
> usb_ether enabled in board late init:
> int board_late_init(void)
> {
> #ifdef CONFIG_USB_ETHER
> usb_ether_init();
> #endif
> return 0;
> }
>
> Without this patch the host will try to enumerate the USB device once
>  U-Boot is loaded and result in the error I mentioned.

Thank you for the details. I could reproduce the issue on Khadas VIM3
board and I could also test that your patch fixes the issue.

Tested-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

>
> With this patch USB is connected only when ethernet command, like dhcp
> is run, then disconnect when it's finished:
> usb 1-1: new high-speed USB device number 91 using xhci_hcd
> usb 1-1: New USB device found, idVendor=0000, idProduct=0000, bcdDevice= 3.17
> usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> usb 1-1: Product: Ethernet Gadget
> usb 1-1: Manufacturer: U-Boot
> cdc_ether 1-1:1.0 usb0: register 'cdc_ether' at usb-0000:04:00.3-1,
> CDC Ethernet Device, de:ad:be:ef:00:00
> cdc_ether 1-1:1.0 enp4s0f3u1: renamed from usb0
> gadget0: port 1(enp4s0f3u1) entered blocking state
> gadget0: port 1(enp4s0f3u1) entered disabled state
> cdc_ether 1-1:1.0 enp4s0f3u1: entered allmulticast mode
> cdc_ether 1-1:1.0 enp4s0f3u1: entered promiscuous mode
> gadget0: port 1(enp4s0f3u1) entered blocking state
> gadget0: port 1(enp4s0f3u1) entered forwarding state
> usb 1-1: USB disconnect, device number 91


More information about the U-Boot mailing list