[openwrt/openwrt] ipq40xx: add support for Teltonika RUTX50

LEDE Commits lede-commits at lists.infradead.org
Wed Jul 26 06:40:22 PDT 2023


blocktrron pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/897d55bcdf864f4d40cf50396b963ca240bbc1fc

commit 897d55bcdf864f4d40cf50396b963ca240bbc1fc
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Sat May 6 16:57:18 2023 +0200

    ipq40xx: add support for Teltonika RUTX50
    
    Hardware
    --------
    CPU:     Qualcomm IPQ4018
    RAM:     256M
    Flash:   16MB SPI-NOR (W25Q128)
             128MB SPI-NAND (XTX)
    WiFi:    2T2R (2GHz 802.11n ; 5 GHz 802.11ac)
    ETH:     4x LAN ; 1x WAN (Gigabit)
    CELL:    Quectel RG501Q 3G/4G/5G
    
    UART: Available on the goldfinger connector (Pinout silkscreened)
          115200 8N1 3V3 - Only connect RX / TX / GND
    
    Installation
    ------------
    
    1. Enable SSH in the Teltonika UI
       (System --> Administration --> Access Control)
    
    2. Check from which partition set the device is currently running from.
    
       $ cat /proc/boot_info/rootfs/primaryboot
    
       In case this output reads 0, install a Software update from Teltonika
       first. After upgrade completion, check this file now reads 1 before
       continuing.
    
    2. Transfer the OpenWrt factory image to the device using scp. Use the
       same password (user root!) as used for the Web-UI.
    
       $ scp -O openwrt-factory.bin root at 192.168.1.1:/tmp
    
    3. Connect to the device using ssh as the root user.
    
    4. Install OpenWrt by writing the factory image to flash.
    
       $ ubiformat /dev/mtd16 -y -f /tmp/openwrt-factory.bin
    
    5. Instruct the bootloaer to boot from the first partition set.
    
       $ echo 0 > /proc/boot_info/rootfs/primaryboot
       $ cat /proc/boot_info/getbinary_bootconfig > /tmp/bootconfig.bin
       $ cat /proc/boot_info/getbinary_bootconfig1 > /tmp/bootconfig1.bin
       $ mtd write /tmp/bootconfig.bin /dev/mtd2
       $ mtd write /tmp/bootconfig1.bin /dev/mtd3
    
    6. Reboot the device.
    
       $ reboot
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
    (cherry picked from commit 844bb4bfad84cc6267f9b138d1f63b07ed3b77d0)
---
 .../ipq40xx/base-files/etc/board.d/02_network      |   1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |   6 +-
 .../ipq40xx/base-files/lib/upgrade/platform.sh     |   1 +
 .../arch/arm/boot/dts/qcom-ipq4018-rutx50.dts      | 181 +++++++++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  16 ++
 5 files changed, 203 insertions(+), 2 deletions(-)

diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 1a74fb792c..c297566dd8 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -24,6 +24,7 @@ ipq40xx_setup_interfaces()
 	p2w,r619ac-64m|\
 	p2w,r619ac-128m|\
 	pakedge,wr-1|\
+	teltonika,rutx50|\
 	zyxel,nbg6617)
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
 		;;
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 7f41bdcfcc..c8cf297e81 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -131,7 +131,8 @@ case "$FIRMWARE" in
 		caldata_extract "0:ART" 0x1000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(get_mac_label) 2)
 		;;
-	teltonika,rutx10)
+	teltonika,rutx10|\
+	teltonika,rutx50)
 		caldata_extract "0:ART" 0x1000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 2)
 		;;
@@ -227,7 +228,8 @@ case "$FIRMWARE" in
 		caldata_extract "0:ART" 0x5000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(get_mac_label) 4)
 		;;
