Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipq40xx: use NVMEM-on-UBI for ASUS devices #14729

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions target/linux/ipq40xx/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,6 @@ ipq40xx_setup_macs()
8dev,habanero-dvk)
label_mac=$(mtd_get_mac_binary "ART" 0x1006)
;;
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +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
;;
asus,rt-ac42u)
caldata_extract_ubi "Factory" 0x9000 0x2f20
;;
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 @@ -53,11 +45,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-ahb-a000000.wifi.bin")
case "$board" in
asus,map-ac2200|\
asus,rt-ac42u|\
asus,rt-ac58u)
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 @@ -150,10 +137,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-ahb-a800000.wifi.bin")
case "$board" in
asus,map-ac2200|\
asus,rt-ac58u)
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,20 +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)
;;
asus,rt-ac42u)
base_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
ip link set dev eth0 address $base_mac
ip link set dev lan1 address $base_mac
ip link set dev lan2 address $base_mac
ip link set dev lan3 address $base_mac
ip link set dev lan4 address $base_mac
ip link set dev wan address $(mtd_get_mac_binary_ubi Factory 0x9006)
;;
engenius,eap2200)
base_mac=$(cat /sys/class/net/eth0/address)
ip link set dev eth1 address $(macaddr_add "$base_mac" 1)
Expand Down
1 change: 1 addition & 0 deletions target/linux/ipq40xx/config-6.1
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
label-mac-device = &swport5;
};

soc {
Expand Down Expand Up @@ -270,13 +271,44 @@
#size-cells = <1>;

partition@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@1000 {
reg = <0x1000 0x2f20>;
};

macaddr_factory_1006: macaddr@1006 {
reg = <0x1006 0x6>;
};

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

macaddr_factory_5006: macaddr@5006 {
reg = <0x5006 0x6>;
};
};
};

&blsp1_uart1 {
pinctrl-0 = <&serial_pins>;
pinctrl-names = "default";
Expand All @@ -293,6 +325,8 @@

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

&switch {
Expand All @@ -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";
};
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,46 @@
};

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 +231,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 +257,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 +383,8 @@

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

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

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

label = "wan";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
};

aliases {
label-mac-device = &gmac;
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
Expand Down Expand Up @@ -254,13 +255,44 @@
read-only;
};
partition@400000 {
label = "ubi";
compatible = "linux,ubi";
reg = <0x00400000 0x07C00000>;
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 {
reg = <0x1006 0x6>;
};

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

macaddr_factory_9006: macaddr@9006 {
reg = <0x9006 0x6>;
};
};
};

&usb3_ss_phy {
status = "okay";
};
Expand All @@ -271,6 +303,8 @@

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

&switch {
Expand All @@ -295,10 +329,14 @@

&swport5 {
status = "okay";
nvmem-cells = <&macaddr_factory_9006>;
nvmem-cell-names = "mac-address";
};

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

Expand All @@ -317,6 +355,8 @@
wifi2: wifi@1,0 {
compatible = "qcom,ath10k";
reg = <0x00010000 0 0 0 0>;
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_factory_9000>;

qcom,ath10k-calibration-variant = "ASUS-RT-AC42U";
};
Expand Down