qualcommax: add support for Aliyun AP8220
authorChukun Pan <amadeus@jmu.edu.cn>
Mon, 10 Feb 2025 15:18:15 +0000 (23:18 +0800)
committerRobert Marko <robimarko@gmail.com>
Mon, 17 Feb 2025 09:21:21 +0000 (10:21 +0100)
Aliyun AP8220 is an AP manufactured by Edgecore.
(Very similar to Edgecore EAP102)

Hardware specifications:
  SoC: Qualcomm IPQ8071A
  RAM: 1GB of DDR4 600MHz
  Flash1: MX25U3235F 4MB
  Flash2: MX30UF1G18AC 128MB
  Ethernet: 2x 2.5G RJ45 port
  USB: 2x USB-A 2.0 port
  WiFi1: QCN5024 2.4GHz
  WiFi2: QCN5054 5GHz
  Power: DC 12V / PoE

Flash instructions:
  1. Connect the router via serial port
  2. Keep pressing @ until uboot is interrupted
  3. Download the initramfs image, rename it to
     initramfs.bin, host it with tftp server
  4. Run these commands:
     tftpboot initramfs.bin
     bootm
  5. After openwrt boots up, use scp or luci
     to upload sysupgrade.bin to upgrade.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/17970
Signed-off-by: Robert Marko <robimarko@gmail.com>
package/boot/uboot-envtools/files/qualcommax_ipq807x
package/firmware/ipq-wifi/Makefile
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts [new file with mode: 0644]
target/linux/qualcommax/image/ipq807x.mk
target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network
target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh

index 840e97fa10cb1220edb0c59105523392520749a2..21ec0ae5b133ca05b9dd12bf9fff94f084977135 100644 (file)
@@ -26,6 +26,12 @@ ubootenv_add_mmc() {
 }
 
 case "$board" in
+aliyun,ap8220|\
+compex,wpq873|\
+edgecore,eap102|\
+zyxel,nbg7815)
+       ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x10000"
+       ;;
 dynalink,dl-wrx36|\
 netgear,rax120v2|\
 netgear,sxr80|\
@@ -37,11 +43,6 @@ tplink,eap620hd-v1|\
 tplink,eap660hd-v1)
        ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x20000"
        ;;
-compex,wpq873|\
-edgecore,eap102|\
-zyxel,nbg7815)
-       ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x10000"
-       ;;
 edimax,cax1800)
        ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000"
        ;;
index cb7d71cb55de842c3ac07ba30817a5b6c6c4653c..f784d9a2e45d816872b121f52067afd048c75ef8 100644 (file)
@@ -28,6 +28,7 @@ endef
 
 ALLWIFIBOARDS:= \
        8devices_mango \
+       aliyun_ap8220 \
        arcadyan_aw1000 \
        asus_rt-ax89x \
        buffalo_wxr-5950ax12 \
@@ -166,6 +167,7 @@ endef
 #   board-<devicename>.<qca4019|qca9888|qca9889|qca9984|qca99x0|ipq8074>
 
 $(eval $(call generate-ipq-wifi-package,8devices_mango,8devices Mango))
+$(eval $(call generate-ipq-wifi-package,aliyun_ap8220,Aliyun AP8220))
 $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000))
 $(eval $(call generate-ipq-wifi-package,asus_rt-ax89x,Asus RT-AX89X))
 $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts
