Add FEC2 in i.MX7D

hi experts

i asked a related question before and got some help and saw tens of times
and thought i can add fec2 but i failed

when i changed dts file ( see below) , fec1 ,fec2 could n’t get connect phy

here is log


[  OK  ] Started Permit User Sessions.
[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttymxc0.
[    8.308979] Generic PHY 30bf0000.ethernet-1:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=30bf0000.ethernet-1:01, irq=POLL)
[  OK  ] Reached target Login Prompts.
   **8.328535] fec 30be0000.ethernet eth1: Unable to connect to phy
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
[  OK  ] Reached target Multi-User System.

and i wonder fec1 in devicetree was registered as eth0 where could i change the loading order of fec1 and fec2

the chage i made in devicetree


&fec2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet2>;
	clocks = <&clks IMX7D_ENET2_IPG_ROOT_CLK>,
			 <&clks IMX7D_ENET_AXI_ROOT_CLK>,
			 <&clks IMX7D_ENET2_TIME_ROOT_CLK>,
			 <&clks IMX7D_PLL_ENET_MAIN_50M_CLK>;
	clock-names = "ipg", "ahb", "ptp", "enet_clk_ref";
	assigned-clocks = 	<&clks IMX7D_ENET2_TIME_ROOT_SRC>,
	       				<&clks IMX7D_ENET2_TIME_ROOT_CLK> ;
	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
	assigned-clock-rates = <0>, <100000000>;

	local-mac-address = [00 15 6c 10 20 30];

	phy-mode = "rmii";

	fsl.magic-packet;

	phy-handle = < &ethphy1>;
	status = "disabled";
	
	mdio {
		#address-cells = <1>;
		#size-cells = <0>;

		ethphy1: ethernet-phy@1 {
			compatible = "ethernet-phy-ieee802.3-c22";
			max-speed = <100>;
			micrel,led-mode = <0>;
			reg = <1>;
		};
	};

	
};
&fec2 {

	status = "okay";
} ;
&fec1 {

	status = "okay";
} ;





&iomux {

	pinctrl_enet2: enet2grp {
		fsl,pins = <
			MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL	0x73
			MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0	0x73
			MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1	    0x73
			MX7D_PAD_EPDC_SDCE1__ENET2_RX_ER		0x73

			MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL	0x73
			MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0	0x73
			MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1	0x73
			MX7D_PAD_EPDC_BDR0__CCM_ENET_REF_CLK2	0x73 
			MX7D_PAD_GPIO1_IO14__ENET2_MDIO			0x3
			MX7D_PAD_GPIO1_IO15__ENET2_MDC			0x3
		>;
	};

	};

thank you in advance

Hi @hyoungki , can you confirm the Linux kernel version you used and the device tree where you applied these changes?

Thanks a lot.
Alvaro.

hi alvaro.tx
i forgot to update my issue and i figured out what was the problem
i followed the kernel source ( 5.4-2.3.x-imx) and add exclusive flag in devicetree
but still linux uses fec1 as eth0 , i change the order in devicetree but it doesn’t work

and Linux uses the only one mac address from- u-boot
about mac address issue any hints will be of great help

thank you for yor interest

Hi @hyoungki , sorry for the late reply.

I would need to check on the FEC numbering, please wait a bit longer.

Please try with eth1addr for the second MAC address: Second ethernet MAC address - #8 by stefan.tx

Kind regards,
Alvaro.

Hi alvaro.tx

the mac address is exchanged when linux booted

from u-boot

eth1addr=00:14:2d:7c:19:91
ethaddr=00:14:2d:6c:19:90
fdt_addr_r=0x82000000

from linux ifconfig

eth0 Link encap:Ethernet HWaddr 00:14:2D:7C:19:91
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)

eth1 Link encap:Ethernet HWaddr 00:14:2D:6C:19:90
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)

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:80 errors:0 dropped:0 overruns:0 frame:0
TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6080 (5.9 KiB) TX bytes:6080 (5.9 KiB)

thank you

Thanks for the confirmation! We will update our documentation to reflect this.