ipq807x: add Arcadyan AW1000 support
authorChukun Pan <amadeus@jmu.edu.cn>
Fri, 25 Aug 2023 15:10:35 +0000 (23:10 +0800)
committerChristian Marangi <ansuelsmth@gmail.com>
Wed, 13 Dec 2023 16:29:15 +0000 (17:29 +0100)
Hardware specification:
  SoC: Qualcomm IPQ8072A
  Flash: Toshiba NAND 1GiB
  RAM: 1 GiB of DDR3 466 MHz
  Ethernet: 4x 1Gbps + 1x 2.5Gbps
  WiFi1: QCN5024 2.4GHz ax 4x4
  WiFi2: QCN5054 5GHz ax 4x4
  Button: WiFi, WPS, Reset
  Modem: RG500Q-EA
  USB: 1 x USB 3.0
  Power: DC 12V 4A

Flash instructions:
  1. Download the initramfs image, rename it to
     initramfs.bin, and host it with tftp server.
  2. Interrupt U-Boot and run these commands:
     tftpboot initramfs.bin
     bootm
  3. After openwrt boots up, use scp or luci web
     to upload sysupgrade.bin to upgrade.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Reviewed-by: Robert Marko <robimarko@gmail.com>
package/firmware/ipq-wifi/Makefile
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts [new file with mode: 0644]
target/linux/qualcommax/image/ipq807x.mk
target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds
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/etc/hotplug.d/ieee80211/11_fix_wifi_mac [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh

index 8da2ac4e1f316a3c5e3fac45489cd745112c5a8c..cbd61c5be8a8ec0caf6cb88378903c83b5c73b99 100644 (file)
@@ -28,6 +28,7 @@ endef
 # <https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>
 
 ALLWIFIBOARDS:= \
+       arcadyan_aw1000 \
        buffalo_wxr-5950ax12 \
        compex_wpq873 \
        dynalink_dl-wrx36 \
@@ -136,6 +137,7 @@ endef
 # Board files should follow this name structure:
 #   board-<devicename>.<qca4019|qca9888|qca9889|qca9984|qca99x0|ipq8074>
 
+$(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000))
 $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
 $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873))
 $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts
