cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
183 Views
Registered: ‎03-29-2019

Zynq dual ethernet configuration (MIO+EMIO) in petalinux

Hi,
I am working in petalinux and trying to activate both ethernet interfaces on my Zynq device: one with MIO+MDIO and another with EMIO+MDIO+GMII_to_RGMII_IP. First version of the project with only MIO-ethernet (ethernet0) works well with the next configuration in "system-conf.dtsi":

&gem0 {
	phy-handle = <&phy0>
	phy-mode = "rgmii-id";
	mdio {
   		#address-cells = <1>;
   		#size-cells = <0>;
		phy0: phy@7 {
			device_type = "ethernet-phy";
			reg = <0x7>;
		};
	};
};

But after activating EMIO-ethernet (ethernet1) in the Zynq IP core and adding GMII_to_RGMII_IP core into the block design, with the code of this solution AR# 61117 i.e. with the strings below in "system-conf.dtsi", build process stops with error:

&gem0 {
	phy-handle = <&phy0>;
	phy-mode = "rgmii-id";
	mdio {
   		#address-cells = <1>;
   		#size-cells = <0>;
		phy0: phy@7 {
			device_type = "ethernet-phy";
			reg = <0x7>;
		};
	};
};

&gem1 {
	phy-handle = <&phy1>;
	local-mac-address = [00 0a 35 00 22 02]; 
 	gmii2rgmii-phy-handle = <&gmii_to_rgmii_0>;
	ps7_ethernet_1: mdio {
  		#address-cells = <1>;
  		#size-cells = <0>;
		phy1: phy@1 {
			device_type = "ethernet-phy";
			reg = <0x1>;
		};
 		gmii_to_rgmii_0: gmii_to_rgmii_0@8 {
   			device_type = "ethernet-phy";
			phy-handle = <&phy1>;
			reg = <8>;
		};
	};
};

The error is: "| system-top.dtb: ERROR (duplicate_label): Duplicate label 'phy0' on /amba/ethernet@e000c000/mdio/phy@0 and /amba/ethernet@e000b000/mdio/phy@7".

If i swap phy0 and phy1 in gem0 and gem1, error will be: "| system-top.dtb: ERROR (duplicate_label): Duplicate label 'phy0' on /amba/ethernet@e000c000/mdio/phy@1 and /amba/ethernet@e000c000/mdio/phy@0" and then will change "phy@1" to "phy@0" in &gem1, petalinux will build successful but without eth1, but eth0 works. Boot log attached to this message, but in the beginning there is this message:

 

Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000ZYNQ GEM: e000c000, phyaddr 0, interface gmii
Could not get PHY for eth1: addr 0


Strings about &gem0 and &gem1 in pcw.dtsi are:

&gem0 {
	enet-reset = <&gpio0 30 0>;
	phy-mode = "rgmii-id";
	status = "okay";
	xlnx,ptp-enet-clock = <0x69f6bcb>;
};
&gem1 {
	phy-handle = <&phy0>;
	phy-mode = "gmii";
	status = "okay";
	xlnx,ptp-enet-clock = <0x69f6bcb>;
	ps7_ethernet_1_mdio: mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		phy0: phy@0 {
			device_type = "ethernet-phy";
			reg = <0>;
		};
		gmii_to_rgmii_0: gmii_to_rgmii_0@8 {
			compatible = "xlnx,gmii-to-rgmii-1.0";
			phy-handle = <&phy0>;
			reg = <8>;
		};
	};
};

We can find here phy0 in &gem1.
Strings about &gem0 and &gem1 in system-conf.dtsi are:

&gem0 {
	local-mac-address = [00 0a 35 00 22 01];
};

Strings about &gem0 and &gem1 in zynq-7000.dtsi are:

		gem0: ethernet@e000b000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000b000 0x1000>;
			status = "disabled";
			interrupts = <0 22 4>;
			clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		gem1: ethernet@e000c000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000c000 0x1000>;
			status = "disabled";
			interrupts = <0 45 4>;
			clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <1>;
			#size-cells = <0>;
		};

Strings about &gem0 and &gem1 in zedboard.dtsi are:

&gem0 {
	phy-handle = <&ethernet_phy>;
	ethernet_phy: ethernet-phy@0 {
		reg = <0>;
		device_type = "ethernet-phy";
	};
};

How to correct device tree to build project with working ethernet interfaces? 

