ath79: ubnt: nvmem calibration
authorRosen Penev <[email protected]>
Sat, 4 Oct 2025 22:22:58 +0000 (15:22 -0700)
committerHauke Mehrtens <[email protected]>
Sun, 30 Nov 2025 23:03:06 +0000 (00:03 +0100)
Userspace handling is deprecated.

Moved pcie wifi nodes out of dtsi as these devices differ in wifi
chipsets and thus calibration size. Added compatible lines too.

Removed pointless label_mac assignments as label-mac-device is already
implemented.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20303
Signed-off-by: Hauke Mehrtens <[email protected]>
14 files changed:
target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
target/linux/ath79/dts/ar7241_ubnt_nanobridge-m.dts
target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
target/linux/ath79/dts/ar7241_ubnt_powerbridge-m.dts
target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/tiny/base-files/etc/board.d/02_network
target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom [deleted file]

index 7dd2c7b27718fcb6c238541af435dc3407eeb41c..abca0a7c5aca2e4b5b99d3d72b5a4cba364ec8e8 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 4fa0c704a600d06684a14a80ab52bdaabebfc4cf..ae7aafa91d905f1714794b6567fa48ce54f4e78b 100644 (file)
        };
 };
 
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0x200>;
+       };
+};
+
 &usb_phy {
        status = "okay";
 };
 &usb {
        status = "okay";
 };
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002b";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 00a11b44b1006e53b0206161de3a3ccf7d1450c1..73c9a715c86b9e566f66eb1ef3b66c8917f337c2 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 77ed9b1f03f0142c1f962f5c8161cdf92e839205..95a3080812a05f56c57d03dec73b1ed51628782e 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 55476a2d1063ac8c4b96ad34339089035b0c4878..9ccda317e0a775c8f6cd65a40c90d68cbf94f781 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0x3d8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002e";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 71c686058c0ddbe00b937de09e1cfb60ee03a595..cd706a747dd1b9a0cc7ffab3b1d096ef3f980944 100644 (file)
@@ -8,3 +8,18 @@
        compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241";
        model = "Ubiquiti Nanostation M (XM)";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index f5647837f5918452586cf5aaa9cec3a423625a51..85ca704b70bb95354bf24cf857a3aa5af7db9c68 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index e2df1ff138cc8d41cb10c6385bb1345e2085b241..b30d665bc23e67546475ddddc46a09cec35db887 100644 (file)
 &eth1 {
        compatible = "syscon", "simple-mfd";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index e0342ec08d4f232fe70432a07f761415fd400219..0a4860c25fb6b15b29158308537ead68d311cdf8 100644 (file)
 &usb {
        status = "okay";
 };
+
+&art {
+       cal_art_1000: calibration@1000 {
+               reg = <0x1000 0xeb8>;
+       };
+};
+
+&pcie {
+       wifi: wifi@0,0 {
+               compatible = "pci168c,002a";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&cal_art_1000>;
+               nvmem-cell-names = "calibration";
+       };
+};
index 96018dce5eaafe544a12576f8871365abd903d58..d8e5821da17b25183302ba9fa77c71d057a95b9f 100644 (file)
@@ -63,7 +63,7 @@
                                reg = <0x7f0000 0x010000>;
                                read-only;
 
-                               nvmem-layout {
+                               art: nvmem-layout {
                                        compatible = "fixed-layout";
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
 &pcie {
        status = "okay";
-
-       wifi: wifi@0,0 {
-               reg = <0x0000 0 0 0 0>;
-               qca,no-eeprom;
-       };
 };
 
 &eth0 {
index f01da50c0847c1150d82dc22883bb2244368e417..fef96060a825d0bb5efe95a1423f71e919c82f31 100644 (file)
@@ -829,8 +829,6 @@ ath79_setup_macs()
                base_mac=$(mtd_get_mac_binary info 0x8)
                wan_mac=$(macaddr_add "$base_mac" 1)
                ;;
-       ubnt,powerbridge-m|\
-       ubnt,rocket-m|\
        ubnt,unifi)
                label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
                ;;
index a6c1eff2b6aaca1a208a1fbb08afa2d649c59392..798f2da136da9129118a9cc85ab9b6e9e82d8cf1 100644 (file)
@@ -42,10 +42,6 @@ case "$FIRMWARE" in
        meraki,mr12)
                caldata_extract "art" 0x11000 0xeb8
                ;;
-       ubnt,powerbridge-m|\
-       ubnt,rocket-m)
-               caldata_extract "art" 0x1000 0x1000
-               ;;
        wd,mynet-wifi-rangeextender)
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(nvram get wl0_hwaddr)
index 8bc7040d0385d9078a7e05f413b71564744fdc80..7bd55986d5815cad7fa5997af972c2248c61189f 100644 (file)
@@ -148,14 +148,7 @@ ath79_setup_macs()
                lan_mac=$(get_mac_label)
                wan_mac=$(macaddr_add "$lan_mac" 3)
                ;;
-       engenius,enh202-v1|\
-       ubnt,airrouter|\
-       ubnt,bullet-m-ar7240|\
-       ubnt,bullet-m-ar7241|\
-       ubnt,nanobridge-m|\
-       ubnt,nanostation-loco-m|\
-       ubnt,nanostation-m|\
-       ubnt,picostation-m)
+       engenius,enh202-v1)
                label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
                ;;
        nec,wg600hp|\
diff --git a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
deleted file mode 100644 (file)
index f55d982..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/functions/caldata.sh
-
-board=$(board_name)
-
-case "$FIRMWARE" in
-"ath9k-eeprom-pci-0000:00:00.0.bin")
-       case $board in
-       ubnt,airrouter|\
-       ubnt,bullet-m-ar7240|\
-       ubnt,bullet-m-ar7241|\
-       ubnt,nanobridge-m|\
-       ubnt,nanostation-loco-m|\
-       ubnt,nanostation-m|\
-       ubnt,picostation-m)
-               caldata_extract "art" 0x1000 0x1000
-               ;;
-       *)
-               caldata_die "board $board is not supported yet"
-               ;;
-       esac
-       ;;
-esac