UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant tkato@poc.com
Participant
154 Views
Registered: ‎09-06-2019

Issue enabling SGMII ethernet in Linux (master/slave resolution failed)

We have a system we are bringing up with 4 GEMs enabled on a Zynq Ultrascale+, 2 RGMII and 2 SGMII all connected directly to the PS using a shared MDIO bus on GEM2. We are able to enable the RGMII GEMs but having trouble with the SGMII. Based on these posts:

https://forums.xilinx.com/t5/Ethernet/VCU118-Ethernet/td-p/969450

https://www.xilinx.com/Attachment/(2018.1patch)0001-net-macb-Use-DT-property-for-internal-SGMII-initiali.patch

https://forums.xilinx.com/t5/Embedded-Linux/ZynqMP-Ethernet-PS-SGMII-with-Ti83867-Phy-issues/td-p/811628

https://forums.xilinx.com/t5/Processor-System-Design/ZynqMP-PS-GTR-1000BASE-KX-or-SGMII/m-p/817706

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842230/Zynq+Ultrascale+Fixed+Link+PS+Ethernet+Demo

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841740/Macb+Driver

 

This is our current device tree configuration (system-user.dtsi):

 

&gem3 {
	status = "disabled";
	phy-handle = <&phy1>;
	phy-mode = "rgmii";
	pinctrl-names = "default";
	//pinctrl-0 = <&pinctrl_gem3_default>;
	local-mac-address = [00 0a 35 00 00 03];
	ti,dp83867-rxctrl-strap-quirk;
};

&gem2 {
	status = "okay";
	phy-handle = <&phy0>;
	phy-mode = "rgmii";
	pinctrl-names = "default";
	//pinctrl-0 = <&pinctrl_gem2_default>;
	local-mac-address = [00 0a 35 00 00 02];
	ti,dp83867-rxctrl-strap-quirk;

	phy0: phy@0 {
		reg = <0x0>;
		ti,rx-internal-delay = <0x8>;
		ti,tx-internal-delay = <0xa>;
		ti,fifo-depth = <0x1>;
		ti,rxctrl-strap-worka;
	};
	phy1: phy@1 {
		reg = <0x1>;
		ti,rx-internal-delay = <0x8>;
		ti,tx-internal-delay = <0xa>;
		ti,fifo-depth = <0x1>;
		ti,rxctrl-strap-worka;
	};
	phy2: phy@2 {
		reg = <0x2>;
		ti,rx-internal-delay = <0x8>;
		ti,tx-internal-delay = <0xa>;
		ti,fifo-depth = <0x1>;
		ti,dp83867-rxctrl-strap-quirk;
		xlnx,phy-type = <0x4>;
	};
	phy3: phy@3 {
		reg = <0x3>;
		xlnx,phy-type = <0x4>;		
		ti,rx-internal-delay = <0x8>;
		ti,tx-internal-delay = <0xa>;
		ti,fifo-depth = <0x1>;
		ti,dp83867-rxctrl-strap-quirk;
	};
};

&gem1 {
	status = "disabled";
	phy-handle = <&phy3>;
	phy-mode = "sgmii";
	pinctrl-names = "default";
	reset-gpios = <&gpio 45 0>;
	local-mac-address = [00 0a 35 00 00 01];
	//ti,rxctrl-strap-worka;  
	is-internal-pcspma;  
};
&gem0 {
	status = "disabled";
	phy-handle = <&phy2>;
	phy-mode = "sgmii";	
	pinctrl-names = "default";
	reset-gpios = <&gpio 13 0>;
	local-mac-address = [00 0a 35 00 00 00];
	is-internal-pcspma;  
};

 

Here is our overlay file for the gem nodes:

/dts-v1/;
/plugin/;	/* allow undefined label references and record them */
/ {
	fragment@0{
		target-path = "/amba/ethernet@ff0e0000";
		__overlay__ {
            		status = "okay";			
		};
	};	
	fragment@1 {
		target-path = "/amba/ethernet@ff0b0000";
		__overlay__ {
            		status = "okay";			
		};
	};
	fragment@2 {
		target-path = "/amba/ethernet@ff0c0000";
		__overlay__ {
            		status = "okay";			
		};
	};
};

 

