Files
wlan-ap/patches/0018-ramips-add-tplink-ex228-support.patch
2021-08-12 17:07:51 +02:00

198 lines
4.4 KiB
Diff

From 842b431559c3992e182190b7f96c4407978723c7 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 16:48:27 +0200
Subject: [PATCH] ramips: add tplink ex228 support
Signed-off-by: John Crispin <john@phrozen.org>
---
.../linux/ramips/dts/mt7621_tplink_ex228.dts | 129 ++++++++++++++++++
target/linux/ramips/image/mt7621.mk | 10 ++
.../mt7621/base-files/etc/board.d/02_network | 1 +
.../mt7621/base-files/lib/upgrade/platform.sh | 1 +
4 files changed, 141 insertions(+)
create mode 100644 target/linux/ramips/dts/mt7621_tplink_ex228.dts
diff --git a/target/linux/ramips/dts/mt7621_tplink_ex228.dts b/target/linux/ramips/dts/mt7621_tplink_ex228.dts
new file mode 100644
index 0000000000..9e5cc9ef01
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tplink_ex228.dts
@@ -0,0 +1,129 @@
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "tplink,ex228", "mediatek,mt7621-soc";
+ model = "TP-Link EX228";
+
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_status: blue {
+ label = "blue:status";
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ green {
+ label = "green:system";
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+ };
+
+ red {
+ label = "green:system";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&nand {
+ status = "okay";
+
+ 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 0x80000>;
+ read-only;
+ };
+
+ factory: partition@100000 {
+ label = "factory";
+ reg = <0x100000 0x80000>;
+ read-only;
+ };
+
+ partition@180000 {
+ label = "kernel";
+ reg = <0x180000 0x400000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a60000>;
+ };
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie1 {
+ mt76@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x0000>;
+ };
+};
+
+&switch0 {
+ ports {
+ port@1 {
+ status = "okay";
+ label = "lan1";
+ };
+
+ port@2 {
+ status = "okay";
+ label = "lan2";
+ };
+
+ port@3 {
+ status = "okay";
+ label = "lan3";
+ };
+
+ port@0 {
+ status = "okay";
+ label = "wan";
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "uart3", "jtag";
+ function = "gpio";
+ };
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index a8f558326d..1a84abc842 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1138,6 +1138,16 @@ define Device/tplink_eap235-wall-v1
endef
TARGET_DEVICES += tplink_eap235-wall-v1
+define Device/tplink_ex228
+ $(Device/uimage-lzma-loader)
+ DEVICE_VENDOR := TP-Link
+ DEVICE_MODEL := EX228
+ DEVICE_PACKAGES := kmod-mt7915e
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size
+ IMAGE_SIZE=20000k
+endef
+TARGET_DEVICES += tplink_ex228
+
define Device/tplink_re350-v1
$(Device/dsa-migration)
$(Device/tplink-safeloader)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 89e679be7c..b6b8b6482d 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -36,6 +36,7 @@ ramips_setup_interfaces()
;;
gehua,ghl-r-001|\
hiwifi,hc5962|\
+ tplink,ex228|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index c9152c5cf4..853a464ea5 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -61,6 +61,7 @@ platform_do_upgrade() {
netgear,wac104|\
netgear,wac124|\
netis,wf2881|\
+ tplink,ex228|\
xiaomi,mi-router-3g|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-4|\
--
2.25.1