From: Joshua Roys Date: Thu, 30 Dec 2021 20:25:03 +0000 (-0500) Subject: ipq40xx: add support for ASUS RT-ACRH17/RT-AC42U X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=51b9aef553a82cbc80c12e13a4011d4d2e29fde4;p=openwrt%2Fstaging%2Fjow.git ipq40xx: add support for ASUS RT-ACRH17/RT-AC42U SOC: IPQ4019 CPU: Quad-core ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d DRAM: 256 MB NAND: 128 MiB Macronix MX30LF1G18AC ETH: Qualcomm Atheros QCA8075 Gigabit Switch (4x LAN, 1x WAN) USB: 1x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC) WLAN1: Qualcomm Atheros QCA4019 2.4GHz 802.11bgn 2x2:2 WLAN2: Qualcomm Atheros QCA9984 5GHz 802.11nac 4x4:4 INPUT: 1x WPS, 1x Reset LEDS: Status, WIFI1, WIFI2, WAN (red & blue), 4x LAN This board is very similar to the RT-ACRH13/RT-AC58U. It must be flashed with an intermediary initramfs image, the jffs2 ubi volume deleted, and then finally a sysupgrade with the final image performed. Signed-off-by: Joshua Roys (added ALT0) Signed-off-by: Christian Lamparter --- diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index b1e6541e61..5d8c04b7d8 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -27,6 +27,7 @@ endef ALLWIFIBOARDS:= \ 8dev_habanero-dvk \ aruba_ap-303 \ + asus_rt-ac42u \ avm_fritzrepeater-1200 \ buffalo_wtr-m2133hp \ cellc_rtl30vw \ @@ -116,6 +117,7 @@ endef $(eval $(call generate-ipq-wifi-package,8dev_habanero-dvk,8devices Habanero DVK)) $(eval $(call generate-ipq-wifi-package,aruba_ap-303,Aruba AP-303)) +$(eval $(call generate-ipq-wifi-package,asus_rt-ac42u,ASUS RT-AC42U)) $(eval $(call generate-ipq-wifi-package,avm_fritzrepeater-1200,AVM FRITZRepeater 1200)) $(eval $(call generate-ipq-wifi-package,buffalo_wtr-m2133hp,Buffalo WTR-M2133HP)) $(eval $(call generate-ipq-wifi-package,cellc_rtl30vw, Cell C RTL30VW)) diff --git a/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca4019 b/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca4019 new file mode 100644 index 0000000000..cf6b9e0538 Binary files /dev/null and b/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca4019 differ diff --git a/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca9984 b/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca9984 new file mode 100644 index 0000000000..ea123a3a63 Binary files /dev/null and b/package/firmware/ipq-wifi/board-asus_rt-ac42u.qca9984 differ diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds index 16039c8c42..26acfb6037 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -12,6 +12,12 @@ case "$board" in alfa-network,ap120c-ac) ucidef_set_led_netdev "wan" "WAN" "amber:wan" "eth1" ;; +asus,rt-ac42u) + ucidef_set_led_switch "lan1" "LAN1" "blue:lan" "switch0" "0x02" + ucidef_set_led_switch "lan2" "LAN2" "blue:lan_1" "switch0" "0x04" + ucidef_set_led_switch "lan3" "LAN3" "blue:lan_2" "switch0" "0x08" + ucidef_set_led_switch "lan4" "LAN4" "blue:lan_3" "switch0" "0x10" + ;; asus,rt-ac58u) ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x1e" diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index c37fc58b22..2b908c800f 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -50,6 +50,7 @@ ipq40xx_setup_interfaces() openmesh,a62) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; + asus,rt-ac42u|\ asus,rt-ac58u|\ mikrotik,hap-ac2|\ mikrotik,hap-ac3|\ @@ -153,7 +154,6 @@ ipq40xx_setup_macs() label_mac=$(mtd_get_mac_binary "ART" 0x1006) ;; asus,rt-ac58u) - CI_UBIPART=UBI_DEV wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006) label_mac=$wan_mac diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index d368475ffc..12061eadf5 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -26,6 +26,9 @@ case "$FIRMWARE" in ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; + asus,rt-ac42u) + caldata_extract_ubi "Factory" 0x9000 0x2f20 + ;; avm,fritzrepeater-3000) /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ @@ -81,11 +84,9 @@ case "$FIRMWARE" in caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary mfginfo 0x1D) ;; - asus,map-ac2200) - caldata_extract_ubi "Factory" 0x1000 0x2f20 - ;; + asus,map-ac2200 |\ + asus,rt-ac42u |\ asus,rt-ac58u) - CI_UBIPART=UBI_DEV caldata_extract_ubi "Factory" 0x1000 0x2f20 ;; avm,fritzbox-4040) @@ -203,11 +204,8 @@ case "$FIRMWARE" in caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mfginfo 0x1D) 1) ;; - asus,map-ac2200) - caldata_extract_ubi "Factory" 0x5000 0x2f20 - ;; + asus,map-ac2200 |\ asus,rt-ac58u) - CI_UBIPART=UBI_DEV caldata_extract_ubi "Factory" 0x5000 0x2f20 ;; avm,fritzbox-4040) diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index d1fcd804d9..2609a55d27 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -7,6 +7,10 @@ preinit_set_mac_address() { ip link set dev eth0 address $(macaddr_add "$base_mac" 1) ip link set dev eth1 address $(macaddr_add "$base_mac" 3) ;; + asus,rt-ac42u) + ip link set dev eth0 address $(mtd_get_mac_binary_ubi Factory 0x1006) + ip link set dev eth1 address $(mtd_get_mac_binary_ubi Factory 0x9006) + ;; engenius,eap2200) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth1 address $(macaddr_add "$base_mac" 1) diff --git a/target/linux/ipq40xx/base-files/lib/preinit/06_set_preinit_iface_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/06_set_preinit_iface_ipq40xx.sh index e97133f105..18c13c602c 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/06_set_preinit_iface_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/06_set_preinit_iface_ipq40xx.sh @@ -3,6 +3,7 @@ set_preinit_iface() { case $(board_name) in aruba,ap-303| \ + asus,rt-ac42u| \ asus,rt-ac58u| \ avm,fritzbox-4040| \ ezviz,cs-w3-wd1200g-eup| \ diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 357e02000a..b0493e10ba 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -6,8 +6,8 @@ RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' platform_check_image() { case "$(board_name)" in + asus,rt-ac42u |\ asus,rt-ac58u) - CI_UBIPART="UBI_DEV" local ubidev=$(nand_find_ubi $CI_UBIPART) local asus_root=$(nand_find_volume $ubidev jffs2) @@ -117,8 +117,8 @@ platform_do_upgrade() { CI_KERNPART="linux" nand_do_upgrade "$1" ;; + asus,rt-ac42u |\ asus,rt-ac58u) - CI_UBIPART="UBI_DEV" CI_KERNPART="linux" nand_do_upgrade "$1" ;; diff --git a/target/linux/ipq40xx/config-5.10 b/target/linux/ipq40xx/config-5.10 index 64f0e54d41..b944c11d16 100644 --- a/target/linux/ipq40xx/config-5.10 +++ b/target/linux/ipq40xx/config-5.10 @@ -225,6 +225,7 @@ CONFIG_LEDS_LP5523=y CONFIG_LEDS_LP5562=y CONFIG_LEDS_LP55XX_COMMON=y CONFIG_LEDS_TLC591XX=y +CONFIG_LED_TRIGGER_PHY=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_SPIN_ON_OWNER=y diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts index bd0c6b71df..ac4d4a139c 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts @@ -21,10 +21,6 @@ led-upgrade = &led_power; }; - chosen { - bootargs-append = " ubi.mtd=UBI_DEV"; - }; - soc { rng@22000 { status = "okay"; @@ -272,12 +268,7 @@ #size-cells = <1>; partition@0 { - /* - * TODO: change to label = "ubi" once we drop 4.14. - * also drop the bootargs-append and all the - * userspace CI_UBIPART="UBI_DEV" remains. - */ - label = "UBI_DEV"; + label = "ubi"; reg = <0x00000000 0x08000000>; }; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-rt-ac42u.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-rt-ac42u.dts new file mode 100644 index 0000000000..31e2e40ac0 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-rt-ac42u.dts @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + model = "ASUS RT-AC42U"; + compatible = "asus,rt-ac42u"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256MB */ + }; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb3@8af8800 { + status = "okay"; + + dwc3@8a00000 { + #address-cells = <1>; + #size-cells = <0>; + + usb3_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + usb3_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + }; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&tlmm 40 GPIO_ACTIVE_LOW>; + label = "blue:status"; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&tlmm 61 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "90000.mdio-1:04:link"; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&tlmm 68 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-4 { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&tlmm 54 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-5 { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&tlmm 45 GPIO_ACTIVE_LOW>; + linux,default-trigger = "switch0"; + }; + + led-6 { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&tlmm 43 GPIO_ACTIVE_LOW>; + linux,default-trigger = "switch0"; + }; + + led-7 { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + linux,default-trigger = "switch0"; + }; + + led-8 { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&tlmm 49 GPIO_ACTIVE_LOW>; + linux,default-trigger = "switch0"; + }; + }; +}; + +&cryptobam { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + serial_0_pins: serial0_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + nand_pins: nand_pins { + pullups { + pins = "gpio53", "gpio58", "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio55", "gpio56", "gpio57", "gpio60", + "gpio62", "gpio63", "gpio64", "gpio65", + "gpio66", "gpio67", "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&nand { + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x00000000 0x00080000>; + read-only; + }; + partition@80000 { + label = "MIBIB"; + reg = <0x00080000 0x00080000>; + read-only; + }; + partition@100000 { + label = "QSEE"; + reg = <0x00100000 0x00100000>; + read-only; + }; + partition@200000 { + label = "CDT"; + reg = <0x00200000 0x00080000>; + read-only; + }; + partition@280000 { + label = "APPSBL"; + reg = <0x00280000 0x00140000>; + read-only; + }; + partition@3C0000 { + label = "APPSBLENV"; + reg = <0x003C0000 0x00040000>; + read-only; + }; + partition@400000 { + label = "ubi"; + reg = <0x00400000 0x07C00000>; + }; + }; + }; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "ASUS-RT-AC42U"; +}; + +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 50 GPIO_ACTIVE_LOW>; + clkreq-gpio = <&tlmm 39 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi2: wifi@1,0 { + compatible = "qcom,ath10k"; + reg = <0x00010000 0 0 0 0>; + + qcom,ath10k-calibration-variant = "ASUS-RT-AC42U"; + }; + }; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 332fff7f45..43ea5b801a 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -57,6 +57,10 @@ define Build/append-rutx-metadata }' | fwtool -I - $@ endef +define Build/copy-file + cat "$(1)" > "$@" +endef + define Build/mkmylofw_32m $(eval device_id=$(word 1,$(1))) $(eval revision=$(word 2,$(1))) @@ -196,6 +200,34 @@ define Device/asus_map-ac2200 endef TARGET_DEVICES += asus_map-ac2200 +# WARNING: this is an initramfs image that gets you half of the way there +# you need to delete the jffs2 ubi volume and sysupgrade to the final image +# to get a "trx" you can flash via web UI for ac42u/ac58u: +# - change call Device/FitImageLzma to Device/FitImage +# - add the following below UIMAGE_NAME +# UIMAGE_MAGIC := 0x27051956 +# IMAGES += factory.trx +# IMAGE/factory.trx := copy-file $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) | uImage none +define Device/asus_rt-ac42u + $(call Device/FitImageLzma) + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RT-AC42U + DEVICE_ALT0_VENDOR := ASUS + DEVICE_ALT0_MODEL := RT-ACRH17 + SOC := qcom-ipq4019 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DTB_SIZE := 65536 + IMAGE_SIZE := 20439364 + FILESYSTEMS := squashfs +# RT-AC82U is nowhere to be found online +# Rather, this device is a/k/a RT-AC42U +# But we'll go with what the vendor firmware has... + UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC82U') + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-asus_rt-ac42u kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asus_rt-ac42u + define Device/asus_rt-ac58u $(call Device/FitImageLzma) DEVICE_VENDOR := ASUS diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch index b641251423..b76b1a30bb 100644 --- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -902,11 +902,71 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -902,11 +902,72 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -65,6 +65,7 @@ Signed-off-by: John Crispin + qcom-ipq4019-r619ac-128m.dtb \ + qcom-ipq4019-rbr50.dtb \ + qcom-ipq4019-rbs50.dtb \ ++ qcom-ipq4019-rt-ac42u.dtb \ + qcom-ipq4019-rtl30vw.dtb \ + qcom-ipq4019-srr60.dtb \ + qcom-ipq4019-srs60.dtb \