我用的是官方buildroot 2020.11.3,主线Linux 5.3.5,以太网设备树是从 荔枝派 zero-5.2.y 这里抄过来的。
这是开机时 kernel 打印的信息,看起来以太网驱动貌似没啥问题:
[ 0.670942] libphy: Fixed MDIO Bus: probed
[ 0.675134] CAN device driver interface
[ 0.679641] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[ 0.685514] dwmac-sun8i 1c30000.ethernet: No regulator found
[ 0.691600] dwmac-sun8i 1c30000.ethernet: Current syscon value is not the default 38000 (expect 58000)
[ 0.701003] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[ 0.708253] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[ 0.715489] dwmac-sun8i 1c30000.ethernet: COE Type 2
[ 0.720454] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[ 0.727250] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[ 0.732909] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[ 0.738591] dwmac-sun8i 1c30000.ethernet: device MAC address 52:57:dc:70:bf:b8
[ 0.746056] libphy: stmmac: probed
[ 0.750101] dwmac-sun8i 1c30000.ethernet: Found internal PHY node
[ 0.756447] libphy: mdio_mux: probed
[ 0.760062] dwmac-sun8i 1c30000.ethernet: Switch mux to internal PHY
[ 0.766461] dwmac-sun8i 1c30000.ethernet: Powering internal PHY
[ 0.773048] libphy: mdio_mux: probed
登录后运行 ifconfig,然后尝试用 udhcpc 来获取 IP,会卡在 “sending discover” 上:
# ifconfig eth0 up
[ 780.217368] dwmac-sun8i 1c30000.ethernet eth0: PHY [0.1:01] driver [Generic PHY]
[ 780.226392] dwmac-sun8i 1c30000.ethernet eth0: No Safety Features support found
[ 780.233807] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[ 780.241472] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[ 780.248026] dwmac-sun8i 1c30000.ethernet eth0: configuring for phy/mii link mode
# udhcpc
udhcpc: started, v1.32.0
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
过一会儿后(几十秒到几十分钟不等),kernel 会打印一个 “Link is Up” 的信息,然后这时候运行 udhcpc 立即就能获取到 IP:
[ 878.003861] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
# udhcpc
udhcpc: started, v1.32.0
udhcpc: sending discover
udhcpc: sending select for 192.168.3.190
udhcpc: lease of 192.168.3.190 obtained, lease time 86400
deleting routers
adding dns 192.168.3.1
有些时候这个以太网还会在 Down、Up 之间来回变动:
# udhcpc
udhcpc: started, v1.32.0
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
[ 101.283907] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[ 102.323796] dwmac-sun8i 1c30000.ethernet eth0: Link is Down
[ 110.483599] random: crng init done
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
[ 126.243915] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[ 127.283790] dwmac-sun8i 1c30000.ethernet eth0: Link is Down
[ 132.483944] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
udhcpc: sending discover
udhcpc: sending select for 192.168.3.190
udhcpc: lease of 192.168.3.190 obtained, lease time 86400
deleting routers
adding dns 192.168.3.1
#
请问有哪位大佬遇到过这个情况吗?荔枝派Zero的以太网是不是还需要什么设备树以外的特别的配置?奇怪的是,如果我在荔枝派上用 USB-Ethernet 转接器,同样的问题就从来没有出现过,udhcpc 也总是立即就可以获取 IP。
多谢指教!
最近编辑记录 unturned3 (2021-05-08 10:00:46)
离线
网线接触不良?
离线
碰到一模一样的问题
离线
谢谢各位大佬!貌似还真是网线的问题。换了一根线测试了一下,ifconfig eth0 up 后 Link 马上就 Up 了
离线
今天遇到相同的问题,换了网线就好了,测试是软的网线都不行,硬点的网线都正常
离线
挑网线也可能是PCB板上的差分线阻抗控制不好导致的信号完整性问题
离线