diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 8bb8d1ab47..0872880069 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -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" ] && \ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts new file mode 100644 index 0000000000..a67a803f85 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts @@ -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; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts new file mode 100644 index 0000000000..47e05a1aeb --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts @@ -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; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index fc06744d71..ea58c26738 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -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 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds index b5c3cbc736..c6e2957545 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -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" diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 26dc4da363..8314ab43a3 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -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|\ diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 0000000000..863435e05d --- /dev/null +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -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 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 6fcdd31be4..398117e270 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -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|\ diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount index 26da7cd614..3822afd709 100755 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount @@ -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 } diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 44230635c3..462d16b3f5 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -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)