new file mode 100644 (file)
index 0000000..176dc59
--- /dev/null
@@ -0,0 +1,337 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "ipq8074.dtsi"
+#include "ipq8074-ac-cpu.dtsi"
+#include "ipq8074-ess.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       model = "Aliyun AP8220";
+       compatible = "aliyun,ap8220", "qcom,ipq8074";
+
+       aliases {
+               serial0 = &blsp1_uart5;
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-append = " root=/dev/ubiblock0_1";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               pinctrl-0 = <&button_pins>;
+               pinctrl-names = "default";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&tlmm 66 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
+                       gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
+               };
+
+               wlan2g {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WLAN_2GHZ;
+                       gpios = <&tlmm 47 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy1radio";
+               };
+
+               wlan5g {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WLAN_5GHZ;
+                       gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy0radio";
+               };
+
+               bluetooth {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_BLUETOOTH;
+                       gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               ble-power {
+                       gpio-export,name = "ble_power";
+                       gpio-export,output = <1>;
+                       gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&tlmm {
+       mdio_pins: mdio-pins {
+               mdc {
+                       pins = "gpio68";
+                       function = "mdc";
+                       drive-strength = <8>;
+                       bias-pull-up;
+               };
+
+               mdio {
+                       pins = "gpio69";
+                       function = "mdio";
+                       drive-strength = <8>;
+                       bias-pull-up;
+               };
+       };
+
+       button_pins: button-pins {
+               mux {
+                       pins = "gpio66";
+                       function = "gpio";
+                       drive-strength = <8>;
+                       bias-pull-up;
+               };
+       };
+};
+
+&blsp1_spi1 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "0:sbl1";
+                               reg = <0x0 0x50000>;
+                               read-only;
+                       };
+
+                       partition@50000 {
+                               label = "0:mibib";
+                               reg = <0x50000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@60000 {
+                               label = "0:qsee";
+                               reg = <0x60000 0x180000>;
+                               read-only;
+                       };
+
+                       partition@1e0000 {
+                               label = "0:devcfg";
+                               reg = <0x1e0000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@1f0000 {
+                               label = "0:apdp";
+                               reg = <0x1f0000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@200000 {
+                               label = "0:rpm";
+                               reg = <0x200000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@240000 {
+                               label = "0:cdt";
+                               reg = <0x240000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@250000 {
+                               label = "0:appsblenv";
+                               reg = <0x250000 0x10000>;
+                       };
+
+                       partition@260000 {
+                               label = "0:appsbl";
+                               reg = <0x260000 0xa0000>;
+                               read-only;
+                       };
+
+                       partition@300000 {
+                               label = "0:art";
+                               reg = <0x300000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@340000 {
+                               label = "0:ethphyfw";
+                               reg = <0x340000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@3c0000 {
+                               label = "product_info";
+                               reg = <0x3c0000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@3d0000 {
+                               label = "mtdoops";
+                               reg = <0x3d0000 0x20000>;
+                       };
+
+                       partition@3f0000 {
+                               label = "priv_data1";
+                               reg = <0x3f0000 0x10000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&blsp1_uart5 {
+       status = "okay";
+};
+
+&cryptobam {
+       status = "okay";
+};
+
+&crypto {
+       status = "okay";
+};
+
+&prng {
+       status = "okay";
+};
+
+&qpic_bam {
+       status = "okay";
+};
+
+&qusb_phy_0 {
+       status = "okay";
+};
+
+&ssphy_0 {
+       status = "okay";
+};
+
+&usb_0 {
+       status = "okay";
+};
+
+&qpic_nand {
+       status = "okay";
+
+       nand@0 {
+               reg = <0>;
+               nand-ecc-strength = <4>;
+               nand-ecc-step-size = <512>;
+               nand-bus-width = <8>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "rootfs1";
+                               reg = <0x0000000 0x3000000>;
+                       };
+
+                       partition@3000000 {
+                               label = "rootfs2";
+                               reg = <0x3000000 0x3000000>;
+                       };
+
+                       partition@6000000 {
+                               label = "usrdata";
+                               reg = <0x6000000 0x2000000>;
+                       };
+               };
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       pinctrl-0 = <&mdio_pins>;
+       pinctrl-names = "default";
+
+       qca8081_24: ethernet-phy@24 {
+               compatible = "ethernet-phy-id004d.d101";
+               reg = <24>;
+               reset-deassert-us = <10000>;
+               reset-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>;
+       };
+
+       qca8081_28: ethernet-phy@28 {
+               compatible = "ethernet-phy-id004d.d101";
+               reg = <28>;
+               reset-deassert-us = <10000>;
+               reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&switch {
+       status = "okay";
+
+       switch_lan_bmp = <ESS_PORT5>;
+       switch_wan_bmp = <ESS_PORT6>;
+       switch_mac_mode1 = <MAC_MODE_SGMII_PLUS>;
+       switch_mac_mode2 = <MAC_MODE_SGMII_PLUS>;
+
+       qcom,port_phyinfo {
+               port@5 {
+                       port_id = <5>;
+                       phy_address = <24>;
+                       port_mac_sel = "QGMAC_PORT";
+               };
+               port@6 {
+                       port_id = <6>;
+                       phy_address = <28>;
+                       port_mac_sel = "QGMAC_PORT";
+               };
+       };
+};
+
+&edma {
+       status = "okay";
+};
+
+&dp5 {
+       status = "okay";
+       phy-mode = "sgmii";
+       phy-handle = <&qca8081_24>;
+       label = "wan";
+};
+
+&dp6 {
+       status = "okay";
+       phy-handle = <&qca8081_28>;
+       label = "lan";
+};
+
+&wifi {
+       status = "okay";
+
+       qcom,ath11k-calibration-variant = "Aliyun-AP8220";
+};
index 39fc63827cac45bf03e6e440b31c07182da0f079..4477e10505f7d1041514f4a56d5b9c2c6bcf83ed 100644 (file)
@@ -33,6 +33,19 @@ define Build/wax6xx-netgear-tar
        rm -rf $@.tmp
 endef
 
+define Device/aliyun_ap8220
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Aliyun
+       DEVICE_MODEL := AP8220
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@ac02
+       SOC := ipq8071
+       DEVICE_PACKAGES := ipq-wifi-aliyun_ap8220
+endef
+TARGET_DEVICES += aliyun_ap8220
+
 define Device/arcadyan_aw1000
        $(call Device/FitImage)
        $(call Device/UbiFit)
index c464be6701d152a0bbe0009989fa3b8fde322a13..7d55f6ab69e10b0c174595082c62834b13758ba8 100644 (file)
@@ -11,6 +11,12 @@ ipq807x_setup_interfaces()
        local board="$1"
 
        case "$board" in
+       aliyun,ap8220|\
+       edgecore,eap102|\
+       yuncore,ax880|\
+       zte,mf269)
+               ucidef_set_interfaces_lan_wan "lan" "wan"
+               ;;
        asus,rt-ax89x)
                ucidef_set_interfaces_lan_wan "10g-sfp 10g-copper lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8" "wan"
                ;;
@@ -37,11 +43,6 @@ ipq807x_setup_interfaces()
        xiaomi,ax3600)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
                ;;
-       edgecore,eap102|\
-       yuncore,ax880|\
-       zte,mf269)
-               ucidef_set_interfaces_lan_wan "lan" "wan"
-               ;;
        edimax,cax1800)
                ucidef_set_interfaces_lan_wan "lan"
                ;;
@@ -83,6 +84,11 @@ ipq807x_setup_macs()
        local label_mac=""
 
        case "$board" in
+       aliyun,ap8220)
+               wan_mac=$(mtd_get_mac_text product_info 0x4b)
+               lan_mac=$(macaddr_add "$wan_mac" 1)
+               label_mac="$wan_mac"
+               ;;
        linksys,mx4200v2|\
        linksys,mx4300)
                label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
index ec772de8eb672a25009c2ab8bef6a70f9d271f3f..508ecec314a357bb5838a03d9254d0d1f76f39e5 100644 (file)
@@ -9,6 +9,13 @@ board=$(board_name)
 case "$FIRMWARE" in
 "ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
        case "$board" in
+       aliyun,ap8220)
+               caldata_extract "0:art" 0x1000 0x20000
+               addr=$(mtd_get_mac_text product_info 0x4b)
+               ath11k_patch_mac $addr 0
+               ath11k_patch_mac $(macaddr_add $addr 8) 1
+               ath11k_set_macflag
+               ;;
        asus,rt-ax89x)
                CI_UBIPART="UBI_DEV"
                caldata_extract_ubi "Factory" 0x1000 0x20000
index cb60c5daf61fb6f31e46977624211f0a4f5dc53e..431491c14121d8bd87da8b5babf0d304bfc4fc53 100644 (file)
@@ -166,6 +166,15 @@ platform_pre_upgrade() {
 
 platform_do_upgrade() {
        case "$(board_name)" in
+       aliyun,ap8220)
+               active="$(fw_printenv -n active)"
+               if [ "$active" -eq "1" ]; then
+                       CI_UBIPART="rootfs1"
+               else
+                       CI_UBIPART="rootfs2"
+               fi
+               nand_do_upgrade "$1"
+               ;;
        arcadyan,aw1000|\
        cmcc,rm2-6|\
        compex,wpq873|\