ramips: mt7621: set mac address in dts for DBDC
authorRosen Penev <[email protected]>
Thu, 14 Aug 2025 00:22:35 +0000 (17:22 -0700)
committerHauke Mehrtens <[email protected]>
Wed, 10 Sep 2025 20:50:08 +0000 (22:50 +0200)
Support in mt76 has existed for quite a while. Use it.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19806
Signed-off-by: Hauke Mehrtens <[email protected]>
15 files changed:
target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts
target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts
target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi
target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts
target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts
target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts
target/linux/ramips/dts/mt7621_totolink_x5000r.dts
target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts
target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts
target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts
target/linux/ramips/dts/mt7621_z-router_zr-2660.dts
target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index d7facb61a09cc0d3059b0cae792a45171c0a2435..b0f995f8abb71204974979af995cc794a486888a 100644 (file)
                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";
+               };
        };
 };
 
                                                reg = <0x0 0xe00>;
                                        };
 
+                                       macaddr_factory_8004: macaddr@8004 {
+                                               reg = <0x8004 0x6>;
+                                       };
+
                                        macaddr_factory_e000: macaddr@e000 {
                                                compatible = "mac-base";
                                                reg = <0xe000 0x6>;
index 0dbf03d35445a0d71f9e3f07121e33f145520ddc..efdd58ec2314ff74d8330c59b88b53cb4616d4ce 100644 (file)
                                };
 
                                macaddr_factory_4: macaddr@4 {
+                                       compatible = "mac-base";
                                        reg = <0x4 0x6>;
+                                       #nvmem-cell-cells = <1>;
                                };
 
                                precal_factory_e10: precal@e10 {
                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";
+               };
        };
 };
 
 };
 
 &gmac0 {
-       nvmem-cells = <&macaddr_factory_4>;
+       nvmem-cells = <&macaddr_factory_4 0>;
        nvmem-cell-names = "mac-address";
 };
 
index 7bc3a3f186cde55f454dcfefd1dcdcc53300cc0f..ef4ed6d8105b24528d9ab896f7da910c46384819 100644 (file)
                                        };
 
                                        macaddr_factory_e000: macaddr@e000 {
+                                               compatible = "mac-base";
                                                reg = <0xe000 0x6>;
+                                               #nvmem-cell-cells = <1>;
                                        };
 
                                        macaddr_factory_e006: macaddr@e006 {
                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";
 };
 
index 0f25750c5cf5a27b7e1eca3a9d0123bf36f58825..a4ce97281bd6e3954c54cb450d7c19169372db31 100644 (file)
                                        };
 
                                        macaddr_factory_e000: macaddr@e000 {
+                                               compatible = "mac-base";
                                                reg = <0xe000 0x6>;
+                                               #nvmem-cell-cells = <1>;
                                        };
                                };
                        };
                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";
 };
 
index e4b254ebce840142e96f5f5b781f7b21e8e2b368..dd066814025c4a0ef30e3857fcf1da14346b168d 100644 (file)
                                                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>;
                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";
+               };
        };
 };
 
index a6ce11b2f710393dab04b0a6d008dd14b911b3b3..20071def8cd194fcf9a5bb152d48f9d83ddb8ceb 100644 (file)
                                        };
 
                                        macaddr_factory_4: macaddr@4 {
+                                               compatible = "mac-base";
                                                reg = <0x4 0x6>;
+                                               #nvmem-cell-cells = <1>;
                                        };
 
                                        macaddr_factory_28: macaddr@28 {
                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";
+               };
        };
 };
 
 };
 
 &gmac0 {
-       nvmem-cells = <&macaddr_factory_4>;
+       nvmem-cells = <&macaddr_factory_4 0>;
        nvmem-cell-names = "mac-address";
 };
 
index 145b0eeb40d35384a01d6b41c9aeec517a4d50f4..70c674554e4be10f13ac93d5d81b4fb6e32b9661 100644 (file)
        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";
+               };
        };
 };
 
index 9c36add8cb819a3a320a438ed60b5a0f42ee0324..1eebe36da95643f95ae269a84c18c5c9ed90e2d1 100644 (file)
                                                reg = <0x0 0x4da8>;
                                        };
 
+                                       macaddr_factory_8004: macaddr@8004 {
+                                               reg = <0x8004 0x6>;
+                                       };
+
                                        macaddr_factory_e000: macaddr@e000 {
                                                reg = <0xe000 0x6>;
                                        };
                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";
+               };
        };
 };
index e2d706c5db12dac608bea9dd4df3c619863a469d..341c1e3e4c18e651f4be5f7ab5f6c409377bc1a4 100644 (file)
                                                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>;
                                        };
                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";
+               };
        };
 };
 
index ac03545eca8093a6acf6d0c67a7cc83052fe07e5..0ffa2d387e9e4cf04822bc34c0614472e30ebf52 100644 (file)
        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";
+               };
        };
 };
 
index e14873f61add84836ef198673466c89284e64e95..dcac566147baa88d337f213601264620aac9b068 100644 (file)
@@ -79,7 +79,9 @@
                                        #size-cells = <1>;
 
                                        macaddr: macaddr@8 {
+                                               compatible = "mac-base";
                                                reg = <0x8 0x6>;
+                                               #nvmem-cell-cells = <1>;
                                        };
                                };
                        };
                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";
 };
 
index 2694b3890fe1bfcf99d735938bd83d743e83a640..731dbde806749ca1be010245365e757a2f8af67c 100644 (file)
@@ -99,7 +99,9 @@
                                        #size-cells = <1>;
 
                                        macaddr_info_8: macaddr@8 {
+                                               compatible = "mac-base";
                                                reg = <0x8 0x6>;
+                                               #nvmem-cell-cells = <1>;
                                        };
                                };
                        };
                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";
 };
 
        label = "lan0";
        phy-handle = <&ethphy0>;
 
-       nvmem-cells = <&macaddr_info_8>;
+       nvmem-cells = <&macaddr_info_8 0>;
        nvmem-cell-names = "mac-address";
 };
 
index d6f9a368e4fb62ac804984cb4a7ce8b0632cd527..b65c3f4cf602c908ec91be8beea5b7ff22de59a8 100644 (file)
        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";
+               };
        };
 };
 
index 3acc1529e5dbb045f241ee37495c2aa483823541..d13bb8b50dcb061b96d54de1d88b18b8af3804fe 100644 (file)
                                        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>;
                                };
 
                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";
+               };
        };
 };
 
index fe0974049228a9ad227ed7790e51c02db190b478..bbd1c7f630037498ef6f639fa7f275930eabb9a1 100644 (file)
@@ -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" ] && \