diff mbox series

Approved RE: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices

Message ID AM6PR03MB383274226AF510902A71C309EFAEA@AM6PR03MB3832.eurprd03.prod.outlook.com
State Not Applicable
Headers show
Series Approved RE: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices | expand

Commit Message

Catrinel Catrinescu Nov. 10, 2023, 1:28 p.m. UTC
Hi Rafal

Your patches for our Dorin & Balin modules are good, many thanks.
You can push the patches upstream.


Best regards & have a nice weekend
Catrinel


-----Original Message-----
From: Rafał Miłecki <zajec5@gmail.com> 
Sent: Friday, 10 November 2023 11:25
To: openwrt-devel@lists.openwrt.org
Cc: yangshiji66@outlook.com; Hauke Mehrtens <hauke@hauke-m.de>; Rafał Miłecki <rafal@milecki.pl>; Ansuel Smith <ansuelsmth@gmail.com>; Catrinel Catrinescu <cc@80211.de>; Felix Fietkau <nbd@nbd.name>
Subject: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices

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

Those devices have Ethernet interfaces using base MAC address increased by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we were using a custom (downstream) "mac-address-increment-byte" property.

The same result can be achieved by using "mac-base" with a properly adjusted offset value (0x40 << 16). It may be not pretty but it should work without custom property or downstream kernel patch to support it.

Cc: Ansuel Smith <ansuelsmth@gmail.com>
Cc: Catrinel Catrinescu <cc@80211.de>
Cc: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../dts/ar9331_embeddedwireless_dorin.dts     | 26 ++++++++--------
 .../dts/ar9344_embeddedwireless_balin.dts     | 30 ++++++++++---------
 2 files changed, 29 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
index de6b709b5c..6286f203ef 100644
--- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
+++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
@@ -85,6 +85,18 @@ 
 				label = "art";
 				reg = <0xff0000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_art_1002: macaddr@1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 		};
 	};
@@ -93,10 +105,8 @@ 
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 };
 
 &mdio1 {
@@ -108,13 +118,3 @@ 
 
 	mtd-cal-data = <&art 0x1000>;
 };
-
-&art {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_art_1002: macaddr@1002 {
-		reg = <0x1002 0x6>;
-	};
-};
diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
index a84c273f86..de13865818 100644
--- a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
+++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
@@ -83,16 +83,20 @@ 
 				reg = <0xff0000 0x010000>;
 				read-only;
 
-				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				calibration_art_1000: calibration_data@1000 {
-					reg = <0x1000 0x440>;
-				};
-
-				macaddr_art_1002: macaddr@1002 {
-					reg = <0x1002 0x6>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					calibration_art_1000: calibration_data@1000 {
+						reg = <0x1000 0x440>;
+					};
+
+					macaddr_art_1002: macaddr@1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 		};
@@ -106,10 +110,8 @@ 
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 
 	gmac-config {
 		device = <&gmac>;
@@ -121,7 +123,7 @@ 
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>;
+	nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>;
 	nvmem-cell-names = "mac-address", "calibration";  };
 
--
2.35.3