Skip to content

Commit

Permalink
ipq40xx: use NVMEM-on-UBI for ASUS Lyra MAP-AC2200
Browse files Browse the repository at this point in the history
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@makrotopia.org>
  • Loading branch information
dangowrt committed Feb 25, 2024
1 parent 7920593 commit 7268dc0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-pci-0000:01:00.0.bin")
case "$board" in
asus,map-ac2200)
caldata_extract_ubi "Factory" 0x9000 0x2f20
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
avm,fritzrepeater-3000)
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
Expand Down Expand Up @@ -50,9 +45,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-ahb-a000000.wifi.bin")
case "$board" in
asus,map-ac2200)
caldata_extract_ubi "Factory" 0x1000 0x2f20
;;
avm,fritzbox-4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
;;
Expand Down Expand Up @@ -145,9 +137,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-ahb-a800000.wifi.bin")
case "$board" in
asus,map-ac2200)
caldata_extract_ubi "Factory" 0x5000 0x2f20
;;
avm,fritzbox-4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

preinit_set_mac_address() {
case $(board_name) in
asus,map-ac2200)
base_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
ip link set dev eth0 address $(macaddr_add "$base_mac" 1)
ip link set dev eth1 address $(macaddr_add "$base_mac" 3)
;;
engenius,eap2200)
base_mac=$(cat /sys/class/net/eth0/address)
ip link set dev eth1 address $(macaddr_add "$base_mac" 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,45 @@
};

partition@400000 {
label = "ubi";
compatible = "linux,ubi";
reg = <0x400000 0x7c00000>;
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@1000 {
reg = <0x1000 0x2f20>;
};

macaddr_factory_1006: macaddr@1006 {
compatible = "mac-base";
reg = <0x1006 0x6>;
#nvmem-cell-cells = <1>;
};

precal_factory_5000: precal@5000 {
reg = <0x5000 0x2f20>;
};

precal_factory_9000: precal@9000 {
reg = <0x9000 0x2f20>;
};
};

&tlmm {
i2c_0_pins: i2c_0_pinmux {
pinmux {
Expand Down Expand Up @@ -198,11 +230,15 @@

&wifi0 {
status = "okay";
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_factory_1000>;
qcom,ath10k-calibration-variant = "ASUS-MAP-AC2200";
};

&wifi1 {
status = "okay";
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_factory_5000>;
qcom,ath10k-calibration-variant = "ASUS-MAP-AC2200";
ieee80211-freq-limit = <5470000 5875000>;
};
Expand All @@ -220,10 +256,12 @@

wifi2: wifi@1,0 {
compatible = "qcom,ath10k";
status = "okay";
reg = <0x00010000 0 0 0 0>;
qcom,ath10k-calibration-variant = "ASUS-MAP-AC2200";
ieee80211-freq-limit = <5170000 5350000>;
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_factory_9000>;
qcom,ath10k-calibration-variant = "ASUS-MAP-AC2200";
status = "okay";
};
};
};
Expand Down Expand Up @@ -344,6 +382,8 @@

&gmac {
status = "okay";
nvmem-cell-names = "mac-address";
nvmem-cells = <&macaddr_factory_1006 1>;
};

&switch {
Expand All @@ -352,6 +392,8 @@

&swport4 {
status = "okay";
nvmem-cell-names = "mac-address";
nvmem-cells = <&macaddr_factory_1006 3>;

label = "wan";
};
Expand Down

0 comments on commit 7268dc0

Please sign in to comment.