[openwrt/openwrt] ipq40xx: use NVMEM-on-UBI for ASUS RT-AC58U
LEDE Commits
lede-commits at lists.infradead.org
Wed Jun 5 05:46:26 PDT 2024
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/683a35098ff603e073acf13e124bfc0708852c51
commit 683a35098ff603e073acf13e124bfc0708852c51
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Sun Feb 25 21:59:39 2024 +0000
ipq40xx: use NVMEM-on-UBI for ASUS RT-AC58U
Instead of extracting WiFi precal as well as MAC addresses in userspace
use recently introduced NVMEM-on-UBI instead.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
Tested-by: Christian Lamparter <chunkeey at gmail.com>
---
.../ipq40xx/base-files/etc/board.d/02_network | 5 ---
.../etc/hotplug.d/firmware/11-ath10k-caldata | 6 ++--
target/linux/ipq40xx/config-6.6 | 1 +
.../arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts | 42 +++++++++++++++++++++-
4 files changed, 44 insertions(+), 10 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 df0fca7544..7a2874a6e4 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -170,11 +170,6 @@ ipq40xx_setup_macs()
asus,rt-ac42u)
label_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
;;
- asus,rt-ac58u)
- wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
- lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
- label_mac=$wan_mac
- ;;
avm,fritzbox-7530)
local tffsdev=$(find_mtd_chardev "nand-tffs")
wan_mac=$(/usr/bin/fritz_tffs_nand -b -d $tffsdev -n macdsl)
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 3b7f44282d..4a1a0ff311 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
@@ -58,8 +58,7 @@ case "$FIRMWARE" in
"ath10k/pre-cal-ahb-a000000.wifi.bin")
case "$board" in
asus,map-ac2200|\
- asus,rt-ac42u|\
- asus,rt-ac58u)
+ asus,rt-ac42u)
caldata_extract_ubi "Factory" 0x1000 0x2f20
;;
avm,fritzbox-4040)
@@ -158,8 +157,7 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-ahb-a800000.wifi.bin")
case "$board" in
- asus,map-ac2200|\
- asus,rt-ac58u)
+ asus,map-ac2200)
caldata_extract_ubi "Factory" 0x5000 0x2f20
;;
avm,fritzbox-4040)
diff --git a/target/linux/ipq40xx/config-6.6 b/target/linux/ipq40xx/config-6.6
index 52ac1a585e..3049efc3d6 100644
--- a/target/linux/ipq40xx/config-6.6
+++ b/target/linux/ipq40xx/config-6.6
@@ -309,6 +309,7 @@ CONFIG_MTD_SPLIT_WRGG_FW=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_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts
index 4f31c8f283..e58b3378d5 100644
--- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts
+++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts
@@ -20,6 +20,7 @@
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
+ label-mac-device = &swport5;
};
soc {
@@ -247,13 +248,44 @@
#size-cells = <1>;
partition at 0 {
- label = "ubi";
+ compatible = "linux,ubi";
reg = <0x00000000 0x08000000>;
+ label = "ubi";
+
+ volumes {
+ ubi_factory: ubi-volume-factory {
+ volname = "Factory";
+ };
+ };
};
};
};
};
+&ubi_factory {
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ precal_factory_1000: precal at 1000 {
+ reg = <0x1000 0x2f20>;
+ };
+
+ macaddr_factory_1006: macaddr at 1006 {
+ reg = <0x1006 0x6>;
+ };
+
+ precal_factory_5000: precal at 5000 {
+ reg = <0x5000 0x2f20>;
+ };
+
+ macaddr_factory_5006: macaddr at 5006 {
+ reg = <0x5006 0x6>;
+ };
+ };
+};
+
&blsp1_uart1 {
pinctrl-0 = <&serial_pins>;
pinctrl-names = "default";
@@ -293,6 +325,8 @@
&gmac {
status = "okay";
+ nvmem-cells = <&macaddr_factory_5006>;
+ nvmem-cell-names = "mac-address";
};
&switch {
@@ -317,14 +351,20 @@
&swport5 {
status = "okay";
+ nvmem-cells = <&macaddr_factory_1006>;
+ nvmem-cell-names = "mac-address";
};
&wifi0 {
status = "okay";
+ nvmem-cell-names = "pre-calibration";
+ nvmem-cells = <&precal_factory_1000>;
qcom,ath10k-calibration-variant = "RT-AC58U";
};
&wifi1 {
status = "okay";
+ nvmem-cell-names = "pre-calibration";
+ nvmem-cells = <&precal_factory_5000>;
qcom,ath10k-calibration-variant = "RT-AC58U";
};
More information about the lede-commits
mailing list