[openwrt/openwrt] mediatek: convert mtd-mac-address to nvmem implementation

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 19 05:51:52 PDT 2021


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/1e6f330ccfa91f8a6860cfc768299490e3c08603

commit 1e6f330ccfa91f8a6860cfc768299490e3c08603
Author: Ansuel Smith <ansuelsmth at gmail.com>
AuthorDate: Fri Apr 2 23:53:02 2021 +0200

    mediatek: convert mtd-mac-address to nvmem implementation
    
    Define nvmem-cells and convert mtd-mac-address to nvmem implementation.
    The conversion is done with an automated script.
    
    Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
---
 .../mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts   | 15 ++++++++++++--
 .../mediatek/dts/mt7622-linksys-e8450-ubi.dts      | 20 +++++++++++++++++--
 target/linux/mediatek/dts/mt7622-linksys-e8450.dts | 20 +++++++++++++++++--
 .../dts/mt7622-ubnt-unifi-6-lr-ubootmod.dts        | 23 +++++++++++++++++++---
 .../linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts  | 23 +++++++++++++++++++---
 5 files changed, 89 insertions(+), 12 deletions(-)

diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts
index 62e2e7f4cb..6d77be532b 100644
--- a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts
+++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts
@@ -218,8 +218,9 @@
 
 		phy-connection-type = "2500base-x";
 
-		mtd-mac-address = <&factory 0x4>;
-		mtd-mac-address-increment = <(-1)>;
+		nvmem-cells = <&macaddr_factory_4>;
+		nvmem-cell-names = "mac-address";
+		mac-address-increment = <(-1)>;
 
 		fixed-link {
 			speed = <2500>;
@@ -337,3 +338,13 @@
 &rtc {
 	status = "disabled";
 };
+
+&factory {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_factory_4: macaddr at 4 {
+		reg = <0x4 0x6>;
+	};
+};
diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts
index d6cadd320c..9df736eb01 100644
--- a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts
+++ b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts
@@ -53,9 +53,25 @@
 };
 
 &gmac0 {
-	mtd-mac-address = <&factory 0x7fff4>;
+	nvmem-cells = <&macaddr_factory_7fff4>;
+	nvmem-cell-names = "mac-address";
 };
 
 &wan {
-	mtd-mac-address = <&factory 0x7fffa>;
+	nvmem-cells = <&macaddr_factory_7fffa>;
+	nvmem-cell-names = "mac-address";
+};
+
+&factory {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_factory_7fff4: macaddr at 7fff4 {
+		reg = <0x7fff4 0x6>;
+	};
+
+	macaddr_factory_7fffa: macaddr at 7fffa {
+		reg = <0x7fffa 0x6>;
+	};
 };
diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450.dts
index b30b5d2455..8552dbf1a9 100644
--- a/target/linux/mediatek/dts/mt7622-linksys-e8450.dts
+++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dts
@@ -98,9 +98,25 @@
 };
 
 &gmac0 {
-	mtd-mac-address = <&factory 0x7fff4>;
+	nvmem-cells = <&macaddr_factory_7fff4>;
+	nvmem-cell-names = "mac-address";
 };
 
 &wan {
-	mtd-mac-address = <&factory 0x7fffa>;
+	nvmem-cells = <&macaddr_factory_7fffa>;
+	nvmem-cell-names = "mac-address";
+};
+
+&factory {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_factory_7fff4: macaddr at 7fff4 {
+		reg = <0x7fff4 0x6>;
+	};
+
+	macaddr_factory_7fffa: macaddr at 7fffa {
+		reg = <0x7fffa 0x6>;
+	};
 };
diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-ubootmod.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-ubootmod.dts
index b2f741ea3b..e573d30912 100644
--- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-ubootmod.dts
+++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-ubootmod.dts
@@ -49,7 +49,8 @@
 
 &wmac {
 	mediatek,mtd-eeprom = <&factory 0x0>;
-	mtd-mac-address = <&eeprom 0x0>;
+	nvmem-cells = <&macaddr_eeprom_0>;
+	nvmem-cell-names = "mac-address";
 	status = "okay";
 };
 
@@ -57,11 +58,27 @@
 	wifi at 0,0 {
 		reg = <0x0 0 0 0 0>;
 		mediatek,mtd-eeprom = <&factory 0x20000>;
-		mtd-mac-address = <&eeprom 0x6>;
+		nvmem-cells = <&macaddr_eeprom_6>;
+		nvmem-cell-names = "mac-address";
 		ieee80211-freq-limit = <5000000 6000000>;
 	};
 };
 
 &gmac0 {
-	mtd-mac-address = <&eeprom 0x0>;
+	nvmem-cells = <&macaddr_eeprom_0>;
+	nvmem-cell-names = "mac-address";
+};
+
+&eeprom {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_eeprom_0: macaddr at 0 {
+		reg = <0x0 0x6>;
+	};
+
+	macaddr_eeprom_6: macaddr at 6 {
+		reg = <0x6 0x6>;
+	};
 };
diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts
index 8603de392a..9b676b43c1 100644
--- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts
+++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts
@@ -65,7 +65,8 @@
 
 &wmac {
 	mediatek,mtd-eeprom = <&factory 0x0>;
-	mtd-mac-address = <&eeprom 0x0>;
+	nvmem-cells = <&macaddr_eeprom_0>;
+	nvmem-cell-names = "mac-address";
 	status = "okay";
 };
 
@@ -73,11 +74,27 @@
 	wifi at 0,0 {
 		reg = <0x0 0 0 0 0>;
 		mediatek,mtd-eeprom = <&factory 0x20000>;
-		mtd-mac-address = <&eeprom 0x6>;
+		nvmem-cells = <&macaddr_eeprom_6>;
+		nvmem-cell-names = "mac-address";
 		ieee80211-freq-limit = <5000000 6000000>;
 	};
 };
 
 &gmac0 {
-	mtd-mac-address = <&eeprom 0x0>;
+	nvmem-cells = <&macaddr_eeprom_0>;
+	nvmem-cell-names = "mac-address";
+};
+
+&eeprom {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_eeprom_0: macaddr at 0 {
+		reg = <0x0 0x6>;
+	};
+
+	macaddr_eeprom_6: macaddr at 6 {
+		reg = <0x6 0x6>;
+	};
 };



More information about the lede-commits mailing list