]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
lantiq: use nvmem for bthomehub v5a 17289/head
authorRosen Penev <rosenp@gmail.com>
Tue, 17 Dec 2024 00:55:55 +0000 (16:55 -0800)
committerRobert Marko <robimarko@gmail.com>
Wed, 6 Aug 2025 21:42:43 +0000 (23:42 +0200)
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@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17289
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata [deleted file]
target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
target/linux/lantiq/xrx200/config-6.12

index e0e49f377a7f1efd1a7c87892362f85ab86194fa..10fb8d4934e1d94044f72dadda829f79c27716d2 100644 (file)
                        interrupts = <63>;
                };
 
-               ppe@e234000 {
+               ppe: ppe@e234000 {
                        compatible = "lantiq,ppe-xrx200";
                        reg = <0xe234000 0x3ffd>;
                        interrupt-parent = <&icu0>;
index cb6cb74af82aa8470e2da50ab5b14d8c3b4b4186..994b50832337cd93811c4aa6b405e3b81f47af0e 100644 (file)
        };
 };
 
+&eth0 {
+       nvmem-cells = <&macaddr_caldata_110c 0>;
+       nvmem-cell-names = "mac-address";
+};
+
 &gswip {
        pinctrl-0 = <&mdio_pins>;
        pinctrl-names = "default";
                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@1 {
                compatible = "lantiq,nand-xway";
                                reg = <0xc0000 0x40000>;
                        };
                        partition@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@1000 {
+                                                               reg = <0x1000 0x3d8>;
+                                                       };
+
+                                                       macaddr_caldata_110c: macaddr@110c {
+                                                               compatible = "mac-base";
+                                                               reg = <0x110c 0x6>;
+                                                               #nvmem-cell-cells = <1>;
+                                                       };
+
+                                                       cal_caldata_5000: calibration@5000 {
+                                                               reg = <0x5000 0x844>;
+                                                       };
+                                               };
+                                       };
+                               };
                        };
                        /*
                         * last 512 KiB are for the bad block table, not writable
        status = "okay";
        reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 
-       wifi@168c,002d {
+       wifi@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@0 {
+               reg = <0x0000 0 0 0 0>;
+               #interrupt-cells = <1>;
+               #size-cells = <2>;
+               #address-cells = <3>;
+               device_type = "pci";
+
+               wifi@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";
 };
index bf907578970cdbee6b0dab0c17aa03786af79887..ca40c9cbd688f68a21498d0adbe5b2221f4adcf0 100644 (file)
@@ -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 (file)
index c555aa2..0000000
+++ /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
index cb3fef9168753469dec6aa03bc3e77825fc13f04..a3968b2303edeb88da636770eec78b850c0450a3 100644 (file)
@@ -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"
                                ;;
index ab46229c0e3b85b80521ec26e793177fd2cad0db..ad8a4544cec0064940df108503e8232abe856f54 100644 (file)
@@ -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