And here is result of the driver probe following the device tree overlay:

 

# echo -n "gem-enable-overlay.dtbo" > full/path
[  122.575999] macb ff0e0000.ethernet: Not enabling partial store and forward
[  122.583425] libphy: MACB_mii_bus: probed
[  122.587342] mdio_bus ff0e0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.689793] TI DP83867 ff0d0000.ethernet-ffffffff:01: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:01, irq=POLL)
[  122.702837] macb ff0e0000.ethernet eth1: Cadence GEM rev 0x50070106 at 0xff0e0000 irq 49 (00:0a:35:00:00:03)
[  122.713248] macb ff0b0000.ethernet: Not enabling partial store and forward
[  122.720730] libphy: MACB_mii_bus: probed
[  122.724647] mdio_bus ff0b0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.827969] TI DP83867 ff0d0000.ethernet-ffffffff:02: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:02, irq=POLL)
[  122.841014] macb ff0b0000.ethernet eth2: Cadence GEM rev 0x50070106 at 0xff0b0000 irq 50 (00:0a:35:00:22:01)
[  122.851425] macb ff0c0000.ethernet: Not enabling partial store and forward
[  122.858882] libphy: MACB_mii_bus: probed
[  122.862802] mdio_bus ff0c0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.966677] TI DP83867 ff0d0000.ethernet-ffffffff:03: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:03, irq=POLL)
[  122.979726] macb ff0c0000.ethernet eth3: Cadence GEM rev 0x50070106 at 0xff0c0000 irq 51 (00:0a:35:00:00:01)

 

When bringing up the gems, both SGMIIs seem to have an issue with resolving the master/slave:

# echo -n "gem-enable-overlay.dtbo" > full/path
[  122.575999] macb ff0e0000.ethernet: Not enabling partial store and forward
[  122.583425] libphy: MACB_mii_bus: probed
[  122.587342] mdio_bus ff0e0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.689793] TI DP83867 ff0d0000.ethernet-ffffffff:01: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:01, irq=POLL)
[  122.702837] macb ff0e0000.ethernet eth1: Cadence GEM rev 0x50070106 at 0xff0e0000 irq 49 (00:0a:35:00:00:03)
[  122.713248] macb ff0b0000.ethernet: Not enabling partial store and forward
[  122.720730] libphy: MACB_mii_bus: probed
[  122.724647] mdio_bus ff0b0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.827969] TI DP83867 ff0d0000.ethernet-ffffffff:02: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:02, irq=POLL)
[  122.841014] macb ff0b0000.ethernet eth2: Cadence GEM rev 0x50070106 at 0xff0b0000 irq 50 (00:0a:35:00:22:01)
[  122.851425] macb ff0c0000.ethernet: Not enabling partial store and forward
[  122.858882] libphy: MACB_mii_bus: probed
[  122.862802] mdio_bus ff0c0000.ethernet-ffffffff: Loop over the child nodes and register a phy_device for each phy
[  122.966677] TI DP83867 ff0d0000.ethernet-ffffffff:03: attached PHY driver [TI DP83867] (mii_bus:phy_addr=ff0d0000.ethernet-ffffffff:03, irq=POLL)
[  122.979726] macb ff0c0000.ethernet eth3: Cadence GEM rev 0x50070106 at 0xff0c0000 irq 51 (00:0a:35:00:00:01)
# ifconfig eth1 192.168.6.11 up
[  171.501261] pps pps1: new PPS source ptp1
[  171.505282] macb ff0e0000.ethernet: gem-ptp-timer ptp clock registered.
[  171.512025] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
# ifconfig eth2 192.168.6.12 up
[  177.581496] pps pps2: new PPS source ptp2
[  177.585513] macb ff0b0000.ethernet: gem-ptp-timer ptp clock registered.
[  177.592248] IPv6: ADDRCONF(NETDEV_UP): eth2: link is not ready
# ifconfig eth2 192.168.6.12 up[  178.609509] TI DP83867 ff0d0000.ethernet-ffffffff:02: Master/Slave resolution failed, maybe conflicting manual settings?
# ifconfig eth3 192.168.6.13 up
[  185.950047] pps pps3: new PPS source ptp3
[  185.954061] macb ff0c0000.ethernet: gem-ptp-timer ptp clock registered.
[  185.960796] IPv6: ADDRCONF(NETDEV_UP): eth3: link is not ready
# [  186.961469] TI DP83867 ff0d0000.ethernet-ffffffff:03: Master/Slave resolution failed, maybe conflicting manual settings?

 

