Hi,
I have been trying to get OpenWRT running on the RUT956 for a while now. I took the dts file from the SDK that Teltonika releases, modified it slightly, added the device to the Makefile, and to my surprise after some debugging it actually compiled and is running now.
Other than the similar RUT955 they use the mt7628an SoC now, with the MeiGLink SLM750 modem.
Once I added the mt76x2 wifi driver, even WLAN started working... nice.
But now I am stuck at getting the modem to work. The control pins (modem_power, modem_reset...) are connected to the shift register 74hc595. Somehow it needs to be activated, but I don't see the shift register with the "normal" GPIOs. I am assuming that the dts needs to be modified to match more what OpenWRT expects, but I am still struggling to understand what is going on there. I tried looking at the ar9344_teltonika_rut955-h7v3c0.dts file, but so far could not transfer what I see there into the dts I am using, without breaking everything.
The DTS I am currently using:
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include "mt7628an.dtsi"
/ {
compatible = "teltonika,rut9m", "mediatek,mt7628an-soc";
model = "Teltonika RUT9M";
chosen {
bootargs = "console=ttyS0,115200";
};
ext_io {
compatible = "spi-gpio";
#address-cells = <1>;
#size-cells = <0>;
gpio-sck = <&gpio 3 GPIO_ACTIVE_HIGH>; // SRCLK
gpio-mosi = <&gpio 1 GPIO_ACTIVE_HIGH>; // SER
cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; // RCLK
num-chipselects = <1>;
shift_io: shift_io@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <2>;
spi-max-frequency = <10000000>;
};
};
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
sd_enable {
gpio-export,name = "sd_enable";
gpio-export,output = <1>;
gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
};
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
};
gpio_modem_status { // From v5
gpio-export,name = "modem_status";
gpio-export,input = <0>;
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
};
gpio_rs485_rx_en {
gpio-export,name = "rs485_rx_en";
gpio-export,output = <0>;
gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>;
};
gpio_dcd {
gpio-export,name = "dcd";
gpio-export,output = <0>;
gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
eth1_led {
label = "eth1_led";
gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
};
eth2_led {
label = "eth2_led";
gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
};
eth3_led {
label = "eth3_led";
gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
};
wan_led {
label = "wan_led";
gpios = <&gpio 39 GPIO_ACTIVE_LOW>;
};
led_gen_2_3 {
label = "mob_gen_2_3";
gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4_3 {
label = "mob_gen_4_3";
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&shift_io 4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_power {
label = "power";
gpios = <&shift_io 15 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
tlt_gpios { // Modify according to wiki page "DTS syntax with Libgpiod changes"
gpiochip_info {
hw_0 {
hwver = <0>;
gpiochip_count = <4>;
gpiochip_0 = <32>; // Built-in
gpiochip_1 = <32>; // Built-in
gpiochip_2 = <32>; // Built-in
gpiochip_3 = <16>; // Shift Register
};
};
ioman {
GPIO_40 {
line_name = "GPIO_IN_1";
};
GPIO_108 {
line_name = "GPIO_OUT_1";
};
GPIO_11 {
compatible_model = "RUT956";
line_name = "GPIO_ISOLATED_INPUT";
};
GPIO_37 {
compatible_model = "RUT956";
line_name = "GPIO_IN_2";
};
GPIO_104 {
compatible_model = "RUT956";
line_name = "GPIO_OUT_2";
};
GPIO_105 {
compatible_model = "RUT956";
line_name = "GPIO_RELAY_CLOSE_1";
};
};
ledman {
GPIO_43 {
line_name = "LED_ETH_GREEN_1";
active_low;
};
GPIO_42 {
line_name = "LED_ETH_GREEN_2";
active_low;
};
GPIO_41 {
line_name = "LED_ETH_GREEN_3";
active_low;
};
GPIO_39 {
line_name = "LED_ETH_GREEN_4";
active_low;
};
GPIO_101 {
line_name = "LED_TECH_GEN_23";
};
GPIO_102 {
line_name = "LED_TECH_GEN_43";
};
GPIO_96 {
line_name = "LED_SSID_1";
};
GPIO_97 {
line_name = "LED_SSID_2";
};
GPIO_98 {
line_name = "LED_SSID_3";
};
GPIO_99 {
line_name = "LED_SSID_4";
};
GPIO_100 {
line_name = "LED_SSID_5";
};
GPIO_111 { // Exists in ioman as GPIO_RELAY_OPEN_1, but not used
compatible_model = "RUT956";
compatible_versions = <5 99>;
line_name = "LED_POWER";
active_low;
};
};
misc {
GPIO_0 {
compatible_versions = <5 99>;
line_name = "GPIO_MODEM_STATUS";
active_low;
};
GPIO_106 {
line_name = "GPIO_MODEM_POWER_1";
};
GPIO_107 {
line_name = "GPIO_MODEM_RESET_1";
};
GPIO_103 {
line_name = "GPIO_SIM_SELECT";
};
GPIO_44 {
line_name = "GPIO_SD_ENABLE"; // Duplicates as rts, fix in the future
};
GPIO_109 {
line_name = "GPIO_RS458_RX_EN";
};
GPIO_110 {
line_name = "GPIO_DCD";
};
};
};
};
&state_default {
gpio {
groups = "i2s", "p4led_an", "p3led_an", "p2led_an", "p1led_an", "p0led_an", "gpio", "wled_an", "perst", "refclk", "spi cs1";
function = "gpio";
};
};
&pcie {
status = "okay";
};
&pcie0 {
mt76@0,0 {
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x28000>;
ieee80211-freq-limit = <5000000 6000000>;
mtd-mac-address = <&factory 0xf100>;
mtd-mac-address-increment = <(-1)>;
};
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot: boot: partition@0 {
label = "u-boot";
reg = <0x0 0x20000>;
read-only;
};
config: partition@20000 {
label = "config";
reg = <0x020000 0x010000>;
read-only;
};
factory: partition@30000 {
label = "factory";
reg = <0x030000 0x030000>;
read-only;
};
partition@60000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x060000 0xf10000>;
};
partition@f70000 {
label = "event-log";
reg = <0xf70000 0x90000>;
};
};
};
};
&wmac {
status = "okay";
mtd-mac-address = <&config 0x0>;
mtd-mac-address-increment = <2>;
mediatek,mtd-eeprom = <&factory 0x20000>;
};
ðernet {
mtd-mac-address = <&config 0x0>;
};
&esw {
mediatek,portmap = <0x2f>;
};
&i2c {
status = "okay";
hwmon@0x4d {
compatible = "mcp3221";
reg = <0x4d>;
reference-voltage-microvolt = <3300000>;
};
hwmon@0x48 {
compatible = "ti,tla2021";
reg = <0x48>;
};
};
&uart1 {
linux,rs485-enabled-at-boot-time;
rs485-rts-delay = <0 0>;
rs485-rx-during-tx;
rts-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
status = "okay";
};
I guess my question is, do I even have to modify the dts or can somehow activate the modem from the running OpenWRT?