ipq807x: add Redmi AX6
authorZhijun You <hujy652@gmail.com>
Sat, 1 Jan 2022 22:12:51 +0000 (23:12 +0100)
committerRobert Marko <robimarko@gmail.com>
Mon, 16 Jan 2023 11:42:23 +0000 (12:42 +0100)
Redmi AX6 is a budget 802.11ax dual-band router/AP

Specifications:
* CPU: Qualcomm IPQ8071A Quad core Cortex-A53 1.4GHz
* RAM: 512MB of DDR3
* Storage: 128MB NAND
* Ethernet: 4x1G RJ45 ports (QCA8075)
* WLAN:
* 2.4GHz: Qualcomm QCN5024 2x2 802.11b/g/n/ax 574 Mbps PHY rate
* 5GHz: Qualcomm QCN5054 4x4@80MHz or 2x2@160MHz 802.11a/b/g/n/ac/ax 2402 PHY rate
* LEDs:
* System (Blue/Yellow)
* Network (Blue/Yellow)
*Buttons: 1x soft reset
*Power: 12V DC jack

Installation instructions:

Obtaining SSH access is mandatory
https://openwrt.org/inbox/toh/xiaomi/xiaomi_redmi_ax6_ax3000#ssh_access

Installation is done by the ubiformat method, through SSH:
1. Open an SSH shell to the router
2. Copy the file openwrt-ipq807x-generic-redmi_ax6-initramfs-factory.ubi to the /tmp directory
3. Check which rootfs partition is your router booted in (0 = rootfs | 1 = rootfs_1):
nvram get flag_boot_rootfs

4. Find the rootfs and rootfs_1 mtd indexes respectively:
cat /proc/mtd
Please confirm if mtd12 and mtd13 are the correct indexes from above!

5. Use the command ubiformat to flash the opposite mtd with UBI image:

If nvram get flag_boot_rootfs returned 0:
ubiformat /dev/mtd13 -y -f /tmp/openwrt-ipq807x-generic-redmi_ax6-initramfs-factory.ubi && nvram set flag_boot_rootfs=1 && nvram set flag_last_success=1 && nvram commit

otherwise:
ubiformat /dev/mtd12 -y -f /tmp/openwrt-ipq807x-generic-redmi_ax6-initramfs-factory.ubi && nvram set flag_boot_rootfs=0 && nvram set flag_last_success=0 && nvram commit

6. Reboot the device by:
reboot

Previous commands flashed an ubinized OpenWrt initramfs that will serve as the intermediate step
since OpenWrt uses unified rootfs in order to fully utilize NAND and provide enough space for packages.
Continue in order to pernamently flash OpenWrt:

7. SSH into OpenWrt from one of the LAN ports
8. Copy the file openwrt-ipq807x-generic-redmi_ax6-squashfs-sysupgrade.bin to the /tmp directory
9. Sysupgrade the device:
sysupgrade -n /tmp/openwrt-ipq807x-generic-redmi_ax6-squashfs-sysupgrade.bin

Device will reboot with OpenWrt, and then sysupgrade can be used to upgrade the device when desired.

Signed-off-by: Zhijun You <hujy652@gmail.com>
package/boot/uboot-envtools/files/ipq807x
package/firmware/ipq-wifi/Makefile
package/firmware/ipq-wifi/board-redmi_ax6.ipq8074 [new file with mode: 0644]
target/linux/ipq807x/base-files/etc/board.d/01_leds
target/linux/ipq807x/base-files/etc/board.d/02_network
target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
target/linux/ipq807x/base-files/lib/upgrade/platform.sh
target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts [new file with mode: 0644]
target/linux/ipq807x/image/generic.mk

index bf116d1fca0c9f1fc283b67724236c87bb1d81a0..44f2d8a0c271f61d027ecc4526030af4e909da5d 100644 (file)
@@ -8,6 +8,7 @@ touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
+redmi,ax6|\
 xiaomi,ax3600)
        idx="$(find_mtd_index 0:appsblenv)"
        [ -n "$idx" ] && \
index 9b490e6f74e1cc868e71787a662c19fcc815b4ad..1fa7482ddb8936a21f664ad7f082e60acd3500b9 100644 (file)
@@ -39,6 +39,7 @@ ALLWIFIBOARDS:= \
        pakedge_wr-1 \
        qxwlan_e2600ac-c1 \
        qxwlan_e2600ac-c2 \