new file mode 100644 (file)
index 0000000..495ebad
--- /dev/null
@@ -0,0 +1,345 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/* Copyright (c) 2023, Chukun Pan <amadeus@jmu.edu.cn> */
+
+/dts-v1/;
+
+#include "ipq8074.dtsi"
+#include "ipq8074-hk-cpu.dtsi"
+#include "ipq8074-ess.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Arcadyan AW1000";
+       compatible = "arcadyan,aw1000", "qcom,ipq8074";
+
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+               serial0 = &blsp1_uart5;
+               /*
+                * Aliases as required by u-boot
+                * to patch MAC addresses
+                */
+               ethernet0 = &dp1;
+               ethernet1 = &dp2;
+               ethernet2 = &dp3;
+               ethernet3 = &dp4;
+               ethernet4 = &dp6_syn;
+               label-mac-device = &dp1;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-append = " root=/dev/ubiblock0_1";
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               lte-pwrkey {
+                       gpio-export,name = "lte_pwrkey";
+                       gpio-export,output = <1>;
+                       gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
+               };
+
+               lte-power {
+                       gpio-export,name = "lte_power";
+                       gpio-export,output = <1>;
+                       gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>;
+               };
+
+               lte-reset {
+                       gpio-export,name = "lte_reset";
+                       gpio-export,output = <1>;
+                       gpios = <&tlmm 63 GPIO_ACTIVE_HIGH>;
+               };
+
+               usb-vbus {
+                       gpio-export,name = "usb_vbus";
+                       gpio-export,output = <0>;
+                       gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               wlan {
+                       label = "wlan";
+                       linux,code = <KEY_WLAN>;
+                       gpios = <&tlmm 2 GPIO_ACTIVE_LOW>;
+               };
+
+               wps {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&tlmm 62 GPIO_ACTIVE_LOW>;
+               };
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&tlmm 67 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       led-spi {
+               compatible = "spi-gpio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               sck-gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
+               mosi-gpios = <&tlmm 19 GPIO_ACTIVE_HIGH>;
+
+               led_gpio: led-gpio@0 {
+                       compatible = "fairchild,74hc595";
+                       reg = <0>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       registers-number = <2>;
+                       spi-max-frequency = <1000000>;
+                       enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "green:power";
+                       gpios = <&led_gpio 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               wifi {
+                       label = "green:wifi";
+                       gpios = <&led_gpio 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               internet {
+                       label = "green:internet";
+                       gpios = <&led_gpio 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               5g-red {
+                       label = "red:5g";
+                       gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
+               };
+
+               5g-green {
+                       label = "green:5g";
+                       gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
+               };
+
+               5g-blue {
+                       label = "blue:5g";
+                       gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
+               };
+
+               signal-red {
+                       label = "red:signal";
+                       gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
+               };
+
+               signal-green {
+                       label = "green:signal";
+                       gpios = <&led_gpio 8 GPIO_ACTIVE_LOW>;
+               };
+
+               signal-blue {
+                       label = "blue:signal";
+                       gpios = <&led_gpio 9 GPIO_ACTIVE_LOW>;
+               };
+
+               phone {
+                       label = "green:phone";
+                       gpios = <&led_gpio 11 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;
+               };
+       };
+};
+
+&blsp1_uart5 {
+       status = "okay";
+};
+
+&cryptobam {
+       status = "okay";
+};
+
+&crypto {
+       status = "okay";
+};
+
+&prng {
+       status = "okay";
+};
+
+&qpic_bam {
+       status = "okay";
+};
+
+&qpic_nand {
+       status = "okay";
+
+       nand@0 {
+               reg = <0>;
+               nand-ecc-strength = <8>;
+               nand-ecc-step-size = <512>;
+               nand-bus-width = <8>;
+
+               partitions {
+                       compatible = "qcom,smem-part";
+               };
+       };
+};
+
+&qusb_phy_0 {
+       status = "okay";
+};
+
+&qusb_phy_1 {
+       status = "okay";
+};
+
+&ssphy_0 {
+       status = "okay";
+};
+
+&ssphy_1 {
+       status = "okay";
+};
+
+&usb_0 {
+       status = "okay";
+};
+
+&usb_1 {
+       status = "okay";
+};
+
+&mdio {
+       status = "okay";
+
+       pinctrl-0 = <&mdio_pins>;
+       pinctrl-names = "default";
+       reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
+
+       qca8075_0: ethernet-phy@0 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+       };
+
+       qca8075_1: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+
+       qca8075_2: ethernet-phy@2 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <2>;
+       };
+
+       qca8075_3: ethernet-phy@3 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <3>;
+       };
+
+       qca8081: ethernet-phy@28 {
+               compatible = "ethernet-phy-id004d.d101";
+               reg = <28>;
+               reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&switch {
+       status = "okay";
+
+       switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */
+       switch_wan_bmp = <ESS_PORT6>; /* wan port bitmap */
+       switch_mac_mode = <MAC_MODE_QSGMII>; /* mac mode for uniphy instance0*/
+       switch_mac_mode2 = <MAC_MODE_SGMII_PLUS>; /* mac mode for uniphy instance2*/
+
+       qcom,port_phyinfo {
+               port@1 {
+                       port_id = <1>;
+                       phy_address = <0>;
+               };
+               port@2 {
+                       port_id = <2>;
+                       phy_address = <1>;
+               };
+               port@3 {
+                       port_id = <3>;
+                       phy_address = <2>;
+               };
+               port@4 {
+                       port_id = <4>;
+                       phy_address = <3>;
+               };
+               port@6 {
+                       port_id = <6>;
+                       phy_address = <28>;
+                       port_mac_sel = "QGMAC_PORT";
+               };
+       };
+};
+
+&edma {
+       status = "okay";
+};
+
+&dp1 {
+       status = "okay";
+       phy-handle = <&qca8075_0>;
+       label = "lan1";
+};
+
+&dp2 {
+       status = "okay";
+       phy-handle = <&qca8075_1>;
+       label = "lan2";
+};
+
+&dp3 {
+       status = "okay";
+       phy-handle = <&qca8075_2>;
+       label = "lan3";
+};
+
+&dp4 {
+       status = "okay";
+       phy-handle = <&qca8075_3>;
+       label = "lan4";
+};
+
+&dp6_syn {
+       status = "okay";
+       phy-handle = <&qca8081>;
+       label = "wan";
+};
+
+&wifi {
+       status = "okay";
+
+       qcom,ath11k-calibration-variant = "Arcadyan-AW1000";
+};
index 6eb8ed2ce2785584006572f001dfa2c5418d97cb..ce4d62d571d2baf7e92b2491efaad7672196ba75 100644 (file)
@@ -33,6 +33,20 @@ define Build/wax6xx-netgear-tar
        rm -rf $@.tmp
 endef
 
+define Device/arcadyan_aw1000
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Arcadyan
+       DEVICE_MODEL := AW1000
+       BLOCKSIZE := 256k
+       PAGESIZE := 4096
+       DEVICE_DTS_CONFIG := config@hk09
+       SOC := ipq8072
+       DEVICE_PACKAGES := ipq-wifi-arcadyan_aw1000 kmod-spi-gpio \
+               kmod-gpio-nxp-74hc164 kmod-usb-serial-option uqmi
+endef
+TARGET_DEVICES += arcadyan_aw1000
+
 define Device/buffalo_wxr-5950ax12
        $(call Device/FitImage)
        DEVICE_VENDOR := Buffalo
index fb14a667cb0f3010fc78d628d5538b8d8fe0a7c8..5e478d75eeca082edf79a266002eb3da0153f3e5 100644 (file)
@@ -6,6 +6,10 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
+arcadyan,aw1000)
+       ucidef_set_led_netdev "5g" "5G" "green:5g" "wwan0"
+       ucidef_set_led_netdev "wan" "WAN" "green:internet" "wan"
+       ;;
 edgecore,eap102)
        ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "wan"
        ;;
