From fb1e8a446d8bf914999c09273273e4f71430493e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 4 Oct 2025 15:22:58 -0700 Subject: [PATCH] ath79: ubnt: nvmem calibration 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 Link: https://github.com/openwrt/openwrt/pull/20303 Signed-off-by: Hauke Mehrtens --- .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 15 +++++++++++ .../linux/ath79/dts/ar7241_ubnt_airrouter.dts | 15 +++++++++++ .../ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts | 15 +++++++++++ .../ath79/dts/ar7241_ubnt_nanobridge-m.dts | 15 +++++++++++ .../dts/ar7241_ubnt_nanostation-loco-m.dts | 15 +++++++++++ .../ath79/dts/ar7241_ubnt_nanostation-m.dts | 15 +++++++++++ .../ath79/dts/ar7241_ubnt_picostation-m.dts | 15 +++++++++++ .../ath79/dts/ar7241_ubnt_powerbridge-m.dts | 15 +++++++++++ .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts | 15 +++++++++++ target/linux/ath79/dts/ar724x_ubnt_xm.dtsi | 7 +---- .../generic/base-files/etc/board.d/02_network | 2 -- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 --- .../tiny/base-files/etc/board.d/02_network | 9 +------ .../etc/hotplug.d/firmware/10-ath9k-eeprom | 26 ------------------- 14 files changed, 137 insertions(+), 46 deletions(-) delete mode 100644 target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts index 7dd2c7b277..abca0a7c5a 100644 --- a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts +++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts @@ -19,3 +19,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts index 4fa0c704a6..ae7aafa91d 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts @@ -33,6 +33,12 @@ }; }; +&art { + cal_art_1000: calibration@1000 { + reg = <0x1000 0x200>; + }; +}; + &usb_phy { status = "okay"; }; @@ -40,3 +46,12 @@ &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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts index 00a11b44b1..73c9a715c8 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts @@ -12,3 +12,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanobridge-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanobridge-m.dts index 77ed9b1f03..95a3080812 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_nanobridge-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_nanobridge-m.dts @@ -12,3 +12,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts index 55476a2d10..9ccda317e0 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts @@ -12,3 +12,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts index 71c686058c..cd706a747d 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts @@ -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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts index f5647837f5..85ca704b70 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts @@ -12,3 +12,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_powerbridge-m.dts b/target/linux/ath79/dts/ar7241_ubnt_powerbridge-m.dts index e2df1ff138..b30d665bc2 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_powerbridge-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_powerbridge-m.dts @@ -12,3 +12,18 @@ ð1 { 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"; + }; +}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts index e0342ec08d..0a4860c25f 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts @@ -20,3 +20,18 @@ &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"; + }; +}; diff --git a/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi index 96018dce5e..d8e5821da1 100644 --- a/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi +++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi @@ -63,7 +63,7 @@ reg = <0x7f0000 0x010000>; read-only; - nvmem-layout { + art: nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; @@ -83,11 +83,6 @@ &pcie { status = "okay"; - - wifi: wifi@0,0 { - reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - }; }; ð0 { diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index f01da50c08..fef96060a8 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -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) ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index a6c1eff2b6..798f2da136 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -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) diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network index 8bc7040d03..7bd55986d5 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network +++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network @@ -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 index f55d9829e3..0000000000 --- a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ /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 -- 2.30.2