From ae7fc18cf2686fbafffb5f8b78948f9e411fe907 Mon Sep 17 00:00:00 2001 From: Elwin Huang Date: Fri, 5 Sep 2025 09:56:29 +0800 Subject: [PATCH] ramips: add support for AsiaRF AP7621-004 Rev. 3 Specification: - SoC : MediaTek MT7621AT, dual-core 880 MHz MIPS CPU - RAM : DDR3 512 MB (Micron MT41K256M16TW-107) - Flash : SPI-NOR 16 MB (MACRONIX MX25L12835FM2I-10G) - Ethernet : 5 port GbE Switch - LAN : 3x RJ-45 Port 1x PHD Connector (2x5 pin, pitch 2.0 mm) - WAN : 1x RJ-45 Port - LED : 8x LEDs 1x Power (Blue) 2x MiniPCIe (Orange) 1x M.2 B Key (Red) 4x Ethernet activity (White) - UART : 1x4 pin header on PCB [J1] - arrangement : 3.3V, TX, RX, GND - settings : 57600, 8n1 - Button : 2x (Reset, WPS) - USB : 1x USB 2.0 - Socket : 2x MiniPCIe (PCIe Gen2) 1x M.2 B key (PCIe Gen2 + USB 3.0) 1x MicroSD 1x SIM Card - Power : 12V DC, 1A MAC addresses : LAN: 00:0A:52:xx:xx:xx (Factory, 0xe000) WAN: 00:0A:52:xx:xx:xx (Factory, 0xe006) Flash instruction through LuCI: This device is flashed OpenWRT base firmware with this target. The LuCI webpage is integrated in default for upgrading. Flash instruction through u-boot: 1. Prepare the TFTP server on PC. 2. Connect uart to PC, select "2. Upgrade firmware" in u-boot menu. 3. Select "0 - TFTP client (Default)", input client IP, server IP, flashed bin file path 4. Wait about 60 seconds to complete flashing Signed-off-by: Elwin Huang Link: https://github.com/openwrt/openwrt/pull/19944 Signed-off-by: Hauke Mehrtens --- .../uboot-tools/uboot-envtools/files/ramips | 1 + .../dts/mt7621_asiarf_ap7621-004-v3.dts | 138 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 11 ++ 3 files changed, 150 insertions(+) create mode 100755 target/linux/ramips/dts/mt7621_asiarf_ap7621-004-v3.dts diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips b/package/boot/uboot-tools/uboot-envtools/files/ramips index 3ec3da6988..db551d1860 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/ramips +++ b/package/boot/uboot-tools/uboot-envtools/files/ramips @@ -30,6 +30,7 @@ alfa-network,ax1800rm|\ allnet,all0256n-4m|\ allnet,all0256n-8m|\ allnet,all5002|\ +asiarf,ap7621-004-v3|\ yuncore,ax820) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621-004-v3.dts b/target/linux/ramips/dts/mt7621_asiarf_ap7621-004-v3.dts new file mode 100755 index 0000000000..376c3461f4 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621-004-v3.dts @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +/ { + compatible = "asiarf,ap7621-004-v3", "mediatek,mt7621-soc"; + model = "AsiaRF AP7621-004 v3"; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&sdhci { + status = "okay"; + non-removable; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; + }; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + compatible = "denx,uimage"; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&gmac0 { + status = "okay"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_e000>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_e006>; + }; + + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "lan4"; + }; + }; + +}; + +&state_default { + gpio { + groups = "wdt", "jtag"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 4c9947a518..720b90cc50 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -366,6 +366,17 @@ define Device/asiarf_ap7621-001 endef TARGET_DEVICES += asiarf_ap7621-001 +define Device/asiarf_ap7621-004-v3 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + DEVICE_VENDOR := AsiaRF + DEVICE_MODEL := AP7621-004 + DEVICE_VARIANT := v3 + IMAGE_SIZE := 16000k + DEVICE_PACKAGES := kmod-mmc-mtk kmod-usb3 +endef +TARGET_DEVICES += asiarf_ap7621-004-v3 + define Device/asiarf_ap7621-nv1 $(Device/dsa-migration) $(Device/uimage-lzma-loader) -- 2.30.2