From e8084a3c3b94adcff6c9f62554cf8d9d1871fe25 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Thu, 23 Nov 2023 18:59:35 -0800
Subject: [PATCH] ramips: mt7628: use mac-base

mac-address-increment is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../linux/ramips/dts/mt7628an_comfast_cf-wr617ac.dts  |  5 +++--
 target/linux/ramips/dts/mt7628an_linksys_e5400.dts    | 10 +++++-----
 target/linux/ramips/dts/mt7628an_motorola_mwr03.dts   |  5 +++--
 target/linux/ramips/dts/mt7628an_netgear_r6120.dts    |  3 +--
 target/linux/ramips/dts/mt7628an_netgear_r6xxx.dtsi   |  4 +++-
 .../ramips/dts/mt7628an_tplink_8m-split-uboot.dtsi    |  6 ++++--
 target/linux/ramips/dts/mt7628an_tplink_8m.dtsi       | 11 +++--------
 .../ramips/dts/mt7628an_tplink_archer-c20-v4.dts      |  8 +++++---
 .../ramips/dts/mt7628an_tplink_archer-c20-v5.dts      |  3 +--
 .../ramips/dts/mt7628an_tplink_archer-c50-v3.dts      | 10 ++++++++--
 .../ramips/dts/mt7628an_tplink_archer-c50-v4.dts      |  3 +--
 .../ramips/dts/mt7628an_tplink_archer-c50-v6.dts      |  3 +--
 target/linux/ramips/dts/mt7628an_tplink_re200.dtsi    | 10 +++++-----
 target/linux/ramips/dts/mt7628an_tplink_re305-v1.dts  | 10 +++++-----
 target/linux/ramips/dts/mt7628an_tplink_re305-v3.dts  | 10 +++++-----
 .../linux/ramips/dts/mt7628an_tplink_tl-mr3420-v5.dts |  7 +++++++
 .../ramips/dts/mt7628an_tplink_tl-wa801nd-v5.dts      |  7 +++++++
 .../linux/ramips/dts/mt7628an_tplink_tl-wr802n-v4.dts |  9 ++++++++-
 .../linux/ramips/dts/mt7628an_tplink_tl-wr840n-v4.dts |  7 +++++++
 .../ramips/dts/mt7628an_tplink_tl-wr841n-v13.dts      |  7 +++++++
 .../linux/ramips/dts/mt7628an_tplink_tl-wr842n-v5.dts |  7 +++++++
 .../linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts |  7 +++++++
 .../ramips/dts/mt7628an_tplink_tl-wr902ac-v3.dts      | 10 ++++++++--
 .../linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi |  2 ++
 .../dts/mt7628an_xiaomi_mi-router-4a-100m-intl.dts    |  3 +--
 .../ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts  |  3 +--
 26 files changed, 115 insertions(+), 55 deletions(-)

diff --git a/target/linux/ramips/dts/mt7628an_comfast_cf-wr617ac.dts b/target/linux/ramips/dts/mt7628an_comfast_cf-wr617ac.dts
index 19c220cabb..1d6304cfa7 100644
--- a/target/linux/ramips/dts/mt7628an_comfast_cf-wr617ac.dts
+++ b/target/linux/ramips/dts/mt7628an_comfast_cf-wr617ac.dts
@@ -88,7 +88,9 @@
 					};
 
 					macaddr_factory_8004: macaddr@8004 {
+						compatible = "mac-base";
 						reg = <0x8004 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 
 					macaddr_factory_e000: macaddr@e000 {
@@ -115,9 +117,8 @@
 		compatible = "mediatek,mt76";
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_factory_8000>, <&macaddr_factory_8004>;
+		nvmem-cells = <&eeprom_factory_8000>, <&macaddr_factory_8004 2>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <2>;
 	};
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_linksys_e5400.dts b/target/linux/ramips/dts/mt7628an_linksys_e5400.dts
index 183b5c3cd1..26ff86dac2 100644
--- a/target/linux/ramips/dts/mt7628an_linksys_e5400.dts
+++ b/target/linux/ramips/dts/mt7628an_linksys_e5400.dts
@@ -96,7 +96,9 @@
 					};
 
 					macaddr_factory_28: macaddr@28 {
+						compatible = "mac-base";
 						reg = <0x28 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -126,7 +128,7 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_28>;
+	nvmem-cells = <&macaddr_factory_28 0>;
 	nvmem-cell-names = "mac-address";
 };
 
@@ -144,9 +146,8 @@
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
 
-		nvmem-cells = <&eeprom_factory_8000>, <&macaddr_factory_28>;
+		nvmem-cells = <&eeprom_factory_8000>, <&macaddr_factory_28 3>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <3>;
 	};
 };
 