0 Kudos
3 Replies
Highlighted
Moderator
Moderator
137 Views
Registered: ‎12-04-2016

Hi @crepe 

Try not to add the phy0 label or phy details in the GEM0 node, as I think phy0 label is created by petalinux somwhere and is erroring out.

If you can share your HDF, I will try to see if I can fix this error

 

Best Regards

Shabbir

0 Kudos
Highlighted
Visitor
Visitor
121 Views
Registered: ‎03-29-2019

Hi,@shabbirk!
Thanks for quick response. I deleted all mentioning of phy in "system-user.dtsi" &gem0 and petalinux now builds. Here is "system-user.dtsi":

 

&gem0 {
	phy-mode = "rgmii-id";
	xlnx,has-mdio = <0x1>;
	status = "okay";
	mdio {
   		#address-cells = <1>;
   		#size-cells = <0>;
	};
};

&gem1 {
	phy-handle = <&phy1>;
	local-mac-address = [00 0a 35 00 22 02]; 
	status = "okay";
 	phy-mode = "gmii";
	xlnx,has-mdio = <0x1>;
 	gmii2rgmii-phy-handle = <&gmii_to_rgmii_0>;
	ps7_ethernet_1_mdio: mdio {
  		#address-cells = <1>;
  		#size-cells = <0>;
		phy1: phy@7 {
			device_type = "ethernet-phy";
			reg = <7>;
		};
 		gmii_to_rgmii_0: gmii_to_rgmii_0@8 {
   			device_type = "ethernet-phy";
			phy-handle = <&phy1>;
			reg = <8>;
		};
	};
};

 

But as i can see from boot log, something is wrong. Some mentioning of them from the log:

 

...
Net:   ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id
eth0: ethernet@e000b000ZYNQ GEM: e000c000, phyaddr 7, interface gmii

Warning: ethernet@e000c000 (eth1) using random MAC address - 92:c2:88:7d:f4:79
, eth1: ethernet@e000c000
...
Configuring network interfaces... Cannot find device "eth0"
Cannot find device "eth0"
Cannot find device "eth0"

 

If convert result .dtb file to .dts (with the command "dtc -I dtb -O dts -o dump.dts images/linux/system.dtb"), here is output about ethernets:

 

		ethernet@e000b000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000b000 0x1000>;
			status = "okay";
			interrupts = <0x0 0x16 0x4>;
			clocks = <0x1 0x1e 0x1 0x1e 0x1 0xd>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			phy-handle = <0x5>;
			enet-reset = <0x6 0x1e 0x0>;
			phy-mode = "rgmii-id";
			xlnx,ptp-enet-clock = <0x69f6bcb>;
			local-mac-address = [00 0a 35 00 22 01];

			ethernet-phy@0 {
				reg = <0x0>;
				device_type = "ethernet-phy";
				linux,phandle = <0x5>;
				phandle = <0x5>;
			};

			mdio {
				#address-cells = <0x1>;
				#size-cells = <0x0>;
			};
		};

		ethernet@e000c000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000c000 0x1000>;
			status = "okay";
			interrupts = <0x0 0x2d 0x4>;
			clocks = <0x1 0x1f 0x1 0x1f 0x1 0xe>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			phy-handle = <0x7>;
			phy-mode = "gmii";
			xlnx,ptp-enet-clock = <0x69f6bcb>;
			local-mac-address = [00 0a 35 00 22 02];
			gmii2rgmii-phy-handle = <0x8>;

			mdio {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				phy@0 {
					device_type = "ethernet-phy";
					reg = <0x0>;
				};

				gmii_to_rgmii_0@8 {
					compatible = "xlnx,gmii-to-rgmii-1.0";
					phy-handle = <0x7>;
					reg = <0x8>;
					device_type = "ethernet-phy";
					linux,phandle = <0x8>;
					phandle = <0x8>;
				};

				phy@7 {
					device_type = "ethernet-phy";
					reg = <0x7>;
					linux,phandle = <0x7>;
					phandle = <0x7>;
				};
			};
		};

 

Seems like phy@0 with address 0 inserts anyway into &gem1 from pcw.dtsi:

 

				phy@0 {
					device_type = "ethernet-phy";
					reg = <0x0>;
				};

 

.hdf of the project and boot log after changing "system-user.dtsi" attached to this reply.

Best regards,
Crepe.

0 Kudos
Highlighted
Visitor
Visitor
69 Views
Registered: ‎03-29-2019

