[PATCH v4] dm: uclass: don't assign aliased seq numbers

Michael Walle michael at walle.cc
Wed Apr 15 17:22:31 CEST 2020


Hi Simon,

Am 2020-04-15 15:56, schrieb Simon Glass:
> +Tom
> 
> Hi,
> 
> On Sat, 14 Mar 2020 at 14:33, <sjg at google.com> wrote:
>> 
>> On 03. 03. 20 8:47, Michael Walle wrote:
>> > If there are aliases for an uclass, set the base for the "dynamically"
>> > allocated numbers next to the highest alias.
>> >
>> > Please note, that this might lead to holes in the sequences, depending
>> > on the device tree. For example if there is only an alias "ethernet1",
>> > the next device seq number would be 2.
>> >
>> > In particular this fixes a problem with boards which are using ethernet
>> > aliases but also might have network add-in cards like the E1000. If the
>> > board is started with the add-in card and depending on the order of the
>> > drivers, the E1000 might occupy the first ethernet device and mess up
>> > all the hardware addresses, because the devices are now shifted by one.
>> >
>> > Also adapt the test cases to the new handling and add test cases
>> > checking the holes in the seq numbers.
>> >
>> > Signed-off-by: Michael Walle <michael at walle.cc>
>> > Reviewed-by: Alex Marginean <alexandru.marginean at nxp.com>
>> > Tested-by: Alex Marginean <alexandru.marginean at nxp.com>
>> > Acked-by: Vladimir Oltean <olteanv at gmail.com>
>> > Reviewed-by: Simon Glass <sjg at chromium.org>
>> > ---
>> > changes since v3:
>> >  - dev_read_alias_highest_id() is only available if CONFIG_OF_CONTROL is
>> >    set. Thus added an additional condition "CONFIG_IS_ENABLED(OF_CONTROL)",
>> >    thanks Simon.
>> >
>> > changes since v2:
>> >  - adapt/new test cases, thanks Simon
>> >
>> > changes since v1:
>> >  - move notice about superfluous commits from commit message to this
>> >    section.
>> >  - fix the comment style
>> >
>> >  arch/sandbox/dts/test.dts |  4 ++--
>> >  drivers/core/uclass.c     | 21 +++++++++++++++------
>> >  include/configs/sandbox.h |  6 +++---
>> >  test/dm/eth.c             | 14 +++++++-------
>> >  test/dm/test-fdt.c        | 22 +++++++++++++++++-----
>> >  5 files changed, 44 insertions(+), 23 deletions(-)
>> >
>> Applied to u-boot-dm/next, thanks!
> 
> Sadly, after applying this was found to break rpi_3. Due to some
> still-pending patches mine doesn't boot anyway so I didn't notice.
> 
> The tbot trace is below. The first is the new u-boot-dm/master with
> two rpi patches, the second is the same with just your patch added.
> Ethernet seems to go away.

could you dump "dm tree" and "dm uclass" in both cases?

I've had a look at the device tree and there seems to be one ethernet
alias to the corresponding USB LAN device. I can only imagine that this
alias doesn't match (for whatever reason) and as a second problem, the
networking doesn't find a device if there is only a ethernet1.

-michael

