[openwrt/openwrt] lantiq: use nvmem for bthomehub v5a

LEDE Commits lede-commits at lists.infradead.org
Wed Aug 6 14:42:49 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/03542312f7d8fdd1dd624ae29c8403560da83acb

commit 03542312f7d8fdd1dd624ae29c8403560da83acb
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Mon Dec 16 16:55:55 2024 -0800

    lantiq: use nvmem for bthomehub v5a
    
    Userspace handling of both calibration and mac addresses is deprecated.
    
    Also fixed calibration size for ath9k. AR9287 uses 3d8 for its size.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/17289
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../files/arch/mips/boot/dts/lantiq/vr9.dtsi       |  2 +-
 .../mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts    | 62 +++++++++++++++++++++-
 .../xrx200/base-files/etc/board.d/02_network       |  3 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata       | 20 -------
 .../etc/hotplug.d/firmware/12-ath9k-eeprom         |  4 --
 target/linux/lantiq/xrx200/config-6.12             |  1 +
 6 files changed, 63 insertions(+), 29 deletions(-)

diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
index e0e49f377a..10fb8d4934 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
@@ -509,7 +509,7 @@
 			interrupts = <63>;
 		};
 
-		ppe at e234000 {
+		ppe: ppe at e234000 {
 			compatible = "lantiq,ppe-xrx200";
 			reg = <0xe234000 0x3ffd>;
 			interrupt-parent = <&icu0>;
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
index cb6cb74af8..994b508323 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
@@ -151,6 +151,11 @@
 	};
 };
 
+&eth0 {
+	nvmem-cells = <&macaddr_caldata_110c 0>;
+	nvmem-cell-names = "mac-address";
+};
+
 &gswip {
 	pinctrl-0 = <&mdio_pins>;
 	pinctrl-names = "default";
@@ -210,9 +215,17 @@
 		tx-internal-delay-ps = <1500>;
 		rx-internal-delay-ps = <1500>;
 		phy-handle = <&phy5>;
+
+		nvmem-cells = <&macaddr_caldata_110c 4>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
+&ppe {
+	nvmem-cells = <&macaddr_caldata_110c 5>;
+	nvmem-cell-names = "mac-address";
+};
+
 &localbus {
 	flash at 1 {
 		compatible = "lantiq,nand-xway";
@@ -248,8 +261,35 @@
 				reg = <0xc0000 0x40000>;
 			};
 			partition at 100000 {
+				compatible = "linux,ubi";
 				label = "ubi";
 				reg = <0x100000 0x7e80000>;
+
+				volumes {
+					ubi-volume-caldata {
+						volname = "caldata";
+
+						nvmem-layout {
+							compatible = "fixed-layout";
+							#address-cells = <1>;
+							#size-cells = <1>;
+
+							cal_caldata_1000: calibration at 1000 {
+								reg = <0x1000 0x3d8>;
+							};
+
+							macaddr_caldata_110c: macaddr at 110c {
+								compatible = "mac-base";
+								reg = <0x110c 0x6>;
+								#nvmem-cell-cells = <1>;
+							};
+
+							cal_caldata_5000: calibration at 5000 {
+								reg = <0x5000 0x844>;
+							};
+						};
+					};
+				};
 			};
 			/*
 			 * last 512 KiB are for the bad block table, not writable
@@ -262,14 +302,32 @@
 	status = "okay";
 	reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 
-	wifi at 168c,002d {
+	wifi at 0,0 {
 		compatible = "pci168c,002d";
 		reg = <0x7000 0 0 0 0>;
-		qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+		nvmem-cells = <&cal_caldata_1000>, <&macaddr_caldata_110c 2>;
+		nvmem-cell-names = "calibration", "mac-address";
 		ieee80211-freq-limit = <2402000 2482000>;
 	};
 };
 
+&pcie0 {
+	pcie at 0 {
+		reg = <0x0000 0 0 0 0>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		device_type = "pci";
+
+		wifi at 0,0 {
+			compatible = "qcom,ath10k";
+			reg = <0x0000 0 0 0 0>;
+			nvmem-cells = <&cal_caldata_5000>, <&macaddr_caldata_110c 3>;
+			nvmem-cell-names = "calibration", "mac-address";
+		};
+	};
+};
+
 &usb_phy0 {
 	status = "okay";
 };
diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
index bf90757897..ca40c9cbd6 100644
--- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
@@ -128,8 +128,7 @@ lantiq_setup_macs()
 		label_mac=$lan_mac
 		;;
 	bt,homehub-v5a)
-		lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c)
-		wan_mac=$(macaddr_add "$lan_mac" 1)
+		wan_mac=$(macaddr_add "$(mtd_get_mac_binary_ubi caldata 0x110c)" 5)
 		;;
 	buffalo,wbmr-300hpd)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
deleted file mode 100644
index c555aa2c12..0000000000
--- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/functions/caldata.sh
-
-case "$FIRMWARE" in
-"ath10k/cal-pci-0000:02:00.0.bin")
-	board=$(board_name)
-	case $board in
-		bt,homehub-v5a)
-			caldata_extract_ubi "caldata" 0x5000 0x844
-			ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 3)
-			;;
-		*)
-			caldata_die "board $board is not supported yet"
-			;;
-	esac
-	;;
-esac
diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
index cb3fef9168..a3968b2303 100644
--- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
+++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
@@ -27,10 +27,6 @@ case "$FIRMWARE" in
 				/usr/bin/fritz_cal_extract -r -i 4 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \
 				/usr/bin/fritz_cal_extract -r -i 4 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
 				;;
-			bt,homehub-v5a)
-				caldata_extract_ubi "caldata" 0x1000 0x1000
-				ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c
-				;;
 			*)
 				caldata_die "board $board is not supported yet"
 				;;
diff --git a/target/linux/lantiq/xrx200/config-6.12 b/target/linux/lantiq/xrx200/config-6.12
index ab46229c0e..ad8a4544ce 100644
--- a/target/linux/lantiq/xrx200/config-6.12
+++ b/target/linux/lantiq/xrx200/config-6.12
@@ -44,6 +44,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
 CONFIG_MTD_UBI_BLOCK=y
+CONFIG_MTD_UBI_NVMEM=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 CONFIG_NEED_SRCU_NMI_SAFE=y
 CONFIG_NET_DEVLINK=y




More information about the lede-commits mailing list