bind/unbind command not working for usb_ether

Patrice CHOTARD patrice.chotard at foss.st.com
Tue Feb 15 18:36:33 CET 2022


Hi Tim

On 2/15/22 17:09, Tim Harvey wrote:
> On Tue, Feb 15, 2022 at 5:29 AM Patrice CHOTARD
> <patrice.chotard at foss.st.com> wrote:
>>
>> Hi Tim
>>
>> On 2/10/22 18:04, Tim Harvey wrote:
>>> Greetings,
>>>
>>> I'm trying to understand how to use the U-Boot bind command to bind
>>> the usb_ether driver to the usb class to register a USB ethernet
>>> gadget network device as referenced in:
>>> commit 02291d83fdaaf ("doc: add bind/unbind command documentation")
>>> commit 49c752c93a78 ("cmd: Add bind/unbind commands to bind a device
>>> to a driver from the command line")
>>>
>>
>> For example, i made some trial on STM32MP1 platform:
>>
>> At boot, we got :
>>
>> STM32MP> dm tree
>>  Class     Index  Probed  Driver                Name
>> -----------------------------------------------------------
>>  root          0  [ + ]   root_driver           root_driver
>>  firmware      0  [   ]   psci                  |-- psci
>>  sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
>>  .....
>>  blk           0  [ + ]   mmc_blk               |   |   `-- mmc at 58005000.blk
>>  ethernet      0  [ + ]   eth_eqos              |   |-- ethernet at 5800a000
>>  eth_phy_ge    0  [ + ]   eth_phy_generic_drv   |   |   `-- ethernet-phy at 0
>>  usb           0  [   ]   ehci_generic          |   |-- usb at 5800d000
>>  video         0  [   ]   stm32_display         |   |-- display-controller at 5a001000
>>  .....
>>
>>
>> As you can see, there is already an ethernet interface used.
>> We unbind the ethernet interface before binding the usb_ether gadget to the usb class.
>> First unbind the generic ethernet phy (eth_phy_generic_drv) and the ethernet driver
>> (eth_eqos).
>>
>>
>> STM32MP> unbind eth_phy_generic 0
>> STM32MP> unbind ethernet 0
>> STM32MP> dm tree
>>  Class     Index  Probed  Driver                Name
>> -----------------------------------------------------------
>>  root          0  [ + ]   root_driver           root_driver
>>  firmware      0  [   ]   psci                  |-- psci
>>  sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
>> ....
>>  blk           0  [ + ]   mmc_blk               |   |   `-- mmc at 58005000.blk
>>  usb           0  [   ]   ehci_generic          |   |-- usb at 5800d000
>>  video         0  [   ]   stm32_display         |   |-- display-controller at 5a001000
>> ....
>>
>> Ethernet and phy driver are both unbinded.
>> Now we can bind the usb_eher to the usb class
>>
>> STM32MP> bind usb 0 usb_ether
>> STM32MP> dm tree
>>  Class     Index  Probed  Driver                Name
>> -----------------------------------------------------------
>>  root          0  [ + ]   root_driver           root_driver
>>  firmware      0  [   ]   psci                  |-- psci
>>  sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
>> ....
>>  blk           0  [ + ]   mmc_blk               |   |   `-- mmc at 58005000.blk
>>  usb           0  [   ]   ehci_generic          |   |-- usb at 5800d000
>>  ethernet      0  [   ]   usb_ether             |   |   `-- usb_ether
>>  video         0  [   ]   stm32_display         |   |-- display-controller at 5a001000
>> ....
>>
>> usb_ether is now binded.
>> As example, if you can then use some ethernet command as dhcp or ping :
>>
>> STM32MP> dhcp
>> using dwc2-udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep3in-int
>> MAC de:ad:be:ef:00:01
>> HOST MAC de:ad:be:ef:00:00
>> RNDIS ready
>> high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
>> USB RNDIS network up!
>> BOOTP broadcast 1
>>
>>> I have enabled:
>>> CONFIG_DM_USB=y
>>> CONFIG_USB_GADGET=y
>>> CONFIG_USB_ETHER=y
>>>
>> In my case i enabled also CONFIG_USB_ETH_RNDIS=y
>>
> 
> Patrice,
> 
> In my case when I try to bind to usb_ether the device can not be found
> (as it is never registered in the first place):
> Ventana > unbind ethernet 0
> Ventana > bind usb 0 usb_ether
> Cannot find device 0 of class usb

weird, because below, in the dm tree output, we can see :

>  usb           0  [   ]   ehci_mx6              |   |   |-- usb at 2184000
>  usb           1  [   ]   ehci_mx6              |   |   |-- usb at 2184200

so it should find a usb class device .....

Patrice

> Ventana > dm tree
>  Class     Index  Probed  Driver                Name
> -----------------------------------------------------------
>  root          0  [ + ]   root_driver           root_driver
>  thermal       0  [   ]   imx_thermal           |-- imx_thermal
>  simple_bus    0  [ + ]   simple_bus            |-- soc
>  pci           0  [   ]   imx_pcie              |   |-- pcie at 1ffc000
>  simple_bus    1  [ + ]   simple_bus            |   |-- bus at 2000000
>  simple_bus    2  [   ]   simple_bus            |   |   |-- spba-bus at 2000000
>  serial        0  [   ]   serial_mxc            |   |   |   `-- serial at 2020000
>  gpio          0  [ + ]   gpio_mxc              |   |   |-- gpio at 209c000
>  gpio          1  [ + ]   gpio_mxc              |   |   |-- gpio at 20a0000
>  gpio          2  [ + ]   gpio_mxc              |   |   |-- gpio at 20a4000
>  gpio          3  [ + ]   gpio_mxc              |   |   |-- gpio at 20a8000
>  gpio          4  [ + ]   gpio_mxc              |   |   |-- gpio at 20ac000
>  gpio          5  [   ]   gpio_mxc              |   |   |-- gpio at 20b0000
>  gpio          6  [   ]   gpio_mxc              |   |   |-- gpio at 20b4000
>  watchdog      0  [ + ]   imx_wdt               |   |   |-- wdog at 20bc000
>  simple_bus    3  [   ]   simple_bus            |   |   |-- anatop at 20c8000
>  simple_bus    4  [   ]   simple_bus            |   |   |-- snvs at 20cc000
>  simple_bus    5  [   ]   simple_bus            |   |   |-- iomuxc-gpr at 20e0000
>  pinctrl       0  [ + ]   fsl_imx6q_iomuxc      |   |   `-- iomuxc at 20e0000
>  pinconfig     0  [ + ]   pinconfig             |   |       |-- enetgrp
>  pinconfig     1  [   ]   pinconfig             |   |       |-- gpioledsgrp
>  pinconfig     2  [ + ]   pinconfig             |   |       |-- i2c1grp
>  pinconfig     3  [ + ]   pinconfig             |   |       |-- i2c2grp
>  pinconfig     4  [   ]   pinconfig             |   |       |-- i2c3grp
>  pinconfig     5  [   ]   pinconfig             |   |       |-- imugrp
>  pinconfig     6  [   ]   pinconfig             |   |       |-- maggrp
>  pinconfig     7  [ + ]   pinconfig             |   |       |-- pciegrp
>  pinconfig     8  [   ]   pinconfig             |   |       |-- pmicgrp
>  pinconfig     9  [   ]   pinconfig             |   |       |-- ppsgrp
>  pinconfig    10  [   ]   pinconfig             |   |       |-- pwm2grp
>  pinconfig    11  [   ]   pinconfig             |   |       |-- pwm3grp
>  pinconfig    12  [   ]   pinconfig             |   |       |-- pwm4grp
>  pinconfig    13  [   ]   pinconfig             |   |       |-- uart1grp
>  pinconfig    14  [ + ]   pinconfig             |   |       |-- uart2grp
>  pinconfig    15  [   ]   pinconfig             |   |       |-- uart3grp
>  pinconfig    16  [   ]   pinconfig             |   |       |-- uart4grp
>  pinconfig    17  [   ]   pinconfig             |   |       |-- uart5grp
>  pinconfig    18  [   ]   pinconfig             |   |       |-- usbh1grp
>  pinconfig    19  [   ]   pinconfig             |   |       |-- usbotggrp
>  pinconfig    20  [ + ]   pinconfig             |   |       |-- usdhc3grp
>  pinconfig    21  [   ]   pinconfig             |   |       |-- usdhc3grp100mhz
>  pinconfig    22  [   ]   pinconfig             |   |       |-- usdhc3grp200mhz
>  pinconfig    23  [ + ]   pinconfig             |   |       `-- wdoggrp
>  simple_bus    6  [ + ]   simple_bus            |   |-- bus at 2100000
>  usb           0  [   ]   ehci_mx6              |   |   |-- usb at 2184000
>  usb           1  [   ]   ehci_mx6              |   |   |-- usb at 2184200
>  mmc           0  [ + ]   fsl_esdhc             |   |   |-- usdhc at 2198000
>  blk           0  [ + ]   mmc_blk               |   |   |   `--
> usdhc at 2198000.blk
>  i2c           0  [ + ]   i2c_mxc               |   |   |-- i2c at 21a0000
>  i2c_generi    0  [ + ]   i2c_generic_chip_drv  |   |   |   |-- generic_51
>  i2c_generi    2  [ + ]   i2c_generic_chip_drv  |   |   |   |-- generic_20
>  i2c_generi    3  [ + ]   i2c_generic_chip_drv  |   |   |   |-- generic_29
>  i2c_generi    4  [ + ]   i2c_generic_chip_drv  |   |   |   `-- generic_68
>  i2c           1  [ + ]   i2c_mxc               |   |   |-- i2c at 21a4000
>  i2c_generi    1  [ + ]   i2c_generic_chip_drv  |   |   |   `-- generic_3c
>  i2c           2  [   ]   i2c_mxc               |   |   |-- i2c at 21a8000
>  serial        1  [ + ]   serial_mxc            |   |   |-- serial at 21e8000
>  serial        2  [   ]   serial_mxc            |   |   |-- serial at 21ec000
>  serial        3  [   ]   serial_mxc            |   |   |-- serial at 21f0000
>  serial        4  [   ]   serial_mxc            |   |   `-- serial at 21f4000
>  video         0  [ + ]   fsl_imx6q_ipu         |   `-- ipu at 2400000
>  vidconsole    0  [ + ]   vidconsole0           |       `--
> ipu at 2400000.vidconsole0
>  led           0  [   ]   gpio_led              |-- leds
>  led           1  [   ]   gpio_led              |   |-- user1
>  led           2  [   ]   gpio_led              |   |-- user2
>  led           3  [   ]   gpio_led              |   `-- user3
>  regulator     0  [   ]   regulator_fixed       |-- regulator-1p0v
>  regulator     1  [ + ]   regulator_fixed       |-- regulator-3p3v
>  regulator     2  [   ]   regulator_fixed       |-- regulator-usb-h1-vbus
>  regulator     3  [   ]   regulator_fixed       `-- regulator-usb-otg-vbus
> Ventana >
> 
> I'm not clear how for your board usb_ether is registered in the first place.
> 
> Best Regards,
> 
> Tim


More information about the U-Boot mailing list