Here is the snippet of code where this is printed. I'm not sure what the error quite refers to but the GEM is not able to establish the communication with the phy prior to the LPA_1000MSFAIL timeout. Could this be a problem with the physical SGMII traces on the board itself? (we're implementing the zynqmp on a custom board.) 

The error refers to a possible conflict with the manual configuration. Which configuration is this referring to? The device tree? 

		if (phydev->supported & (SUPPORTED_1000baseT_Half
					| SUPPORTED_1000baseT_Full)) {
			lpagb = phy_read(phydev, MII_STAT1000);
			if (lpagb < 0)
				return lpagb;

			adv = phy_read(phydev, MII_CTRL1000);
			if (adv < 0)
				return adv;

			if (lpagb & LPA_1000MSFAIL) {
				if (adv & CTL1000_ENABLE_MASTER)
					phydev_err(phydev, "Master/Slave resolution failed, maybe conflicting manual settings?\n");
				else
					phydev_err(phydev, "Master/Slave resolution failed\n");
				return -ENOLINK;
			}

			phydev->lp_advertising =
				mii_stat1000_to_ethtool_lpa_t(lpagb);
			common_adv_gb = lpagb & adv << 2;
		}

ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:00:02
          inet addr:192.168.6.10  Bcast:192.168.6.255  Mask:255.255.255.0
          inet6 addr: fe80::20a:35ff:fe00:2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:91 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9232 (9.0 KiB)  TX bytes:1446 (1.4 KiB)
          Interrupt:30

eth1      Link encap:Ethernet  HWaddr 00:0A:35:00:00:03
          inet addr:192.168.6.11  Bcast:192.168.6.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:49

eth2      Link encap:Ethernet  HWaddr 00:0A:35:00:22:01
          inet addr:192.168.6.12  Bcast:192.168.6.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:50

eth3      Link encap:Ethernet  HWaddr 00:0A:35:00:00:01
          inet addr:192.168.6.13  Bcast:192.168.6.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:51

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

Can anyone see an issue with the device tree setup? Or have a suggestion of what might be possibly wrong? Thanks! 

0 Kudos
2 Replies
Moderator
Moderator
115 Views
Registered: ‎09-12-2007

Re: Issue enabling SGMII ethernet in Linux (master/slave resolution failed)

What version of the petalinux/linux are you using. I ask as  the is-internal-pcspma;  is only needed for an old patch that is no longer needed if you are using 2019.1.

It looks like it is struggling to register the PHY 2 and 3

# ifconfig eth2 192.168.6.12 up[  178.609509] TI DP83867 ff0d0000.ethernet-ffffffff:02: Master/Slave resolution failed, maybe conflicting manual settings?

TI DP83867 ff0d0000.ethernet-ffffffff:03: Master/Slave resolution failed, maybe conflicting manual settings?

It can read the PHY ID at PHY registers; 0x2 and 0x3 as it can find the DP83867. However, it is stuggling with the capabilities

https://github.com/Xilinx/linux-xlnx/blob/8807ecf79df2330d273b65e4a655d7f19a04aef8/include/uapi/linux/mii.h

mii.PNG

 

To debug, you should read these PHY registers 0x9, and 0xa

You can read these PHY registers manually. You can do this over devmem over the phy management register:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/145031176/Reading+PHY+registers+over+MDIO+via+the+PHY+Management+GEM+Register

For example, you have the MDIO on GEM2 (0xff0d0034)

