[PATCH] ramips: add support for Dragonglass DGR7 (16M flash)

Ivan Lee ivanlee2014 at 163.com
Sat Jun 20 03:00:05 PDT 2026


From 59ccfae94243683e1e3557b4420c539608303bca Mon Sep 17 00:00:00 2001
From: Ivan Lee <ivanlee2014 at 163.com>
Date: Sat, 20 Jun 2026 17:58:36 +0800
Subject: [PATCH] ramips: add support for Dragonglass DGR7 (16M flash)

Identical to the standard 8M DGR7 version but uses the full 16 MB
SPI NOR flash (XM25QH128A), providing approximately 15.4 MB of
usable firmware space.

Signed-off-by: Ivan Lee <ivanlee2014 at 163.com>
---
 .../uboot-tools/uboot-envtools/files/ramips   |   3 +-
 .../dts/mt7621_dragonglass_dgr7-16m.dts       | 189 ++++++++++++++++++
 target/linux/ramips/image/mt7621.mk           |  16 ++
 .../mt7621/base-files/etc/board.d/02_network  |   3 +-
 4 files changed, 209 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_dragonglass_dgr7-16m.dts

diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips b/package/boot/uboot-tools/uboot-envtools/files/ramips
index 7b218a54ac..3d629dbfae 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/ramips
+++ b/package/boot/uboot-tools/uboot-envtools/files/ramips
@@ -37,7 +37,8 @@ yuncore,ax820)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
 	;;
 dragonglass,dgx25|\
-dragonglass,dgr7)
+dragonglass,dgr7|\
+dragonglass,dgr7-16m)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
 	;;
 dragonglass,dgx25-nand)
diff --git a/target/linux/ramips/dts/mt7621_dragonglass_dgr7-16m.dts b/target/linux/ramips/dts/mt7621_dragonglass_dgr7-16m.dts
new file mode 100644
index 0000000000..85f759c220
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dragonglass_dgr7-16m.dts
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+	compatible = "dragonglass,dgr7-16m", "dragonglass,dgr7", "mediatek,mt7621-soc";
+	model = "Dragonglass DGR7 (16M)";
+
+	aliases {
+		led-boot = &led_status;
+		led-failsafe = &led_status;
+		led-running = &led_status;
+		led-upgrade = &led_status;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,57600";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_status: status {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition at 30000 {
+				label = "config";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					eeprom_factory_0: eeprom at 0 {
+						reg = <0x0 0x400>;
+					};
+
+					eeprom_factory_8000: eeprom at 8000 {
+						reg = <0x8000 0x4da8>;
+					};
+
+					macaddr_factory_e000: macaddr at e000 {
+						reg = <0xe000 0x6>;
+					};
+
+					macaddr_factory_e006: macaddr at e006 {
+						reg = <0xe006 0x6>;
+					};
+				};
+			};
+
+			partition at 50000 {
+				label = "permanent_config";
+				reg = <0x50000 0x50000>;
+				read-only;
+			};
+
+			partition at a0000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0xa0000 0xf60000>;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
+
+&pcie0 {
+	wifi at 0,0 {
+		compatible = "mediatek,mt76";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&eeprom_factory_8000>;
+		nvmem-cell-names = "eeprom";
+	};
+};
+
+&pcie1 {
+	wifi at 0,0 {
+		compatible = "mediatek,mt76";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&eeprom_factory_0>;
+		nvmem-cell-names = "eeprom";
+	};
+};
+
+&gmac0 {
+	nvmem-cells = <&macaddr_factory_e000>;
+	nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+	status = "okay";
+
+	nvmem-cells = <&macaddr_factory_e006>;
+	nvmem-cell-names = "mac-address";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+		pause;
+	};
+};
+
+&switch0 {
+	ports {
+		port at 0 {
+			status = "okay";
+			label = "lan1";
+		};
+
+		port at 1 {
+			status = "okay";
+			label = "lan2";
+		};
+
+		port at 2 {
+			status = "okay";
+			label = "lan3";
+		};
+
+		port at 3 {
+			status = "okay";
+			label = "lan4";
+		};
+
+		port at 4 {
+			status = "okay";
+			label = "wan";
+			nvmem-cells = <&macaddr_factory_e006>;
+			nvmem-cell-names = "mac-address";
+		};
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "i2c", "uart2", "uart3", "jtag", "wdt";
+		function = "gpio";
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index ee5a849b10..20b7dc0ff3 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1204,6 +1204,22 @@ define Device/dragonglass_dgr7
 endef
 TARGET_DEVICES += dragonglass_dgr7
 
+define Device/dragonglass_dgr7-16m
+  $(Device/dsa-migration)
+  DEVICE_VENDOR := Dragonglass
+  DEVICE_MODEL := DGR7
+  DEVICE_VARIANT := 16M
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
+  IMAGE_SIZE := 15744k
+  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
+	check-size | append-metadata
+  IMAGE/factory.bin := $$(KERNEL) | pad-to $$(IMAGE_SIZE)
+  SUPPORTED_DEVICES += dragonglass,dgr7-16m
+endef
+TARGET_DEVICES += dragonglass_dgr7-16m
+
 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 61887f43c7..bd810a11a3 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
@@ -198,7 +198,8 @@ ramips_setup_interfaces()
 		;;
 	dragonglass,dgx25|\
 	dragonglass,dgx25-nand|\
-	dragonglass,dgr7)
+	dragonglass,dgr7|\
+	dragonglass,dgr7-16m)
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
 		;;
 	*)
-- 
2.25.1



More information about the openwrt-devel mailing list