Revert "qualcommax: drop stock layout for xiaomi ax3600 and redmi ax6"

The OpenWrt layout will waste about 30 MiB spaces, which is... a lot.
It makes sense to keep this stock layout.

This reverts commit 6a6c7a2395.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2024-10-14 20:01:32 +08:00
parent d097b8ed16
commit 102fcffa2d
10 changed files with 198 additions and 3 deletions

View File

@@ -46,7 +46,9 @@ tplink,eap660hd-v1)
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
;;
redmi,ax6|\
redmi,ax6-stock|\
xiaomi,ax3600|\
xiaomi,ax3600-stock|\
xiaomi,ax9000)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \

View File

@@ -0,0 +1,57 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ipq8071-ax3600.dts"
/ {
model = "Xiaomi AX3600 (stock layout)";
compatible = "xiaomi,ax3600-stock", "qcom,ipq8074";
aliases {
/* Aliases as required by u-boot to patch MAC addresses */
ethernet1 = &dp2;
ethernet2 = &dp3;
ethernet3 = &dp4;
ethernet4 = &dp5;
};
chosen {
bootargs-append = " root=/dev/ubiblock0_1";
};
};
&qpic_nand {
/delete-node/ partitions;
nand@0 {
/delete-node/ partitions;
partitions {
compatible = "qcom,smem-part";
};
};
};
&dp2 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp3 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp4 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp5 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&wifi0 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};

View File

@@ -0,0 +1,52 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ipq8071-ax6.dts"
/ {
model = "Redmi AX6 (stock layout)";
compatible = "redmi,ax6-stock", "qcom,ipq8074";
aliases {
/* Aliases as required by u-boot to patch MAC addresses */
ethernet1 = &dp2;
ethernet2 = &dp3;
ethernet3 = &dp4;
ethernet4 = &dp5;
};
chosen {
bootargs-append = " root=/dev/ubiblock0_1";
};
};
&qpic_nand {
/delete-node/ partitions;
nand@0 {
/delete-node/ partitions;
partitions {
compatible = "qcom,smem-part";
};
};
};
&dp2 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp3 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp4 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
&dp5 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};

View File

@@ -332,6 +332,17 @@ define Device/redmi_ax6
endef
TARGET_DEVICES += redmi_ax6
define Device/redmi_ax6-stock
$(call Device/redmi_ax6)
DEVICE_VARIANT := (stock layout)
DEVICE_ALT0_VENDOR := Redmi
DEVICE_ALT0_MODEL := AX6
DEVICE_ALT0_VARIANT := (custom U-Boot layout)
KERNEL_SIZE :=
ARTIFACTS :=
endef
TARGET_DEVICES += redmi_ax6-stock
define Device/spectrum_sax1v1k
$(call Device/FitImage)
$(call Device/EmmcImage)
@@ -363,6 +374,7 @@ define Device/xiaomi_ax3600
$(call Device/UbiFit)
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := AX3600
DEVICE_VARIANT := (OpenWrt expand layout)
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@ac04
@@ -377,11 +389,23 @@ endif
endef
TARGET_DEVICES += xiaomi_ax3600
define Device/xiaomi_ax3600-stock
$(call Device/xiaomi_ax3600)
DEVICE_VARIANT := (stock layout)
DEVICE_ALT0_VENDOR := Xiaomi
DEVICE_ALT0_MODEL := AX3600
DEVICE_ALT0_VARIANT := (custom U-Boot layout)
KERNEL_SIZE :=
ARTIFACTS :=
endef
TARGET_DEVICES += xiaomi_ax3600-stock
define Device/xiaomi_ax9000
$(call Device/FitImage)
$(call Device/UbiFit)
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := AX9000
DEVICE_VARIANT := (OpenWrt expand layout)
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@hk14

View File

@@ -38,10 +38,12 @@ netgear,wax630)
ucidef_set_led_netdev "lan1" "LAN1" "lan1:green" "lan1"
ucidef_set_led_netdev "lan2" "LAN2" "lan2:green" "lan2"
;;
redmi,ax6)
redmi,ax6|\
redmi,ax6-stock)
ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan"
;;
xiaomi,ax3600)
xiaomi,ax3600|\
xiaomi,ax3600-stock)
ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "90000.mdio-1:01:green:wan" "wan" "tx rx link_10 link_100 link_1000"
ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "90000.mdio-1:02:green:lan" "lan1" "tx rx link_10 link_100 link_1000"
ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "90000.mdio-1:03:green:lan" "lan2" "tx rx link_10 link_100 link_1000"

View File

@@ -31,8 +31,10 @@ ipq807x_setup_interfaces()
linksys,mx4200v2|\
prpl,haze|\
redmi,ax6|\
redmi,ax6-stock|\
spectrum,sax1v1k|\
xiaomi,ax3600)
xiaomi,ax3600|\
xiaomi,ax3600-stock)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
edgecore,eap102|\

View File

@@ -0,0 +1,20 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"ath10k/cal-pci-0000:01:00.0.bin")
case "$board" in
xiaomi,ax3600-stock)
caldata_extract "0:art" 0x33000 0x844
;;
esac
;;
*)
exit 1
;;
esac

View File

@@ -24,7 +24,9 @@ case "$FIRMWARE" in
netgear,wax218|\
qnap,301w|\
redmi,ax6|\
redmi,ax6-stock|\
xiaomi,ax3600|\
xiaomi,ax3600-stock|\
xiaomi,ax9000|\
yuncore,ax880|\
zte,mf269|\

View File

@@ -16,5 +16,12 @@ boot() {
linksys,mx8500)
mtd resetbc s_env || true
;;
redmi,ax6-stock|\
xiaomi,ax3600-stock)
# OTA handling should not be used. Reset it just in case.
fw_setenv flag_ota_reboot 0
# Not strictly needed but useful to handle partition crash condition
fw_setenv flag_boot_success 1
;;
esac
}

View File

@@ -209,6 +209,33 @@ platform_do_upgrade() {
# Kernel and rootfs are placed in 2 different UBI
CI_KERN_UBIPART="ubi_kernel"
CI_ROOT_UBIPART="rootfs"
nand_do_upgrade "$1"
;;
redmi,ax6-stock|\
xiaomi,ax3600-stock)
part_num="$(fw_printenv -n flag_boot_rootfs)"
if [ "$part_num" -eq "1" ]; then
CI_UBIPART="rootfs_1"
target_num=1
# Reset fail flag for the current partition
# With both partition set to fail, the partition 2 (bit 1)
# is loaded
fw_setenv flag_try_sys2_failed 0
else
CI_UBIPART="rootfs"
target_num=0
# Reset fail flag for the current partition
# or uboot will skip the loading of this partition
fw_setenv flag_try_sys1_failed 0
fi
# Tell uboot to switch partition
fw_setenv flag_boot_rootfs "$target_num"
fw_setenv flag_last_success "$target_num"
# Reset success flag
fw_setenv flag_boot_success 0
nand_do_upgrade "$1"
;;
spectrum,sax1v1k)