> 
> $ do-try-int.sh rpi3 HEAD
> 
> Checking revision eff8ae8810da44bbbad71e617ea80abc7d7cde45
> tbot starting ...
> ├─Parameters:
> │     rev        = 'eff8ae8810da44bbbad71e617ea80abc7d7cde45'
> │     clean      = True
> ├─Calling uboot_checkout ...
> │   ├─Builder: rpi_3
> │   └─Done. (1.100s)
> ├─────────────────────────────────────────
> └─SUCCESS (1.277s)
> tbot starting ...
> ├─Parameters:
> │     clean      = False
> ├─Calling uboot_build_and_flash ...
> │   ├─POWERON (Raspberry Pi 3b)
> │   ├─Calling uboot_build ...
> │   │   ├─Calling uboot_checkout ...
> │   │   │   ├─Builder: rpi_3
> │   │   │   └─Done. (0.135s)
> │   │   ├─Configuring build ...
> │   │   ├─Calling uboot_make ...
> │   │   │   └─Done. (12.614s)
> │   │   └─Done. (15.038s)
> │   ├─Calling uboot_flash ...
> │   │   ├─Calling copy ...
> │   │   │   └─Done. (0.003s)
> │   │   └─Done. (3.628s)
> │   ├─POWEROFF (Raspberry Pi 3b)
> │   └─Done. (19.594s)
> ├─────────────────────────────────────────
> └─SUCCESS (19.771s)
> tbot starting ...
> ├─Calling interactive_board ...
> │   ├─POWERON (Raspberry Pi 3b)
> │   ├─Entering interactive shell (CTRL+D to exit) ...
> picocom v2.2
> 
> port is        : /dev/ttyusb_port1
> flowcontrol    : none
> baudrate is    : 115200
> parity is      : none
> databits are   : 8
> stopbits are   : 1
> escape is      : C-a
> local echo is  : no
> noinit is      : no
> noreset is     : no
> nolock is      : no
> send_cmd is    : sz -vv
> receive_cmd is : rz -vv -E
> imap is        :
> omap is        :
> emap is        : crcrlf,delbs,
> 
> Type [C-a] [C-h] to see available commands
> 
> Terminal ready
> 
> 
> U-Boot 2020.04-00305-geff8ae8810 (Apr 15 2020 - 07:40:23 -0600)
> 
> DRAM:  992 MiB
> RPI 3 Model B (0xa22082)
> MMC:   mmc at 7e202000: 0, sdhci at 7e300000: 1
> Loading Environment from FAT... *** Warning - bad CRC, using default 
> environment
> 
> In:    serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   No ethernet found.
> starting USB...
> Bus usb at 7e980000: scanning bus usb at 7e980000 for devices... Timeout
> poll on interrupt endpoint
> Failed to get keyboard state from device 0c40:8000
> 4 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> U-Boot> bootp
> Waiting for Ethernet connection... done.
> BOOTP broadcast 1
> DHCP client bound to address 192.168.4.50 (4 ms)
> *** Warning: no boot file name; using 'C0A80432.img'
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'C0A80432.img'.
> Load address: 0x200000
> Loading: *
> Abort
> U-Boot>
> │   ├─POWEROFF (Raspberry Pi 3b)
> │   └─Done. (26.173s)
> ├─────────────────────────────────────────
> └─SUCCESS (26.333s)
> ellesmere:~/u$ gp 8c324ac6faa
> [dm-push dd18fbdf7ff] dm: uclass: don't assign aliased seq numbers
>  Author: Michael Walle <michael at walle.cc>
>  Date: Tue Mar 3 08:47:38 2020 +0100
>  5 files changed, 45 insertions(+), 23 deletions(-)
> ellesmere:~/u$ do-try-int.sh rpi3 HEAD
> 
> Checking revision dd18fbdf7ff915672fb4933a1f82a78f7b484d24
> tbot starting ...
> ├─Parameters:
> │     rev        = 'dd18fbdf7ff915672fb4933a1f82a78f7b484d24'
> │     clean      = True
> ├─Calling uboot_checkout ...
> │   ├─Builder: rpi_3
> │   └─Done. (1.045s)
> ├─────────────────────────────────────────
> └─SUCCESS (1.259s)
> tbot starting ...
> ├─Parameters:
> │     clean      = False
> ├─Calling uboot_build_and_flash ...
> │   ├─POWERON (Raspberry Pi 3b)
> │   ├─Calling uboot_build ...
> │   │   ├─Calling uboot_checkout ...
> │   │   │   ├─Builder: rpi_3
> │   │   │   └─Done. (0.123s)
> │   │   ├─Configuring build ...
> │   │   ├─Calling uboot_make ...
> │   │   │   └─Done. (12.167s)
> │   │   └─Done. (14.622s)
> │   ├─Calling uboot_flash ...
> │   │   ├─Calling copy ...
> │   │   │   └─Done. (0.003s)
> │   │   └─Done. (4.191s)
> │   ├─POWEROFF (Raspberry Pi 3b)
> │   └─Done. (19.758s)
> ├─────────────────────────────────────────
> └─SUCCESS (19.946s)
> tbot starting ...
> ├─Calling interactive_board ...
> │   ├─POWERON (Raspberry Pi 3b)
> │   ├─Entering interactive shell (CTRL+D to exit) ...
> picocom v2.2
> 
> port is        : /dev/ttyusb_port1
> flowcontrol    : none
> baudrate is    : 115200
> parity is      : none
> databits are   : 8
> stopbits are   : 1
> escape is      : C-a
> local echo is  : no
> noinit is      : no
> noreset is     : no
> nolock is      : no
> send_cmd is    : sz -vv
> receive_cmd is : rz -vv -E
> imap is        :
> omap is        :
> emap is        : crcrlf,delbs,
> 
> Type [C-a] [C-h] to see available commands
> 
> Terminal ready
> 
> 
> U-Boot 2020.04-00306-gdd18fbdf7f (Apr 15 2020 - 07:41:47 -0600)
> 
> DRAM:  992 MiB
> RPI 3 Model B (0xa22082)
> MMC:   mmc at 7e202000: 0, sdhci at 7e300000: 1
> Loading Environment from FAT... *** Warning - bad CRC, using default 
> environment
> 
> In:    serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   No ethernet found.
> starting USB...
> Bus usb at 7e980000: scanning bus usb at 7e980000 for devices...
> Error: smsc95xx_eth address not set.
> Timeout poll on interrupt endpoint
> Failed to get keyboard state from device 0c40:8000
> 3 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> U-Boot> bootp
> No ethernet found.
> U-Boot>
> │   ├─POWEROFF (Raspberry Pi 3b)
> │   └─Done. (17.196s)
> ├─────────────────────────────────────────
> └─SUCCESS (17.337s)
> 
> 
> Regards,
> Simon


More information about the U-Boot mailing list