[PATCH] ath79: replace "mac-address-ascii" with "mac-base"

Rafał Miłecki zajec5 at gmail.com
Fri Jul 14 06:40:08 PDT 2023


From: Rafał Miłecki <rafal at milecki.pl>

With upstream accepted "mac-base" binding there is no need for a
downstream "mac-address-ascii" workaround anymore.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../ath79/dts/ar7161_dlink_dir-825-b1.dts     | 57 +++++++++++--------
 .../linux/ath79/dts/ar9331_hiwifi_hc6361.dts  | 37 ++++++------
 .../linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi | 28 +++++----
 .../linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi | 42 ++++++++------
 .../ath79/dts/qca9558_dlink_dir-629-a1.dts    | 32 +++++++----
 .../ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi   | 31 ++++++----
 6 files changed, 134 insertions(+), 93 deletions(-)

diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
index 0e39be7d0b..bdb678298d 100644
--- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
+++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
@@ -139,8 +139,8 @@
 	ath9k0: wifi at 0,11 {
 		compatible = "pci168c,0029";
 		reg = <0x8800 0 0 0 0>;
-		nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
+		nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -148,9 +148,8 @@
 	ath9k1: wifi at 0,12 {
 		compatible = "pci168c,0029";
 		reg = <0x9000 0 0 0 0>;
-		nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
-		mac-address-increment = <1>;
+		nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -191,23 +190,31 @@
 				label = "caldata";
 				reg = <0x660000 0x010000>;
 				read-only;
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				cal_art_1000: cal at 1000 {
-					reg = <0x1000 0xeb8>;
-				};
-
-				cal_art_5000: cal at 5000 {
-					reg = <0x5000 0xeb8>;
-				};
-
-				macaddr_lan: macaddr at ffa0 {
-					reg = <0xffa0 0x11>;
-				};
-
-				macaddr_wan: macaddr at ffb4 {
-					reg = <0xffb4 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					cal_art_1000: cal at 1000 {
+						reg = <0x1000 0xeb8>;
+					};
+
+					cal_art_5000: cal at 5000 {
+						reg = <0x5000 0xeb8>;
+					};
+
+					macaddr_lan: macaddr at ffa0 {
+						compatible = "mac-base";
+						reg = <0xffa0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at ffb4 {
+						compatible = "mac-base";
+						reg = <0xffb4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -224,8 +231,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <1000>;
@@ -238,8 +245,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_wan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_wan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-handle = <&phy4>;
 };
diff --git a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
index 05d3f6730e..fa000ab90c 100644
--- a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
+++ b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
@@ -77,9 +77,22 @@
 			};
 
 			bdinfo: partition at 10000 {
+				compatible = "nvmem-cells";
 				reg = <0x10000 0x10000>;
 				label = "bdinfo";
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_bdinfo_18a: macaddr at 18a {
+						compatible = "mac-base";
+						reg = <0x18a 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			firmware: partition at 20000 {
@@ -124,33 +137,21 @@
 &eth0 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <1>;
+	nvmem-cells = <&macaddr_bdinfo_18a 1>;
+	nvmem-cell-names = "mac-address";
 };
 
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_bdinfo_18a 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &wmac {
 	status = "okay";
 	mtd-cal-data = <&art 0x1000>;
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <2>;
-};
-
-&bdinfo {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_bdinfo_18a: macaddr at 18a {
-		reg = <0x18a 0x11>;
-	};
+	nvmem-cells = <&macaddr_bdinfo_18a 2>;
+	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
index 7cc1bba3fc..a05cc2e263 100644
--- a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
+++ b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
@@ -93,15 +93,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mib0_4b: macaddr at 4b {
-					reg = <0x4b 0x11>;
-				};
 
-				macaddr_mib0_66: macaddr at 66 {
-					reg = <0x66 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mib0_4b: macaddr at 4b {
+						compatible = "mac-base";
+						reg = <0x4b 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mib0_66: macaddr at 66 {
+						compatible = "mac-base";
+						reg = <0x66 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -161,6 +169,6 @@
 
 	ieee80211-freq-limit = <2402000 2482000>;
 
-	nvmem-cells = <&macaddr_mib0_4b>, <&calibration_ath9k>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_mib0_4b 0>, <&calibration_ath9k>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
index 8e21b0dd9e..8db1bf5e0c 100644
--- a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
+++ b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
@@ -29,8 +29,8 @@
 	/* default for ar934x, except for 1000M */
 	pll-data = <0x06000000 0x00000101 0x00001616>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
@@ -58,13 +58,13 @@
 	ath9k: wifi at 0,0 {
 		compatible = "pci168c,0030";
 		reg = <0x0000 0 0 0 0>;
-		/* "mac-address-ascii" currently does not work for
+		/* "mac-address" currently does not work for
 		   ath9k pci devices. these below are retained for future
 		   improvements. */
-		/* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		   nvmem-cell-names = "mac-address-ascii", "calibration";
-		   mac-address-increment = <1>; */
-		qca,no-eeprom; /* remove this when "mac-address-ascii" works  */
+		/* nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		   nvmem-cell-names = "mac-address", "calibration";
+		 */
+		qca,no-eeprom; /* remove this when "mac-address" works  */
 		gpio-controller;
 		#gpio-cells = <2>;
 	};
@@ -117,15 +117,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_lan: macaddr at 4 {
-					reg = <0x4 0x11>;
-				};
 
-				macaddr_wan: macaddr at 18 {
-					reg = <0x18 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_lan: macaddr at 4 {
+						compatible = "mac-base";
+						reg = <0x4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at 18 {
+						compatible = "mac-base";
+						reg = <0x18 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -160,6 +168,6 @@
 
 &wmac {
 	status = "okay";
-	nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
index 41b0039e93..d012ae4c50 100644
--- a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
+++ b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
@@ -65,8 +65,8 @@
 
 	phy-mode = "mii";
 
-	nvmem-cells = <&macaddr_mfcdata_35>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_mfcdata_35 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <100>;
@@ -115,15 +115,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mfcdata_35: macaddr at 35 {
-					reg = <0x35 0x11>;
-				};
 
-				macaddr_mfcdata_51: macaddr at 51 {
-					reg = <0x51 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mfcdata_35: macaddr at 35 {
+						compatible = "mac-base";
+						reg = <0x35 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mfcdata_51: macaddr at 51 {
+						compatible = "mac-base";
+						reg = <0x51 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -165,6 +173,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
index 3fd9790c4a..616c29a4c1 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
@@ -32,8 +32,8 @@
 		compatible = "qcom,ath10k";
 		reg = <0x0000 0 0 0 0>;
 
-		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94>;
-		nvmem-cell-names = "calibration", "mac-address-ascii";
+		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94 0>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -68,16 +68,25 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				macaddr_devdata_94: macaddr at 94 {
-					reg = <0x94 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_devdata_94: macaddr at 94 {
+						compatible = "mac-base";
+						reg = <0x94 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_devdata_b0: macaddr at b0 {
+						compatible = "mac-base";
+						reg = <0xb0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 
-				macaddr_devdata_b0: macaddr at b0 {
-					reg = <0xb0 0x11>;
-				};
 			};
 
 			partition at 60000 {
@@ -147,6 +156,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
-- 
2.35.3




More information about the openwrt-devel mailing list