diff --git a/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts index d7facb61a0..b0f995f8ab 100644 --- a/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts +++ b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts @@ -64,6 +64,15 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_8004>; + nvmem-cell-names = "mac-address"; + }; }; }; @@ -104,6 +113,10 @@ reg = <0x0 0xe00>; }; + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + macaddr_factory_e000: macaddr@e000 { compatible = "mac-base"; reg = <0xe000 0x6>; diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts index 0dbf03d354..efdd58ec23 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts @@ -143,7 +143,9 @@ }; macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; }; precal_factory_e10: precal@e10 { @@ -192,6 +194,21 @@ nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>; nvmem-cell-names = "eeprom", "precal"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 4>; + nvmem-cell-names = "mac-address"; + }; }; }; @@ -200,7 +217,7 @@ }; &gmac0 { - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts index 7bc3a3f186..ef4ed6d810 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts @@ -126,7 +126,9 @@ }; macaddr_factory_e000: macaddr@e000 { + compatible = "mac-base"; reg = <0xe000 0x6>; + #nvmem-cell-cells = <1>; }; macaddr_factory_e006: macaddr@e006 { @@ -169,12 +171,25 @@ nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; - /* The correct Mac addresses are set in 10_fix_wifi_mac. */ + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_e000 1>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_e000 2>; + nvmem-cell-names = "mac-address"; + }; }; }; &gmac0 { - nvmem-cells = <&macaddr_factory_e000>; + nvmem-cells = <&macaddr_factory_e000 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi b/target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi index 0f25750c5c..a4ce97281b 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi +++ b/target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi @@ -110,7 +110,9 @@ }; macaddr_factory_e000: macaddr@e000 { + compatible = "mac-base"; reg = <0xe000 0x6>; + #nvmem-cell-cells = <1>; }; }; }; @@ -134,12 +136,26 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; - /* The correct MAC addresses are set in 10_fix_wifi_mac. */ + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_e000 1>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_e000 2>; + nvmem-cell-names = "mac-address"; + }; }; }; &gmac0 { - nvmem-cells = <&macaddr_factory_e000>; + nvmem-cells = <&macaddr_factory_e000 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts index e4b254ebce..dd06681402 100644 --- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts @@ -101,6 +101,12 @@ reg = <0x0 0x4da8>; }; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + macaddr_factory_4000: macaddr@4000 { compatible = "mac-base"; reg = <0x4000 0x6>; @@ -128,6 +134,15 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts index a6ce11b2f7..20071def8c 100644 --- a/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts +++ b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts @@ -132,7 +132,9 @@ }; macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; }; macaddr_factory_28: macaddr@28 { @@ -215,6 +217,15 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + }; }; }; @@ -223,7 +234,7 @@ }; &gmac0 { - nvmem-cells = <&macaddr_factory_4>; + nvmem-cells = <&macaddr_factory_4 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts index 145b0eeb40..70c674554e 100644 --- a/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts +++ b/target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts @@ -125,9 +125,24 @@ wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>; - nvmem-cell-names = "eeprom", "mac-address"; + nvmem-cells = <&eeprom_radio_0>; + nvmem-cell-names = "eeprom"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_config_8 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_config_8 (-1)>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts b/target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts index 9c36add8cb..1eebe36da9 100644 --- a/target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts +++ b/target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts @@ -111,6 +111,10 @@ reg = <0x0 0x4da8>; }; + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + macaddr_factory_e000: macaddr@e000 { reg = <0xe000 0x6>; }; @@ -200,5 +204,14 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_8004>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_totolink_x5000r.dts b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts index e2d706c5db..341c1e3e4c 100644 --- a/target/linux/ramips/dts/mt7621_totolink_x5000r.dts +++ b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts @@ -83,6 +83,12 @@ reg = <0x0 0xe00>; }; + macaddr_factory_4: macaddr@0 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + macaddr_factory_e000: macaddr@e000 { reg = <0xe000 0x6>; }; @@ -113,6 +119,15 @@ nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 4>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts index ac03545eca..0ffa2d387e 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts @@ -161,9 +161,24 @@ wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>; - nvmem-cell-names = "eeprom", "mac-address"; + nvmem-cells = <&eeprom_radio_0>; + nvmem-cell-names = "eeprom"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_config_8 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_config_8 (-1)>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts b/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts index e14873f61a..dcac566147 100644 --- a/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts @@ -79,7 +79,9 @@ #size-cells = <1>; macaddr: macaddr@8 { + compatible = "mac-base"; reg = <0x8 0x6>; + #nvmem-cell-cells = <1>; }; }; }; @@ -145,11 +147,26 @@ nvmem-cells = <&eeprom_radio_0>; nvmem-cell-names = "eeprom"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr 1>; + nvmem-cell-names = "mac-address"; + }; }; }; &gmac0 { - nvmem-cells = <&macaddr>; + nvmem-cells = <&macaddr 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts index 2694b3890f..731dbde806 100644 --- a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts @@ -99,7 +99,9 @@ #size-cells = <1>; macaddr_info_8: macaddr@8 { + compatible = "mac-base"; reg = <0x8 0x6>; + #nvmem-cell-cells = <1>; }; }; }; @@ -165,11 +167,26 @@ nvmem-cells = <&eeprom_radio_0>; nvmem-cell-names = "eeprom"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_info_8 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_info_8 1>; + nvmem-cell-names = "mac-address"; + }; }; }; &gmac0 { - nvmem-cells = <&macaddr_info_8>; + nvmem-cells = <&macaddr_info_8 0>; nvmem-cell-names = "mac-address"; }; @@ -178,7 +195,7 @@ label = "lan0"; phy-handle = <ðphy0>; - nvmem-cells = <&macaddr_info_8>; + nvmem-cells = <&macaddr_info_8 0>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts index d6f9a368e4..b65c3f4cf6 100644 --- a/target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts @@ -199,9 +199,24 @@ wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&eeprom_radio_0>, <&precal_radio_e10>, <&macaddr_rom_file_f100 0>; - nvmem-cell-names = "eeprom", "precal", "mac-address"; + nvmem-cells = <&eeprom_radio_0>, <&precal_radio_e10>; + nvmem-cell-names = "eeprom", "precal"; mediatek,disable-radar-background; + + #address-cells = <1>; + #size-cells = <0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_rom_file_f100 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_rom_file_f100 2>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_z-router_zr-2660.dts b/target/linux/ramips/dts/mt7621_z-router_zr-2660.dts index 3acc1529e5..d13bb8b50d 100644 --- a/target/linux/ramips/dts/mt7621_z-router_zr-2660.dts +++ b/target/linux/ramips/dts/mt7621_z-router_zr-2660.dts @@ -135,6 +135,12 @@ reg = <0x0 0xe00>; }; + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + macaddr_factory_3fff4: macaddr@3fff4 { reg = <0x3fff4 0x6>; }; @@ -179,6 +185,15 @@ nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; + + #address-cells = <1>; + #size-cells = <0>; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index fe09740492..bbd1c7f630 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -41,25 +41,12 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add $lan_mac_addr 8 > /sys${DEVPATH}/macaddress ;; - comfast,cf-e390ax) - [ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress - ;; cudy,x6-v1|\ cudy,x6-v2) hw_mac_addr="$(mtd_get_mac_binary bdinfo 0xde00)" [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(macaddr_add $hw_mac_addr 0x100000)" > /sys${DEVPATH}/macaddress ;; - dlink,dap-1620-b1|\ - dlink,dir-853-a1|\ - dlink,dra-1360-a1) - lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)" - [ "$PHYNBR" = "0" ] && \ - macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && \ - macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress - ;; dlink,covr-x1860-a1) label_mac=$(mtd_get_mac_ascii config2 factory_mac) [ "$PHYNBR" = "0" ] && \ @@ -67,13 +54,6 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress ;; - dlink,dap-x1860-a1) - hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" - [ "$PHYNBR" = "0" ] && \ - macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && \ - macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress - ;; dlink,dir-3040-a1) lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)" [ "$PHYNBR" = "0" ] && \ @@ -91,11 +71,6 @@ case "$board" in macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress fi ;; - glinet,gl-mt1300|\ - z-router,zr-2660) - [ "$PHYNBR" = "1" ] && \ - macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress - ;; h3c,tx1800-plus|\ h3c,tx1801-plus|\ h3c,tx1806) @@ -136,11 +111,6 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo $hw_mac_addr > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 0x800000 > /sys${DEVPATH}/macaddress ;; - keenetic,kn-1910) - lan_mac_addr="$(mtd_get_mac_binary RF-EEPROM 0x4)" - [ "$PHYNBR" = "1" ] && \ - macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress - ;; keenetic,kn-3510) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress @@ -185,11 +155,6 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo -n "$hw_mac_2g" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && echo -n "$hw_mac_5g" > /sys${DEVPATH}/macaddress ;; - mercusys,mr70x-v1|\ - tplink,archer-ax23-v1) - hw_mac_addr="$(mtd_get_mac_binary config 0x8)" - [ "$PHYNBR" = "1" ] && macaddr_add "$hw_mac_addr" -1 > "/sys${DEVPATH}/macaddress" - ;; mts,wg430223) hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1) [ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress @@ -213,27 +178,10 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress ;; - snr,snr-cpe-me2-sfp) - hw_mac_addr="$(mtd_get_mac_binary factory 0x8004)" - [ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress - ;; tenbay,t-mb5eu-v01) hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress ;; - totolink,x5000r) - hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" - [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress - ;; - tplink,eap613-v1|\ - tplink,eap615-wall-v1) - hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)" - macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress" - ;; - tplink,ex220-v1) - hw_mac_addr="$(mtd_get_mac_binary rom_file 0xf100)" - [ "$PHYNBR" = "1" ] && macaddr_add "$hw_mac_addr" 2 > "/sys${DEVPATH}/macaddress" - ;; yuncore,ax820|\ yuncore,g720) [ "$PHYNBR" = "1" ] && \