Skip to content

Commit 85e300c

Browse files
simsassshauke
authored andcommitted
ramips: mt76x8: add Teltonika RUT956/RUT906 support
Specification: - MediaTek MT7628AN SoC - 128 MB of RAM EtronTech EM68C16CWQG-25IH - 16MB of Flash Winbond W25Q128 SPI - 4x 10/100 Mbps Ethernet, with passive PoE support on LAN1 - MediaTek MT7628AN 2.4 GHz 802.11n WiFi - Quectel EC25-EUX (RUT956) or Meig SLM770A (RUT906) modem - GNSS - RS232, DB9 connector, Cypress ACM via USB, /dev/ttyACM0 - RS485 /dev/ttyS1 - microSD card slot - 2.0 USB Type-A HOST port - analog 0-24V input (MCP3221) - Relay - 2x Digital input - 2x Digital output - 2x SIM slot (can be swapped via GPIO) - eSIM (depends on hardware configuration, can be swapped via GPIO) GPIO: - 1 button (Reset) - 7 LEDs (power, status green/red, RSSI 1,2,3,4,5) - 5 Modem control (power button, reset, status (v5 hw), SIM select, eSIM select) - 2 Digital input - 2 Digital output - 1 Isolated input - 1 RS485 tx enable - 1 RS485 rx enable - 1 Relay - 1 Data Carrier Detect (DCD) Flashing via OEM WebUI: 1. Download the firmware image *-squashfs-factory.bin 2. Upload firmware image via OEM WebUI firmware update, do not keep settings To revert back to OEM firmware: https://wiki.teltonika-networks.com/view/Bootloader_menu Mobile data connection: Meig SLM770 create proto DHCP interface with usb0 device. Quectel EC25-EUX create proto qmi interface. Signed-off-by: Simonas Tamošaitis <[email protected]> Link: openwrt/openwrt#18788 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 7dd9cf8 commit 85e300c

File tree

6 files changed

+381
-3
lines changed

6 files changed