-	teltonika,rutx10)
+	teltonika,rutx10|\
+	teltonika,rutx50)
 		caldata_extract "0:ART" 0x5000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 3)
 		;;
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index e6e99b9d21..8807f844e5 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -207,6 +207,7 @@ platform_do_upgrade() {
 		sony_emmc_do_upgrade "$1"
 		;;
 	teltonika,rutx10 |\
+	teltonika,rutx50 |\
 	zte,mf18a |\
 	zte,mf286d |\
 	zte,mf287plus |\
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts
new file mode 100644
index 0000000000..ea2102f7d6
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx50.dts
@@ -0,0 +1,181 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qcom-ipq4018-rutx.dtsi"
+
+/ {
+	model = "Teltonika RUTX50";
+	compatible = "teltonika,rutx50";
+
+	aliases {
+		led-boot = &led_rssi0;
+		led-failsafe = &led_rssi0;
+		led-running = &led_rssi0;
+		led-upgrade = &led_rssi0;
+		label-mac-device = &gmac;
+	};
+
+	soc {
+		gpio-export {
+			compatible = "gpio-export";
+			#size-cells = <0>;
+
+			gpio_modem_reset {
+				gpio-export,name = "modem_reset";
+				gpio-export,output = <0>;
+				gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>;
+			};
+
+			gpio_modem_power {
+				gpio-export,name = "modem_power";
+				gpio-export,output = <0>;
+				gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>;
+			};
+
+			gpio_out_1 {
+				gpio-export,name = "sim-select";
+				/* 0 = SIM1 ; 1 = SIM2 */
+				gpio-export,output = <0>;
+				gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
+			};
+
+			gpio_in_1 {
+				gpio-export,name = "sim-detect";
+				gpio-export,input = <0>;
+				gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
+			};
+		};
+
+		leds {
+			compatible = "gpio-leds";
+
+			led-0 {
+				label = "green:sim1";
+				gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-1 {
+				label = "green:sim2";
+				gpios = <&shift_io 15 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-2 {
+				label = "green:eth";
+				gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-3 {
+				label = "green:wifi";
+				gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-4 {
+				label = "green:3g";
+				gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-5 {
+				label = "green:4g";
+				gpios = <&shift_io 4 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-6 {
+				label = "green:5g";
+				gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>;
+			};
+
+			led_rssi0: led-7 {
+				label = "green:rssi0";
+				gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-8 {
+				label = "green:rssi1";
+				gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-9 {
+				label = "green:rssi2";
+				gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-10 {
+				label = "green:wifi2g";
+				gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>;
+			};
+
+			led-11 {
+				label = "green:wifi5g";
+				gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>;
+			};
+		};
+
+		spi-gpio {
+			compatible = "spi-gpio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			gpio-sck = <&tlmm 1 GPIO_ACTIVE_HIGH>;
+			gpio-mosi = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+			cs-gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>;
+			num-chipselects = <1>;
+
+			shift_io: shift_io at 0 {
+				compatible = "fairchild,74hc595";
+				reg = <0>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				/* Attn: This is specific to RUTX50 in Teltonika GPL */
+				registers-number = <2>;
+				spi-max-frequency = <10000000>;
+			};
+		};
+	};
+};
+
+&wifi0 {
+	status = "okay";
+	qcom,ath10k-calibration-variant = "Teltonika-RUTX10";
+};
+
+&wifi1 {
+	status = "okay";
+	qcom,ath10k-calibration-variant = "Teltonika-RUTX10";
+};
+
+&gmac {
+	status = "okay";
+};
+
+&switch {
+	status = "okay";
+};
+
+&swport1 {
+	status = "okay";
+
+	label = "lan1";
+};
+
+&swport2 {
+	status = "okay";
+
+	label = "lan2";
+};
+
+&swport3 {
+	status = "okay";
+
+	label = "lan3";
+};
+
+&swport4 {
+	status = "okay";
+
+	label = "lan4";
+};
+
+&swport5 {
+	status = "okay";
+
+	label = "wan";
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index f15463ae8c..a9dd2aa091 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -1076,6 +1076,22 @@ endef
 # Missing DSA Setup
 #TARGET_DEVICES += teltonika_rutx10
 
+define Device/teltonika_rutx50
+	$(call Device/FitImage)
+	$(call Device/UbiFit)
+	DEVICE_VENDOR := Teltonika
+	DEVICE_MODEL := RUTX50
+	SOC := qcom-ipq4018
+	DEVICE_DTS_CONFIG := config at 5
+	KERNEL_INSTALL := 1
+	BLOCKSIZE := 128k
+	PAGESIZE := 2048
+	FILESYSTEMS := squashfs
+	IMAGE/factory.ubi := append-ubi
+	DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi
+endef
+TARGET_DEVICES += teltonika_rutx50
+
 define Device/tel_x1pro
 	$(call Device/FitImage)
 	DEVICE_VENDOR := Telco




More information about the lede-commits mailing list