@@ -164,8 +165,7 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&eeprom_factory_0>, <&macaddr_factory_28>;
+	nvmem-cells = <&eeprom_factory_0>, <&macaddr_factory_28 2>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <2>;
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_motorola_mwr03.dts b/target/linux/ramips/dts/mt7628an_motorola_mwr03.dts
index 003bd9f544..ebaa4326ae 100644
--- a/target/linux/ramips/dts/mt7628an_motorola_mwr03.dts
+++ b/target/linux/ramips/dts/mt7628an_motorola_mwr03.dts
@@ -86,7 +86,9 @@
 					};
 
 					macaddr_factory_4: macaddr@4 {
+						compatible = "mac-base";
 						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -120,9 +122,8 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 (-1)>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment = <(-1)>;
 };
 
 &esw {
diff --git a/target/linux/ramips/dts/mt7628an_netgear_r6120.dts b/target/linux/ramips/dts/mt7628an_netgear_r6120.dts
index e9fc6d7090..e3ee55873e 100644
--- a/target/linux/ramips/dts/mt7628an_netgear_r6120.dts
+++ b/target/linux/ramips/dts/mt7628an_netgear_r6120.dts
@@ -44,7 +44,6 @@
 };
 
 &wifi5 {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 2>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment = <(2)>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_netgear_r6xxx.dtsi b/target/linux/ramips/dts/mt7628an_netgear_r6xxx.dtsi
index 6a3b654e08..98d132e891 100644
--- a/target/linux/ramips/dts/mt7628an_netgear_r6xxx.dtsi
+++ b/target/linux/ramips/dts/mt7628an_netgear_r6xxx.dtsi
@@ -98,7 +98,9 @@
 					};
 
 					macaddr_factory_4: macaddr@4 {
+						compatible = "mac-base";
 						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -120,7 +122,7 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 0>;
 	nvmem-cell-names = "mac-address";
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_tplink_8m-split-uboot.dtsi b/target/linux/ramips/dts/mt7628an_tplink_8m-split-uboot.dtsi
index fee3935fdf..a5c9267c8d 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_8m-split-uboot.dtsi
+++ b/target/linux/ramips/dts/mt7628an_tplink_8m-split-uboot.dtsi
@@ -63,7 +63,9 @@
 					#size-cells = <1>;
 
 					macaddr_rom_f100: macaddr@f100 {
+						compatible = "mac-base";
 						reg = <0xf100 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -99,12 +101,12 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&eeprom_radio_0>, <&macaddr_rom_f100>;
+	nvmem-cells = <&eeprom_radio_0>, <&macaddr_rom_f100 0>;
 	nvmem-cell-names = "eeprom", "mac-address";
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_rom_f100>;
+	nvmem-cells = <&macaddr_rom_f100 0>;
 	nvmem-cell-names = "mac-address";
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_tplink_8m.dtsi b/target/linux/ramips/dts/mt7628an_tplink_8m.dtsi
index 90ccebe723..3db4bb9b9c 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_8m.dtsi
+++ b/target/linux/ramips/dts/mt7628an_tplink_8m.dtsi
@@ -55,7 +55,9 @@
 					#size-cells = <1>;
 
 					macaddr_factory_f100: macaddr@f100 {
+						compatible = "mac-base";
 						reg = <0xf100 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 
 					eeprom_factory_20000: eeprom@20000 {
@@ -71,14 +73,7 @@
 	};
 };
 
-&wmac {
-	status = "okay";
-
-	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100>;
-	nvmem-cell-names = "eeprom", "mac-address";
-};
-
 &ethernet {
-	nvmem-cells = <&macaddr_factory_f100>;
+	nvmem-cells = <&macaddr_factory_f100 0>;
 	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v4.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v4.dts
index 2225b63333..0d09e54345 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v4.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v4.dts
@@ -78,7 +78,10 @@
 };
 
 &wmac {
-	mac-address-increment = <(-2)>;
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 (-2)>;
+	nvmem-cell-names = "eeprom", "mac-address";
 };
 
 &esw {
@@ -100,8 +103,7 @@
 	mt76@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100>;
+		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v5.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v5.dts
index 04eba88d19..93695660ae 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v5.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_archer-c20-v5.dts
@@ -95,8 +95,7 @@
 	wifi@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100>;
+		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v3.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v3.dts
index f628908b98..bfb39b3531 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v3.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v3.dts
@@ -83,6 +83,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
@@ -95,8 +102,7 @@
 	mt76@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100>;
+		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v4.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v4.dts
index 87927da62a..302a9d9c6a 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v4.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v4.dts
@@ -93,8 +93,7 @@
 	wifi@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100>;
+		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v6.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v6.dts
index 86cefbc230..c3a890bc2d 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v6.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_archer-c50-v6.dts
@@ -88,9 +88,8 @@
 	wifi@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100>;
+		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_tplink_re200.dtsi b/target/linux/ramips/dts/mt7628an_tplink_re200.dtsi
index 9d39906b41..8826365beb 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_re200.dtsi
+++ b/target/linux/ramips/dts/mt7628an_tplink_re200.dtsi
@@ -106,7 +106,9 @@
 					#size-cells = <1>;
 
 					macaddr_config_2008: macaddr@2008 {
+						compatible = "mac-base";
 						reg = <0x2008 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -143,16 +145,15 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_config_2008>;
+	nvmem-cells = <&macaddr_config_2008 0>;
 	nvmem-cell-names = "mac-address";
 };
 
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_2008>;
+	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_2008 1>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <1>;
 };
 
 &pcie {
@@ -163,8 +164,7 @@
 	mt76@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_2008>;
+		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_2008 2>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <2>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_re305-v1.dts b/target/linux/ramips/dts/mt7628an_tplink_re305-v1.dts
index e1c68daccf..9e0bea7cd1 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_re305-v1.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_re305-v1.dts
@@ -43,7 +43,9 @@
 					#size-cells = <1>;
 
 					macaddr_config_10008: macaddr@10008 {
+						compatible = "mac-base";
 						reg = <0x10008 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -77,18 +79,16 @@
 };
 
 &wlan5g {
-	nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_10008>;
+	nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_10008 2>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <2>;
 };
 
 &wmac {
-	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_10008>;
+	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_10008 1>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <1>;
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_config_10008>;
+	nvmem-cells = <&macaddr_config_10008 0>;
 	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_re305-v3.dts b/target/linux/ramips/dts/mt7628an_tplink_re305-v3.dts
index d0d0701231..d37febfbc8 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_re305-v3.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_re305-v3.dts
@@ -43,7 +43,9 @@
 					#size-cells = <1>;
 
 					macaddr_config_2008: macaddr@2008 {
+						compatible = "mac-base";
 						reg = <0x2008 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -72,18 +74,16 @@
 };
 
 &wlan5g {
-	nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_2008>;
+	nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_2008 (-2)>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <(-2)>;
 };
 
 &wmac {
-	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_2008>;
+	nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_2008 (-1)>;
 	nvmem-cell-names = "eeprom", "mac-address";
-	mac-address-increment = <(-1)>;
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_config_2008>;
+	nvmem-cells = <&macaddr_config_2008 0>;
 	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-mr3420-v5.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-mr3420-v5.dts
index 173b4cddca..297e7b441d 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-mr3420-v5.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-mr3420-v5.dts
@@ -76,6 +76,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wa801nd-v5.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wa801nd-v5.dts
index de9a48445a..44a483ed6d 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wa801nd-v5.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wa801nd-v5.dts
@@ -73,3 +73,10 @@
 		function = "gpio";
 	};
 };
+
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr802n-v4.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr802n-v4.dts
index 46c18d6b2d..01cbba2024 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr802n-v4.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr802n-v4.dts
@@ -49,6 +49,13 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_f100>;
+	nvmem-cells = <&macaddr_factory_f100 0>;
 	nvmem-cell-names = "mac-address";
 };
+
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v4.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v4.dts
index 8a8ba81ec3..e480395ffd 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v4.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v4.dts
@@ -66,6 +66,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr841n-v13.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr841n-v13.dts
index 5c7f9836b6..e1e77eba23 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr841n-v13.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr841n-v13.dts
@@ -92,6 +92,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr842n-v5.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr842n-v5.dts
index 9077ec00ce..b5c3bd9ab5 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr842n-v5.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr842n-v5.dts
@@ -76,6 +76,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts
index 7abeae9c07..9fc7f97ae5 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts
@@ -69,6 +69,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &esw {
 	mediatek,portmap = <0x3e>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v3.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v3.dts
index b49dc61a4c..0029be21e0 100644
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v3.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v3.dts
@@ -83,6 +83,13 @@
 	};
 };
 
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>;
+	nvmem-cell-names = "eeprom", "mac-address";
+};
+
 &pcie {
 	status = "okay";
 };
@@ -91,8 +98,7 @@
 	mt76@0,0 {
 		reg = <0x0000 0 0 0 0>;
 		ieee80211-freq-limit = <5000000 6000000>;
-		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100>;
+		nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100 (-1)>;
 		nvmem-cell-names = "eeprom", "mac-address";
-		mac-address-increment = <(-1)>;
 	};
 };
diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi
index ef070549d3..7655da40db 100644
--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi
@@ -65,7 +65,9 @@
 					};
 
 					macaddr_factory_4: macaddr@4 {
+						compatible = "mac-base";
 						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 
 					macaddr_factory_28: macaddr@28 {
diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m-intl.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m-intl.dts
index 809a0af30a..49ca637cb9 100644
--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m-intl.dts
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m-intl.dts
@@ -64,9 +64,8 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 (-1)>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment = <(-1)>;
 };
 
 &esw {
diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
index 7b40cdb6af..f40717267c 100644
--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
@@ -64,9 +64,8 @@
 };
 
 &ethernet {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 (-1)>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment = <(-1)>;
 };
 
 &esw {
-- 
2.30.2