To do a read, we need to give the PHY address, and the PHY Register

0110<phy addr><phy reg>100000000000000000

To read phy reg 0x9 at phy addr 0x2

  • 0110<00010><01001>100000000000000000
  • 0110 0001 0010 0110 0000 0000 0000 0000
  • devmem 0xff0d0034 32 0x61260000
  • devmem 0xff0d0034

To read phy reg 0xa at phy addr 0x2

  • 0110<00010><01010>100000000000000000
  • 0110 0001 0010 1010 0000000000000000
  • devmem 0xff0d0034 32 0x612a0000
  • devmem 0xff0d0034

To read phy reg 0x9 at phy addr 0x3

  • 0110<00011><01001>100000000000000000
  • 0110 0001 1010 0110 0000 0000 0000 0000
  • devmem 0xff0d0034 32 0x61a60000
  • devmem 0xff0d0034

To read phy reg 0xa at phy addr 0x3

  • 0110<00011><01010>100000000000000000
  • 0110 0001 1010 1010 0000000000000000
  • devmem 0xff0d0034 32 0x61aa0000
  • devmem 0xff0d0034

Thne check this against your PHY datasheet, and share here too and I can take a look

 

 

 

 

 

 

 

0 Kudos
Participant tkato@poc.com
Participant
93 Views
Registered: ‎09-06-2019

Re: Issue enabling SGMII ethernet in Linux (master/slave resolution failed)

Thanks for the detailed reply!

We have our buildroot project setup to compile 2019.1 so I'll go ahead and take out the is-internal-pcspma property.

I've attempted to use devmem but I don't think I'm getting proper results. Reads to any register on either PHY return the same value.

Here are the results of the devmem commands to 0x2 and 0x3 (after bringing down each link using ifconfig down as instructed in the wiki):

To read phy reg 0x9 at phy addr 0x2

0110<00010><01001>100000000000000000
0110 0001 0010 0110 0000 0000 0000 0000
devmem 0xff0d0034 32 0x61260000
devmem 0xff0d0034
0x6127FFFF

To read phy reg 0xa at phy addr 0x2

0110<00010><01010>100000000000000000
0110 0001 0010 1010 0000000000000000
devmem 0xff0d0034 32 0x612a0000
devmem 0xff0d0034
0x612BFFFF

To read phy reg 0x9 at phy addr 0x3

0110<00011><01001>100000000000000000
0110 0001 1010 0110 0000 0000 0000 0000
devmem 0xff0d0034 32 0x61a60000
devmem 0xff0d0034
0x61a7ffff

To read phy reg 0xa at phy addr 0x3

0110<00011><01010>100000000000000000
0110 0001 1010 1010 0000000000000000
devmem 0xff0d0034 32 0x61aa0000
devmem 0xff0d0034
0x61abffff

 

Here are the results of the devmem commands to 0x2 and 0x3 (after bringing up each link using ifconfig up):

To read phy reg 0x9 at phy addr 0x2

0110<00010><01001>100000000000000000
0110 0001 0010 0110 0000 0000 0000 0000
devmem 0xff0d0034 32 0x61260000
devmem 0xff0d0034
> 0x601201E1

To read phy reg 0xa at phy addr 0x2

0110<00010><01010>100000000000000000
0110 0001 0010 1010 0000000000000000
devmem 0xff0d0034 32 0x612a0000
devmem 0xff0d0034
> 0x601201E1

To read phy reg 0x9 at phy addr 0x3

0110<00011><01001>100000000000000000
0110 0001 1010 0110 0000 0000 0000 0000
devmem 0xff0d0034 32 0x61a60000
devmem 0xff0d0034
> 0x601201E1

To read phy reg 0xa at phy addr 0x3

0110<00011><01010>100000000000000000
0110 0001 1010 1010 0000000000000000
devmem 0xff0d0034 32 0x61aa0000
devmem 0xff0d0034
> 0x601201E1

I would have at least expected to get back the upper 16-bits to match the original command looking at this at the network_configuration register:Capture.PNG

 

 

 

 

 

 

 

0 Kudos