aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/ath79/dts/qca9531_teltonika_rut300.dts164
-rw-r--r--target/linux/ath79/generic/base-files/etc/board.d/01_leds7
-rw-r--r--target/linux/ath79/generic/base-files/etc/board.d/02_network5
-rw-r--r--target/linux/ath79/image/generic.mk47
4 files changed, 223 insertions, 0 deletions
diff --git a/target/linux/ath79/dts/qca9531_teltonika_rut300.dts b/target/linux/ath79/dts/qca9531_teltonika_rut300.dts
new file mode 100644
index 0000000000..a4f5fb543b
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_teltonika_rut300.dts
@@ -0,0 +1,164 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "qca953x.dtsi"
+
+/ {
+ compatible = "teltonika,rut300", "teltonika,rut30x", "qca,qca9531";
+ model = "TELTONIKA RUT300";
+
+ aliases {
+ label-mac-device = &eth1;
+ led-boot = &led_wan;
+ led-failsafe = &led_wan;
+ led-running = &led_wan;
+ led-upgrade = &led_wan;
+ serial0 = &uart;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pmx_leds_switch>, <&jtag_disable_pins>;
+
+ led_wan: wan {
+ label = "yellow:wan";
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ };
+
+ lan1 {
+ label = "yellow:lan1";
+ gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
+ };
+
+ lan2 {
+ label = "yellow:lan2";
+ gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+ };
+
+ lan3 {
+ label = "yellow:lan3";
+ gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ };
+
+ lan4 {
+ label = "yellow:lan4";
+ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&spi {
+ status = "okay";
+ num-cs = <1>;
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <25000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x000000 0x020000>;
+ read-only;
+ };
+
+ config: partition@20000 {
+ label = "config";
+ reg = <0x020000 0x010000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "art";
+ reg = <0x030000 0x010000>;
+ read-only;
+ };
+
+ partition@40000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x040000 0xf30000>;
+ };
+
+ partition@f70000 {
+ label = "event-log";
+ reg = <0xf70000 0x090000>;
+ };
+ };
+ };
+};
+
+&usb0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ hub_port0: port@1 {
+ reg = <1>;
+ #trigger-source-cells = <0>;
+ };
+};
+
+&usb_phy {
+ status = "okay";
+};
+
+&uart {
+ status = "okay";
+};
+
+&config {
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_config_0: macaddr@0 {
+ reg = <0x0 0x6>;
+ };
+};
+
+&eth0 {
+ status = "okay";
+ phy-handle = <&swphy0>;
+
+ nvmem-cells = <&macaddr_config_0>;
+ nvmem-cell-names = "mac-address";
+ mac-address-increment = <1>;
+};
+
+&eth1 {
+ phy-handle = <&swphy4>;
+ nvmem-cells = <&macaddr_config_0>;
+ nvmem-cell-names = "mac-address";
+
+ gmac-config {
+ device = <&gmac>;
+ switch-phy-swap = <1>;
+ };
+};
+
+&pinmux {
+ pmx_leds_switch: leds_switch {
+ // switch port LEDs on GPIO 0~4
+ pinctrl-single,bits = <0x0 0x00000000 0xffffffff>,
+ <0x4 0x00000000 0x000000ff>;
+ };
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 606a194f7e..7fe9343876 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -337,6 +337,13 @@ teltonika,rut230-v1)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x04"
;;
+teltonika,rut300)
+ ucidef_set_led_netdev "wan" "WAN" "yellow:wan" "eth1"
+ ucidef_set_led_switch "lan1" "LAN1" "yellow:lan1" "switch0" "0x02"
+ ucidef_set_led_switch "lan2" "LAN2" "yellow:lan2" "switch0" "0x10"
+ ucidef_set_led_switch "lan3" "LAN3" "yellow:lan3" "switch0" "0x08"
+ ucidef_set_led_switch "lan4" "LAN4" "yellow:lan4" "switch0" "0x04"
+ ;;
tplink,archer-a7-v5|\
tplink,archer-c7-v4|\
tplink,archer-c7-v5)
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index e47f66c2f2..339005f051 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -193,6 +193,11 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
;;
+ teltonika,rut300)
+ ucidef_set_interface_wan "eth1"
+ ucidef_add_switch "switch0" \
+ "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
+ ;;
buffalo,wzr-hp-g300nh-rb|\
buffalo,wzr-hp-g300nh-s|\
dlink,dir-825-b1|\
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 11c5669fe4..e5bc73e5a6 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -10,6 +10,7 @@ DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE
DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL
DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING
+DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
define Build/addpattern
-$(STAGING_DIR_HOST)/bin/addpattern -B $(ADDPATTERN_ID) \
@@ -139,6 +140,35 @@ define Build/teltonika-v1-header
@mv $@.new $@
endef
+metadata_json_teltonika = \
+ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
+ "metadata_version": "1.1", \
+ "compat_version": "$(call json_quote,$(compat_version))", \
+ "version":"$(call json_quote,$(VERSION_DIST))-$(call json_quote,$(VERSION_NUMBER))-$(call json_quote,$(REVISION))", \
+ "device_code": [".*"], \
+ "hwver": [".*"], \
+ "batch": [".*"], \
+ "serial": [".*"], \
+ $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
+ $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
+ [$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma) \
+ "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
+ $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma)) \
+ "version_wrt": { \
+ "dist": "$(call json_quote,$(VERSION_DIST))", \
+ "version": "$(call json_quote,$(VERSION_NUMBER))", \
+ "revision": "$(call json_quote,$(REVISION))", \
+ "target": "$(call json_quote,$(TARGETID))", \
+ "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
+ }, \
+ "hw_support": {}, \
+ "hw_mods": {} \
+ }'
+
+define Build/append-metadata-teltonika
+ echo $(call metadata_json_teltonika) | fwtool -I - $@
+endef
+
define Build/wrgg-pad-rootfs
$(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
endef
@@ -2527,6 +2557,23 @@ define Device/teltonika_rut230-v1
endef
TARGET_DEVICES += teltonika_rut230-v1
+define Device/teltonika_rut300
+ SOC := qca9531
+ DEVICE_VENDOR := Teltonika
+ DEVICE_MODEL := RUT300
+ SUPPORTED_TELTONIKA_DEVICES := teltonika,rut30x
+ DEVICE_PACKAGES := -kmod-ath9k -uboot-envtools -wpad-basic-wolfssl kmod-usb2
+ IMAGE_SIZE := 15552k
+ IMAGES += factory.bin
+ IMAGE/factory.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
+ append-rootfs | pad-rootfs | append-metadata-teltonika | \
+ check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
+ append-rootfs | pad-rootfs | append-metadata | \
+ check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += teltonika_rut300
+
define Device/teltonika_rut955
SOC := ar9344
DEVICE_VENDOR := Teltonika