Sfoglia il codice sorgente

ramips: mt76x8: add Teltonika RUT976 support

This commit adds support for the Teltonika RUT976, part
of the RUTE series, which is very similar to the RUT956.
The RUT976 now has a 5G modem and the flash size has doubled.

Specification:
- MediaTek MT7628AN SoC
- 128 MB RAM
- 32MB Flash
- 4x 10/100 Mbps Ethernet, with passive PoE support on LAN1
- MediaTek MT7628AN 2.4 GHz 802.11n WiFi
- Quectel RG255C 5G 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, 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:
Create proto qmi interface.

Signed-off-by: Til Kaiser <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20933
Signed-off-by: Hauke Mehrtens <[email protected]>
Til Kaiser 1 mese fa
parent
commit
5629e06cf2

+ 140 - 0
target/linux/ramips/dts/mt7628an_teltonika_rut976.dts

@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7628an_teltonika_rut9xx.dtsi"
+
+/ {
+	compatible = "teltonika,rut976", "mediatek,mt7628an-soc";
+	model = "Teltonika RUT976";
+
+	gpio-export {
+		gpio_dcd {
+			gpio-export,name = "dcd";
+			gpio-export,output = <0>;
+			gpios = <&gpio_hc595 14 GPIO_ACTIVE_HIGH>;
+		};
+
+		gpio_din2 {
+			gpio-export,name = "digital_input2";
+			gpio-export,input = <0>;
+			gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
+		};
+
+		gpio_output2 {
+			gpio-export,name = "digital_output2";
+			gpio-export,output = <0>;
+			gpios = <&gpio_hc595 8 GPIO_ACTIVE_HIGH>;
+		};
+
+		gpio_relay {
+			gpio-export,name = "relay";
+			gpio-export,output = <0>;
+			gpios = <&gpio_hc595 9 GPIO_ACTIVE_HIGH>;
+		};
+
+		gpio_rs485_rx_en {
+			gpio-export,name = "rs485_rx_enable";
+			gpio-export,output = <0>;
+			gpios = <&gpio_hc595 13 GPIO_ACTIVE_HIGH>;
+		};
+
+		gpio_rs485_tx_en {
+			gpio-export,name = "rs485_tx_enable";
+			gpio-export,output = <0>;
+			gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+		};
+
+		gpio_isolated_input {
+			gpio-export,name = "isolated_input";
+			gpio-export,input = <0>;
+			gpios = <&gpio 11 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 0x40000>;
+				read-only;
+			};
+
+			partition@40000 {
+				label = "config";
+				reg = <0x040000 0x010000>;
+				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_config_0: macaddr@0 {
+						reg = <0x0 0x6>;
+						compatible = "mac-base";
+						#nvmem-cell-cells = <1>;
+					};
+				};
+			};
+
+			partition@50000 {
+				label = "factory";
+				reg = <0x050000 0x030000>;
+				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					eeprom_factory_0: eeprom@0 {
+						reg = <0x20000 0x400>;
+					};
+				};
+			};
+
+			partition@80000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x080000 0x1ed0000>;
+			};
+
+			partition@1f50000 {
+				label = "event-log";
+				reg = <0x1f50000 0xb0000>;
+			};
+		};
+	};
+};
+
+&i2c {
+	status = "okay";
+	hwmon@4d {
+		compatible = "mcp3221";
+		reg = <0x4d>;
+		reference-voltage-microvolt = <3300000>;
+	};
+
+	hwmon@48 {
+		compatible = "ti,tla2021";
+		reg = <0x48>;
+	};
+};
+
+&uart1 {
+	linux,rs485-enabled-at-boot-time;
+	rs485-rts-delay = <0 0>;
+	rs485-rx-during-tx;
+	status = "okay";
+};

+ 17 - 0
target/linux/ramips/image/mt76x8.mk

@@ -752,6 +752,23 @@ define Device/teltonika_rut9x6
 endef
 TARGET_DEVICES += teltonika_rut9x6
 
+define Device/teltonika_rut976
+  DEVICE_VENDOR := Teltonika
+  DEVICE_MODEL := RUT976
+  SUPPORTED_TELTONIKA_DEVICES := teltonika,rut976
+  SUPPORTED_TELTONIKA_HW_MODS := 2c7c_6005 TLA2021 CH343 esim ala440
+  IMAGE_SIZE := 31552k
+  BLOCKSIZE := 64k
+  DEVICE_PACKAGES := uqmi kmod-mt76x2 kmod-usb2 kmod-usb-ohci \
+	kmod-usb-serial-option kmod-spi-gpio kmod-gpio-nxp-74hc164 kmod-i2c-mt7628 \
+	kmod-hwmon-mcp3021 kmod-scsi-core kmod-usb-storage kmod-usb-acm kmod-usb-net-cdc-ether
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+	append-rootfs | pad-rootfs | check-size | append-teltonika-metadata
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
+endef
+TARGET_DEVICES += teltonika_rut976
+
 define Device/totolink_a3
   IMAGE_SIZE := 7936k
   UIMAGE_NAME := za3

+ 1 - 0
target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds

@@ -87,6 +87,7 @@ teltonika,rut241)
 	ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x02"
 	ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01"
 	;;
+teltonika,rut976|\
 teltonika,rut9x1|\
 teltonika,rut9x6)
 	ucidef_set_led_switch "lan1" "lan1" "green:lan-1" "switch0" "0x1"

+ 1 - 0
target/linux/ramips/mt76x8/base-files/etc/board.d/02_network

@@ -185,6 +185,7 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
 		;;
+	teltonika,rut976|\
 	teltonika,rut9x1|\
 	teltonika,rut9x6)
 		ucidef_add_switch "switch0" \

+ 1 - 0
target/linux/ramips/mt76x8/base-files/etc/board.d/03_gpio_switches

@@ -29,6 +29,7 @@ teltonika,rut9x1)
 	ucidef_add_gpio_switch "sim_sel" "SIM select" "sim_sel" "0"
 	ucidef_add_gpio_switch "esim_sel" "eSIM select" "esim_sel" "0"
 	;;
+teltonika,rut976|\
 teltonika,rut9x6)
 	ucidef_add_gpio_switch "digital_output" "Digital output 1" "digital_output1" "0"
 	ucidef_add_gpio_switch "digital_output" "Digital output 2" "digital_output2" "0"