From: Simonas Tamošaitis Date: Mon, 18 Aug 2025 19:23:27 +0000 (+0300) Subject: ramips: mt7621: add Teltonika RUTM30/RUTM31 support X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f970c4eefcf0ca94c0b175c55d3e97671993b994;p=thirdparty%2Fopenwrt.git ramips: mt7621: add Teltonika RUTM30/RUTM31 support Specifications: - MediaTek MT7621AT SoC - 256 MB RAM - 16MB SPI NOR Flash - 256MB NAND (split in half for firmware fallback) - 2x 10/100/1000 Mbps Ethernet, with passive PoE support on LAN - WLAN : MediaTek dual-band WiFi 5 - 2.4 GHz : b/g/n, MIMO 2x2 - 5 GHz : n/ac, MIMO 2x2 - Quectel RG520N-EB 5G R16 modem (RUTM30) or RG500U-EB 5G (RUTM31) - 1x Digital input - 1x Digital output - 2x SIM slot (can be swapped via AT commands) - eSIM - TPM GPIO: - 1 button (Reset) - 3 LEDs (power, 2 RGB) - 3 Modem control (power button, reset, eSIM switch) - 1 Digital input - 1 Digital output - 1 TPM enable Installation ------------ Notice: update OEM firmware to 7.19 or later, earlier versions will fail to flash openwrt factory firmware. 1. Check from which partition the device is currently running from $ cat /proc/bootconfig/chosen In case this output reads rutos-b, install a software update from Teltonika first. After upgrade completion, check this file now reads rutos-a before continuing. 2. Download the *-squashfs-factory.bin firmware image 3. Flash firmware image via WEB interface To revert back to OEM firmware: https://wiki.teltonika-networks.com/view/Bootloader_menu Mobile connection: - RG520N-EB: Use "ModemManager" to establish mobile data connection. - RG500U-EB: echo -ne 'AT+QNETDEVCTL=1,3,1\r\n' > /dev/ttyUSB2 Create DHCP interface with usb0 device. Signed-off-by: Simonas Tamošaitis --- diff --git a/target/linux/ramips/dts/mt7621_teltonika_rutm30.dts b/target/linux/ramips/dts/mt7621_teltonika_rutm30.dts new file mode 100644 index 00000000000..4d9167dfe5b --- /dev/null +++ b/target/linux/ramips/dts/mt7621_teltonika_rutm30.dts @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_teltonika_rutm-common.dtsi" + +/ { + compatible = "teltonika,rutm30", "mediatek,mt7621-soc"; + model = "Teltonika RUTM30/RUTM31"; + + gpio_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + num-chipselects = <1>; + + gpio_hc595: gpio_hc595@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <2>; + spi-max-frequency = <10000000>; + enable-gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_modem_reset { + gpio-export,name = "modem_reset"; + gpio-export,output = <0>; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + gpio_modem_power { + gpio-export,name = "modem_power"; + gpio-export,output = <0>; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + gpio_esim_select { + gpio-export,name = "esim_select"; + gpio-export,output = <0>; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + + gpio_tpm_enable { + gpio-export,name = "tpm_enable"; + gpio-export,output = <1>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + }; + + leds { + compatible = "gpio-leds"; + + gsm_red { + function = LED_FUNCTION_MOBILE; + color = ; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + gsm_green { + function = LED_FUNCTION_MOBILE; + color = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + gsm_blue { + function = LED_FUNCTION_MOBILE; + color = ; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + rssi_red { + label = "red:rssi"; + color = ; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + + rssi_green { + label = "green:rssi"; + color = ; + gpios = <&gpio 48 GPIO_ACTIVE_LOW>; + }; + + rssi_blue { + label = "blue:rssi"; + color = ; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + + lan-g { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio 43 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mt7530-0:01:1Gbps"; + }; + + lan-y { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mt7530-0:01:100Mbps"; + }; + + wan-g { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 41 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mt7530-0:00:1Gbps"; + }; + + wan-y { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mt7530-0:00:100Mbps"; + }; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&i2c { + status = "okay"; + + tpm: tpm@2e { + compatible = "infineon,slb9673"; + reg = <0x2e>; + status = "okay"; + }; +}; + +&gmac1 { + phy-handle = <ðphy0>; +}; + +ðphy0 { + /delete-property/ interrupts; +}; + +&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"; + #address-cells = <1>; + #size-cells = <0>; + + led { + status = "disabled"; + }; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_config_0 2>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_config_0 3>; + nvmem-cell-names = "mac-address"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a5d6d0404d2..323fd0bcc87 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2891,6 +2891,15 @@ define Device/teltonika_rutm50 endef TARGET_DEVICES += teltonika_rutm50 +define Device/teltonika_rutm30 + $(Device/teltonika_rutm_common) + DEVICE_MODEL := RUTM30 + DEVICE_ALT0_VENDOR := Teltonika + DEVICE_ALT0_MODEL := RUTM31 + DEVICE_PACKAGES += kmod-usb-net-qmi-wwan kmod-usb-net-cdc-ncm +endef +TARGET_DEVICES += teltonika_rutm30 + define Device/thunder_timecloud $(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 4ec75e702b0..8aa9c7b8f4d 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 @@ -87,6 +87,7 @@ ramips_setup_interfaces() maginon,mc-1200ac|\ meig,slt866|\ openfi,5pro|\ + teltonika,rutm30|\ wavlink,ws-wn572hp3-4g|\ winstars,ws-wn583a6|\ yuncore,ax820|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches index 4c1f3835b4b..9ff446668a2 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches @@ -12,6 +12,7 @@ mikrotik,routerboard-760igs) telco-electronics,x1) ucidef_add_gpio_switch "modem_reset" "Modem Reset" "528" ;; +teltonika,rutm30|\ teltonika,rutm50) ucidef_add_gpio_switch "modem_power" "Modem power button" "modem_power" "1" ucidef_add_gpio_switch "modem_reset" "Modem reset" "modem_reset" "0" diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 00830ee876d..72752795518 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -49,6 +49,7 @@ boot() { [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 [ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0 ;; + teltonika,rutm30|\ teltonika,rutm50) #Bootloader expect successfull startup value after update, we need to write success value to bootconfig partition #otherwise bootloader will fallback to previous root partition 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 0439c494dab..4af3db4f3fa 100644 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -230,6 +230,7 @@ platform_do_upgrade() { zyxel_mstc_upgrade_prepare nand_do_upgrade "$1" ;; + teltonika,rutm30|\ teltonika,rutm50) CI_UBIPART="$(cmdline_get_var ubi.mtd)" nand_do_upgrade "$1"