+       redmi_ax6 \
        sony_ncp-hg100-cellular \
        teltonika_rutx \
        xiaomi_ax3600 \
@@ -129,6 +130,7 @@ $(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC))
 $(eval $(call generate-ipq-wifi-package,pakedge_wr-1,Pakedge WR-1))
 $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c1,Qxwlan E2600AC C1))
 $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2))
+$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
 $(eval $(call generate-ipq-wifi-package,sony_ncp-hg100-cellular,Sony NCP-HG100/Cellular))
 $(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX))
 $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600))
diff --git a/package/firmware/ipq-wifi/board-redmi_ax6.ipq8074 b/package/firmware/ipq-wifi/board-redmi_ax6.ipq8074
new file mode 100644 (file)
index 0000000..e56b4d3
Binary files /dev/null and b/package/firmware/ipq-wifi/board-redmi_ax6.ipq8074 differ
index 215ab7ca21725633389ed4703cd102725caac934..a13ddcbb08467f3bc0722d33b1c6eb0ab2d1c72c 100644 (file)
@@ -6,6 +6,7 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
+redmi,ax6|\
 xiaomi,ax3600)
        ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan"
        ;;
index 4dc118ed29d350890667755cca7d6f0767f1690f..cfe7580f8e7d11d7fa0a9f5bb94c96464c079c9b 100644 (file)
@@ -11,6 +11,7 @@ ipq807x_setup_interfaces()
        local board="$1"
 
        case "$board" in
+       redmi,ax6|\
        xiaomi,ax3600)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
                ;;
index 578ff7ad45164f15ac9f16d0a295d6cfb357668a..0a2908f13d4902db111399abe66e0b6317bdbdec 100644 (file)
@@ -9,6 +9,7 @@ board=$(board_name)
 case "$FIRMWARE" in
 "ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
        case "$board" in
+       redmi,ax6|\
        xiaomi,ax3600)
                caldata_extract "0:art" 0x1000 0x20000
                ;;
index d63e71251b864c069c3718f237322ce5b3015025..f9c28fad093ba32616df854c650d5209818fb572 100644 (file)
@@ -33,6 +33,7 @@ platform_check_image() {
 
 platform_pre_upgrade() {
        case "$(board_name)" in
+       redmi,ax6|\
        xiaomi,ax3600)
                xiaomi_initramfs_prepare
                ;;
@@ -41,6 +42,7 @@ platform_pre_upgrade() {
 
 platform_do_upgrade() {
        case "$(board_name)" in
+       redmi,ax6|\
        xiaomi,ax3600)
                # Make sure that UART is enabled
                fw_setenv boot_wait on
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts
new file mode 100644 (file)
index 0000000..6611a8f
--- /dev/null
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/* Copyright (c) 2021, Zhijun You <hujy652@gmail.com> */
+
+/dts-v1/;
+
+#include "ipq8071-ax3600.dtsi"
+
+/ {
+       model = "Redmi AX6";
+       compatible = "redmi,ax6", "qcom,ipq8074";
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_system_blue: system-blue {
+                       label = "blue:system";
+                       gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_system_yellow: system-yellow {
+                       label = "yellow:system";
+                       gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>;
+               };
+
+               network-blue {
+                       label = "blue:network";
+                       gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>;
+               };
+
+               network-yellow {
+                       label = "yellow:network";
+                       gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+/* AX6 can both have NAND of 256MiB or 128MiB.
+ * To be on the safe side, assume 128MiB of NAND.
+ */
+&rootfs {
+       reg = <0x2dc0000 0x5220000>;
+};
+
+&wifi {
+       qcom,ath11k-calibration-variant = "Redmi-AX6";
+};
index 11cca5450618ee4e7d4c4215803139ab44ad3577..7fd0169a64c16244cc77ddced773e7af7478c034 100644 (file)
@@ -17,6 +17,14 @@ define Device/UbiFit
        IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
 
+define Device/redmi_ax6
+       $(call Device/xiaomi_ax3600)
+       DEVICE_VENDOR := Redmi
+       DEVICE_MODEL := AX6
+       DEVICE_PACKAGES := ipq-wifi-redmi_ax6
+endef
+TARGET_DEVICES += redmi_ax6
+
 define Device/xiaomi_ax3600
        $(call Device/FitImage)
        $(call Device/UbiFit)