[openwrt/openwrt] ipq40xx: utilize nvmem-cells for plasmacloud,pa2200

LEDE Commits lede-commits at lists.infradead.org
Sun Nov 13 06:41:32 PST 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/ce6c9e0328a563082d12397068fbf2eb2a227d24

commit ce6c9e0328a563082d12397068fbf2eb2a227d24
Author: Sven Eckelmann <sven at narfation.org>
AuthorDate: Tue Oct 25 09:12:16 2022 +0200

    ipq40xx: utilize nvmem-cells for plasmacloud,pa2200
    
    The calibration data and mac addresses on this device are stored in the
    0:ART partition. It is therefore possible to move the code to handle them
    directly to the devicetree instead of the various scripts.
    
    But the actual relevant information about the partition layout is provided
    by the bootloader via bootargs (mtdparts) and not via the devicetree
    itself. Instead of using a fixed-partition template, the mtd dynamic
    partitions support from the upstream kernel is used.
    
    Reported-by: Robert Marko <robert.marko at sartura.hr>
    Tested-by: Michaël BILCOT <michael.bilcot at gmail.com>
    Signed-off-by: Sven Eckelmann <sven at narfation.org>
---
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |  9 ++---
 .../arch/arm/boot/dts/qcom-ipq4019-pa2200.dts      | 38 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 246bc6ca21..7498e1c710 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -34,9 +34,6 @@ case "$FIRMWARE" in
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
 		;;
-	plasmacloud,pa2200)
-		caldata_extract "0:ART" 0x9000 0x2f20
-		;;
 	linksys,ea8300 |\
 	linksys,mr8300)
 		caldata_extract "ART" 0x9000 0x2f20
@@ -75,8 +72,7 @@ case "$FIRMWARE" in
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
 		;;
-	cellc,rtl30vw |\
-	plasmacloud,pa2200)
+	cellc,rtl30vw)
 		caldata_extract "0:ART" 0x1000 0x2f20
 		;;
 	devolo,magic-2-wifi-next)
@@ -169,8 +165,7 @@ case "$FIRMWARE" in
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
 		;;
-	cellc,rtl30vw |\
-	plasmacloud,pa2200)
+	cellc,rtl30vw)
 		caldata_extract "0:ART" 0x5000 0x2f20
 		;;
 	devolo,magic-2-wifi-next)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-pa2200.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-pa2200.dts
index 461f05bc73..d7dcf053be 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-pa2200.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-pa2200.dts
@@ -140,7 +140,36 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <24000000>;
+
 		/* partitions are passed via bootloader */
+		partitions {
+			partition-art {
+				compatible = "nvmem-cells";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				label = "0:ART";
+
+				precal_art_1000: precal at 1000 {
+					reg = <0x1000 0x2f20>;
+				};
+
+				precal_art_5000: precal at 5000 {
+					reg = <0x5000 0x2f20>;
+				};
+
+				precal_art_9000: precal at 9000 {
+					reg = <0x9000 0x2f20>;
+				};
+
+				macaddr_gmac0: macaddr at 0 {
+					reg = <0x0 0x6>;
+				};
+
+				macaddr_gmac1: macaddr at 6 {
+					reg = <0x6 0x6>;
+				};
+			};
+		};
 	};
 };
 
@@ -171,6 +200,9 @@
 			reg = <0x00010000 0 0 0 0>;
 			qcom,ath10k-calibration-variant = "PlasmaCloud-PA2200";
 			ieee80211-freq-limit = <5170000 5350000>;
+
+			nvmem-cell-names = "pre-calibration";
+			nvmem-cells = <&precal_art_9000>;
 		};
 	};
 };
@@ -178,10 +210,16 @@
 &wifi0 {
 	status = "okay";
 	qcom,ath10k-calibration-variant = "PlasmaCloud-PA2200";
+
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_1000>;
 };
 
 &wifi1 {
 	status = "okay";
 	qcom,ath10k-calibration-variant = "PlasmaCloud-PA2200";
 	ieee80211-freq-limit = <5470000 5875000>;
+
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_5000>;
 };




More information about the lede-commits mailing list