[openwrt/openwrt] ipq40xx: utilize nvmem-cells for openmesh,a42

LEDE Commits lede-commits at lists.infradead.org
Sat Nov 12 09:30:25 PST 2022


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

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

    ipq40xx: utilize nvmem-cells for openmesh,a42
    
    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>
    Reviewed-by: Robert Marko <robimarko at gmail.com>
    Signed-off-by: Sven Eckelmann <sven at narfation.org>
---
 .../ipq40xx/base-files/etc/board.d/02_network      |  1 -
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |  2 --
 .../lib/preinit/05_set_iface_mac_ipq40xx.sh        |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-a42.dts   | 38 ++++++++++++++++++++++
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index b98c85decf..46e6a3f9bd 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -163,7 +163,6 @@ ipq40xx_setup_macs()
 	pakedge,wr-1)
 		wan_mac=$(macaddr_add $(get_mac_label) 1)
 		;;
-	openmesh,a42|\
 	openmesh,a62)
 		label_mac="$(mtd_get_mac_binary "0:ART" 0x0)"
 		;;
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 5d075509b5..559aacea1e 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
@@ -77,7 +77,6 @@ case "$FIRMWARE" in
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
 		;;
 	cellc,rtl30vw |\
-	openmesh,a42 |\
 	openmesh,a62 |\
 	plasmacloud,pa1200 |\
 	plasmacloud,pa2200)
@@ -174,7 +173,6 @@ case "$FIRMWARE" in
 		/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
 		;;
 	cellc,rtl30vw |\
-	openmesh,a42 |\
 	openmesh,a62 |\
 	plasmacloud,pa1200 |\
 	plasmacloud,pa2200)
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
index 0d19c6bae0..81d22686a3 100644
--- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
+++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
@@ -29,7 +29,6 @@ preinit_set_mac_address() {
 		ip link set dev lan1 address $(macaddr_add "$base_mac" 1)
 		ip link set dev eth0 address $(macaddr_setbit "$base_mac" 7)
 		;;
-	openmesh,a42|\
 	openmesh,a62)
 		ip link set dev ethernet1 address $(mtd_get_mac_binary "0:ART" 0x0)
 		ip link set dev ethernet2 address $(mtd_get_mac_binary "0:ART" 0x6)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts
index 89f5183045..b6ff09a042 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts
@@ -71,6 +71,7 @@
 		led-failsafe = &led_status_green;
 		led-running = &led_status_green;
 		led-upgrade = &led_status_green;
+		label-mac-device = &swport5;
 	};
 
 	leds {
@@ -144,7 +145,32 @@
 		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>;
+				};
+
+				macaddr_gmac0: macaddr at 0 {
+					reg = <0x0 0x6>;
+				};
+
+				macaddr_gmac1: macaddr at 6 {
+					reg = <0x6 0x6>;
+				};
+			};
+		};
 	};
 };
 
@@ -177,19 +203,31 @@
 &swport4 {
 	status = "okay";
 	label = "ethernet2";
+
+	nvmem-cell-names = "mac-address";
+	nvmem-cells = <&macaddr_gmac1>;
 };
 
 &swport5 {
 	status = "okay";
 	label = "ethernet1";
+
+	nvmem-cell-names = "mac-address";
+	nvmem-cells = <&macaddr_gmac0>;
 };
 
 &wifi0 {
 	status = "okay";
 	qcom,ath10k-calibration-variant = "OM-A42";
+
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_1000>;
 };
 
 &wifi1 {
 	status = "okay";
 	qcom,ath10k-calibration-variant = "OM-A42";
+
+	nvmem-cell-names = "pre-calibration";
+	nvmem-cells = <&precal_art_5000>;
 };




More information about the lede-commits mailing list