--- /dev/null
+// 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>
+
+/ {
+ aliases {
+ led-boot = &led_power;
+ led-failsafe = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_power;
+ };
+
+ /* NAND flash is devided by half for failover.
+ Bootloader dynamically pass which partition to boot,
+ we can't change CONFIG_MIPS_CMDLINE_FROM_DTB, so
+ cmdline have to be hardcoded to second partition */
+
+ chosen {
+ bootargs = "console=ttyS0,115200n8 ubi.mtd=rutos-b";
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ debounce-interval = <60>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_power: power {
+ function = LED_FUNCTION_POWER;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&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>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition@80000 {
+ label = "u-boot-env";
+ reg = <0x80000 0x10000>;
+ read-only;
+ };
+
+ partition@90000 {
+ label = "config";
+ reg = <0x90000 0x10000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_config_0: macaddr@0 {
+ compatible = "mac-base";
+ reg = <0x0 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+
+ partition@a0000 {
+ label = "bootconfig-a";
+ reg = <0xa0000 0x10000>;
+ };
+
+ partition@b0000 {
+ label = "bootconfig-b";
+ reg = <0xb0000 0x10000>;
+ };
+
+ partition@c0000 {
+ label = "factory";
+ reg = <0xc0000 0x10000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom@0 {
+ reg = <0x0 0x4da8>;
+ };
+ };
+ };
+
+ partition@d0000 {
+ label = "event-log";
+ reg = <0xd0000 0x90000>;
+ };
+
+ partition@400000 {
+ label = "recovery";
+ reg = <0x200000 0xe00000>;
+ };
+ };
+ };
+
+ flash@1 {
+ compatible = "spi-nand";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <1>;
+ spi-max-frequency = <24000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "rutos-a";
+ reg = <0x00000000 0x08000000>;
+ };
+
+ partition@8000000 {
+ label = "rutos-b";
+ reg = <0x08000000 0x08000000>;
+ };
+ };
+ };
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_config_0 0>;
+ nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+ status = "okay";
+ label = "wan";
+ phy-handle = <ðphy4>;
+ nvmem-cells = <&macaddr_config_0 1>;
+ nvmem-cell-names = "mac-address";
+};
+
+&state_default {
+ gpio {
+ groups = "wdt", "jtag", "sdhci", "uart2", "uart3";
+ function = "gpio";
+ };
+};
+
+ðphy4 {
+ /delete-property/ interrupts;
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621_teltonika_rutm-common.dtsi"
+
+/ {
+ compatible = "teltonika,rutm50", "mediatek,mt7621-soc";
+ model = "Teltonika RUTM50/RUTM51";
+
+ 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 44 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ gpio_modem_reset {
+ gpio-export,name = "modem_reset";
+ gpio-export,output = <0>;
+ gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+ };
+
+ gpio_modem_power {
+ gpio-export,name = "modem_power";
+ gpio-export,output = <0>;
+ gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ leds {
+ wan_sim1 {
+ function = "wan-sim1";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 41 GPIO_ACTIVE_HIGH>;
+ };
+
+ wan_sim2 {
+ function = "wan-sim2";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
+ };
+
+ wan_eth {
+ function = "wan-eth";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
+ };
+
+ wan_wifi {
+ function = "wan-wifi";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
+ };
+
+ wifi_2g {
+ function = LED_FUNCTION_WLAN_2GHZ;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 10 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ wifi_5g {
+ function = LED_FUNCTION_WLAN_5GHZ;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 11 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "phy1tpt";
+ };
+
+ 3G {
+ function = "3G";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ };
+
+ 4G {
+ function = "4G";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+ };
+
+ 5G {
+ function = "5G";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+ };
+
+ rssi1 {
+ function = "rssi-1";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
+ };
+
+ rssi2 {
+ function = "rssi-2";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 48 GPIO_ACTIVE_HIGH>;
+ };
+
+ rssi3 {
+ function = "rssi-3";
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
+ };
+
+ lan1-g {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <1>;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 0 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:00:1Gbps";
+ };
+
+ lan1-y {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <1>;
+ color = <LED_COLOR_ID_AMBER>;
+ gpios = <&gpio_hc595 5 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:00:100Mbps";
+ };
+
+ lan2-g {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <2>;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 1 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:01:1Gbps";
+ };
+
+ lan2-y {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <2>;
+ color = <LED_COLOR_ID_AMBER>;
+ gpios = <&gpio_hc595 6 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:01:100Mbps";
+ };
+
+ lan3-g {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <3>;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 2 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:02:1Gbps";
+ };
+
+ lan3-y {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <3>;
+ color = <LED_COLOR_ID_AMBER>;
+ gpios = <&gpio_hc595 7 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:02:100Mbps";
+ };
+
+ lan4-g {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <4>;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 3 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:03:1Gbps";
+ };
+
+ lan4-y {
+ function = LED_FUNCTION_LAN;
+ function-enumerator = <4>;
+ color = <LED_COLOR_ID_AMBER>;
+ gpios = <&gpio_hc595 8 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:03:100Mbps";
+ };
+
+ wan-g {
+ function = LED_FUNCTION_WAN;
+ color = <LED_COLOR_ID_GREEN>;
+ gpios = <&gpio_hc595 4 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:04:1Gbps";
+ };
+
+ wan-y {
+ function = LED_FUNCTION_WAN;
+ color = <LED_COLOR_ID_AMBER>;
+ gpios = <&gpio_hc595 9 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mt7530-0:04:100Mbps";
+ };
+ };
+};
+
+&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";
+ };
+ };
+};
+
+&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>;
+
+ 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";
+ };
+ };
+};