index 82f16519aaf2c081ec3b6e875285f87182f500e8..cb70b272833a8f901c41d507a7551b3bf12d397a 100644 (file)
@@ -11,6 +11,7 @@ ipq807x_setup_interfaces()
        local board="$1"
 
        case "$board" in
+       arcadyan,aw1000|\
        buffalo,wxr-5950ax12|\
        dynalink,dl-wrx36|\
        xiaomi,ax9000)
index 6139ff0faae7b64d158bdd4f7fa4508bc63681b7..e14af79598734e9c1dceea8e7b445632a9fd5b8d 100644 (file)
@@ -9,6 +9,7 @@ board=$(board_name)
 case "$FIRMWARE" in
 "ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
        case "$board" in
+       arcadyan,aw1000|\
        buffalo,wxr-5950ax12|\
        compex,wpq873|\
        dynalink,dl-wrx36|\
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
new file mode 100644 (file)
index 0000000..c7cacc9
--- /dev/null
@@ -0,0 +1,17 @@
+[ "$ACTION" == "add" ] || exit 0
+
+PHYNBR=${DEVPATH##*/phy}
+
+[ -n $PHYNBR ] || exit 0
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board=$(board_name)
+
+case "$board" in
+       arcadyan,aw1000)
+               [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 1 > /sys${DEVPATH}/macaddress
+               [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress
+               ;;
+esac
index cddf287b5e0f345b2a471394bbd1e46ce0078c7d..5a40d5388371fe80124d09dcd0b863086042b74e 100644 (file)
@@ -43,14 +43,7 @@ platform_pre_upgrade() {
 
 platform_do_upgrade() {
        case "$(board_name)" in
-       buffalo,wxr-5950ax12)
-               CI_KERN_UBIPART="rootfs"
-               CI_ROOT_UBIPART="user_property"
-               buffalo_upgrade_prepare
-               nand_do_flash_file "$1" || nand_do_upgrade_failed
-               nand_do_restore_config || nand_do_upgrade_failed
-               buffalo_upgrade_optvol
-               ;;
+       arcadyan,aw1000|\
        compex,wpq873|\
        dynalink,dl-wrx36|\
        edimax,cax1800|\
@@ -60,6 +53,14 @@ platform_do_upgrade() {
        netgear,wax630)
                nand_do_upgrade "$1"
                ;;
+       buffalo,wxr-5950ax12)
+               CI_KERN_UBIPART="rootfs"
+               CI_ROOT_UBIPART="user_property"
+               buffalo_upgrade_prepare
+               nand_do_flash_file "$1" || nand_do_upgrade_failed
+               nand_do_restore_config || nand_do_upgrade_failed
+               buffalo_upgrade_optvol
+               ;;
        edgecore,eap102)
                active="$(fw_printenv -n active)"
                if [ "$active" -eq "1" ]; then