From 2970ecaae31c8e42cf1ef5cff2a78cf57701070e Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 27 May 2021 16:48:27 +0200 Subject: [PATCH 18/43] ramips: add tplink ex228 support Signed-off-by: John Crispin --- .../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 +#include + +/ { + 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 = ; + }; + }; +}; + +&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 a3bc14d59d..6e0b9b5f76 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1271,6 +1271,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 4b44669b84..1c4e29dd97 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 @@ -25,6 +25,7 @@ ramips_setup_interfaces() ampedwireless,ally-r1900k|\ 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 c2ad4d3ed6..acaa62d171 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -73,6 +73,7 @@ platform_do_upgrade() { netgear,wac124|\ netis,wf2881|\ sercomm,na502|\ + tplink,ex228|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ -- 2.25.1