ramips: mt7621: fix Ubiquiti ER-X ports names and MAC addresses
authorDENG Qingfang <dengqf6@mail2.sysu.edu.cn>
Thu, 19 Mar 2020 11:33:27 +0000 (19:33 +0800)
committerChuanhong Guo <gch981213@gmail.com>
Sat, 4 Apr 2020 06:56:14 +0000 (14:56 +0800)
The name of each user port should be eth0..4, instead of lan1..4
and there is no WAN port. Rename them to match the official firmware.
To avoid conflict with the master port (gmac0), rename it to "dsa".

The official firmware assigns MAC address in this way:
eth0 = label mac
eth1 = label mac + 1
...
eth4 = label mac + 4

Since we have switched to DSA, it's possible to use different MAC for each port.

Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
target/linux/ramips/dts/mt7621_ubiquiti_edgerouterx.dtsi
target/linux/ramips/mt7621/base-files/etc/board.d/02_network

index 6fed4a0b7bfabf675d0d4863081ef0022c53a822..b10953f45ef47f2cb1530943ff94bd145b1ad17f 100644 (file)
 
 &gmac0 {
        mtd-mac-address = <&factory 0x22>;
+       label = "dsa";
 };
 
 &switch0 {
        ports {
                port@0 {
                        status = "okay";
-                       label = "wan";
-                       mtd-mac-address = <&factory 0x22>;
-                       mtd-mac-address-increment = <1>;
+                       label = "eth0";
                };
 
                port@1 {
                        status = "okay";
-                       label = "lan1";
+                       label = "eth1";
+                       mtd-mac-address = <&factory 0x22>;
+                       mtd-mac-address-increment = <1>;
                };
 
                port@2 {
                        status = "okay";
-                       label = "lan2";
+                       label = "eth2";
+                       mtd-mac-address = <&factory 0x22>;
+                       mtd-mac-address-increment = <2>;
                };
 
                port@3 {
                        status = "okay";
-                       label = "lan3";
+                       label = "eth3";
+                       mtd-mac-address = <&factory 0x22>;
+                       mtd-mac-address-increment = <3>;
                };
 
                port@4 {
                        status = "okay";
-                       label = "lan4";
+                       label = "eth4";
+                       mtd-mac-address = <&factory 0x22>;
+                       mtd-mac-address-increment = <4>;
                };
        };
 };
index 6205fab3010118f5022aa54d459d03a4cd3eec47..e2a8a9392d98c513b9d9922320b6512203217efc 100755 (executable)
@@ -39,6 +39,10 @@ ramips_setup_interfaces()
        ubnt,unifi-nanohd)
                ucidef_set_interface_lan "lan"
                ;;
+       ubiquiti,edgerouterx|\
+       ubiquiti,edgerouterx-sfp)
+               ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4"
+               ;;
        *)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
                ;;