本次设计中,我们采用MEMAC4 (RGMII)接口作为调试接口,但是发现网口并不通
1.首先排查PHY 的问题,phy有没有解复位
结果 : CPLD 已经对PHY解复位,且插上网线后,phy'灯link亮,说明phy确实已经解复位
2.使用mii命令,读取phy寄存器,插拔网线后观察寄存器的变化,是否正常反应出phy的down和up
拔掉网线时phy的状态
=> mii dump 1 1
1. (7969) -- PHY status register --
(8000:0000) 1.15 = 0 100BASE-T4 able
(4000:4000) 1.14 = 1 100BASE-X full duplex able
(2000:2000) 1.13 = 1 100BASE-X half duplex able
(1000:1000) 1.12 = 1 10 Mbps full duplex able
(0800:0800) 1.11 = 1 10 Mbps half duplex able
(0400:0000) 1.10 = 0 100BASE-T2 full duplex able
(0200:0000) 1. 9 = 0 100BASE-T2 half duplex able
(0100:0100) 1. 8 = 1 extended status
(0080:0000) 1. 7 = 0 (reserved)
(0040:0040) 1. 6 = 1 MF preamble suppression
(0020:0020) 1. 5 = 1 A/N complete
(0010:0000) 1. 4 = 0 remote fault
(0008:0008) 1. 3 = 1 A/N able
(0004:0000) 1. 2 = 0 link status
(0002:0000) 1. 1 = 0 jabber detect
(0001:0001) 1. 0 = 1 extended capabilities
插上网线时PHY的状态
=> mii dump 1 1
1. (796d) -- PHY status register --
(8000:0000) 1.15 = 0 100BASE-T4 able
(4000:4000) 1.14 = 1 100BASE-X full duplex able
(2000:2000) 1.13 = 1 100BASE-X half duplex able
(1000:1000) 1.12 = 1 10 Mbps full duplex able
(0800:0800) 1.11 = 1 10 Mbps half duplex able
(0400:0000) 1.10 = 0 100BASE-T2 full duplex able
(0200:0000) 1. 9 = 0 100BASE-T2 half duplex able
(0100:0100) 1. 8 = 1 extended status
(0080:0000) 1. 7 = 0 (reserved)
(0040:0040) 1. 6 = 1 MF preamble suppression
(0020:0020) 1. 5 = 1 A/N complete
(0010:0000) 1. 4 = 0 remote fault
(0008:0008) 1. 3 = 1 A/N able
(0004:0004) 1. 2 = 1 link status
(0002:0000) 1. 1 = 0 jabber detect
(0001:0001) 1. 0 = 1 extended capabilities
phy没问题,所以就要怀疑MAC是否正常初始化了,在MAC初始化的地方加打印,发现蛛丝马迹。
定位到原因 :
没有烧入初始化FMAN 用的ucode.bin
烧入ucode.bin后,网络部分有注册函数了
-------- RGMII case process....
----cpu_eth_init,CONFIG_FMAN_ENET case
---fm_standard_init
SF: Detected W25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
Fman1: Uploading microcode version 106.4.18
----fm_eth_initialize
zyhd init_memac.....
--dev->name : FM1@DTSEC1
-----eth_regiseter
----fm_eth_initialize
zyhd init_memac.....
--dev->name : FM1@DTSEC2
FSL_MDIO0:0 is connected to FM1@DTSEC1. Reconnecting to FM1@DTSEC2
-----eth_regiseter
----fm_eth_initialize
zyhd init_memac.....
--dev->name : FM1@DTSEC3
-----eth_regiseter
----fm_eth_initialize
zyhd init_memac.....
--dev->name : FM1@DTSEC4
-----eth_regiseter
FM1@DTSEC1
Error: FM1@DTSEC1 address not set.
, FM1@DTSEC2
Error: FM1@DTSEC2 address not set.
, FM1@DTSEC3
Error: FM1@DTSEC3 address not set.
, FM1@DTSEC4 [PRIME]
Error: FM1@DTSEC4 address not set.
烧入ucode.bin到SPI FLASH 对应位置,重新上电后,调试网口ok,可以使用tftp命令加载内核、设备树,文件系统了
setenv serverip 192.168.0.14;setenv ipaddr 192.168.0.206
setenv nfsboot "tftp 1000000 uImage;tftp 2000000 t1042.rootfs.ext2.gz.u-boot;tftp f00000 t1042d4rdb.dtb ;bootm 1000000 2000000 f00000"
run nfsboot