aredn/patches/001-add_support_for_TP-Link...

148 lines
3.6 KiB
Diff

--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -147,6 +147,7 @@ tplink,archer-d50-v1)
ucidef_set_led_switch "wan_data" "WAN Data" "tp-link:white:internet" "switch0" "0x02" "" "tx rx"
ucidef_set_led_switch "wan_link" "WAN Link" "tp-link:white:wan" "switch0" "0x02" "" "link"
;;
+tplink,cpe220-v2|\
tplink,cpe220-v3)
ucidef_set_led_netdev "lan0" "LAN0" "tp-link:green:lan0" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -119,6 +119,7 @@ ath79_setup_interfaces()
;;
comfast,cf-e110n-v2|\
comfast,cf-e120a-v3|\
+ tplink,cpe220-v2|\
tplink,cpe220-v3|\
ubnt,nanostation-m|\
ubnt,routerstation)
--- a/target/linux/ath79/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ath79/base-files/etc/board.d/03_gpio_switches
@@ -27,6 +27,7 @@ tplink,archer-c25-v1)
ucidef_add_gpio_switch "led_control" "LED control" "21" "0"
ucidef_add_gpio_switch "led_reset" "LED reset" "19" "1"
;;
+tplink,cpe220-v2|\
tplink,cpe220-v3)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
;;
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe220-v2.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar9344_tplink_cpe_2port.dtsi"
+
+/ {
+ compatible = "tplink,cpe220-v2", "qca,ar9344";
+ model = "TP-Link CPE220 v2";
+};
+
+&led_link4 {
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+};
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe_2port.dtsi
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9344_tplink_cpe.dtsi"
+
+/ {
+ aliases {
+ led-boot = &led_link4;
+ led-failsafe = &led_link4;
+ led-running = &led_link4;
+ led-upgrade = &led_link4;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ lan0 {
+ label = "tp-link:green:lan0";
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+ };
+
+ lan1 {
+ label = "tp-link:green:lan1";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ };
+
+ link1 {
+ label = "tp-link:green:link1";
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ };
+
+ link2 {
+ label = "tp-link:green:link2";
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ };
+
+ link3 {
+ label = "tp-link:green:link3";
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ };
+
+ led_link4: link4 {
+ label = "tp-link:green:link4";
+ };
+ };
+};
+
+&gpio {
+ gpio_ext_lna0 {
+ gpio-hog;
+ gpios = <18 0>;
+ output-high;
+ line-name = "tp-link:ext:lna0";
+ };
+
+ gpio_ext_lna1 {
+ gpio-hog;
+ gpios = <19 0>;
+ output-high;
+ line-name = "tp-link:ext:lna1";
+ };
+};
+
+&eth1 {
+ status = "okay";
+
+ mtd-mac-address = <&info 0x8>;
+
+ gmac-config {
+ device = <&gmac>;
+ switch-phy-swap = <0>;
+ switch-only-mode = <1>;
+ };
+};
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -177,6 +177,22 @@ define Device/tplink_cpe210-v3
endef
TARGET_DEVICES += tplink_cpe210-v3
+define Device/tplink_cpe220-v2
+ $(Device/tplink-safeloader)
+ ATH_SOC := ar9344
+ IMAGE_SIZE := 7680k
+ DEVICE_TITLE := TP-Link CPE220 v2
+ DEVICE_PACKAGES := rssileds
+ TPLINK_BOARD_ID := CPE210
+ LOADER_TYPE := elf
+ LOADER_FLASH_OFFS := 0x43000
+ COMPILE := loader-$(1).elf
+ COMPILE/loader-$(1).elf := loader-okli-compile
+ KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 12288
+ SUPPORTED_DEVICES += cpe220-v2
+endef
+TARGET_DEVICES += tplink_cpe220-v2
+
define Device/tplink_cpe220-v3
$(Device/tplink-safeloader)
ATH_SOC := qca9533