ath79: add support for TP-Link Archer c7 v2
authorSibren Vasse <github@sibrenvasse.nl>
Tue, 26 Jun 2018 05:25:33 +0000 (07:25 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 26 Jun 2018 06:57:26 +0000 (08:57 +0200)
Signed-off-by: Sibren Vasse <github@sibrenvasse.nl>
target/linux/ath79/base-files/etc/board.d/02_network
target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ath79/dts/qca9558_tl-archer-c7-v2.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9558_tl-archer-c7.dtsi [new file with mode: 0644]
target/linux/ath79/image/common-tp-link.mk
target/linux/ath79/image/generic-tp-link.mk

index d978c3441e3b178c10dbda511a8eb0e864103716..e2a45b05261aed90781eaeb5c65546c85bd3bc2e 100755 (executable)
@@ -40,6 +40,12 @@ ath79_setup_interfaces()
                "0@eth1" "1:lan" "2:lan" "3:lan:3" "4:lan:4"
                ;;
 
+       "tplink,tl-archer-c7-v2")
+               ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
+               ucidef_add_switch "switch0" \
+                       "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
+               ;;
+
        "tplink,tl-mr3020-v1")
                ucidef_set_interface_lan "eth0.1"
                ucidef_add_switch "switch0" "0@eth0" "1:lan"
index e3a3432dd184811535d06c97990b05a81e895ea1..20df5a220f5b8d606002b7484a9cf8e2be90871c 100644 (file)
@@ -87,10 +87,14 @@ board=$(board_name)
 case "$FIRMWARE" in
 "ath10k/cal-pci-0000:00:00.0.bin")
        case $board in
-       openmesh,om5p-ac-v2)
+       "openmesh,om5p-ac-v2")
                ath10kcal_extract "ART" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
                ;;
+       "tplink,tl-archer-c7-v2")
+               ath10kcal_extract "art" 20480 2116
+               ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
+               ;;
        "ubnt,ubnt-unifiac-lite")
                ath10kcal_extract "EEPROM" 20480 2116
                ;;
diff --git a/target/linux/ath79/dts/qca9558_tl-archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tl-archer-c7-v2.dts
new file mode 100644 (file)
index 0000000..980aa35
--- /dev/null
@@ -0,0 +1,16 @@
+// 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 "qca9558_tl-archer-c7.dtsi"
+
+/ {
+       compatible = "tplink,tl-archer-c7-v2", "qca,qca9558";
+       model = "TP-Link Archer C7 Version 2";
+};
+
+&rfkill {
+       gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
+};
diff --git a/target/linux/ath79/dts/qca9558_tl-archer-c7.dtsi b/target/linux/ath79/dts/qca9558_tl-archer-c7.dtsi
new file mode 100644 (file)
index 0000000..08bb510
--- /dev/null
@@ -0,0 +1,232 @@
+// 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 "qca9557.dtsi"
+
+/ {
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x8000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+       };
+
+       aliases {
+               led-status = &system;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               system: system {
+                       label = "tp-link:green:system";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+               };
+
+               usb1 {
+                       label = "tp-link:green:usb1";
+                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       trigger-sources = <&hub_port0>;
+                       linux,default-trigger = "usbport";
+               };
+
+               usb2 {
+                       label = "tp-link:green:usb2";
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       trigger-sources = <&hub_port1>;
+                       linux,default-trigger = "usbport";
+               };
+
+               wlan2g {
+                       label = "tp-link:green:wlan2g";
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy1tpt";
+               };
+
+               qss {
+                       label = "tp-link:green:qss";
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               wlan5g {
+                       label = "tp-link:green:wlan5g";
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reset {
+                       label = "Reset button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               rfkill: wifi {
+                       linux,code = <KEY_RFKILL>;
+                       linux,input-type = <EV_SW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               gpio_usb1_power {
+                       gpio-export,name = "tp-link:power:usb1";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
+               };
+
+               gpio_usb2_power {
+                       gpio-export,name = "tp-link:power:usb2";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
+               };
+
+       };
+};
+
+&pcie1 {
+       status = "okay";
+};
+
+&uart {
+       status = "okay";
+};
+
+&gpio {
+       status = "okay";
+};
+
+&usb_phy0 {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+
+       hub_port0: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+};
+
+&usb_phy1 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+
+       hub_port1: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+};
+
+&spi {
+       status = "okay";
+       num-cs = <1>;
+
+       flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <25000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       uboot: partition@0 {
+                               label = "u-boot";
+                               reg = <0x000000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               label = "firmware";
+                               reg = <0x020000 0xfd0000>;
+                       };
+
+                       art: partition@ff0000 {
+                               label = "art";
+                               reg = <0xff0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+
+               qca,ar8327-initvals = <
+                       0x04 0x00080080 /* PORT0 PAD MODE CTRL */
+                       0x0c 0x07600000 /* PORT6 PAD MODE CTRL */
+                       0x50 0xc737c737 /* LED_CTRL0 */
+                       0x54 0x00000000 /* LED_CTRL1 */
+                       0x58 0x00000000 /* LED_CTRL2 */
+                       0x5c 0x0030c300 /* LED_CTRL3 */
+                       0x7c 0x0000007e /* PORT0_STATUS */
+                       0x94 0x0000007e /* PORT6 STATUS */
+                       >;
+       };
+};
+
+&mdio1 {
+       status = "okay";
+
+       phy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       mtd-mac-address-increment = <1>;
+       phy-handle = <&phy0>;
+};
+
+&eth1 {
+       status = "okay";
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       phy-handle = <&phy1>;
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
+
+&wmac {
+       status = "okay";
+       mtd-cal-data = <&art 0x1000>;
+       mtd-mac-address = <&uboot 0x1fc00>;
+};
index dcd651722da1f851115784018bf1b5676bc3b5df..f816308a9d9c17012118ae7c6bcc356ffd0e3108 100644 (file)
@@ -82,3 +82,9 @@ $(Device/tplink)
   TPLINK_FLASHLAYOUT := 8Mlzma
   IMAGE_SIZE := 7936k
 endef
+
+define Device/tplink-16mlzma
+  $(Device/tplink)
+  TPLINK_FLASHLAYOUT := 16Mlzma
+  IMAGE_SIZE := 15872k
+endef
index accaf3b68f521f4eea1de35971977fde4874d6fd..8cfbcd3a6748907d3965889f679300c33424337f 100644 (file)
@@ -1,5 +1,18 @@
 include ./common-tp-link.mk
 
+define Device/tl-archer-c7-v2
+  $(Device/tplink-16mlzma)
+  ATH_SOC := qca9558
+  DEVICE_TITLE := TP-LINK Archer C7 v2
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
+  TPLINK_HWID := 0xc7000002
+  SUPPORTED_DEVICES := tplink,tl-archer-c7-v2
+  IMAGES := sysupgrade.bin factory.bin factory-us.bin factory-eu.bin
+  IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US
+  IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
+endef
+TARGET_DEVICES += tl-archer-c7-v2
+
 define Device/tl-wdr3600
   $(Device/tplink-8mlzma)
   ATH_SOC := ar9344