09-07-2020 10:06 AM
We need to use PL based 1G Ethernet on Zynq Ultrascale + MPSoC platform (ZCU102 evaluation board) with Petalinux version 2019.1. The ethernet link is not working as expected.
The block diagram of the design is shown below. The GEM0 of the PS is connected to 1G Ethernet PCS/PMA V16.1 IP Core (configured in 1000BaseX mode with auto-negotiation enabled) in the PL section. The MDIO address is configured as 0x9. Copper SFP (FCLF8521-3) is jacked in the corresponding SFP cage.
The ping test in the U-Boot is working fine. Please see the bellow log (link partner IP address 192.168.1.1):
ZynqMP> setenv ethact eth0 ZynqMP> setenv ipaddr 192.168.1.2 ZynqMP> ping 192.168.1.1 Using ethernet@ff0b0000 device host 192.168.1.1 is alive ZynqMP> mii dump 9 0-1 0. (1140) -- PHY control register -- (8000:0000) 0.15 = 0 reset (4000:0000) 0.14 = 0 loopback (2040:0040) 0. 6,13 = b10 speed selection = 1000 Mbps (1000:1000) 0.12 = 1 A/N enable (0800:0000) 0.11 = 0 power-down (0400:0000) 0.10 = 0 isolate (0200:0000) 0. 9 = 0 restart A/N (0100:0100) 0. 8 = 1 duplex = full (0080:0000) 0. 7 = 0 collision test enable (003f:0000) 0. 5- 0 = 0 (reserved) 1. (01ec) -- PHY status register -- (8000:0000) 1.15 = 0 100BASE-T4 able (4000:0000) 1.14 = 0 100BASE-X full duplex able (2000:0000) 1.13 = 0 100BASE-X half duplex able (1000:0000) 1.12 = 0 10 Mbps full duplex able (0800:0000) 1.11 = 0 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:0080) 1. 7 = 1 (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:0000) 1. 0 = 0 extended capabilities
However in linux the ethernet port is not working (please see the bellow log):
root@petalinux-bob:~# ifconfig eth0 192.168.1.2 up root@petalinux-bob:~# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1): 56 data bytes ^C --- 192.168.1.1 ping statistics --- 20 packets transmitted, 0 packets received, 100% packet loss root@petalinux-bob:~# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Half 100baseT/Half 100baseT/Full Link partner advertised pause frame use: No Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 10Mb/s Duplex: Half Port: MII PHYAD: 9 Transceiver: internal Auto-negotiation: on Link detected: no root@petalinux-bob:~# ethtool -s eth0 speed 1000 duplex full autoneg off root@petalinux-bob:~# [ 220.465733] macb ff0b0000.ethernet eth0: link up (-1/Half) [ 220.471238] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready root@petalinux-bob:~# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1): 56 data bytes ^C --- 192.168.1.1 ping statistics --- 16 packets transmitted, 0 packets received, 100% packet loss root@petalinux-bob:~# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 9 Transceiver: internal Auto-negotiation: off Link detected: yes
The device tree used during petalinux-build is as below:
&gem0 { local-mac-address = [00 0a 35 00 22 04]; phy-handle = <&phy9>; phy9: phy@9 { reg = <0x9>; xlnx,phy-type = <5>; }; };
What could be possible reason of the following :
1. Why the link is not getting detected when auto-negotiation is enabled for eth0?
2. Why ping is failing though link is established in case of auto-negotiation disabled case?
Thanks, Prasanta
09-13-2020 09:34 PM
The problem was with the PHY reset of macb driver. After adding the phy-reset-after-clk-enable patch, the ethernet port is working fine.
Thanks
09-09-2020 01:21 AM
Hi @prasanta ,
Have you checked if the isolate bit is disabled in the register of PCS/PMA IP?
As it's copper SFP, is the DTS phy node for PL 1000BASE-X PHY?
09-10-2020 01:37 AM
Hi @nanz ,
I have verified the the isolate bit of Register 0-Control Register(0.10) of PCS/PMA Transceiver. It is 0 in both U-Boot and Linux environments.
Regarding the DTS PHY node, the MDIO address points to PL PCS/PMA Transceiver. We are using FCLF-8521-3 Copper SFP which have internal PHY. However that internal PHY cannot be accesed through PS MDIO as the SFP only have I2C interface.
Thanks
09-10-2020 09:03 AM
Hi @prasanta ,
So DTS looks good then. As your extenral PHY is configured using I2C. Can you please confirm the PHY status by reading the PHY registers?
09-10-2020 10:59 PM
Hi @nanz ,
I found that the auto-negotiation is enabled in U-Boot, while in in linux I was disabling auto-negotiation with
ethtool -s eth0 speed 1000 duplex full autoneg off
command.
I tried with auto-negotiation enabled in linux as well. Following is the PHY register dump in linux -
root@OpenWrt:/# mii-tool -vv eth0 Using SIOCGMIIPHY=0x8947 eth0: autonegotiation failed, link ok registers for MII PHY 9: 1140 01ec 0174 0c00 0000 4060 0006 0000 0000 0000 0000 0000 0000 0000 0000 8000 0000 0000 0003 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 product info: vendor 00:5d:03, model 0 rev 0 basic mode: autonegotiation enabled basic status: autonegotiation complete, link ok capabilities: advertising: link partner: 10baseT-FD 10baseT-HD
In U-Boot the dump is:
ZynqMP> mii read 0x9 0-15 addr=09 reg=00 data=1140 addr=09 reg=01 data=01EC addr=09 reg=02 data=0174 addr=09 reg=03 data=0C00 addr=09 reg=04 data=01A0 addr=09 reg=05 data=4060 addr=09 reg=06 data=0006 addr=09 reg=07 data=0000 addr=09 reg=08 data=0000 addr=09 reg=09 data=0000 addr=09 reg=0a data=0000 addr=09 reg=0b data=0000 addr=09 reg=0c data=0000 addr=09 reg=0d data=0000 addr=09 reg=0e data=0000 addr=09 reg=0f data=8000 addr=09 reg=10 data=0003 addr=09 reg=11 data=0000 addr=09 reg=12 data=0003 addr=09 reg=13 data=0000 addr=09 reg=14 data=0000 addr=09 reg=15 data=0000
The only difference is that, in linux, the Register 4: Auto-Negotiation Advertisement Register content is 0x0000. I tried to overwrite it with 0x01A0 but it is not updating. I believe due to this register the auto-negotiation is not completed with correct speed/duplex.
What could be the possible reason for this behaviour?
09-13-2020 09:34 PM
The problem was with the PHY reset of macb driver. After adding the phy-reset-after-clk-enable patch, the ethernet port is working fine.
Thanks