Configure second fec apalis imx8

Hello,

For some time now i am trying to configure an external switch, LAN9303i, over MDIO and RMII.

HW/SW
Baseboard: custom
External Switch: LAN9303i in RMII
SoM: Apalis iMX8-QM
BSP: torizon 5.7.0 with DSA and LAN9303 driver enabled

DeviceTree Configuration

fec2

&fec2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_fec2_gpios>;
	//local-mac-address = [00 14 2D 76 D1 CA];
	
	phy-supply = <&reg_ext_rgmii>;
	phy-handle = <&switch>;
	phy-mode = "rmii";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
				
		switch: switch-phy@0 {
			compatible = "smsc,lan9303-mdio";
			reg = <0>;

			reset-gpios = <&lsio_gpio2 23 GPIO_ACTIVE_LOW>;
			reset-duration = <100>;

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

				port@0 {
					reg = <0>;
					label = "cpu";
					ethernet = <&fec2>;
				};

				port@1 { /* external port 1 */
					reg = <1>;
					label = "lan1";
				};

				port@2 { /* external port 2 */
					reg = <2>;
					label = "lan2";
				};
			};
		};
	};
};

PinMuxing

pinctrl_fec2_gpios: fec2gpiosgrp {
			fsl,pins = <
				/* Voltage level */
				IMX8QM_COMP_CTL_GPIO_1V8_3V3_ENET_ENETA_PAD	0x000014a0
				/* MDIO interface */
				IMX8QM_ENET1_MDC_CONN_ENET1_MDC			0x06000020
				IMX8QM_ENET1_MDIO_CONN_ENET1_MDIO		0x06000020
				/* clock */
				/*IMX8QM_ENET1_REFCLK_125M_25M_CONN_ENET1_REFCLK_125M_25M	0x06000020*/
				IMX8QM_ENET1_RGMII_TXC_CONN_ENET1_RCLK50M_OUT		0x06000020
				/* RX */
				IMX8QM_ENET1_RGMII_RX_CTL_CONN_ENET1_RGMII_RX_CTL	0x06000020
				IMX8QM_ENET1_RGMII_RXD0_CONN_ENET1_RGMII_RXD0		0x06000020
				IMX8QM_ENET1_RGMII_RXD1_CONN_ENET1_RGMII_RXD1		0x06000020
				/* IMX8QM_ENET1_RGMII_RXD2_LSIO_GPIO6_IO20		0x00000021*/
				/* IMX8QM_ENET1_RGMII_RXD3_LSIO_GPIO6_IO21		0x00000021*/
				/* TX */
				IMX8QM_ENET1_RGMII_TX_CTL_CONN_ENET1_RGMII_TX_CTL	0x06000020
				IMX8QM_ENET1_RGMII_TXD0_CONN_ENET1_RGMII_TXD0		0x06000020
				IMX8QM_ENET1_RGMII_TXD1_CONN_ENET1_RGMII_TXD1		0x06000020
				/*IMX8QM_ENET1_RGMII_TXD2_LSIO_GPIO6_IO14		0x00000021*/
				/*Reset*/
				IMX8QM_ESAI0_FST_LSIO_GPIO2_IO23		0x00000021
			>;
		};

reg_rgmii

reg_ext_rgmii: regulator-ext-rgmii {
			compatible = "regulator-fixed";
			regulator-name = "VDD_EXT_RGMII (LDO1)";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			power-domains = <&pd IMX_SC_R_BOARD_R1>;

			regulator-state-mem {
				regulator-off-in-suspend;
			};
		};

dmesg - fec2

[    1.098101] fec 5b050000.ethernet: Adding to iommu group 0
[    1.437214] fec 5b050000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[    1.444045] fec 5b050000.ethernet: Using random MAC address: d2:9b:23:5a:c5:cf
[    1.445114] fec: probe of 5b050000.ethernet failed with error -2

Connections to IC

Connections to SoM

The first problem i am facing is that i have no communication on the MDIO bus.
Did i configure something wrong?
Do i miss something?

Thanks

Hello c.gantner,

could you check with a scope if you see a clock signal on the MDIO Interface?
The pull down resistor should be removed.

Best regards,
Matthias

Hello Matthias,

I tested and no movement. I did not have any pull down resistor on the clock line.

After this i desoldered the inline 0R resistor and still have no movement.
After powerup the pin on the SoM side is pulled high, after some time it falls low and stays there.

Best regards,
Cristian

please send you devise tree file.