ath79: add support for ASUS RP-AC51
authorTamas Balogh <tamasbalogh@hotmail.com>
Tue, 28 Jun 2022 10:35:05 +0000 (12:35 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 29 Jun 2022 22:23:42 +0000 (00:23 +0200)
Asus RP-AC51 Repeater
Category:
AC750 300+433 (OEM w. unstable driver)
AC1200 300+866 (OpenWrt w. stable driver)

Hardware specifications:
Board: AP147
SoC: QCA9531 2.4G b/g/n
WiFi: QCA9886 5G n/ac
DRAM: 128MB DDR2
Flash: gd25q128 16MB SPI-NOR
LAN/WAN: AR8229 1x100M
Clocks: CPU:650MHz, DDR:600MHz, AHB:200MHz

MAC addresses as verified by OEM firmware:
use address source
Lan/W2G *:C8 art 0x1002 (label)
5G *:CC art 0x5006

Installation:

Asus windows recovery tool:

install the Asus firmware restoration utility
unplug the router, hold the reset button while powering it on
release when the power LED flashes slowly
specify a static IP on your computer:
IP address: 192.168.1.75
Subnet mask 255.255.255.0
Start the Asus firmware restoration utility, specify the factory image
and press upload
Do not power off the device after OpenWrt has booted until the LED flashing.
TFTP Recovery method:

set computer to a static ip, 192.168.1.10
connect computer to the LAN 1 port of the router
hold the reset button while powering on the router for a few seconds
send firmware image using a tftp client; i.e from linux:
$ tftp
tftp> binary
tftp> connect 192.168.1.1
tftp> put factory.bin
tftp> quit

Signed-off-by: Tamas Balogh <tamasbalogh@hotmail.com>
target/linux/ath79/dts/qca9531_asus_rp-ac51.dts [new file with mode: 0644]
target/linux/ath79/generic/base-files/etc/board.d/01_leds
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ath79/image/generic.mk

diff --git a/target/linux/ath79/dts/qca9531_asus_rp-ac51.dts b/target/linux/ath79/dts/qca9531_asus_rp-ac51.dts
new file mode 100644 (file)
index 0000000..ec8b825
--- /dev/null
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca953x.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "ASUS RP-AC51";
+       compatible = "asus,rp-ac51", "qca,qca9531";
+
+       aliases {
+               led-boot = &led_wps;
+               led-failsafe = &led_wps;
+               led-running = &led_wps;
+               led-upgrade = &led_wps;
+               label-mac-device = &eth0;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               wps {
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               reset {
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "blue:power";
+                       gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_wps: wps {
+                       label = "red:wps";
+                       gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+               };
+
+               lan {
+                       label = "blue:lan";
+                       gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               wlan2g {
+                       label = "blue:wlan2g";
+                       gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+               };
+
+               wlan5g {
+                       label = "blue:wlan5g";
+                       gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&pcie0 {
+       status = "okay";
+};
+
+&spi {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x000000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               label = "u-boot-env";
+                               reg = <0x040000 0x10000>;
+                               read-only;
+                       };
+
+                       art: partition@50000 {
+                               label = "art";
+                               reg = <0x050000 0x10000>;
+                               read-only;
+
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               macaddr_art_0: macaddr@0 {
+                                       reg = <0x0 0x6>;
+                               };
+
+                               macaddr_art_1002: macaddr@1002 {
+                                       reg = <0x1002 0x6>;
+                               };
+                       };
+
+                       partition@60000 {
+                               compatible = "denx,uimage";
+                               label = "firmware";
+                               reg = <0x060000 0xfa0000>;
+                       };
+               };
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&swphy4>;
+
+       nvmem-cells = <&macaddr_art_0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&eth1 {
+       nvmem-cells = <&macaddr_art_1002>;
+       nvmem-cell-names = "mac-address";
+};
+
+&wmac {
+       status = "okay";
+
+       qca,no-eeprom;
+};
index 0802b8345f792921a17ebe48d48b5a9ea2b7457d..b3a8b2fbb620220a43ba8907f6cfbb01ce750a84 100644 (file)
@@ -61,6 +61,11 @@ asus,pl-ac56)
        ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan2g" "wlan1" "link"
        ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan5g" "wlan0" "link"
        ;;
+asus,rp-ac51)
+       ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0"
+       ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2G" "wlan1" "link"
+       ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5G" "wlan0" "link"
+       ;;
 asus,rp-ac66)
        ucidef_set_rssimon "wlan0" "200000" "1"
        ucidef_set_rssimon "wlan1" "200000" "1"
index 8405c5f521b48091e5b3ef3b3243d368fb371614..84221da80d25edf158884cd822410b84d93e7fcd 100644 (file)
@@ -19,6 +19,7 @@ ath79_setup_interfaces()
        araknis,an-700-ap-i-ac|\
        arduino,yun|\
        aruba,ap-105|\
+       asus,rp-ac51|\
        asus,rp-ac66|\
        avm,fritz1750e|\
        avm,fritz300e|\
index 3e4d9a556b0bb722c56116ab206365128c03d66e..95439b9b276938d0532fb5527250a5947a66d86e 100644 (file)
@@ -13,6 +13,7 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x800
                ;;
        asus,pl-ac56|\
+       asus,rp-ac51|\
        asus,rp-ac66)
                caldata_extract "art" 0x1000 0x440
                ;;
index f522268e59c07725ce7e6e601f4ca3830243eb0b..56e42f1e31dcc397a126e3febcfe73879de8fde2 100644 (file)
@@ -175,6 +175,13 @@ case "$FIRMWARE" in
        ;;
 "ath10k/pre-cal-pci-0000:00:00.0.bin")
        case $board in
+       asus,rp-ac51|\
+       yuncore,a782|\
+       yuncore,xd4200)
+               caldata_extract "art" 0x5000 0x2f20
+               ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
+                       /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+               ;;
        comfast,cf-e313ac)
                caldata_extract "art" 0x5000 0x2f20
                ath10k_patch_mac $(mtd_get_mac_binary art 0x6)
@@ -250,12 +257,6 @@ case "$FIRMWARE" in
                ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
                        /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
                ;;
-       yuncore,a782|\
-       yuncore,xd4200)
-               caldata_extract "art" 0x5000 0x2f20
-               ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
-                       /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
-               ;;
        esac
        ;;
 *)
index 6fc844b4b2e427e6fb739f04fa3056be3f768347..8d059f367955c005b00ed75f06754f2292f01364 100644 (file)
@@ -389,6 +389,17 @@ define Device/asus_pl-ac56
 endef
 TARGET_DEVICES += asus_pl-ac56
 
+define Device/asus_rp-ac51
+  SOC := qca9531
+  DEVICE_VENDOR := ASUS
+  DEVICE_MODEL := RP-AC51
+  IMAGE_SIZE := 16000k
+  IMAGES += factory.bin
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct \
+       -swconfig
+endef
+TARGET_DEVICES += asus_rp-ac51
+
 define Device/asus_rp-ac66
   SOC := qca9563
   DEVICE_VENDOR := ASUS