[openwrt/openwrt] ramips: add support for Hongdian H8922 v30

LEDE Commits lede-commits at lists.infradead.org
Sun Mar 9 16:43:42 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6a1bdcf545eec8f9ed5130e7f5794fca6ee54cb3

commit 6a1bdcf545eec8f9ed5130e7f5794fca6ee54cb3
Author: Coia Prant <coiaprant at gmail.com>
AuthorDate: Sat Jan 4 02:43:17 2025 +0800

    ramips: add support for Hongdian H8922 v30
    
    This is an industrial 4G router equipped with OpenWrt 14.07 OEM
    customized version
    
    WARNING: The original firmware device tree is common to multiple
    boards, and the device tree name is H9350. This submitted device
    tree is a modified version, which deletes the non-this-device parts
    and adds GPIO watchdog.
    
    Specification:
    - SoC: MediaTek MT7620A
    - Flash: 16 MB
    - RAM: 128 MB
    - Power: DC 5V-36V 1.5A
    - Ethernet: 1x WAN, 4x LAN (10/100 Mbps)
    - Wireless radio: 802.11n 2.4g-only
    - LED:
      System/Power (RUN): GPIO/26 active-low
      Ethernet: 1x WAN, 4x LAN
      Modem 1: GPIO/66 active-low
      RF 1 (Modem 1 Signal): GPIO/67 active-low
      Modem 2: GPIO 71 active-low
      RF 2 (Modem 2 Signal): GPIO/24 active-low
      WLAN: GPIO/72 active-low
      WPS: GPIO/12 active-low
    - Button:
      WPS / RESET: GPIO/34 active-low
    - UART: 1x UART on PCB - 115200 8N1
    - GPIO Watchdog: GPIO/62 mode=toggle timeout=1s
    - PCIe: 2x miniPCIe for modem
    - SIM Slots: 2x SIM Slots
    
    Issue:
    - No factory partition, eeprom is located
     at /lib/firmware/mt7620a.eeprom
    
    Flash instruction:
    Using UART:
    1. Configure PC with a static IP address and setup an TFTP server.
    2. Put rootfs into the tftp directory.
    3. Connect the UART line as described on the PCB.
    4. Power up the device and press Ctrl+C to break auto boot.
    5. Use `system 6` command and follow the instruction to set device
       and tftp server IP address and input the rootfs file name.
       U-boot will then load the rootfs and write it into
       the flash.
    6. Use `system 1` command and follow the instruction to set device
       and tftp server IP address and input the firmware file name.
       U-boot will then load the firmware once.
    7. Login to LuCI and use LuCI upgrade firmware.
    
    Original Firmware Dump / More details:
    https://blog.gov.cooking/archives/research-hongdian-h8922-and-flash.html
    
    Signed-off-by: Coia Prant <coiaprant at gmail.com>
    Tested-by: Coia Prant <coiaprant at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/17472
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/boot/uboot-envtools/files/ramips           |   1 +
 .../ramips/dts/mt7620a_hongdian_h8922-v30.dts      | 189 +++++++++++++++++++++
 target/linux/ramips/image/mt7620.mk                |  12 ++
 .../mt7620/base-files/etc/board.d/02_network       |   1 +
 4 files changed, 203 insertions(+)

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index ace29907da..c1633e2cac 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -19,6 +19,7 @@ alfa-network,r36m-e4g|\
 alfa-network,tube-e4g|\
 engenius,epg600|\
 engenius,esr600h|\
+hongdian,h8922-v30|\
 linksys,re7000|\
 meig,slt866|\
 sitecom,wlr-4100-v1-002|\
diff --git a/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts
new file mode 100644
index 0000000000..d983f5f854
--- /dev/null
+++ b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+	compatible = "hongdian,h8922-v30", "ralink,mt7620a-soc";
+	model = "Hongdian H8922 v30";
+
+	aliases {
+		led-boot = &led_sys;
+		led-failsafe = &led_sys;
+		led-running = &led_sys;
+		led-upgrade = &led_sys;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led-wps {
+			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WPS;
+		};
+
+		led-rf-2 {
+			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = "rf";
+			function-enumerator = <2>;
+		};
+
+		led_sys: led-sys {
+			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_POWER;
+			default-state = "on";
+		};
+
+		led-net-1 {
+			gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_MOBILE;
+			function-enumerator = <1>;
+		};
+
+		led-rf-1 {
+			gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = "rf";
+			function-enumerator = <1>;
+		};
+
+		led-net-2 {
+			gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_MOBILE;
+			function-enumerator = <2>;
+		};
+
+		led-wlan {
+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WLAN;
+			linux,default-trigger = "phy0tpt";
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	watchdog {
+		compatible = "linux,wdt-gpio";
+
+		gpios = <&gpio2 22 GPIO_ACTIVE_HIGH>;
+		hw_algo = "toggle";
+		hw_margin_ms = <600>;
+		always-running;
+	};
+};
+
+&watchdog {
+	status = "disabled";
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&gpio2 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
+&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 0x2f000>;
+				read-only;
+			};
+
+			partition at 2f000 {
+				label = "u-boot-env";
+				reg = <0x2f000 0x1000>;
+				read-only;
+			};
+
+			partition at 30000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x30000 0xffd000>;
+			};
+		};
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "wled", "rgmii1", "rgmii2";
+		function = "gpio";
+	};
+};
+
+&ethernet {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ephy_pins>;
+
+	mediatek,portmap = "llllw";
+};
+
+&pcie {
+	status = "okay";
+};
+
+&wmac {
+	ralink,eeprom-data = <0x20760501 0x000c4376 0x2058ffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0x000c4376 0x2077000c 0x43762066 0x220c0000 0xffffb701 0x5577a8aa
+			      0x8c88ffff 0x0a000000 0x00000000 0x0000ffff 0xffff0a0a 0x0a0a0808 0x08080808 0x08080808
+			      0x0e0e0e0e 0x0e0e0e0e 0x0e0e0e0e 0x0e0e80ff 0xffff80ff 0xffff0000 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x20ffffff 0xffffffff 0xffffffff 0xffff0606
+			      0x06060402 0x06060400 0x06060400 0x07070400 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
+			      0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>;
+};
+
+&ehci {
+	status = "okay";
+};
+
+&ohci {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index f12f13d9e9..a21473311e 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -604,6 +604,18 @@ define Device/hnet_c108
 endef
 TARGET_DEVICES += hnet_c108
 
+define Device/hongdian_h8922-v30
+  SOC := mt7620a
+  IMAGE_SIZE := 15808k
+  DEVICE_VENDOR := Hongdian
+  DEVICE_MODEL := H8922
+  DEVICE_VARIANT := v30
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi uboot-envtools
+  IMAGES += rootfs.bin
+  IMAGE/rootfs.bin := append-rootfs | check-size 10560k
+endef
+TARGET_DEVICES += hongdian_h8922-v30
+
 define Device/humax_e2
   SOC := mt7620a
   IMAGE_SIZE := 7744k
diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
index 204a1b0a54..57db30b923 100644
--- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
@@ -15,6 +15,7 @@ ramips_setup_interfaces()
 	dlink,dwr-921-c1|\
 	dlink,dwr-922-e2|\
 	dovado,tiny-ac|\
+	hongdian,h8922-v30|\
 	ohyeah,oy-0001|\
 	phicomm,psg1208|\
 	planex,db-wrt01|\




More information about the lede-commits mailing list