summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtarget/linux/ramips/base-files/etc/board.d/01_leds6
-rwxr-xr-xtarget/linux/ramips/base-files/etc/board.d/02_network1
-rw-r--r--target/linux/ramips/base-files/etc/diag.sh1
-rwxr-xr-xtarget/linux/ramips/base-files/lib/ramips.sh3
-rwxr-xr-xtarget/linux/ramips/base-files/lib/upgrade/platform.sh1
-rw-r--r--target/linux/ramips/dts/ArcherC20.dts189
-rw-r--r--target/linux/ramips/image/mt7620.mk11
-rw-r--r--tools/firmware-utils/src/mktplinkfw2.c8
8 files changed, 220 insertions, 0 deletions
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index f6a7bac..a0baa61 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -86,6 +86,12 @@ c108)
ucidef_set_led_netdev "lan" "lan" "$board:green:lan" "eth0"
ucidef_set_led_netdev "modem" "modem" "$board:green:modem" "wwan0"
;;
+c20)
+ ucidef_set_led_switch "lan" "lan" "$board:blue:lan" "switch0" "0x1e"
+ ucidef_set_led_switch "wan" "wan" "$board:blue:wan" "switch0" "0x01"
+ set_usb_led "$board:blue:usb"
+ ucidef_set_led_netdev "wlan2g" "wlan2g" "$board:blue:wlan2g" "wlan0"
+ ;;
c20i)
ucidef_set_led_switch "lan" "lan" "$board:blue:lan" "switch0" "0x1e"
ucidef_set_led_switch "wan" "wan" "$board:blue:wan" "switch0" "0x01"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 6f05259..862e99b 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -184,6 +184,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
+ c20|\
c50)
ucidef_add_switch "switch0" \
"1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 16c83f2..0345f1e 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -119,6 +119,7 @@ get_status_led() {
w502u)
status_led="$board:blue:wps"
;;
+ c20|\
d240|\
dap-1350|\
na930|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index d0055d4..d0b9bb1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -88,6 +88,9 @@ ramips_board_detect() {
*"C108")
name="c108"
;;
+ *"C20")
+ name="c20"
+ ;;
*"C20i")
name="c20i"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 09a7dae..e08c45d 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -230,6 +230,7 @@ platform_check_image() {
}
return 0
;;
+ c20|\
c20i|\
c50|\
mr200|\
diff --git a/target/linux/ramips/dts/ArcherC20.dts b/target/linux/ramips/dts/ArcherC20.dts
new file mode 100644
index 0000000..a0e7c61
--- /dev/null
+++ b/target/linux/ramips/dts/ArcherC20.dts
@@ -0,0 +1,189 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ compatible = "tplink,c20", "ralink,mt7620a-soc";
+ model = "TP-Link Archer C20";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ lan {
+ label = "c20:blue:lan";
+ gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+ };
+
+ power {
+ label = "c20:blue:power";
+ gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+ };
+
+ usb {
+ label = "c20:blue:usb";
+ gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
+ };
+
+ wan {
+ label = "c20:blue:wan";
+ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+ };
+
+ wan_orange {
+ label = "c20:orange:wan";
+ gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+ };
+
+ wlan5g {
+ label = "c20:blue:wlan5g";
+ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
+ };
+
+ wlan2g {
+ label = "c20:blue:wlan2g";
+ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+ };
+
+ wps {
+ label = "c20:blue:wps";
+ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+
+ rfkill {
+ label = "rfkill";
+ gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RFKILL>;
+ }; };
+};
+
+&gpio1 {
+ status = "okay";
+};
+
+&gpio2 {
+ status = "okay";
+};
+
+&gpio3 {
+ status = "okay";
+};
+
+&spi0 {
+ status = "okay";
+
+ m25p80@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x20000>;
+ read-only;
+ };
+
+ partition@20000 {
+ label = "firmware";
+ reg = <0x20000 0x7a0000>;
+ };
+
+ partition@7c0000 {
+ label = "config";
+ reg = <0x7c0000 0x10000>;
+ read-only;
+ };
+
+ rom: partition@7d0000 {
+ label = "rom";
+ reg = <0x7d0000 0x10000>;
+ read-only;
+ };
+
+ partition@7e0000 {
+ label = "romfile";
+ reg = <0x7e0000 0x10000>;
+ read-only;
+ };
+
+ radio: partition@7f0000 {
+ label = "radio";
+ reg = <0x7f0000 0x10000>;
+ read-only;
+ };
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "i2c", "uartf", "wled", "ephy", "spi refclk", "wdt";
+ ralink,function = "gpio";
+ };
+
+ pa {
+ ralink,group = "pa";
+ ralink,function = "pa";
+ };
+ };
+};
+
+&ethernet {
+ pinctrl-names = "default";
+ mtd-mac-address = <&rom 0xf100>;
+ mediatek,portmap = "wllll";
+ };
+
+&ehci {
+ status = "okay";
+};
+
+&ohci {
+ status = "okay";
+};
+
+&gsw {
+ mediatek,port4 = "ephy";
+};
+
+&wmac {
+ ralink,mtd-eeprom = <&radio 0>;
+ mtd-mac-address = <&rom 0xf100>;
+ mtd-mac-address-increment = <(-2)>;
+};
+
+&pcie {
+ status = "okay";
+
+ pcie-bridge {
+ mt76@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ device_type = "pci";
+ mediatek,mtd-eeprom = <&radio 32768>;
+ ieee80211-freq-limit = <5000000 6000000>;
+ mtd-mac-address = <&rom 0xf100>;
+ mtd-mac-address-increment = <(-1)>;
+ };
+ };
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 6d2533d..f964b3e 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -32,6 +32,17 @@ define Device/Archer
IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
endef
+define Device/ArcherC20
+ $(Device/Archer)
+ DTS := ArcherC20
+ SUPPORTED_DEVICES := c20
+ TPLINK_BOARD_ID := ArcherC20
+ IMAGES += factory.bin
+ DEVICE_TITLE := TP-Link ArcherC20
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+endef
+TARGET_DEVICES += ArcherC20
+
define Device/ArcherC20i
$(Device/Archer)
DTS := ArcherC20i
diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c
index 7d09477..6ef51db 100644
--- a/tools/firmware-utils/src/mktplinkfw2.c
+++ b/tools/firmware-utils/src/mktplinkfw2.c
@@ -181,6 +181,14 @@ static struct board_info boards[] = {
.hw_rev = 14,
.layout_id = "8Mltq",
}, {
+ .id = "ArcherC20",
+ .hw_id = 0xc2000001,
+ .hw_rev = 0x44,
+ .hw_ver_add = 0x1,
+ .layout_id = "8Mmtk",
+ .hdr_ver = 3,
+ .flags = FLAG_LE_KERNEL_LA_EP
+ }, {
.id = "ArcherC20i",
.hw_id = 0xc2000001,
.hw_rev = 58,