Welcome! Log In Create A New Profile

Advanced

u-boot ethernet device not ready in time

Posted by IvanZarevich 
IvanZarevich
u-boot ethernet device not ready in time
April 17, 2023 07:31AM
Hi,
I try to make a netboot over tftp with statically assigned ip address. This is the configuration of bootcmd:

bootcmd=env set ipaddr 192.168.178.46; env set serverip 192.168.178.39; tftp 0x82000000 Image; tftp 0x88000000 imx.dtb;

after booting it shows following problem:

loading FDT from mmc 0 'imx8mp-qsxp-ml81-qsbase3-raspi-display.dtb'
MAC addr: 00:0c:c6:06:2d:dc
Net: eth0: ethernet@30bf0000
Hit any key to stop autoboot: 0
ethernet@30bf0000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
ethernet@30bf0000: phy_startup() failed: -110
ethernet@30bf0000: eqos_start() FAILED: -110
ethernet@30bf0000 Waiting for PHY auto negotiation to complete.... done

this is as it seems because of not yet initialized ethernet device. As workaround I used a sleep 10, just in front of tftp command to give the ethernet device more time for initialization

question: is it possible to somehow programmatically test for available network device? something like if test is_eth_online then tftp ??

Thanks
Ivan
Re: u-boot ethernet device not ready in time
April 17, 2023 03:04PM
Ivan,

> bootcmd=env set ipaddr 192.168.178.46; env set
> serverip 192.168.178.39; tftp 0x82000000 Image;
> tftp 0x88000000 imx.dtb;
>
> question: is it possible to somehow
> programmatically test for available network
> device? something like if test is_eth_online then
> tftp ??

This is IMX u-boot so I am not sure if there is such command. In general, for any u-boot, you would do a few pings if you think the network is slow coming up. pinging the network will force it to come up. Like this,

env set initialize_net 'env set ipaddr 192.168.178.46; ping $serverip; sleep 1; ping $serverip;  sleep 1; ping $serverip; sleep 1;'
env set bootcmd 'env set ipaddr 192.168.178.46; run initialize_net; tftp 0x82000000 Image; tftp 0x88000000 imx.dtb;'
Note that you should do at least 2 pings.

There are other methods, such as using a for loop to ping until the network come up (ping successful). But I'm not sure this u-boot has supports for that syntax. Also, in modern u-boot, you have other means to check the network status.

Please post the output of the fowwoling in serial console:
ver
help

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
IvanZarevich
Re: u-boot ethernet device not ready in time
April 17, 2023 11:45PM
I did as you suggested with ping, but the problem is the early access of ethernet device. If I ping just after the boot I still get the same problem with negotiation. To test this I have set bootcmd to "env set ipaddr 192.168.178.46; ping 192.168.178.39" and reset. Here the output:

loading FDT from mmc 0:1 'imx8mp-qsxp-ml81-qsbase3.dtb'
MAC addr: 00:0c:c6:06:2d:dc
Net:   eth0: ethernet@30bf0000
Hit any key to stop autoboot:  0 
ethernet@30bf0000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
ethernet@30bf0000: phy_startup() failed: -110
ethernet@30bf0000: eqos_start() FAILED: -110
ping failed; host 192.168.178.39 is not alive

I need something more low-level that accesses the state of ethernet device in a manner that I can just very simple use with something like test.


OUTPUT OF VER AND HELP:

QSXP U-Boot > ver
U-Boot 2020.04-5.10.9-1.0.0+gd3987c4f40 (Aug 24 2022 - 11:47:52 +0000)

aarch64-poky-linux-gcc (GCC) 11.2.0
GNU ld (GNU Binutils) 2.38.20220313

QSXP U-Boot > help
?         - alias for 'help'
base      - print or set address offset
bdinfo    - print Board Info structure
blkcache  - block cache diagnostics and control
bmp       - manipulate BMP image data
boot      - boot default, i.e., run 'bootcmd'
bootd     - boot default, i.e., run 'bootcmd'
booti     - boot Linux kernel 'Image' format from memory
bootm     - boot application image from memory
bootp     - boot image via network using BOOTP/TFTP protocol
clk       - CLK sub-system
clocks    - display clocks
cls       - clear screen
cmp       - memory compare
coninfo   - print console devices and information
cp        - memory copy
dcache    - enable or disable data cache
dhcp      - boot image via network using DHCP/TFTP protocol
dm        - Driver model low level access
echo      - echo args to console
editenv   - edit environment variable
env       - environment handling commands
eraseenv  - erase environment variables from persistent storage
exit      - exit script
ext2load  - load binary file from a Ext2 filesystem
ext2ls    - list files in a directory (default /)
ext4load  - load binary file from a Ext4 filesystem
ext4ls    - list files in a directory (default /)
ext4size  - determine a file's size
ext4write - create a file in the root directory
false     - do nothing, unsuccessfully
fatinfo   - print information about filesystem
fatload   - load binary file from a dos filesystem
fatls     - list files in a directory (default /)
fatmkdir  - create a directory
fatrm     - delete a file
fatsize   - determine a file's size
fatwrite  - write file into a dos filesystem
fdt       - flattened device tree utility commands
fstype    - Look up a filesystem type
fuse      - Fuse sub-system
go        - start application at address 'addr'
gpio      - query and control gpio pins
gpt       - GUID Partition Table
help      - print command description/usage
i2c       - I2C sub-system
icache    - enable or disable instruction cache
iminfo    - print header information for application image
itest     - return true/false on integer compare
lcdputs   - print string on video framebuffer
ln        - Create a symbolic link
load      - load binary file from a filesystem
loadb     - load binary file over serial line (kermit mode)
loads     - load S-Record file over serial line
loadx     - load binary file over serial line (xmodem mode)
loady     - load binary file over serial line (ymodem mode)
loop      - infinite loop on address range
ls        - list files in a directory (default /)
md        - memory display
mdio      - MDIO utility commands
mii       - MII utility commands
mm        - memory modify (auto-incrementing address)
mmc       - MMC sub system
mmcinfo   - display MMC info
mtest     - simple RAM read/write test
mw        - memory write (fill)
nfs       - boot image via network using NFS protocol
nm        - memory modify (constant address)
part      - disk partition related commands
ping      - send ICMP ECHO_REQUEST to network host
pinmux    - show pin-controller muxing
printenv  - print environment variables
random    - fill memory with random pattern
read      - Load binary data from a partition
regulator - uclass operations
reset     - Perform RESET of the CPU
run       - run commands in an environment variable
save      - save file to a filesystem
saveenv   - save environment variables to persistent storage
setcurs   - set cursor position within screen
setenv    - set environment variables
setexpr   - set environment variable as the result of eval expression
showvar   - print local hushshell variables
size      - determine a file's size
sleep     - delay execution for some time
source    - run script from memory
test      - minimal test like /bin/sh
tftpboot  - boot image via network using TFTP protocol
time      - run commands and summarize execution time
true      - do nothing, successfully
ums       - Use the UMS [USB Mass Storage]
usb       - USB sub-system
usbboot   - boot from USB device
version   - print monitor, compiler and linker version
videolink - list and select video link
Re: u-boot ethernet device not ready in time
April 18, 2023 12:41AM
This u-boot is quite new. And it has driver model.

Quote

dm - Driver model low level access

Run
dm tree
It should list the DM uclasses. And there might be a way to test the Enthernet uclass (i.e if it has been bound to a device).

Also, with slow network like this, you will need to do several pings before it is successful.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 04/18/2023 12:47AM by bodhi.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: