Second Ethernet

Ok, we have set LAN8720AI phy address to 1. But the problem is linux can’t find PHY of eth1.

[   19.923786] Generic PHY 20b4000.ethernet-1:02: attached PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet-1:02, irq=POLL)
[   20.166711] fec 2188000.ethernet eth1: Unable to connect to phy

But using phytool I can read it correctly:

phytool eth0/0

ieee-phy: id:0x00221513

   ieee-phy: reg:BMCR(0x00) val:0x3000
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          100-half

   ieee-phy: reg:BMSR(0x01) val:0x786d
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          -ext-status +aneg-complete -remote-fault +aneg-capable +link -jabber +ext-register

phytool eth0/1

ieee-phy: id:0x0007c0f1

   ieee-phy: reg:BMCR(0x00) val:0x3100
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          100-full

   ieee-phy: reg:BMSR(0x01) val:0x7829
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          -ext-status +aneg-complete -remote-fault +aneg-capable -link -jabber +ext-register

phytool eth0/2

ieee-phy: id:0x00221513

   ieee-phy: reg:BMCR(0x00) val:0x3000
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          100-half

   ieee-phy: reg:BMSR(0x01) val:0x786d
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          -ext-status +aneg-complete -remote-fault +aneg-capable +link -jabber +ext-register

We have 3.3v line reset logic and when we disconnect 3.3v (it disconnects LAN8720AI PHY). phytool doesn’t find LAN8720AI on address 1. So PHY is address is set correct.

phytool print eth0/0

ieee-phy: id:0x00221513

   ieee-phy: reg:BMCR(0x00) val:0x3000
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          100-half

   ieee-phy: reg:BMSR(0x01) val:0x786d
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          -ext-status +aneg-complete -remote-fault +aneg-capable +link -jabber +ext-register

phytool print eth0/1

ieee-phy: id:0xffffffff

   ieee-phy: reg:BMCR(0x00) val:0xffff
      flags:          +reset +loopback +aneg-enable +power-down +isolate +aneg-restart +collision-test
      speed:          1000-full

   ieee-phy: reg:BMSR(0x01) val:0xffff
      capabilities:   +100-b4 +100-f +100-h +10-f +10-h +100-t2-f +100-t2-h
      flags:          +ext-status +aneg-complete +remote-fault +aneg-capable +link +jabber +ext-register

phytool print eth0/2

ieee-phy: id:0x00221513

   ieee-phy: reg:BMCR(0x00) val:0x3000
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          100-half

   ieee-phy: reg:BMSR(0x01) val:0x786d
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          -ext-status +aneg-complete -remote-fault +aneg-capable +link -jabber +ext-register

I’ll now dig into kernel drivers to find out how it tries to find phy. But as you can see 0 address is used as broadcast and we can’t use 0 address when we also use KSZ8041TL/FTL/MLL PHY that is integrated in imx6ull SOM. The problem now is linux can’t find LAN8720AI on address 1, but it’s working and readable. That is strange.

Ok, seems solved. After adding debug to of_mdio.c I have noticed that search of phy address 1 is OK, but phy is not answering, also at the about the same time LEDS of phy turns off.

ethernet pins for both interfaces were muxed in fec1 and fec2 nodes. So I thought maybe they get reseted at the same time as kernel is searching for phy.

So I moved pinmuxing for enet1 and enet2 to iomuxc node and that solved the problem, now both interfaces works as expeced.

Here is working dts

&fec1 {
	phy-mode = "rmii";
	phy-handle = <&ethphy0>;
	phy-supply = <&reg_eth_phy>;
	status = "okay";
};

/* eth0 (internal) interface */
&fec2 {
	phy-mode = "rmii";
	phy-handle = <&ethphy1>;
	phy-supply = <&reg_eth_phy>;
	status = "okay";

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

		ethphy0: ethernet-phy@1 {
			compatible = "ethernet-phy-ieee802.3-c22";
			max-speed = <100>;
			reg = <1>;
			status = "okay";
		};

		ethphy1: ethernet-phy@2 {
			compatible = "ethernet-phy-ieee802.3-c22";
			max-speed = <100>;
			reg = <2>;
			status = "okay";
		};
	};
};

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <
		&pinctrl_enet1
	>;

	imx6ull-colibri {
		/* ethernet 1 (eth1) pinctrl_enet1 */
		pinctrl_enet1: enet1-grp {
			fsl,pins = <
				MX6UL_PAD_ENET1_RX_EN__ENET1_RX_EN	0x1b0b0	/* SODIMM 178 */
				MX6UL_PAD_ENET1_RX_ER__ENET1_RX_ER	0x1b0b0	/* SODIMM 104 */
				MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00	0x1b0b0	/* SODIMM 55  */
				MX6UL_PAD_ENET1_RX_DATA1__ENET1_RDATA01	0x1b0b0	/* SODIMM 63  */
				MX6UL_PAD_ENET1_TX_EN__ENET1_TX_EN	0x1b0b0	/* SODIMM 30  */
				MX6UL_PAD_ENET1_TX_DATA0__ENET1_TDATA00	0x1b0b0	/* SODIMM 188 */
				MX6UL_PAD_ENET1_TX_DATA1__ENET1_TDATA01	0x1b0b0	/* SODIMM 73  */
				MX6UL_PAD_ENET1_TX_CLK__ENET1_REF_CLK1	0x4001b031	/* SODIMM 67  */
			>;
		};
	};
};

Hi @tomasvilda ,

Thanks a lot for sharing your results!

Best regards,
Daniel Morais