From ba74b45476ab1fe36f8449b18501ba5d2c01cf8c Mon Sep 17 00:00:00 2001 From: Sibren Vasse Date: Tue, 26 Jun 2018 07:25:33 +0200 Subject: [PATCH] ath79: add support for TP-Link Archer c7 v2 Signed-off-by: Sibren Vasse --- .../ath79/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +- .../ath79/dts/qca9558_tl-archer-c7-v2.dts | 16 ++ .../linux/ath79/dts/qca9558_tl-archer-c7.dtsi | 232 ++++++++++++++++++ target/linux/ath79/image/common-tp-link.mk | 6 + target/linux/ath79/image/generic-tp-link.mk | 13 + 6 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9558_tl-archer-c7-v2.dts create mode 100644 target/linux/ath79/dts/qca9558_tl-archer-c7.dtsi diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index d978c3441e..e2a45b0526 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -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" diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index e3a3432dd1..20df5a220f 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -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 index 0000000000..980aa35b91 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_tl-archer-c7-v2.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#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 index 0000000000..08bb510ea7 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_tl-archer-c7.dtsi @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#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 = ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + rfkill: wifi { + linux,code = ; + linux,input-type = ; + 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>; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&uboot 0x1fc00>; + mtd-mac-address-increment = <1>; + phy-handle = <&phy0>; +}; + +ð1 { + 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>; +}; diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk index dcd651722d..f816308a9d 100644 --- a/target/linux/ath79/image/common-tp-link.mk +++ b/target/linux/ath79/image/common-tp-link.mk @@ -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 diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index accaf3b68f..8cfbcd3a67 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -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 -- 2.30.2