ramips: rt305x: use flash location for wan_mac in 02_network
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sun, 8 Dec 2019 15:15:00 +0000 (16:15 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Thu, 12 Dec 2019 12:11:58 +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.

This removes the wan_mac setup for the following devices as they
do not set up a MAC address for ethernet in the first place:
- asiarf,awapn2403
- belkin,f7c027
- dlink,dir-615-d
- mofinetwork,mofi3500-3gn
- prolink,pwh2004
- ralink,v22rw-2x2
- unbranded,wr512-3gn-4m
- unbranded,wr512-3gn-8m

While at it, make some DT node labels consistent with the label
property.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ramips/dts/rt3050_dlink_dir-300-b1.dts
target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts
target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts
target/linux/ramips/dts/rt5350_7links_px-4885.dtsi
target/linux/ramips/rt305x/base-files/etc/board.d/02_network

index 8bc77e422d6f98537cdeb5a91f498480bec399ac..030796f28699398e52168e15ab342d24b66da3cf 100644 (file)
@@ -39,7 +39,7 @@
                                read-only;
                        };
 
-                       factory: partition@40000 {
+                       partition@40000 {
                                label = "devconf";
                                reg = <0x40000 0x10000>;
                                read-only;
index 66e2c1924c9a4b7dd38ce7fd122fd32e3774d520..914ceb0c53ea731b4ef423df93521b5650a9c976 100644 (file)
@@ -32,7 +32,7 @@
                                read-only;
                        };
 
-                       factory: partition@40000 {
+                       devconf: partition@40000 {
                                label = "devconf";
                                reg = <0x40000 0x10000>;
                                read-only;
index f3d99267022ea32a6c559ae928908395f1eb9499..c9826166b472de8f11f425e6a3158aaae5ce85a9 100644 (file)
@@ -32,7 +32,7 @@
                                read-only;
                        };
 
-                       factory: partition@40000 {
+                       devconf: partition@40000 {
                                label = "devconf";
                                reg = <0x40000 0x10000>;
                                read-only;
index 032a89cd1a94708c41ec6f3a170113107cc0df5b..cdd3033bedad95ee1671f3f9ecac1cbc9d5ba971 100644 (file)
@@ -51,7 +51,7 @@
 };
 
 &ethernet {
-       mtd-mac-address = <&factory 0x28>;
+       mtd-mac-address = <&devconf 0x28>;
 };
 
 &esw {
@@ -59,5 +59,5 @@
 };
 
 &wmac {
-       ralink,mtd-eeprom = <&factory 0>;
+       ralink,mtd-eeprom = <&devconf 0>;
 };
index de71dd620287c3f7106e9d859dc8dcefdf4be639..5efcd5395546644bbd512558ba7e8d8512522bce 100755 (executable)
@@ -167,34 +167,38 @@ ramips_setup_macs()
 
        case $board in
        7links,px-4885-4m|\
-       7links,px-4885-8m|\
+       7links,px-4885-8m)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary devconf 0x28)" 1)
+               ;;
+       8devices,carambola|\
+       alfa-network,w502u|\
+       arcwireless,freestation5|\
+       netgear,wnce2001)
+               wan_mac=$(mtd_get_mac_binary factory 0x2e)
+               ;;
        accton,wr6202|\
-       airlive,air3gii|\
-       argus,atp-52b|\
-       asiarf,awapn2403|\
        asiarf,awm002-evb-4m|\
        asiarf,awm002-evb-8m|\
-       asus,rt-g32-b1|\
-       asus,rt-n10-plus|\
        asus,rt-n13u|\
-       asus,wl-330n3g|\
        aztech,hw550-3g|\
-       belkin,f5d8235-v2|\
-       belkin,f7c027|\
-       dlink,dap-1350|\
-       dlink,dir-300-b1|\
-       dlink,dir-600-b1|\
-       dlink,dir-610-a1|\
+       fon,fonera-20n|\
+       huawei,hg255d|\
+       omnima,miniembwifi|\
+       planex,mzk-wdpr|\
+       poray,ip2202|\
+       teltonika,rut5xx|\
+       unbranded,xdx-rn502j|\
+       zyxel,keenetic|\
+       zyxel,nbg-419n|\
+       zyxel,nbg-419n-v2)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
+               ;;
+       airlive,air3gii|\
+       argus,atp-52b|\
+       asus,wl-330n3g|\
        dlink,dir-620-d1|\
-       dlink,dwr-512-b|\
        edimax,3g-6200n|\
        edimax,3g-6200nl|\
-       fon,fonera-20n|\
-       huawei,hg255d|\
-       jcg,jhr-n805r|\
-       jcg,jhr-n825r|\
-       jcg,jhr-n926r|\
-       mofinetwork,mofi3500-3gn|\
        netcore,nw718|\
        nexx,wt1520-4m|\
        nexx,wt1520-8m|\
@@ -203,30 +207,17 @@ ramips_setup_macs()
        olimex,rt5350f-olinuxino|\
        olimex,rt5350f-olinuxino-evb|\
        omnima,miniembplug|\
-       omnima,miniembwifi|\
        planex,mzk-w300nh2|\
-       planex,mzk-wdpr|\
-       poray,ip2202|\
-       prolink,pwh2004|\
-       ralink,v22rw-2x2|\
        sitecom,wl-351|\
-       teltonika,rut5xx|\
-       trendnet,tew-714tru|\
-       unbranded,wr512-3gn-4m|\
-       unbranded,wr512-3gn-8m|\
-       unbranded,xdx-rn502j|\
-       upvel,ur-326n4g|\
-       upvel,ur-336un|\
-       zyxel,keenetic|\
-       zyxel,nbg-419n|\
-       zyxel,nbg-419n-v2)
-               wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
+       trendnet,tew-714tru)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
                ;;
-       8devices,carambola|\
-       alfa-network,w502u|\
-       arcwireless,freestation5|\
-       netgear,wnce2001)
-               wan_mac=$(mtd_get_mac_binary factory 0x2e)
+       asus,rt-g32-b1|\
+       asus,rt-n10-plus)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary devconf 0x4)" 1)
+               ;;
+       belkin,f5d8235-v2)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary uboot 0x40004)" 1)
                ;;
        dlink,dir-300-b7|\
        dlink,dir-320-b1|\
@@ -242,27 +233,46 @@ ramips_setup_macs()
                lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
                wan_mac=$(macaddr_add "$lan_mac" 1)
                ;;
+       dlink,dap-1350)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary devdata 0x2e)" 1)
+               ;;
+       dlink,dir-300-b1|\
+       dlink,dir-600-b1|\
+       dlink,dir-610-a1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary devdata 0x4004)" 1)
+               ;;
        dlink,dir-615-d)
-               wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
                label_mac=$(mtd_get_mac_binary devdata 0x4004)
                ;;
        dlink,dir-615-h1)
-               wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
                label_mac=$(mtd_get_mac_binary factory 0x4)
                ;;
+       dlink,dwr-512-b)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary config 0xe07e)" 1)
+               ;;
+       jcg,jhr-n805r|\
+       jcg,jhr-n825r|\
+       jcg,jhr-n926r)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x2e)" 1)
+               ;;
        poray,m3|\
        poray,m4-4m|\
        poray,m4-8m|\
        poray,x5|\
        poray,x8)
-               lan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" -2)
+               lan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -2)
                ;;
        sparklan,wcr-150gn|\
        wiznet,wizfi630a)
                wan_mac=$(mtd_get_mac_binary factory 0x28)
                ;;
        tenda,w306r-v2)
-               wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 5)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 5)
+               ;;
+       upvel,ur-326n4g|\
+       upvel,ur-336un)
+               wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4004)" 1)
                ;;
        esac