>From 11887aff34e728f300b9bbbb4fbad0083199f931 Mon Sep 17 00:00:00 2001
From: Ivan Lee <[email protected]>
Date: Sat, 13 Jun 2026 14:27:54 +0800
Subject: [PATCH] ramips: add support for Dragonglass DGR7

Specifications:
- SoC: MediaTek MT7621A
- RAM: 128MB DDR3
- Flash: 16MB SPI NOR (Winbond W25Q128JV)
- WiFi: MT7603E (2.4GHz) + MT7612E (5GHz, AC1200)
- Ethernet: 4x LAN + 1x WAN (MT7530 DSA)
- LED: Green status LED (GPIO 15, active-low)
- Button: Reset (GPIO 18, active-low)

Signed-off-by: Ivan Lee <[email protected]>
---
 .../uboot-tools/uboot-envtools/files/ramips   |   3 +-
 .../ramips/dts/mt7621_dragonglass_dgr7.dts    | 176 ++++++++++++++++++
 target/linux/ramips/image/mt7621.mk           |  13 ++
 .../mt7621/base-files/etc/board.d/02_network  |   3 +-
 .../mt7621/base-files/lib/upgrade/platform.sh |   3 +-
 5 files changed, 195 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_dragonglass_dgr7.dts

diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips 
b/package/boot/uboot-tools/uboot-envtools/files/ramips
index 7fade5a173..7b218a54ac 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/ramips
+++ b/package/boot/uboot-tools/uboot-envtools/files/ramips
@@ -36,7 +36,8 @@ plasmacloud,pax1800-lite|\
 yuncore,ax820)
        ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
        ;;
-dragonglass,dgx25)
+dragonglass,dgx25|\
+dragonglass,dgr7)
        ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
        ;;
 dragonglass,dgx25-nand)
diff --git a/target/linux/ramips/dts/mt7621_dragonglass_dgr7.dts 
b/target/linux/ramips/dts/mt7621_dragonglass_dgr7.dts
new file mode 100644
index 0000000000..57d004ce21
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dragonglass_dgr7.dts
@@ -0,0 +1,176 @@
+// 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", "mediatek,mt7621-soc";
+       model = "Dragonglass DGR7";
+
+       aliases {
+               led-boot = &led_status;
+               led-failsafe = &led_status;
+               led-running = &led_status;
+               led-upgrade = &led_status;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200";
+       };
+
+       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@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 = <0x0 0x30000>;
+                               read-only;
+                       };
+
+                       partition@30000 {
+                               label = "config";
+                               reg = <0x30000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               label = "factory";
+                               reg = <0x40000 0x10000>;
+                               read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0x400>;
+                                       };
+
+                                       eeprom_factory_8000: eeprom@8000 {
+                                               reg = <0x8000 0x4da8>;
+                                       };
+
+                                       macaddr_factory_e000: macaddr@e000 {
+                                               reg = <0xe000 0x6>;
+                                       };
+
+                                       macaddr_factory_e006: macaddr@e006 {
+                                               reg = <0xe006 0x6>;
+                                       };
+                               };
+                       };
+
+                       partition@50000 {
+                               compatible = "denx,uimage";
+                               label = "firmware";
+                               reg = <0x50000 0x7b0000>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&pcie0 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&eeprom_factory_0>;
+               nvmem-cell-names = "eeprom";
+       };
+};
+
+&pcie1 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&eeprom_factory_8000>;
+               nvmem-cell-names = "eeprom";
+       };
+};
+
+&gmac0 {
+       nvmem-cells = <&macaddr_factory_e000>;
+       nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+       status = "okay";
+       label = "wan";
+       phy-handle = <&ethphy0>;
+
+       nvmem-cells = <&macaddr_factory_e006>;
+       nvmem-cell-names = "mac-address";
+};
+
+&ethphy0 {
+       /delete-property/ interrupts;
+};
+
+&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";
+               };
+       };
+};
+
+&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 6331ad9940..9c73163e55 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1189,6 +1189,19 @@ define Device/dragonglass_dgx25-nand
 endef
 TARGET_DEVICES += dragonglass_dgx25-nand
 
+define Device/dragonglass_dgr7
+  $(Device/dsa-migration)
+  $(Device/uimage-lzma-loader)
+  DEVICE_VENDOR := Dragonglass
+  DEVICE_MODEL := DGR7
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2
+  KERNEL_INITRAMFS := $$(KERNEL/lzma-loader) | uImage none
+  IMAGE_SIZE := 7872k
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  SUPPORTED_DEVICES += dragonglass,dgr7
+endef
+TARGET_DEVICES += dragonglass_dgr7
+
 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 30827c9a4d..61887f43c7 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
@@ -197,7 +197,8 @@ ramips_setup_interfaces()
                ucidef_set_interfaces_lan_wan "lan3 lan2 lan1" "wan"
                ;;
        dragonglass,dgx25|\
-       dragonglass,dgx25-nand)
+       dragonglass,dgx25-nand|\
+       dragonglass,dgr7)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
                ;;
        *)
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 608603774c..f7e41de272 100644
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -165,7 +165,8 @@ platform_do_upgrade() {
        dragonglass,dgx25-nand)
                nand_do_upgrade "$1"
                ;;
-       dragonglass,dgx25)
+       dragonglass,dgx25|\
+       dragonglass,dgr7)
                # 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-.*/$')
-- 
2.25.1

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to