ramips: mt76x8: use flash location for wan_mac in 02_network
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sun, 8 Dec 2019 13:26:34 +0000 (14:26 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Thu, 12 Dec 2019 12:11:39 +0000 (13:11 +0100)
This uses the flash locations instead of eth0 MAC address to
calculate MAC address increments for WAN.

The change will make the MAC address setup of a particular device
more obvious and removes the dependency of 02_network on the eth0
initialization.

While at it, change the partition label for zyxel,keenetic-extra-ii
to factory to be consistent with node label and all the other devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
target/linux/ramips/mt76x8/base-files/etc/board.d/02_network

index 8b069d4370c6f9876cb4e76b491b02d824fa678c..f4d678e38ef4b33317928eb8de8eb3210caa4351 100644 (file)
                        };
 
                        factory: partition@40000 {
-                               label = "rf-eeprom";
+                               label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };
index f76af66f27e2ffed14f0f72dfb7a8ced1f707d5a..aeaf2969843b2a1d7c583482b47560b31aae5b4e 100755 (executable)
@@ -138,27 +138,10 @@ ramips_setup_macs()
                ;;
        duzun,dm06|\
        netgear,r6120|\
-       rakwireless,rak633|\
-       tplink,archer-c20-v4|\
-       tplink,archer-c50-v3|\
-       tplink,archer-c50-v4|\
-       tplink,tl-mr3420-v5|\
-       tplink,tl-wr840n-v4|\
-       tplink,tl-wr840n-v5|\
-       tplink,tl-wr841n-v13|\
-       tplink,tl-wr841n-v14|\
-       tplink,tl-wr842n-v5|\
-       unielec,u7628-01-16m|\
-       wavlink,wl-wn570ha1|\
-       wavlink,wl-wn575a3|\
-       wiznet,wizfi630s|\
        wrtnode,wrtnode2p|\
        wrtnode,wrtnode2r|\
-       xiaomi,mir4a-100m|\
-       xiaomi,miwifi-nano|\
-       zbtlink,zbt-we1226|\
        zyxel,keenetic-extra-ii)
-               wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
                ;;
        hilink,hlk-7628n)
                lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
@@ -185,14 +168,41 @@ ramips_setup_macs()
        mercury,mac1200r-v2)
                wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 1)
                ;;
+       rakwireless,rak633|\
+       unielec,u7628-01-16m|\
+       wavlink,wl-wn575a3|\
+       wiznet,wizfi630s|\
+       xiaomi,miwifi-nano)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
+               ;;
        skylab,skw92a|\
        totolink,lr1200)
                wan_mac=$(mtd_get_mac_binary factory 0x2e)
                ;;
+       tplink,archer-c20-v4|\
+       tplink,archer-c50-v3|\
+       tplink,tl-mr3420-v5|\
+       tplink,tl-wr840n-v4|\
+       tplink,tl-wr840n-v5|\
+       tplink,tl-wr841n-v13|\
+       tplink,tl-wr841n-v14|\
+       tplink,tl-wr842n-v5)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xf100)" 1)
+               ;;
+       tplink,archer-c50-v4)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1)
+               ;;
        vocore,vocore2|\
        vocore,vocore2-lite)
                label_mac=$(mtd_get_mac_binary factory 0x8)
                ;;
+       wavlink,wl-wn570ha1|\
+       zbtlink,zbt-we1226)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x2e)" 1)
+               ;;
+       xiaomi,mir4a-100m)
+               wan_mac=$(mtd_get_mac_binary factory 0x4)
+               ;;
        esac
 
        [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac