From: Adrian Schmutzler Date: Sun, 8 Dec 2019 15:15:00 +0000 (+0100) Subject: ramips: rt305x: use flash location for wan_mac in 02_network X-Git-Tag: v21.02.0-rc1~4384 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=772af7f98d23f9d616928d89315860dade3d704b;p=openwrt%2Fstaging%2Fpepe2k.git ramips: rt305x: use flash location for wan_mac in 02_network 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 --- diff --git a/target/linux/ramips/dts/rt3050_dlink_dir-300-b1.dts b/target/linux/ramips/dts/rt3050_dlink_dir-300-b1.dts index 8bc77e422d..030796f286 100644 --- a/target/linux/ramips/dts/rt3050_dlink_dir-300-b1.dts +++ b/target/linux/ramips/dts/rt3050_dlink_dir-300-b1.dts @@ -39,7 +39,7 @@ read-only; }; - factory: partition@40000 { + partition@40000 { label = "devconf"; reg = <0x40000 0x10000>; read-only; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts b/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts index 66e2c1924c..914ceb0c53 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts +++ b/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts @@ -32,7 +32,7 @@ read-only; }; - factory: partition@40000 { + devconf: partition@40000 { label = "devconf"; reg = <0x40000 0x10000>; read-only; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts b/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts index f3d9926702..c9826166b4 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts +++ b/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts @@ -32,7 +32,7 @@ read-only; }; - factory: partition@40000 { + devconf: partition@40000 { label = "devconf"; reg = <0x40000 0x10000>; read-only; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi index 032a89cd1a..cdd3033bed 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi +++ b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi @@ -51,7 +51,7 @@ }; ðernet { - 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>; }; diff --git a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network index de71dd6202..5efcd53955 100755 --- a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network +++ b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network @@ -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