All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Zixun LI <admin@hifiphile.com>
Cc: Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>,
	Tom Rini <trini@konsulko.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH] usb: gadget: ether: Handle gadget driver registration in start and stop
Date: Tue, 20 Aug 2024 18:11:08 +0200	[thread overview]
Message-ID: <87le0ruqcj.fsf@baylibre.com> (raw)
In-Reply-To: <172301272563.244852.18199647448023901472.b4-ty@baylibre.com>

Hi Zixun,

On mer., août 07, 2024 at 08:38, Mattijs Korpershoek <mkorpershoek@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() ?


  reply	other threads:[~2024-08-20 16:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26  8:31 [PATCH] usb: gadget: ether: Handle gadget driver registration in start and stop Zixun LI
2024-08-06 14:00 ` Mattijs Korpershoek
2024-08-06 20:28   ` Zixun LI
2024-08-07  6:34     ` Mattijs Korpershoek
2024-08-07  6:38 ` Mattijs Korpershoek
2024-08-20 16:11   ` Mattijs Korpershoek [this message]
2024-08-20 17:11     ` Caleb Connolly
2024-08-20 17:12       ` Marek Vasut
2024-08-21 12:34         ` Mattijs Korpershoek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87le0ruqcj.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=admin@hifiphile.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.