+381
-3
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
#include "mt7628an_teltonika_rut9xx.dtsi"
4+
5+
/ {
6+
compatible = "teltonika,rut9x6", "mediatek,mt7628an-soc";
7+
model = "Teltonika RUT956/RUT906";
8+
9+
gpio-export {
10+
gpio_dcd {
11+
gpio-export,name = "dcd";
12+
gpio-export,output = <0>;
13+
gpios = <&gpio_hc595 14 GPIO_ACTIVE_HIGH>;
14+
};
15+
16+
gpio_din2 {
17+
gpio-export,name = "digital_input2";
18+
gpio-export,input = <0>;
19+
gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
20+
};
21+
22+
gpio_output2 {
23+
gpio-export,name = "digital_output2";
24+
gpio-export,output = <0>;
25+
gpios = <&gpio_hc595 8 GPIO_ACTIVE_HIGH>;
26+
};
27+
28+
gpio_adcin {
29+
gpio-export,name = "adc_input";
30+
gpio-export,input = <0>;
31+
gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
32+
};
33+
34+
gpio_relay {
35+
gpio-export,name = "relay";
36+
gpio-export,output = <0>;
37+
gpios = <&gpio_hc595 9 GPIO_ACTIVE_HIGH>;
38+
};
39+
40+
gpio_rs485_rx_en {
41+
gpio-export,name = "rs485_rx_enable";
42+
gpio-export,output = <0>;
43+
gpios = <&gpio_hc595 13 GPIO_ACTIVE_HIGH>;
44+
};
45+
46+
gpio_rs485_tx_en {
47+
gpio-export,name = "rs485_tx_enable";
48+
gpio-export,output = <0>;
49+
gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
50+
};
51+
52+
gpio_isolated_input {
53+
gpio-export,name = "isolated_input";
54+
gpio-export,input = <0>;
55+
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
56+
};
57+
};
58+
};
59+
60+
&i2c {
61+
status = "okay";
62+
hwmon@4d {
63+
compatible = "mcp3221";
64+
reg = <0x4d>;
65+
reference-voltage-microvolt = <3300000>;
66+
};
67+
68+
hwmon@48 {
69+
compatible = "ti,tla2021";
70+
reg = <0x48>;
71+
};
72+
};
73+
74+
&uart1 {
75+
linux,rs485-enabled-at-boot-time;
76+
rs485-rts-delay = <0 0>;
77+
rs485-rx-during-tx;
78+
status = "okay";
79+
};
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
#include <dt-bindings/input/input.h>
4+
#include <dt-bindings/gpio/gpio.h>
5+
#include <dt-bindings/leds/common.h>
6+
#include "mt7628an.dtsi"
7+
8+
/ {
9+
chosen {
10+
bootargs = "console=ttyS0,115200";
11+
};
12+
13+
aliases {
14+
led-boot = &led_power;
15+
led-failsafe = &led_power;
16+
led-upgrade = &led_power;
17+
led-running = &led_power;
18+
};
19+
20+
gpio_spi {
21+
compatible = "spi-gpio";
22+
#address-cells = <1>;
23+
#size-cells = <0>;
24+
25+
sck-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
26+
mosi-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
27+
cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
28+
num-chipselects = <1>;
29+
30+
gpio_hc595: gpio_hc595@0 {
31+
compatible = "fairchild,74hc595";
32+
reg = <0>;
33+
gpio-controller;
34+
#gpio-cells = <2>;
35+
registers-number = <2>;
36+
spi-max-frequency = <10000000>;
37+
};
38+
};
39+
40+
gpio-export {
41+
compatible = "gpio-export";
42+
43+
gpio_modem_reset {
44+
gpio-export,name = "modem_reset";
45+
gpio-export,output = <0>;
46+
gpios = <&gpio_hc595 11 GPIO_ACTIVE_HIGH>;
47+
};
48+
49+
gpio_modem_power {
50+
gpio-export,name = "modem_power";
51+
gpio-export,output = <0>;
52+
gpios = <&gpio_hc595 10 GPIO_ACTIVE_HIGH>;
53+
};
54+
55+
gpio_sim_select {
56+
gpio-export,name = "sim_sel";
57+
gpio-export,output = <0>;
58+
gpios = <&gpio_hc595 7 GPIO_ACTIVE_LOW>;
59+
};
60+
61+
gpio_esim_select {
62+
gpio-export,name = "esim_sel";
63+
gpio-export,output = <0>;
64+
gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
65+
};
66+
67+
gpio_modem_status {
68+
gpio-export,name = "modem_status";
69+
gpio-export,input = <0>;
70+
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
71+
};
72+
73+
gpio_din1 {
74+
gpio-export,name = "digital_input1";
75+
gpio-export,input = <0>;
76+
gpios = <&gpio 40 GPIO_ACTIVE_LOW>;
77+
};
78+
79+
gpio_dout1 {
80+
gpio-export,name = "digital_output1";
81+
gpio-export,output = <0>;
82+
gpios = <&gpio_hc595 12 GPIO_ACTIVE_HIGH>;
83+
};
84+
};
85+
86+
keys {
87+
compatible = "gpio-keys";
88+
89+
reset {
90+
label = "reset";
91+
linux,code = <KEY_RESTART>;
92+
gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
93+
};
94+
};
95+
96+
leds {
97+
compatible = "gpio-leds";
98+
99+
lan1 {
100+
function = LED_FUNCTION_LAN;
101+
color = <LED_COLOR_ID_GREEN>;
102+
function-enumerator = <1>;
103+
gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
104+
};
105+
106+
lan2 {
107+
function = LED_FUNCTION_LAN;
108+
color = <LED_COLOR_ID_GREEN>;
109+
function-enumerator = <2>;
110+
gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
111+
};
112+
113+
lan3 {
114+
function = LED_FUNCTION_LAN;
115+
color = <LED_COLOR_ID_GREEN>;
116+
function-enumerator = <3>;
117+
gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
118+
};
119+
120+
wan {
121+
function = LED_FUNCTION_WAN;
122+
color = <LED_COLOR_ID_GREEN>;
123+
gpios = <&gpio 39 GPIO_ACTIVE_LOW>;
124+
};
125+
126+
modem_status_red {
127+
function = LED_FUNCTION_STATUS;
128+
color = <LED_COLOR_ID_RED>;
129+
gpios = <&gpio_hc595 5 GPIO_ACTIVE_HIGH>;
130+
};
131+
132+
modem_status_green {
133+
function = LED_FUNCTION_STATUS;
134+
color = <LED_COLOR_ID_GREEN>;
135+
gpios = <&gpio_hc595 6 GPIO_ACTIVE_HIGH>;
136+
};
137+
138+
rssi1{
139+
label = "green:rssi-1";
140+
gpios = <&gpio_hc595 0 GPIO_ACTIVE_HIGH>;
141+
};
142+
143+
rssi2 {
144+
label = "green:rssi-2";
145+
gpios = <&gpio_hc595 1 GPIO_ACTIVE_HIGH>;
146+
};
147+
148+
rssi3 {
149+
label = "green:rssi-3";
150+
gpios = <&gpio_hc595 2 GPIO_ACTIVE_HIGH>;
151+
};
152+
153+
rssi4 {
154+
label = "green:rssi-4";
155+
gpios = <&gpio_hc595 3 GPIO_ACTIVE_HIGH>;
156+
};
157+
158+
rssi5 {
159+
label = "green:rssi-5";
160+
gpios = <&gpio_hc595 4 GPIO_ACTIVE_HIGH>;
161+
};
162+
163+
led_power: power {
164+
gpios = <&gpio_hc595 15 GPIO_ACTIVE_LOW>;
165+
function = LED_FUNCTION_POWER;
166+
color = <LED_COLOR_ID_GREEN>;
167+
};
168+
};
169+
};
170+
171+
&spi0 {
172+
status = "okay";
173+
174+
flash@0 {
175+
compatible = "jedec,spi-nor";
176+
reg = <0>;
177+
spi-max-frequency = <10000000>;
178+
179+
partitions {
180+
compatible = "fixed-partitions";
181+
#address-cells = <1>;
182+
#size-cells = <1>;
183+
184+
partition@0 {
185+
label = "u-boot";
186+
reg = <0x0 0x20000>;
187+
read-only;
188+
};
189+
190+
partition@20000 {
191+
label = "config";
192+
reg = <0x020000 0x010000>;
193+
read-only;
194+
195+
nvmem-layout {
196+
compatible = "fixed-layout";
197+
#address-cells = <1>;
198+
#size-cells = <1>;
199+
200+
macaddr_config_0: macaddr@0 {
201+
reg = <0x0 0x6>;
202+
compatible = "mac-base";
203+
#nvmem-cell-cells = <1>;
204+
};
205+
};
206+
};
207+
208+
partition@30000 {
209+
label = "factory";
210+
reg = <0x030000 0x030000>;
211+
read-only;
212+
213+
nvmem-layout {
214+
compatible = "fixed-layout";
215+
#address-cells = <1>;
216+
#size-cells = <1>;
217+
218+
eeprom_factory_0: eeprom@0 {
219+
reg = <0x20000 0x400>;
220+
};
221+
};
222+
};
223+
224+
partition@60000 {
225+
compatible = "denx,uimage";
226+
label = "firmware";
227+
reg = <0x060000 0xf10000>;
228+
};
229+
230+
partition@f70000 {
231+
label = "event-log";
232+
reg = <0xf70000 0x90000>;
233+
};
234+
};
235+
};
236+
};
237+
238+
&state_default {
239+
gpio {
240+
groups = "i2s", "p4led_an", "p3led_an", "p2led_an", "p1led_an", "p0led_an", "gpio", "wled_an", "perst", "refclk", "spi cs1";
241+
function = "gpio";
242+
};
243+
};
244+
245+
&wmac {
246+
status = "okay";
247+
nvmem-cells = <&eeprom_factory_0>, <&macaddr_config_0 2>;
248+
nvmem-cell-names = "eeprom", "mac-address";
249+
};
250+
251+
&ethernet {
252+
nvmem-cells = <&macaddr_config_0 0>;
253+
nvmem-cell-names = "mac-address";
254+
};
255+
256+
&esw {
257+
mediatek,portmap = <0x2f>;
258+
};

