From 1982d31fb776b1c201018e7898ba6b4fec059ae1 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 27 Jun 2025 12:49:06 +0800 Subject: [PATCH] qualcommax: ipq50xx: Add support for Xiaomi AX6000 --- package/boot/uboot-envtools/files/qualcommax | 16 + package/firmware/ipq-wifi/Makefile | 10 +- .../arm64/boot/dts/qcom/ipq5018-ax6000.dts | 642 ++++++++++++++++++ target/linux/qualcommax/image/ipq50xx.mk | 21 + .../ipq50xx/base-files/etc/board.d/01_leds | 40 ++ .../ipq50xx/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/firmware/11-ath11k-caldata | 6 + .../base-files/lib/upgrade/platform.sh | 48 ++ 8 files changed, 780 insertions(+), 6 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax6000.dts create mode 100644 target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds diff --git a/package/boot/uboot-envtools/files/qualcommax b/package/boot/uboot-envtools/files/qualcommax index 0c6b9e60b..318805c89 100644 --- a/package/boot/uboot-envtools/files/qualcommax +++ b/package/boot/uboot-envtools/files/qualcommax @@ -7,6 +7,18 @@ touch /etc/config/ubootenv board=$(board_name) +ubootenv_add_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_sys_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && \ + ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + case "$board" in compex,wpq873|\ edgecore,eap102|\ @@ -53,6 +65,10 @@ redmi,ax5-jdcloud) [ -n "$mmcpart" ] && \ ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x20000" "2" ;; +xiaomi,ax6000) + ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000" + ubootenv_add_sys_mtd "bdata" "0x0" "0x10000" "0x20000" + ;; esac config_load ubootenv diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 357e2bc17..cfc874904 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,11 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2025-04-08 -PKG_SOURCE_VERSION:=9591c9b7578af3548c35bb80cd6c37978669f7c9 -PKG_MIRROR_HASH:=74e7c92fdd68488ad5b761fec78eb98fa0dcab6ba2aab04fb463108610e8b758 - -PKG_FLAGS:=nonshared +PKG_SOURCE_DATE:=2025-06-13 +PKG_SOURCE_VERSION:=4810aacf3b1c5de99923b9a424a1f0e6341c6bca +PKG_MIRROR_HASH:=2e2fdf0578e39eb0be36cfd8e11de920c3e8446469dafee0ebbc580f272193a8 include $(INCLUDE_DIR)/package.mk @@ -57,6 +55,7 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ wallys_dr40x9 \ xiaomi_ax3600 \ + xiaomi_ax6000 \ xiaomi_ax9000 \ xiaomi_rm1800 \ yuncore_ax880 \ @@ -174,6 +173,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax5-jdcloud,Redmi AX5 JDCloud)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) +$(eval $(call generate-ipq-wifi-package,xiaomi_ax6000,Xiaomi AX6000)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,xiaomi_rm1800,Xiaomi RM1800)) $(eval $(call generate-ipq-wifi-package,yuncore_ax880,Yuncore AX880)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax6000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax6000.dts new file mode 100644 index 000000000..1d2e4f0e8 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax6000.dts @@ -0,0 +1,642 @@ +/dts-v1/; + +#include "ipq5018.dtsi" +#include "ipq5018-ess.dtsi" + +#include +#include +#include + +/ { + model = "Xiaomi AX6000"; + compatible = "xiaomi,ax6000", "qcom,ipq5018"; + + aliases { + label-mac-device = &dp1; + led-boot = &led_system_blue; + led-failsafe = &led_system_yellow; + led-running = &led_system_blue; + led-upgrade = &led_system_yellow; + serial0 = &blsp1_uart1; + }; + + chosen { + /* Xiaomi's U-boot sets bootargs to: + * ubi.mtd=rootfs_1 root=mtd:ubi_rootfs rootfstype=squashfs rootwait uart_en=1 + * so we need to override and set ubi.mtd=rootfs + */ + bootargs-append = " ubi.mtd=rootfs root=/dev/ubiblock0_0 coherent_pool=2M"; + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset-button { + label = "reset"; + gpios = <&tlmm 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-0 = <&leds_pins>; + pinctrl-names = "default"; + + led_wlan_green: wlan-green { + color = ; + function = LED_FUNCTION_WLAN; + gpio = <&tlmm 23 GPIO_ACTIVE_HIGH>; + }; + + led_system_blue: system-blue { + color = ; + function = LED_FUNCTION_POWER; + gpio = <&tlmm 24 GPIO_ACTIVE_HIGH>; + }; + + led_system_yellow: system-yellow { + color = ; + function = LED_FUNCTION_POWER; + gpio = <&tlmm 25 GPIO_ACTIVE_HIGH>; + }; + + led_net_blue: net-blue { + color = ; + function = LED_FUNCTION_WAN_ONLINE; + gpio = <&tlmm 26 GPIO_ACTIVE_HIGH>; + }; + + led_net_yellow: net-yellow { + color = ; + function = LED_FUNCTION_WAN; + gpio = <&tlmm 27 GPIO_ACTIVE_HIGH>; + }; + + led_phy_green: phy-green { + color = ; + function = LED_FUNCTION_LAN; + gpio = <&tlmm 28 GPIO_ACTIVE_HIGH>; + }; + }; + + reserved-memory { + q6_mem_regions: q6_mem_regions@4b000000 { + no-map; + reg = <0x0 0x4b000000 0x0 0x3000000>; + }; + }; +}; + +&sleep_clk { + clock-frequency = <32000>; +}; + +&xo_board_clk { + clock-frequency = <24000000>; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&qfprom { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + pinctrl-0 = <&qpic_pins>; + pinctrl-names = "default"; + status = "okay"; + + nand@0 { + compatible = "spi-nand"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + nand-ecc-engine = <&qpic_nand>; + nand-bus-width = <8>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:sbl1"; + reg = <0x00000000 0x80000>; + read-only; + }; + + partition@80000 { + label = "0:mibib"; + reg = <0x00080000 0x80000>; + read-only; + }; + + partition@100000 { + label = "0:bootconfig"; + reg = <0x00100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "0:bootconfig1"; + reg = <0x00140000 0x40000>; + read-only; + }; + + partition@180000 { + label = "0:qsee"; + reg = <0x00180000 0x100000>; + read-only; + }; + + partition@280000 { + label = "0:qsee_1"; + reg = <0x00280000 0x100000>; + read-only; + }; + + partition@380000 { + label = "0:devcfg"; + reg = <0x00380000 0x40000>; + read-only; + }; + + partition@3c0000 { + label = "0:devcfg_1"; + reg = <0x003c0000 0x40000>; + read-only; + }; + + partition@400000 { + label = "0:cdt"; + reg = <0x00400000 0x40000>; + read-only; + }; + + partition@440000 { + label = "0:cdt_1`"; + reg = <0x00440000 0x40000>; + read-only; + }; + + partition@480000 { + label = "0:appsblenv"; + reg = <0x00480000 0x80000>; + }; + + partition@500000 { + label = "0:appsbl"; + reg = <0x00500000 0x140000>; + read-only; + }; + + partition@640000 { + label = "0:appsbl_1"; + reg = <0x00640000 0x140000>; + read-only; + }; + + partition@780000 { + label = "0:art"; + reg = <0x00780000 0x100000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + mac_addr_dp1: macaddr@0 { + reg = <0x0 0x6>; + }; + + mac_addr_dp2: macaddr@6 { + reg = <0x6 0x6>; + }; + + caldata_qca9889: caldata@4d000 { + reg = <0x4d000 0x844>; + }; + }; + }; + + partition@880000 { + label = "0:training"; + reg = <0x00880000 0x80000>; + read-only; + }; + + partition@900000 { + label = "bdata"; + reg = <0x00900000 0x80000>; + }; + + partition@980000 { + label = "crash"; + reg = <0x00980000 0x80000>; + }; + + partition@a00000 { + label = "crash_syslog"; + reg = <0x00a00000 0x80000>; + }; + + partition@a80000 { + label = "ubi_kernel"; + reg = <0x00a80000 0x2400000>; + }; + + partition@2e80000 { + label = "rootfs"; + reg = <0x02e80000 0x5180000>; + }; + }; + }; +}; + +/* +* ================================================================= +* _______________________ _______________________ +* | IPQ5018 | | QCA8337 | +* | +------+ +--------+ | | +--------+ +------+ | +* | | MAC0 |---| GE Phy |-+--- MDI ---+ | Phy3 |---| MAC4 | | +* | +------+ +--------+ | | +--------+ +------+ | +* | | |_______________________| +* | | _______________________ +* | | | QCA8081 | +* | +------+ +--------+ | | +-------------------+ | +* | | MAC1 |---| Uniphy |-+-- SGMII+--+ | Phy | | +* | +------+ +--------+ | | +-------------------+ | +* |_______________________| |_______________________| +* +* ================================================================= +*/ + +&switch { + status = "okay"; + + switch_mac_mode = ; + + qcom,port_phyinfo { + // MAC0 -> GE Phy --- MDI --- QCA8337 Switch + port@0 { + port_id = <1>; + mdiobus = <&mdio0>; + phy_address = <7>; + phy_dac = <0x10 0x10>; + }; + + // MAC1 -> Uniphy --- SGMII --- QCA8081 + port@1 { + port_id = <2>; + mdiobus = <&mdio1>; + phy_address = <8>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +// MAC0 -> GE Phy +&dp1 { + status = "okay"; + + nvmem-cells = <&mac_addr_dp1 0>; + nvmem-cell-names = "mac-address"; +}; + +// MAC1 ---SGMII---> QCA8081 +&dp2 { + status = "okay"; + + label = "wan"; + phy-handle = <&qca8081>; + nvmem-cells = <&mac_addr_dp2 0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio0 { + status = "okay"; +}; + +// IPQ5018 GE Phy -> QCA8337 PHY0 +&ge_phy { + qcom,dac-preset-short-cable; +}; + +&mdio1 { + status = "okay"; + + pinctrl-0 = <&mdio1_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>; + + // QCA8337 Phy0 -> LAN1 + qca8337_0: ethernet-phy@0 { + reg = <0>; + }; + + // QCA8337 Phy1 -> LAN2 + qca8337_1: ethernet-phy@1 { + reg = <1>; + }; + + // QCA8337 Phy2 -> LAN3 + qca8337_2: ethernet-phy@2 { + reg = <2>; + }; + + // QCA8337 Phy3 -> IPQ5018 GE Phy + qca8337_3: ethernet-phy@3 { + reg = <3>; + }; + + // QCA8081 Phy -> WAN + qca8081: ethernet-phy@8 { + compatible = "ethernet-phy-id004d.d101"; + reg = <8>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + }; + }; + }; + + // QCA8337 switch + ethernet-switch@11 { + compatible = "qca,qca8337"; + reg = <17>; + + ports { + port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&qca8337_0>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-handle = <&qca8337_1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-handle = <&qca8337_2>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@4 { + reg = <4>; + phy-handle = <&qca8337_3>; + phy-mode = "gmii"; + ethernet = <&dp1>; + }; + }; + }; +}; + +&tlmm { + button_pins: button-state { + pins = "gpio38"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + leds_pins: leds-state { + pins = "gpio23", "gpio24", "gpio25", + "gpio26", "gpio27", "gpio28"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + + mdio1_pins: mdio-state { + mdc-pins { + pins = "gpio36"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio-pins { + pins = "gpio37"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + qpic_pins: qpic-state { + clock-pins { + pins = "gpio9"; + function = "qspi_clk"; + drive-strength = <8>; + bias-disable; + }; + + cs-pins { + pins = "gpio8"; + function = "qspi_cs"; + drive-strength = <8>; + bias-disable; + }; + + data-pins { + pins = "gpio4", "gpio5", "gpio6", "gpio7"; + function = "qspi_data"; + drive-strength = <8>; + bias-disable; + }; + }; + + serial_0_pins: uart0-state { + pins = "gpio20", "gpio21"; + function = "blsp0_uart0"; + bias-disable; + }; +}; + +&tsens { + status = "okay"; +}; + +&pcie0_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + + perst-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>; + + pcie@0 { + wifi@0,0 { + status = "okay"; + + /* QCN9074: ath11k lacks DT compatible for PCI cards */ + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + + qcom,ath11k-calibration-variant = "Xiaomi-AX6000"; + }; + }; +}; + +&pcie1_phy { + status = "okay"; +}; + +&pcie1 { + /* + * although the pcie1 phy probes successfully, the controller is unable + * to bring it up. So let's disable it until a solution is found. + */ + status = "disbled"; + + perst-gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + + pcie@0 { + wifi@0,0 { + status = "okay"; + + compatible = "qcom,ath10k"; + reg = <0x00010000 0 0 0 0>; + + qcom,ath10k-calibration-variant = "Xiaomi-AX6000"; + nvmem-cell-names = "calibration"; + nvmem-cells = <&caldata_qca9889>; + }; + }; +}; + +&q6v5_wcss { + status = "okay"; + + memory-region = <&q6_mem_regions>; + firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt", + "ath11k/IPQ5018/hw1.0/m3_fw.mdt"; + + // IPQ5018 + q6_wcss_pd1: pd-1 { + firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt"; + + resets = + <&gcc GCC_WCSSAON_RESET>, + <&gcc GCC_WCSS_BCR>, + <&gcc GCC_CE_BCR>; + reset-names = + "wcss_aon_reset", + "wcss_reset", + "ce_reset"; + + clocks = + <&gcc GCC_WCSS_AHB_S_CLK>, + <&gcc GCC_WCSS_ACMT_CLK>, + <&gcc GCC_WCSS_AXI_M_CLK>; + clock-names = + "gcc_wcss_ahb_s_clk", + "gcc_wcss_acmt_clk", + "gcc_wcss_axi_m_clk"; + + interrupts-extended = + <&wcss_smp2p_in 8 0>, + <&wcss_smp2p_in 9 0>, + <&wcss_smp2p_in 12 0>, + <&wcss_smp2p_in 11 0>; + interrupt-names = + "fatal", + "ready", + "spawn-ack", + "stop-ack"; + + qcom,smem-states = + <&wcss_smp2p_out 8>, + <&wcss_smp2p_out 9>, + <&wcss_smp2p_out 10>; + qcom,smem-state-names = + "shutdown", + "stop", + "spawn"; + }; +}; + +&wifi0 { + status = "okay"; + + qcom,rproc = <&q6_wcss_pd1>; + qcom,ath11k-calibration-variant = "Xiaomi-AX6000"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,bdf-addr = <0x4c400000>; +}; diff --git a/target/linux/qualcommax/image/ipq50xx.mk b/target/linux/qualcommax/image/ipq50xx.mk index 661f18cd4..89712d6e0 100644 --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -88,3 +88,24 @@ define Device/linksys_spnmx56 ipq-wifi-linksys_spnmx56 endef TARGET_DEVICES += linksys_spnmx56 + +define Device/xiaomi_ax6000 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := AX6000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@mp03.1 + SOC := ipq5018 + KERNEL_SIZE := 36864k + NAND_SIZE := 128m + DEVICE_PACKAGES := kmod-ath11k-pci \ + ath11k-firmware-qcn9074 \ + ipq-wifi-xiaomi_ax6000 +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel +endif +endef +TARGET_DEVICES += xiaomi_ax6000 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds new file mode 100644 index 000000000..9792cb45b --- /dev/null +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds @@ -0,0 +1,40 @@ +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +elecom,wrc-x3000gs2|\ +iodata,wn-dax3000gr) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" "tx rx link_10 link_100 link_1000" + ;; +linksys,mr5500) + ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:00:green:lan" "lan1" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "qca8k-0.0:00:amber:lan" "lan1" "tx rx" + ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:01:green:lan" "lan2" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "qca8k-0.0:01:amber:lan" "lan2" "tx rx" + ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:02:green:lan" "lan3" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "qca8k-0.0:02:amber:lan" "lan3" "tx rx" + ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:03:green:lan" "lan4" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "qca8k-0.0:03:amber:lan" "lan4" "tx rx" + ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:04:green:wan" "wan" "link_10 link_100 link_1000" + ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "qca8k-0.0:04:amber:wan" "wan" "tx rx" + ;; +xiaomi,ax6000) + ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "90000.mdio-1:00:green:lan" "lan1" "tx rx link_10 link_100 link_1000" + ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "90000.mdio-1:01:green:lan" "lan2" "tx rx link_10 link_100 link_1000" + ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "90000.mdio-1:02:green:lan" "lan3" "tx rx link_10 link_100 link_1000" + ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "90000.mdio-1:08:green:wan" "wan" "tx rx link_10 link_100 link_1000 link_2500" + ucidef_set_led_netdev "wan-port-link-top-blue" "WAN-PORT-LINK-TOP-BLUE" "blue:wan" "wan" "link_1000 link_2500" + ucidef_set_led_netdev "wan-port-link-top-yellow" "WAN-PORT-LINK-TOP-YELLOW" "yellow:wan" "wan" "link_10 link_100" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network index ef881c940..a14ad1a76 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -13,7 +13,8 @@ ipq50xx_setup_interfaces() jdcloud,re-cs-03|\ linksys,mx2000|\ linksys,mx5500|\ - linksys,spnmx56) + linksys,spnmx56|\ + xiaomi,ax6000) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; linksys,mr5500) diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 890525190..dbf036e6f 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -24,6 +24,9 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + xiaomi,ax6000) + caldata_extract "0:art" 0x1000 0x20000 + ;; esac ;; "ath11k/QCN6122/hw1.0/cal-ahb-b00a040.wifi1.bin") @@ -53,6 +56,9 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + xiaomi,ax6000) + caldata_extract "0:art" 0x26800 0x20000 + ;; esac ;; *) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh index 23733a009..d5509613d 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -4,6 +4,29 @@ REQUIRE_IMAGE_METADATA=1 RAMFS_COPY_BIN='dumpimage fw_printenv fw_setenv head seq' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +xiaomi_initramfs_prepare() { + # Wipe UBI if running initramfs + [ "$(rootfs_type)" = "tmpfs" ] || return 0 + + local rootfs_mtdnum="$( find_mtd_index rootfs )" + if [ ! "$rootfs_mtdnum" ]; then + echo "unable to find mtd partition rootfs" + return 1 + fi + + local kern_mtdnum="$( find_mtd_index ubi_kernel )" + if [ ! "$kern_mtdnum" ]; then + echo "unable to find mtd partition ubi_kernel" + return 1 + fi + + ubidetach -m "$rootfs_mtdnum" + ubiformat /dev/mtd$rootfs_mtdnum -y + + ubidetach -m "$kern_mtdnum" + ubiformat /dev/mtd$kern_mtdnum -y +} + remove_oem_ubi_volume() { local oem_volume_name="$1" local oem_ubivol @@ -69,6 +92,14 @@ platform_check_image() { return 0; } +platform_pre_upgrade() { + case "$(board_name)" in + xiaomi,ax6000) + xiaomi_initramfs_prepare + ;; + esac +} + platform_do_upgrade() { case "$(board_name)" in glinet,gl-b3000) @@ -87,6 +118,23 @@ platform_do_upgrade() { remove_oem_ubi_volume squashfs nand_do_upgrade "$1" ;; + xiaomi,ax6000) + # Make sure that UART is enabled + fw_setenv boot_wait on + fw_setenv uart_en 1 + + # Enforce single partition. + fw_setenv flag_boot_rootfs 0 + fw_setenv flag_last_success 0 + fw_setenv flag_boot_success 1 + fw_setenv flag_try_sys1_failed 8 + fw_setenv flag_try_sys2_failed 8 + + # Kernel and rootfs are placed in 2 different UBI + CI_KERN_UBIPART="ubi_kernel" + CI_ROOT_UBIPART="rootfs" + nand_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;;