From fbcda3616e2c18b533a552fad9b724a636bcae5e Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 25 Aug 2023 23:10:35 +0800 Subject: [PATCH] ipq807x: add Arcadyan AW1000 support 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 Reviewed-by: Robert Marko --- package/firmware/ipq-wifi/Makefile | 2 + .../arm64/boot/dts/qcom/ipq8072-aw1000.dts | 345 ++++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 14 + .../ipq807x/base-files/etc/board.d/01_leds | 4 + .../ipq807x/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 17 + .../base-files/lib/upgrade/platform.sh | 17 +- 8 files changed, 393 insertions(+), 8 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts create mode 100644 target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 8da2ac4e1f31..cbd61c5be8a8 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -28,6 +28,7 @@ endef # ALLWIFIBOARDS:= \ + arcadyan_aw1000 \ buffalo_wxr-5950ax12 \ compex_wpq873 \ dynalink_dl-wrx36 \ @@ -136,6 +137,7 @@ endef # Board files should follow this name structure: # board-. +$(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 index 000000000000..495ebad17a31 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts @@ -0,0 +1,345 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Chukun Pan */ + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include + +/ { + 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 = ; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + 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 = ; /* wan port bitmap */ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode2 = ; /* 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"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 6eb8ed2ce278..ce4d62d571d2 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -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 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 fb14a667cb0f..5e478d75eeca 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 @@ -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" ;; 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 82f16519aaf2..cb70b272833a 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 @@ -11,6 +11,7 @@ ipq807x_setup_interfaces() local board="$1" case "$board" in + arcadyan,aw1000|\ buffalo,wxr-5950ax12|\ dynalink,dl-wrx36|\ xiaomi,ax9000) 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 6139ff0faae7..e14af7959873 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 @@ -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 index 000000000000..c7cacc99fe6f --- /dev/null +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -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 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 cddf287b5e0f..5a40d5388371 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -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 -- 2.30.2