From 114b5c2063576d0ce1944d3308280f2ecd72e969 Mon Sep 17 00:00:00 2001 From: Garrett Mesmer Date: Tue, 8 Jul 2025 12:50:14 +0300 Subject: [PATCH] mediatek: filogic: Add support ASUS RT-AX57M ASUS RT-AX57M, RT-AX54HP V2, RT-AX1800HP V2, RT-AX1800S V2, and RT-AX3000S all use the same firmware and have identical hardware Hardware -------- SOC: MediaTek MT7981b RAM: 256MB DDR3L (Winbond W632GU6NB-09) FLASH: 128MB SPI-NAND (Winbond W25N01KVZEIR) WIFI: Mediatek MT7981b + Mediatek MT7976DAN 802.11ax 2.4/5 GHz ETH: MediaTek MT7531AE Switch UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC) MAC addresses ------------- LAN Label MAC (stored in mtd ubi Factory partition at offset 0x4) WAN LAN 2.4G LAN + 2 in first octet 5G LAN Installation ----------------------------------------------------------- Vendor-UI Method ----------------------------------------------------------- 1. Download the OpenWrt initramfs.trx image. 2. Connect the PC via LAN to one of the yellow router ports and wait until your PC to get a DHCP lease. 3. Browse to http://192.168.1.1 (or whatever your router IP is configured as) 4. If your router is brand new, finish the setup process and log into the Web-UI. 5. Navigate to Administration -> Firmware Upgrade and upload the downloaded OpenWrt initramfs.trx image. 6. Wait for OpenWrt to boot. Open the default OpenWrt IP in a web browser and perform a system upgrade using the sysupgrade image as instructed in the top banner. --------------------------------------------------------------------------- Revert to stock firmware: 1: Install package facinstall -> https://forum.openwrt.org/t/facinstall-package-for-easy-installation-factory-images/177587 2. Install Asus stock trx image via OpenWRT LuCI interface. Signed-off-by: Garrett Mesmer Co-authored-by: Oleg S Signed-off-by: Oleg S Link: https://github.com/openwrt/openwrt/pull/20491 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-asus-rt-ax57m.dts | 334 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 31 ++ 5 files changed, 369 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-asus-rt-ax57m.dts diff --git a/target/linux/mediatek/dts/mt7981b-asus-rt-ax57m.dts b/target/linux/mediatek/dts/mt7981b-asus-rt-ax57m.dts new file mode 100644 index 00000000000..2a5f544f2cc --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-asus-rt-ax57m.dts @@ -0,0 +1,334 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7981b.dtsi" +/ { + model = "ASUS RT-AX57M"; + compatible = "asus,rt-ax57m", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac0; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = ""; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x10000000>; + device_type = "memory"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 4 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + wan-blue { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + wan-red { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + lan { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + wlan24 { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + timer { + clock-frequency = <13000000>; + }; +}; + +&uart0 { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan4"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "u-boot-dont-touch-spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + /* + * ASUS bootloader tries to replace the partitions defined in + * Device Tree and by that also deletes all additional properties + * needed for UBI and NVMEM-on-UBI. + * Prevent this from happening by tricking the loader to delete and + * replace a bait node instead (works with older bootloaders). + */ + partitions: dummy { + compatible = "u-boot-dummy-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x0>; + label = "remove_me"; + }; + }; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x400000>; + label = "bootloader"; + read-only; + }; + + partition@400000 { + compatible = "linux,ubi"; + reg = <0x400000 0x7c00000>; + label = "UBI_DEV"; + + volumes { + ubi_factory: ubi-volume-factory { + volname = "Factory"; + }; + }; + }; + }; + }; +}; + +&ubi_factory { + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + precal_factory_1010: precal@1010 { + reg = <0x1010 0x6f010>; + }; + }; +}; + +&pio { + i2c_pins: i2c-pins-g0 { + mux { + function = "i2c"; + groups = "i2c0_0"; + }; + }; + + pcm_pins: pcm-pins-g0 { + mux { + function = "pcm"; + groups = "pcm"; + }; + }; + + pwm0_pin: pwm0-pin-g0 { + mux { + function = "pwm"; + groups = "pwm0_0"; + }; + }; + + pwm1_pin: pwm1-pin-g1 { + mux { + function = "pwm"; + groups = "pwm1_1"; + }; + }; + + pwm2_pin: pwm2-pin { + mux { + function = "pwm"; + groups = "pwm2"; + }; + }; + + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; + + spic_pins: spi1-pins { + mux { + function = "spi"; + groups = "spi1_1"; + }; + }; + + uart1_pins: uart1-pins-g1 { + mux { + function = "uart"; + groups = "uart1_1"; + }; + }; + + uart2_pins: uart2-pins-g1 { + mux { + function = "uart"; + groups = "uart2_1"; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>, <&precal_factory_1010>; + nvmem-cell-names = "eeprom", "precal"; + + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 3ee6967f09d..bb8283a3d07 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -21,6 +21,7 @@ acer,predator-w6x-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:status" "eth1" ;; asus,rt-ax52|\ +asus,rt-ax57m|\ snr,snr-cpe-ax2) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 1feeb6a435b..8ced69c1522 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -44,6 +44,7 @@ case "$board" in /sys${DEVPATH}/macaddress ;; asus,rt-ax52|\ + asus,rt-ax57m|\ asus,tuf-ax4200|\ asus,tuf-ax4200q|\ asus,tuf-ax6000) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index c7d6e9b39b3..8ebbc7326be 100644 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -141,6 +141,7 @@ platform_do_upgrade() { emmc_do_upgrade "$1" ;; asus,rt-ax52|\ + asus,rt-ax57m|\ asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax4200q|\ @@ -369,6 +370,7 @@ platform_pre_upgrade() { case "$board" in asus,rt-ax52|\ + asus,rt-ax57m|\ asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax4200q|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 64e378997b5..8c344f6789d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -392,6 +392,37 @@ endif endef TARGET_DEVICES += asus_rt-ax52 +define Device/asus_rt-ax57m + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RT-AX57M + DEVICE_ALT0_VENDOR := ASUS + DEVICE_ALT0_MODEL := RT-AX54HP + DEVICE_ALT0_VARIANT := V2 + DEVICE_ALT1_VENDOR := ASUS + DEVICE_ALT1_MODEL := RT-AX1800HP + DEVICE_ALT1_VARIANT := V2 + DEVICE_ALT2_VENDOR := ASUS + DEVICE_ALT2_MODEL := RT-AX1800S + DEVICE_ALT2_VARIANT := V2 + DEVICE_ALT3_VENDOR := ASUS + DEVICE_ALT3_MODEL := RT-AX3000S + DEVICE_DTS := mt7981b-asus-rt-ax57m + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +ifeq ($(IB),) + ARTIFACTS := initramfs.trx + ARTIFACT/initramfs.trx := append-image-stage initramfs-kernel.bin | \ + uImage none | asus-trx -v 3 -n $$(DEVICE_MODEL) +endif +endef +TARGET_DEVICES += asus_rt-ax57m + define Device/asus_rt-ax59u DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AX59U -- 2.47.3