Apalis iMX8QM External RGMII interface issue

Dear Support Team,

We are testing external RGMII interface on Apalis iMX8 V1.1B with latest 5.0 Ycoto Linux BSP 5.0.0+build.3(20201006), and found that when enable fec2 in device tree, the eth0 and eth1 assignment will exchange to eth0 for external RGMII interface and eth1 for internal on-board network, then this lead to both ports can’t connect to corresponding PHY chips, could you help check on this? and please find detailed device tree modification and dmesg log as below.
BTW, Also tested with Ycoto Linux multimedia image 202009 build 2 monthly release, the issue is same.

./ device tree modifcation

diff --git a/arch/arm64/boot/dts/freescale/imx8qm-apalis-eval.dtsi b/arch/arm64/boot/dts/freescale/imx8qm-apalis-eval.dtsi
    index 1f0de824031c..ffa90243f635 100644
    --- a/arch/arm64/boot/dts/freescale/imx8qm-apalis-eval.dtsi
    +++ b/arch/arm64/boot/dts/freescale/imx8qm-apalis-eval.dtsi
    @@ -179,6 +179,10 @@
     	status = "okay";
     };
     
    +&fec2 {
    +        status = "okay";
    +};
    +
     &flexcan1 {
     	status = "okay";
     };
    diff --git a/arch/arm64/boot/dts/freescale/imx8qm-apalis-v1.1.dtsi b/arch/arm64/boot/dts/freescale/imx8qm-apalis-v1.1.dtsi
    index 08bd086463db..09e05dbdf6cb 100644
    --- a/arch/arm64/boot/dts/freescale/imx8qm-apalis-v1.1.dtsi
    +++ b/arch/arm64/boot/dts/freescale/imx8qm-apalis-v1.1.dtsi
    @@ -338,6 +338,27 @@
     	};
     };
     
    +/* External RGMII interface PHY */
    +&fec2 {
    +        pinctrl-names = "default";
    +        pinctrl-0 = <&pinctrl_fec2>;
    +        fsl,magic-packet;
    +        fsl,rgmii_txc_dly;
    +        //local-mac-address = [00 14 2D 76 D1 CA];
    +        phy-handle = <&ethphy1>;
    +        phy-mode = "rgmii-rxid";
    +
    +        mdio {
    +                #address-cells = <1>;
    +                #size-cells = <0>;
    +
    +                ethphy1: ethernet-phy@1 {
    +                        compatible = "ethernet-phy-ieee802.3-c22";
    +                        reg = <1>;
    +                };
    +        };
    +};
    +
     /* Apalis CAN1 */
     &flexcan1 {
     	/* define the following property to disable CAN-FD mode */
    @@ -436,7 +457,7 @@
     &iomuxc {
     	pinctrl-names = "default";
     	pinctrl-0 = <&pinctrl_cam1_gpios>, <&pinctrl_dap1_gpios>,
    -		    <&pinctrl_esai0_gpios>, <&pinctrl_fec2_gpios>,
    +		    <&pinctrl_esai0_gpios>,
     		    <&pinctrl_gpio3>, <&pinctrl_gpio4>,
     		    <&pinctrl_gpio_usbh_oc_n>, <&pinctrl_lpuart1ctrl>,
     		    <&pinctrl_lvds0_i2c0_gpio>, <&pinctrl_lvds1_i2c0_gpios>,
    @@ -966,8 +987,6 @@
     			fsl,pins = <
     				IMX8QM_LVDS1_I2C1_SCL_DMA_UART3_TX		0x06000020
     				IMX8QM_LVDS1_I2C1_SDA_DMA_UART3_RX		0x06000020
    -				IMX8QM_ENET1_RGMII_TXD3_DMA_UART3_RTS_B		0x06000020
    -				IMX8QM_ENET1_RGMII_RXC_DMA_UART3_CTS_B		0x06000020
     			>;
     		};
     
    @@ -1119,6 +1138,27 @@
     			>;
     		};
     
    +                pinctrl_fec2: fec2grp {
    +                        fsl,pins = <
    +                                IMX8QM_COMP_CTL_GPIO_1V8_3V3_ENET_ENETA_PAD     0x000014a0
    +                                IMX8QM_ENET1_MDC_CONN_ENET1_MDC                 0x06000020
    +                                IMX8QM_ENET1_MDIO_CONN_ENET1_MDIO                       0x06000020
    +                                IMX8QM_ENET1_REFCLK_125M_25M_CONN_ENET1_REFCLK_125M_25M 0x06000020
    +                                IMX8QM_ENET1_RGMII_TX_CTL_CONN_ENET1_RGMII_TX_CTL       0x06000020
    +                                IMX8QM_ENET1_RGMII_TXC_CONN_ENET1_RGMII_TXC     0x06000020
    +                                IMX8QM_ENET1_RGMII_TXD0_CONN_ENET1_RGMII_TXD0   0x06000020
    +                                IMX8QM_ENET1_RGMII_TXD1_CONN_ENET1_RGMII_TXD1   0x06000020
    +                                IMX8QM_ENET1_RGMII_TXD2_CONN_ENET1_RGMII_TXD2   0x06000020
    +                                IMX8QM_ENET1_RGMII_TXD3_CONN_ENET1_RGMII_TXD3   0x06000020
    +                                IMX8QM_ENET1_RGMII_RXC_CONN_ENET1_RGMII_RXC     0x06000020
    +                                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_CONN_ENET1_RGMII_RXD2   0x06000020
    +                                IMX8QM_ENET1_RGMII_RXD3_CONN_ENET1_RGMII_RXD3   0x06000020
    +                        >;
    +                };
    +
     		/* On-module HDMI_CTRL */
     		pinctrl_hdmi_ctrl: hdmictrlgrp {
     			fsl,pins = <

Then after compiling and deploying the modified device tree file “imx8qm-apalis-v1.1-eval.dtb” to module, both interface eth0 and eth1 don’t work, dmesg as below:

root@apalis-imx8:~# dmesg |grep eth
[    0.000000] psci: probing for conduit method from DT.
[    1.879075] fec 5b040000.ethernet: Adding to iommu group 1
[    1.886019] fec 5b050000.ethernet: Adding to iommu group 1
[    1.896469] fec 5b050000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[    1.903280] fec 5b050000.ethernet: Using random MAC address: 56:48:36:68:ca:17
[    1.915585] mdio_bus 5b050000.ethernet-1: MDIO device at address 1 is missing.
[    1.923130] fec 5b050000.ethernet eth0: registered PHC device 0
[    2.934182] fec 5b040000.ethernet eth1: registered PHC device 1
[    6.960929] using random self ethernet address
[    6.966404] using random host ethernet address
[    7.441776] fec 5b050000.ethernet eth0: Unable to connect to phy
[    7.464425] fec 5b040000.ethernet eth1: Unable to connect to phy

And if disable any one inferface (fec1 or fec2) in device tree, then the other one works well. Also tried boddle mac address to both fec interface in device tree with “local-mac-address” parameter, but doesn’t work.

Thanks and Best Regards

Simon

Hi, be aware that the GRMII Interface of the IMX8QM is not 3.3volt compatible anymore.
NXP specified that interface now for 1.8 to 2.5 volt only.
you could technically switch it to 3.3volt but you will operate it out of spec.
We recommend operate it at 1.8 volt.

Best Regards,

Matthias

Hi Matthias,

sure, thanks for the reminding, but this is not the cause of the issue, you can easily reproduce the issue without acctually PHY chip connected with Apalis Eva board or Ioxra Board.

HI @hai.tx

I will have a closer look into this issue.

Best regards,
Jaski

Hi Jaski,

thanks for your reply, i have just tried add aliases as below in the file “imx8qm-apalis-eval.dtsi”, but after deploying, it persists exactly the same error as above.

#include <dt-bindings/pwm/pwm.h>

/ {
        aliases {
                ethernet0 = &fec1;
                ethernet1 = &fec2;
                rtc0 = &rtc_i2c;
                rtc1 = &rtc;
        };

        reg_usb_host_vbus: regulator-usb-host-vbus {
                regulator-name = "VCC USBH2(ABCD) / USBH(3|4)";
        };
};

Hi @jaski.tx

some updates here, after some testing, finally make the external RGMII fec2 node work, seems the phy-reset/interrupt parameters whthin &fec1 node lead to these issue, so to make the &fec2 work, either remove all these parameters from &fec1 node as below

-       phy-reset-duration = <10>;
-       phy-reset-gpios = <&lsio_gpio1 11 GPIO_ACTIVE_LOW>;

-      interrupt-parent = <&lsio_gpio1>;
-      interrupts = <29 IRQ_TYPE_LEVEL_LOW>;

Or add phy-reset parameters to &fec2 node in the same way, such as

+       phy-reset-duration = <10>;
+       phy-reset-gpios = <&lsio_gpio2 23 GPIO_ACTIVE_LOW>;