target/linux/ramips/image/mt76x8.mk

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,21 @@ define Build/ravpower-wd009-factory
2929
endef
3030

3131
define Build/append-teltonika-metadata
32-
$(eval model_id=$(1))
32+
$(eval model_id=$(word 1,$(1)))
33+
$(eval hw_mods=$(subst $(space),$(comma),$(wordlist 2,$(words $(1)),$(1))))
34+
3335
echo \
3436
'{ \
3537
"metadata_version": "1.1", \
3638
"compat_version": "1.0", \
37-
"version": "", \
39+
"version": "OpenWrt", \
3840
"device_code": [".*"], \
3941
"hwver": [".*"], \
4042
"batch": [".*"], \
4143
"serial": [".*"], \
4244
"supported_devices":["teltonika,$(model_id)"], \
4345
"hw_support": { }, \
44-
"hw_mods": { } \
46+
"hw_mods": { $(hw_mods) } \
4547
}' | fwtool -I - $@
4648
endef
4749

@@ -636,6 +638,24 @@ define Device/tama_w06
636638
endef
637639
TARGET_DEVICES += tama_w06
638640

641+
define Device/teltonika_rut9x6
642+
DEVICE_VENDOR := Teltonika
643+
DEVICE_MODEL := RUT956
644+
DEVICE_ALT0_VENDOR := Teltonika
645+
DEVICE_ALT0_MODEL := RUT906
646+
IMAGE_SIZE := 15424k
647+
BLOCKSIZE := 64k
648+
DEVICE_PACKAGES := uqmi kmod-mt76x2 kmod-usb2 kmod-usb-ohci \
649+
kmod-usb-serial-option kmod-spi-gpio kmod-gpio-nxp-74hc164 kmod-i2c-mt7628 \
650+
kmod-hwmon-mcp3021 kmod-scsi-core kmod-usb-storage kmod-usb-acm kmod-usb-net-cdc-ether
651+
IMAGES += factory.bin
652+
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
653+
append-rootfs | pad-rootfs | check-size | append-teltonika-metadata rut9m \
654+
"mod1":"2c7c_6005" "mod2":"TLA2021" "mod3":"CH343" "mod4":"esim" "mod5":"ala440"
655+
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
656+
endef
657+
TARGET_DEVICES += teltonika_rut9x6
658+
639659
define Device/totolink_a3
640660
IMAGE_SIZE := 7936k
641661
UIMAGE_NAME := za3

0 commit comments

Comments
 (0)