A little update: i changed my "system-user.dtsi" to

/delete-node/ &phy0;

&gem0 {	
	phy-handle = <&phy0>;
	local-mac-address = [00 0a 35 00 22 01];
	phy-mode = "rgmii-id";
	status = "okay";
	mdio {
   		#address-cells = <1>;
   		#size-cells = <0>;
		phy0: phy@7 {
			device_type = "ethernet-phy";
			reg = <7>;
		};
	};
};

&gem1 {
	phy-handle = <&phy1>;
	local-mac-address = [00 0a 35 00 22 02];
	status = "okay";
 	gmii2rgmii-phy-handle = <&gmii_to_rgmii_0>;
	ps7_ethernet_1_mdio: mdio {
  		#address-cells = <1>;
  		#size-cells = <0>;		
		phy1: phy@1 {
			device_type = "ethernet-phy";
			reg = <1>;
		};
 		gmii_to_rgmii_0: gmii_to_rgmii_0@8 {
			compatible = "xlnx,gmii-to-rgmii-1.0";
   			device_type = "ethernet-phy";
			phy-handle = <&phy1>;
			reg = <8>;
		};
	};
};

So /delete-node/ &phy0; deletes in pcw.dtsi the next block, so i could use phy0 without problem (why are these lines always being generated automatically?).

phy0: phy@0 { 
device_type = "ethernet-phy"; 
reg = <0>;
};

 And then petalinux is building successfully. So now there are several questions:
1. Where i can find phyaddr (1 or 5 or 6 - not work) that need to be attached to &phy1 ?  

phy1: phy@1 {
device_type = "ethernet-phy";
reg = <1>;
};

For eth0 (&phy0) it is 7 (and it works with it) but i didn't find information about &phy1.

Net: ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000 

ZYNQ GEM: e000c000, phyaddr 1, interface gmii
Could not get PHY for eth1: addr 1

2. What's wrong with gmii_to_rgdmii drivers because i get this message while booting (probably it appears because eth1 is not work): xgmiitorgmii e000c000.ethernet-ffffffff:08: Couldn't find phydev?

libphy: Fixed MDIO Bus: probed
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (00:0a:35:00:22:01)
Micrel KSZ9031 Gigabit PHY e000b000.ethernet-ffffffff:07: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:07, irq=POLL)
libphy: MACB_mii_bus: probed
xgmiitorgmii e000c000.ethernet-ffffffff:08: Couldn't find phydev
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.

  3. In the result .dtb file with device-tree there are some strings about ethernet-phy@0 which loads into ethernet@e000b000 from zedboard.dtsi. Do i need delete them too or they are don't affect to anything?

ethernet@e000b000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000b000 0x1000>;
			status = "okay";
			interrupts = <0x0 0x16 0x4>;
			clocks = <0x1 0x1e 0x1 0x1e 0x1 0xd>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			phy-handle = <0x5>;
			enet-reset = <0x6 0x1e 0x0>;
			phy-mode = "rgmii-id";
			xlnx,ptp-enet-clock = <0x69f6bcb>;
			local-mac-address = [00 0a 35 00 22 01];

			ethernet-phy@0 {
				reg = <0x0>;
				device_type = "ethernet-phy";
			};

			mdio {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				phy@7 {
					device_type = "ethernet-phy";
					reg = <0x7>;
					linux,phandle = <0x5>;
					phandle = <0x5>;
				};
			};
		};

ethernet@e000c000 {
			compatible = "cdns,zynq-gem", "cdns,gem";
			reg = <0xe000c000 0x1000>;
			status = "okay";
			interrupts = <0x0 0x2d 0x4>;
			clocks = <0x1 0x1f 0x1 0x1f 0x1 0xe>;
			clock-names = "pclk", "hclk", "tx_clk";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			phy-handle = <0x7>;
			phy-mode = "gmii";
			xlnx,ptp-enet-clock = <0x69f6bcb>;
			local-mac-address = [00 0a 35 00 22 02];
			gmii2rgmii-phy-handle = <0x8>;

			mdio {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				gmii_to_rgmii_0@8 {
					compatible = "xlnx,gmii-to-rgmii-1.0";
					phy-handle = <0x7>;
					reg = <0x8>;
					device_type = "ethernet-phy";
					linux,phandle = <0x8>;
					phandle = <0x8>;
				};
0 Kudos