From ec4f26478cb171b6f5d503551261a50048867faa Mon Sep 17 00:00:00 2001
From: Ivan Lee <[email protected]>
Date: Tue, 9 Jun 2026 15:13:31 +0800
Subject: [PATCH] ramips: add support for Dragonglass DGX25 (AX1800)
The Dragonglass DGX25 is an AX1800 Wi-Fi 6 dual-band wireless router.
Specifications:
- SoC: MediaTek MT7621AT (MIPS 1004Kc, dual-core @880MHz)
- RAM: 256MB DDR3 (W632GG6MB-09 / NT5CC128M16JR-EK)
- Flash: GigaDevice GD25Q127C 16MB (SPI NOR), or
Winbond W25N01GV 128MB (parallel NAND)
- WiFi: MediaTek MT7915D (AX1800) 2.4GHz + 5GHz via dual PCIe
- Ethernet: 1x WAN + 4x LAN (MT7530 DSA)
- USB: 1x USB 3.0
- LEDs: Power/Status, WAN, LAN, WLAN, Mesh
- Buttons: Reset, WPS
- Serial: 3.3V TTL, 115200n8
Both NOR and NAND flash variants are supported.
NOR: Standard SPI NOR layout with 192KB u-boot, factory at 0x40000,
kernel + rootfs as a single firmware partition (IMAGE_SIZE=15808k
matching the 0xF70000 firmware partition). Sysupgrade extracts
kernel+root from tar and writes directly to the firmware MTD.
NAND: Parallel NAND controller with nmbm/bmt bad block management.
Uses separate kernel (4MB FIT) and UBI (~115MB) partitions for
rootfs and overlay. EEPROM calibration data is accessed via nvmem
cells from the read-only factory partition.
WiFi: Uses mt7915e driver with mt7915-firmware.
Signed-off-by: Ivan Lee <[email protected]>
---
.../uboot-tools/uboot-envtools/files/ramips | 8 +
.../dts/mt7621_dragonglass_dgx25-nand.dts | 145 +++++++++++++++
.../ramips/dts/mt7621_dragonglass_dgx25.dts | 92 ++++++++++
.../ramips/dts/mt7621_dragonglass_dgx25.dtsi | 165 ++++++++++++++++++
target/linux/ramips/image/mt7621.mk | 32 ++++
.../mt7621/base-files/etc/board.d/02_network | 10 ++
.../mt7621/base-files/lib/upgrade/platform.sh | 12 ++
7 files changed, 464 insertions(+)
create mode 100644 target/linux/ramips/dts/mt7621_dragonglass_dgx25-nand.dts
create mode 100644 target/linux/ramips/dts/mt7621_dragonglass_dgx25.dts
create mode 100644 target/linux/ramips/dts/mt7621_dragonglass_dgx25.dtsi
diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips
b/package/boot/uboot-tools/uboot-envtools/files/ramips
index b4b1ad4..7fade5a 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/ramips
+++ b/package/boot/uboot-tools/uboot-envtools/files/ramips
@@ -36,6 +36,14 @@ plasmacloud,pax1800-lite|\
yuncore,ax820)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;;
+dragonglass,dgx25)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
+ ;;
+dragonglass,dgx25-nand)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
+ ;;
+
+
ampedwireless,ally-00x19k|\
ampedwireless,ally-r1900k)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4"
diff --git a/target/linux/ramips/dts/mt7621_dragonglass_dgx25-nand.dts
b/target/linux/ramips/dts/mt7621_dragonglass_dgx25-nand.dts
new file mode 100644
index 0000000..fcc712a
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dragonglass_dgx25-nand.dts
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/*
+ * Dragonglass DGX25 (NAND variant) - AX1800 Dual-band Wireless Router
+ *
+ * Specs:
+ * - SoC: MediaTek MT7621AT (MIPS 1004Kc, dual-core @ 880 MHz)
+ * - RAM: 256 MB DDR3 (W632GG6MB-09 / NT5CC128M16JR-EK)
+ * - Flash: Winbond W25N01GV 128 MB (MT7621 parallel NAND)
+ * - WiFi: MediaTek MT7915D (AX1800) - 2.4G + 5G via dual PCIe
+ * - Ports: 1x WAN + 4x LAN (DSA, MT7530 switch)
+ * - USB: 1x USB 3.0
+ *
+ * NOTE: The factory-installed U-Boot runs a "dual image check" that
+ * requires a squashfs rootfs sub-image inside the kernel FIT. This
+ * OpenWrt build creates a kernel-only FIT (no embedded rootfs). To
+ * enable auto-boot, the U-Boot bootcmd must be changed to skip the
+ * dual image check:
+ * setenv bootcmd nand read 0x82000000 0x180000 0x400000\; bootm 0x82000000
+ * setenv bootdelay 2
+ * saveenv
+ * Alternatively, include rootfs in the FIT via external-static-with-rootfs
+ * (requires enlarging the kernel partition and adjusting the UBI offset).
+ */
+
+#include "mt7621_dragonglass_dgx25.dtsi"
+
+/ {
+ compatible = "dragonglass,dgx25-nand", "dragonglass,dgx25",
"mediatek,mt7621-soc";
+ model = "Dragonglass DGX25 NAND (AX1800)";
+};
+
+/*
+ * Parallel NAND flash (128 MB via MT7621 NAND controller):
+ * u-boot: 0x000000-0x080000 (512 KB)
+ * config: 0x080000-0x100000 (512 KB)
+ * factory: 0x100000-0x180000 (512 KB)
+ * firmware: 0x180000-0x7800000 (~119 MB, kernel+UBI)
+ */
+&nand {
+ status = "okay";
+
+ mediatek,nmbm;
+ mediatek,bmt-max-ratio = <1>;
+ mediatek,bmt-max-reserved-blocks = <64>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition@80000 {
+ label = "config";
+ reg = <0x80000 0x80000>;
+ };
+
+ partition@100000 {
+ label = "factory";
+ reg = <0x100000 0x80000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom@0 {
+ reg = <0x0 0x1000>;
+ };
+
+ macaddr_factory_4: macaddr@4 {
+ compatible = "mac-base";
+ reg = <0x4 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+
+ macaddr_factory_3fff4: macaddr@3fff4 {
+ reg = <0x3fff4 0x6>;
+ };
+
+ macaddr_factory_3fffa: macaddr@3fffa {
+ reg = <0x3fffa 0x6>;
+ };
+ };
+ };
+
+ partition@180000 {
+ label = "firmware";
+ reg = <0x180000 0x7680000>;
+
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "kernel";
+ reg = <0x0 0x400000>;
+ };
+
+ partition@400000 {
+ label = "ubi";
+ reg = <0x400000 0x7280000>;
+ };
+ };
+ };
+};
+
+&pcie0 {
+ wifi@0,0 {
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
+ };
+};
+
+&pcie1 {
+ wifi@0,0 {
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
+ };
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_factory_4>;
+ nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+ nvmem-cells = <&macaddr_factory_3fff4>;
+ nvmem-cell-names = "mac-address";
+};
+
+&switch0 {
+ ports {
+ port@4 {
+ nvmem-cells = <&macaddr_factory_3fffa>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+};
diff --git a/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dts
b/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dts
new file mode 100644
index 0000000..2982086
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dts
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/*
+ * Dragonglass DGX25 (NOR variant) - AX1800 Dual-band Wireless Router
+ *
+ * Specs:
+ * - SoC: MediaTek MT7621AT (MIPS 1004Kc, dual-core @ 880 MHz)
+ * - RAM: 256 MB DDR3 (W632GG6MB-09 / NT5CC128M16JR-EK)
+ * - Flash: Macronix MX25L12835F 16 MB SPI NOR
+ * - WiFi: MediaTek MT7915D (AX1800) - 2.4G + 5G via dual PCIe
+ * - Ports: 1x WAN + 4x LAN (DSA, MT7530 switch)
+ * - USB: 1x USB 3.0
+ */
+
+#include "mt7621_dragonglass_dgx25.dtsi"
+
+/ {
+ compatible = "dragonglass,dgx25", "mediatek,mt7621-soc";
+ model = "Dragonglass DGX25 (AX1800)";
+};
+
+/*
+ * SPI-NOR flash layout (16 MB MX25L12835F)
+ * u-boot: 0x000000-0x030000 (192 KB, read-only)
+ * config: 0x030000-0x040000 ( 64 KB, read-only)
+ * factory: 0x040000-0x080000 (256 KB, read-only)
+ * config2: 0x080000-0x090000 ( 64 KB, read-only)
+ * firmware: 0x090000-0x1000000 (15.4 MB)
+ */
+&spi0 {
+ 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 = <0x00000 0x30000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "config";
+ reg = <0x30000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@40000 {
+ label = "factory";
+ reg = <0x40000 0x40000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_10000: eeprom@10000 {
+ reg = <0x10000 0x1000>;
+ };
+
+ macaddr_factory_1002a: macaddr@1002a {
+ reg = <0x1002a 0x6>;
+ };
+
+ macaddr_factory_10024: macaddr@10024 {
+ reg = <0x10024 0x6>;
+ };
+ };
+ };
+
+ partition@80000 {
+ label = "config2";
+ reg = <0x80000 0x10000>;
+ read-only;
+ };
+
+ partition@90000 {
+ label = "firmware";
+ reg = <0x90000 0xf70000>;
+ compatible = "denx,uimage";
+ };
+ };
+ };
+};
diff --git a/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dtsi
b/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dtsi
new file mode 100644
index 0000000..544f090
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dragonglass_dgx25.dtsi
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/*
+ * Dragonglass DGX25 - common Device Tree Include
+ *
+ * Shared between NOR (mt7621_dragonglass_dgx25.dts)
+ * and NAND (mt7621_dragonglass_dgx25-nand.dts) variants.
+ */
+
+#include "mt7621.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+ aliases {
+ led-boot = &led_sys;
+ led-failsafe = &led_sys;
+ led-running = &led_sys;
+ led-upgrade = &led_sys;
+ label-mac-device = &gmac0;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_sys: led-0 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ };
+
+ led_wan: led-1 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WAN;
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+ };
+
+ led_lan: led-2 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_LAN;
+ gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+ };
+
+ led_wlan: led-3 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WLAN;
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ led_mesh: led-4 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_INDICATOR;
+ function-enumerator = <1>;
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+
+ wps {
+ label = "wps";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+ };
+};
+
+/* Flash node defined per-variant (NOR or NAND) — DO NOT add here */
+
+&pcie {
+ status = "okay";
+};
+
+/*
+ * MT7915D DBDC WiFi 6 (AX1800): dual PCIe endpoints
+ * pcie0: 14c3:7916 (2.4 GHz)
+ * pcie1: 14c3:7915 (5 GHz)
+ */
+&pcie0 {
+ wifi@0,0 {
+ compatible = "mediatek,mt76";
+ reg = <0x0000 0 0 0 0>;
+ nvmem-cells = <&eeprom_factory_10000>;
+ nvmem-cell-names = "eeprom";
+ };
+};
+
+&pcie1 {
+ wifi@0,0 {
+ compatible = "mediatek,mt76";
+ reg = <0x0000 0 0 0 0>;
+ nvmem-cells = <&eeprom_factory_10000>;
+ nvmem-cell-names = "eeprom";
+ };
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_factory_1002a>;
+ nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+ status = "okay";
+
+ nvmem-cells = <&macaddr_factory_10024>;
+ nvmem-cell-names = "mac-address";
+};
+
+&switch0 {
+ ports {
+ port@0 {
+ status = "okay";
+ label = "lan1";
+ };
+ port@1 {
+ status = "okay";
+ label = "lan2";
+ };
+ port@2 {
+ status = "okay";
+ label = "lan3";
+ };
+ port@3 {
+ status = "okay";
+ label = "lan4";
+ };
+ port@4 {
+ status = "okay";
+ label = "wan";
+ nvmem-cells = <&macaddr_factory_10024>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "i2c", "uart2", "uart3";
+ function = "gpio";
+ };
+};
+
+&uartlite2 {
+ status = "okay";
+};
+
+&uartlite3 {
+ status = "okay";
+};
+
+&xhci {
+ status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7621.mk
b/target/linux/ramips/image/mt7621.mk
index 347ab0e..6331ad9 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1157,6 +1157,38 @@ define Device/dlink_dra-1360-a1
endef
TARGET_DEVICES += dlink_dra-1360-a1
+define Device/dragonglass_dgx25
+ $(Device/dsa-migration)
+ DEVICE_VENDOR := Dragonglass
+ DEVICE_MODEL := DGX25
+ DEVICE_PACKAGES := kmod-mt7915e kmod-mt7915-firmware kmod-mt7916-firmware
kmod-usb3
+ KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
+ KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma | pad-to 64k
+ IMAGE_SIZE := 15808k
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ SUPPORTED_DEVICES += dragonglass,dgx25
+endef
+TARGET_DEVICES += dragonglass_dgx25
+
+define Device/dragonglass_dgx25-nand
+ $(Device/nand)
+ DEVICE_VENDOR := Dragonglass
+ DEVICE_MODEL := DGX25 NAND
+ PAGESIZE := 2048
+ BLOCKSIZE := 128k
+ MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB
--max-leb-cnt=96 --space-fixup --squash-uids
+ UBIFS_OPTS := --min-io-size=2048 --leb-size=124KiB --max-leb-cnt=96
+ UBINIZE_OPTS := -E 5
+ DEVICE_DTS := mt7621_dragonglass_dgx25-nand
+ DEVICE_PACKAGES := kmod-mt7915e kmod-mt7915-firmware kmod-mt7916-firmware
kmod-usb3
+ KERNEL_SIZE := 4096k
+ 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
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ SUPPORTED_DEVICES += dragonglass,dgx25-nand
+endef
+TARGET_DEVICES += dragonglass_dgx25-nand
+
define Device/dual-q_h721
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 9dd1ac1..30827c9 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -196,6 +196,10 @@ ramips_setup_interfaces()
ruijie,rg-ew1300g-v1)
ucidef_set_interfaces_lan_wan "lan3 lan2 lan1" "wan"
;;
+ dragonglass,dgx25|\
+ dragonglass,dgx25-nand)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
+ ;;
*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
@@ -322,6 +326,12 @@ ramips_setup_macs()
yuncore,ax820)
label_mac=$(mtd_get_mac_binary Factory 0x4)
;;
+ dragonglass,dgx25|\
+ dragonglass,dgx25-nand)
+ label_mac=$(mtd_get_mac_binary factory 0x2a)
+ wan_mac=$(mtd_get_mac_binary factory 0x24)
+ ;;
+
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index 52617bc..6086037 100644
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -162,6 +162,18 @@ platform_do_upgrade() {
zyxel,nwa55axe)
nand_do_upgrade "$1"
;;
+ dragonglass,dgx25-nand)
+ nand_do_upgrade "$1"
+ ;;
+ dragonglass,dgx25)
+ # NOR SPI flash: extract kernel+root from sysupgrade tar
+ # and pipe to mtd (default_do_upgrade not available in
initramfs)
+ local board_dir=$(tar tf "$1" | grep -m 1 '^sysupgrade-.*/$')
+ board_dir="${board_dir%/}"
+ (tar xOf "$1" "$board_dir/kernel"; tar xOf "$1"
"$board_dir/root") | \
+ mtd write - firmware
+ ;;
+
buffalo,wsr-2533dhpl2|\
buffalo,wsr-2533dhpls)
buffalo_do_upgrade "$1"
--
2.25.1
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel