Why my mt7621 does not have eth1?

I'm adapting a board with a CPU of mt7621, using openwrt 22.03.4.

The ethernet dts are as follows:

&ethernet {
        status = "okay";

        gmac0: mac@0 {
                compatible = "mediatek,eth-mac";
                reg = <0>;
                phy-mode = "rgmii";

                nvmem-cells = <&macaddr_factory_e000>;
                nvmem-cell-names = "mac-address";

                fixed-link {
                        speed = <1000>;
                        full-duplex;
                        pause;
                };
        };

        gmac1: mac@1 {
                compatible = "mediatek,eth-mac";
                reg = <1>;
                phy-mode = "rgmii-rxid";

                nvmem-cells = <&macaddr_factory_e006>;
                nvmem-cell-names = "mac-address";

                fixed-link {
                        speed = <1000>;
                        full-duplex;
                        pause;
                };
        };
};

&switch0 {
        status = "okay";

        ports {
                port@0 {
                        status = "okay";
                        //label = "wan";
                        ethernet = <&gmac0>;
                };

                port@1 {
                        status = "okay";
                        label = "lan1";
                };

                port@2 {
                        status = "okay";
                        label = "lan2";
                };

                port@3 {
                        status = "okay";
                        label = "lan3";
                };

                port@4 {
                        status = "okay";
                        label = "lan4";
                };


                port@6 {
                        status = "okay";
                        reg = <6>;
                        label = "cpu";
                        ethernet = <&gmac1>;
                        phy-mode = "rgmii";

                        fixed-link {
                                speed = <1000>;
                                full-duplex;
                                pause;
                        };
                };
        };
};

Search dmesg eth message, it's print eth0 only:

# dmesg | fgrep eth
[    0.885084] mtk_soc_eth 1e100000.ethernet: generated random MAC address 3e:43:db:58:91:a4
[    0.894114] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 24
[   13.768922] usbcore: registered new interface driver cdc_ether

The system missing eth1:

# ll /sys/class/net/*
lrwxrwxrwx    1 root     root             0 Oct 25 16:45 /sys/class/net/erspan0 -> ../../devices/virtual/net/erspan0/
lrwxrwxrwx    1 root     root             0 Jan  1  1970 /sys/class/net/eth0 -> ../../devices/platform/1e100000.ethernet/net/eth0/
lrwxrwxrwx    1 root     root             0 Oct 25 16:45 /sys/class/net/gre0 -> ../../devices/virtual/net/gre0/
lrwxrwxrwx    1 root     root             0 Oct 25 16:45 /sys/class/net/gretap0 -> ../../devices/virtual/net/gretap0/
lrwxrwxrwx    1 root     root             0 Jan  1  1970 /sys/class/net/lo -> ../../devices/virtual/net/lo/
lrwxrwxrwx    1 root     root             0 Oct 25 16:45 /sys/class/net/tunl0 -> ../../devices/virtual/net/tunl0/
lrwxrwxrwx    1 root     root             0 Oct 25 16:55 /sys/class/net/wwan0 -> ../../devices/platform/1e1c0000.xhci/usb1/1-1/1-1:1.4/net/wwan0/

Run ip command, missing eth1:

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e2:b9:cf:0b:e8:a7 brd ff:ff:ff:ff:ff:ff
3: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
4: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN qlen 1000
    link/gre 0.0.0.0 brd 0.0.0.0
5: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
6: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

Is there something missing in my dts config?

Looked at the old system and the expectation was that there was eth1:

# ll /sys/class/net/*
lrwxrwxrwx    1 root     root           0 Jan  1  1970 /sys/class/net/eth0 -> ../../devices/platform/1e100000.ethernet/net/eth0
lrwxrwxrwx    1 root     root           0 Jan  1  1970 /sys/class/net/eth1 -> ../../devices/platform/1e100000.ethernet/net/eth1
lrwxrwxrwx    1 root     root           0 Jan  1  1970 /sys/class/net/gre0 -> ../../devices/virtual/net/gre0
lrwxrwxrwx    1 root     root           0 Jan  1  1970 /sys/class/net/gretap0 -> ../../devices/virtual/net/gretap0
lrwxrwxrwx    1 root     root           0 Jan  1  1970 /sys/class/net/lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root           0 Oct 25 17:11 /sys/class/net/wwan0 -> ../../devices/platform/1e1c0000.usb/usb1/1-1/1-1:1.4/net/wwan0

There are old system eth0 and eth1 both exist:

#cat /sys/devices/platform/1e100000.ethernet/uevent
DRIVER=mtk_soc_eth
OF_NAME=ethernet
OF_FULLNAME=/ethernet@1e100000
OF_COMPATIBLE_0=mediatek,mt7621-eth
OF_COMPATIBLE_1=syscon
OF_COMPATIBLE_N=2
MODALIAS=of:NethernetT<NULL>Cmediatek,mt7621-ethCsyscon

There are new system, eth0 only:

# cat /sys/devices/platform/1e100000.ethernet/uevent
DRIVER=mtk_soc_eth
OF_NAME=ethernet
OF_FULLNAME=/ethernet@1e100000
OF_COMPATIBLE_0=mediatek,mt7621-eth
OF_COMPATIBLE_N=1
MODALIAS=of:NethernetT(null)Cmediatek,mt7621-et

It looks different:

OF_COMPATIBLE_1=syscon

Is dts missing syscon?

1 Like

Only gmac1 can be connected to phy0 or phy4 of internal mt7530 switch (gmac0 always connected to switch port6). Example for connection to port0:phy0 and for port4:phy4. In both case label property define network device name (eth1 if you want).

1 Like

Thank you all.

After I added gmac1 to the dts, eth1 appeared.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.