AR8031以太⽹千兆正常百兆不通问题分析
IMX8QXP平台,使⽤AR8031千兆PHY芯⽚,出现1000M⽹络正常,插100M交换机时还是在1Gbps/Full速率上⾯,接下来开始分
析。
电路图
配置低的单机游戏1000M打印
root@genvict_imx8qxp:~# ifconfig eth0 up
[23487.949074] Atheros 8031 hernet-1:00: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_hernet-1:00, irq=P [23487.963198] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
root@genvict_imx8qxp:~# [23488.985380] hernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[23488.993209] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes
100M打印
root@genvict_imx8qxp:~# ifconfig eth0 up
[23487.949074] Atheros 8031 hernet-1:00: attached PHY driver [Atheros 8031
ethernet] (mii_bus:phy_hernet-1:00, irq=P [23487.963198] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
root@genvict_imx8qxp:~# [23488.985380] hernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[23488.993209] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes
问题分析
100M时,驱动打印速率是1Gbps/Full,但是通过ethtool⼯具查看是Speed: 100Mb/s。且LED3灯已经点亮,说明PHY芯⽚与交换机协商成功了100M,但是驱动加载时获取到PHY芯⽚的速率信息为1000M,可以说明硬件没有问题,1000M通信正常且100M协商速率是正常的,那就可能是驱动配置问题。
使⽤⼯具ethtool强制设置100M,ethtool -s eth0 speed 100,打印如下。
root@genvict_imx8qxp:~# ethtool -s eth0 speed 100 【设置10/1000也是下⾯的效果】
Cannot advertise speed 100
root@genvict_imx8qxp:~#
[23329.113366] hernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
这时候驱动打印100M速率,且以太通信正常了,为何重启就能试别到正常的速率呢?
尝试修改
霍建华割双眼皮dts修改rgmii-txid为rgmii【⽆改善】
兰州小吃驱动中改为只⽀持百兆【千兆在百兆正常,百兆正常】
确认复位管脚【驱动加载时不复位也可正常⼯作,所以不是复位的时序问题】
驱动加打印查看获取PHY⽹⼝速率,函数genphy_read_status,打印如下:
[ 86.321797] .
移动wlan[ 86.326997] hernet eth0: RGMII
[ 86.403986] Atheros 8031 hernet-1:00: attached PHY driver [Atheros 8031 et
hernet] (mii_bus:phy_hernet-1:00, irq=PO [ 86.418083] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
root@genvict_imx8qxp:~#
[ 87.451383] eason AUTONEG_ENABLE
[ 87.454784] eason SPEED_1000
[ 87.458438] .
[ 87.463617] hernet eth0: RGMII
[ 87.468002] hernet eth0: SPEED_1000
[ 87.472866] hernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 87.480674] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 88.507376] eason AUTONEG_ENABLE
[ 88.510780] eason SPEED_100
[ 89.531362] eason AUTONEG_ENABLE
[ 89.534765] eason SPEED_100
奇怪的是,驱动加载之前是异常的1000M,加载之后就是正常的100M速率了,继续加打印查看:
[ 26.798011] eason AUTONEG_ENABLE
[ 26.801297] eason lpagb=65535 0xFFFF
[ 26.804350] eason adv=65535
[ 26.807180] eason common_adv_gb=65532
[ 26.811180] eason SPEED_1000
[ 27.822030] eason AUTONEG_ENABLE
[ 27.825312] eason lpagb=8192
[ 27.828508] eason adv=512
[ 27.831156] eason common_adv_gb=0
[ 27.834568] eason SPEED_100
到这⾥,读出的数据是0xFFFF,说明读取寄存器失败了。或者要么是驱动加载之后做了什么就正常,或者驱动加载之前就是异常的,从这
个思路出发,查看前⾯的函数genphy_update_link,发现有⼈为的修改痕迹:
int status;
int status2,status4;
/* Do a fake read */
#if 0
phydev->mdio.addr = 0;
status = phy_read(phydev, MII_BMSR);
if (status < 0)
return status;
国家电网客服回应东北居民遭遇限电phydev->mdio.addr = 2;
status2 = phy_read(phydev, MII_BMSR);
if (status2 < 0)
return status2;
phydev->mdio.addr = 4;
status4 = phy_read(phydev, MII_BMSR);
if (status4 < 0)
return status4;
#else
status = phy_read(phydev, MII_BMSR);
if (status < 0)
return status;
#endif
这就很清晰了,我们只有⼀个PHY芯⽚,PHY地址是0,这⾥依次读取了3个地址,且以地址4读出的状态为准,所以获取的是0xFFFF,代
码中默认给处理1000M,
修改代码#if 0后,读取PHY芯⽚速率正常,打印如下:
root@genvict_imx8qxp:~# ifconfig eth0 192.169.5.92
[ 65.860843] .
[ 65.866055] hernet eth0: RGMII
[ 65.942621] Atheros 8031 hernet-1:00: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_hernet-1:00, irq=PO [ 65.956728] IPv6: ADDRCONF(NET
DEV_UP): eth0: link is not ready
root@genvict_imx8qxp:~#
[ 66.981883] eason AUTONEG_ENABLE
[ 66.985169] eason lpagb=0
[ 66.987882] eason adv=512
[ 66.990546] eason common_adv_gb=0
[ 66.994008] eason SPEED_10
[ 68.005861] eason AUTONEG_ENABLE
[ 68.009145] eason lpagb=0
[ 68.011855] eason adv=512
[ 68.014507] eason common_adv_gb=0
劳斯莱斯怎么样
[ 68.017908] eason SPEED_100
[ 69.029873] eason AUTONEG_ENABLE
[ 69.033152] eason lpagb=0
[ 69.035835] eason adv=512
[ 69.038489] eason common_adv_gb=0
[ 69.042094] eason SPEED_100
[ 69.045550] .
[ 69.050714] hernet eth0: RGMII
[ 69.055088] hernet eth0: SPEED_100
[ 69.059886] hernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 69.067858] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 70.085862] eason AUTONEG_ENABLE
[ 70.089140] eason lpagb=8192
[ 70.092090] eason adv=512
[ 70.094751] eason common_adv_gb=0
[ 70.098316] eason SPEED_100
[ 71.109877] eason AUTONEG_ENABLE
[ 71.113153] eason lpagb=8192
[ 71.116101] eason adv=512
[ 71.118758] eason common_adv_gb=0
[ 71.122387] eason SPEED_100
总结
增加的代码是为了⽀持mv88e6172交换芯⽚,所以就影响到了AR8031的状态读取。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论