Hi Zixun, On mer., août 07, 2024 at 08:38, Mattijs Korpershoek <mkorpersh...@baylibre.com> wrote:
> Hi, > > On Fri, 26 Jul 2024 10:31:00 +0200, Zixun LI wrote: >> Revert part of 718f1d41 to move >> usb_gadget_register_driver()/usb_gadget_unregister_driver() >> back to usb_eth_start()/usb_eth_stop(). >> >> usb_gadget_register_driver() will initialize the USB controller which >> enters ready to connect state with pull-up resistor enabled. >> >> [...] > > Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu > (u-boot-dfu) > > [1/1] usb: gadget: ether: Handle gadget driver registration in start and stop > > https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/d94c0ee1de89e2fbd3cc5bea6351dbaa9462c84f > > -- > Mattijs There has been some ongoing discussion on IRC about this patch: https://libera.irclog.whitequark.org/u-boot/2024-08-20 Marek, who has quite some knowledge about the USB stack in U-Boot (more than myself) suggested that using usb_ether_init() should not be used anymore. Instead, to enable usb ethernet, we should manually bind the UDC driver to the usb_ether gadget. For example, on Khadas VIM3 board, this can be done with: => bind /soc/usb@ffe09000/usb@ff400000 usb_ether Use "dm tree" to find the node path for your UDC. Then, I can enable Ethernet Gadget with: => setenv ethact usb_ether And only when using it, I will see enumerations: => dhcp [437548.488938] usb 1-1: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice=7e.8a [437548.488950] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [437548.488957] usb 1-1: Product: RNDIS/Ethernet Gadget [437548.488963] usb 1-1: Manufacturer: U-Boot [437548.634417] usbcore: registered new interface driver cdc_ether [437548.640519] rndis_host 1-1:2.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, de:ad:be:ef:00:00 [437548.640588] usbcore: registered new interface driver rndis_host [437548.694343] rndis_host 1-1:2.0 enp0s20f0u1c2: renamed from usb0 So, with this method, I can't reproduce the problem that this patch was initially try to solve. Could you please try using the bind method instead of the (deprecated) usb_ether_init() ?