ath79: add support for TP-Link RE450 v2
authorPeter Lundkvist <peter.lundkvist@gmail.com>
Fri, 29 Jun 2018 03:44:58 +0000 (05:44 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 2 Jul 2018 05:05:33 +0000 (07:05 +0200)
TP-Link RE450 v2 is a dual band router/range-extender
based on Qualcomm/Atheros QCA9563 + QCA9880.

Specification:

- 775 MHz CPU
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 1x 10/100/1000 Mbps Ethernet (AR8033 PHY)
- 7x LED, 4x button
- UART header on PCB (needs unmounted R64 & R69 0201 resistors/jumpers)

Flash instruction:
Apply factory image in OEM firmware web-gui.

U-Boot does not seem to have any recovery functions, so
debricking requires connection via UART.

Signed-off-by: Peter Lundkvist <peter.lundkvist@gmail.com>
target/linux/ath79/base-files/etc/board.d/01_leds
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/qca9563_tl-re450-v2.dts [new file with mode: 0644]
target/linux/ath79/image/common-tp-link.mk
target/linux/ath79/image/generic-tp-link.mk
tools/firmware-utils/src/tplink-safeloader.c

index 3edffaff74927dba6050c8b30be7483825d50ece..d8312a9b89217b575b806a013b19ee1d9cd9d9f7 100755 (executable)
@@ -28,6 +28,10 @@ case "$board" in
        ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
        ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
        ;;
+"tplink,re450-v2")
+       ucidef_set_led_netdev "lan_data" "LAN Data" "tp-link:green:lan_data" "eth0" "tx rx"
+       ucidef_set_led_netdev "lan_link" "LAN Link" "tp-link:green:lan_link" "eth0" "link"
+       ;;
 "tplink,tl-mr3020-v1")
        ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x02"
        ;;
index 26b37528244f4880a188c7b1f2a6f59ad8ef6b09..10a1bbd9ec3a28478aa3e969de3438d8d4a0d7cd 100755 (executable)
@@ -13,6 +13,7 @@ ath79_setup_interfaces()
                ucidef_set_interface_lan "eth0" "dhcp"
                ;;
        "avm,fritz300e"|\
+       "tplink,re450-v2"|\
        "tplink,tl-mr10u"|\
        "tplink,tl-wr703n"|\
        "ubnt,unifiac-lite"|\
index c27b4111dec96a7be19fab32d3e8e3c26306684d..28cfa25f4d197fc31cc9dfc715db3fda2eaaa92d 100644 (file)
@@ -91,6 +91,10 @@ case "$FIRMWARE" in
                ath10kcal_extract "ART" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
                ;;
+       "tplink,re450-v2")
+               ath10kcal_extract "art" 20480 2116
+               ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
+               ;;
        "tplink,tl-archer-c7-v2")
                ath10kcal_extract "art" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
diff --git a/target/linux/ath79/dts/qca9563_tl-re450-v2.dts b/target/linux/ath79/dts/qca9563_tl-re450-v2.dts
new file mode 100644 (file)
index 0000000..646cdf2
--- /dev/null
@@ -0,0 +1,195 @@
+// 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 "qca956x.dtsi"
+
+/ {
+       compatible = "tplink,re450-v2", "qca,qca9563";
+       model = "TP-Link RE450 v2";
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+       };
+
+       aliases {
+               led-status = &system;
+               mdio-gpio0 = &mdio2;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               system: power {
+                       label = "tp-link:blue:power";
+                       gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan2g {
+                       label = "tp-link:blue:wlan2g";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy1tpt";
+               };
+
+               wlan5g {
+                       label = "tp-link:blue:wlan5g";
+                       gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               lan_link {
+                       label = "tp-link:green:lan_link";
+                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               lan_data {
+                       label = "tp-link:green:lan_data";
+                       gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               wps_blue {
+                       label = "tp-link:blue:wps";
+                       gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               wps_red {
+                       label = "tp-link:red:wps";
+                       gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reset {
+                       label = "Reset button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               power {
+                       label = "Power button";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               leds {
+                       label = "LED control button";
+                       linux,code = <BTN_0>;
+                       gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               wps {
+                       label = "WPS button";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       mdio2: mdio {
+               compatible = "virtual,mdio-gpio";
+
+               gpios = <&gpio 3 GPIO_ACTIVE_HIGH>, /* MDC */
+                       <&gpio 4 GPIO_ACTIVE_HIGH>; /* MDIO */
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy0: ethernet-phy@4 {
+                       reg = <4>;
+                       device_type = "ethernet-phy";
+                       reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&uart {
+       status = "okay";
+};
+
+&gpio {
+       status = "okay";
+};
+
+&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>;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x000000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               label = "firmware";
+                               reg = <0x020000 0x5e0000>;
+                       };
+
+                       partition@600000 {
+                               label = "partition-table";
+                               reg = <0x600000 0x010000>;
+                               read-only;
+                       };
+
+                       info: partition@610000 {
+                               label = "product-info";
+                               reg = <0x610000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@630000 {
+                               label = "config";
+                               reg = <0x630000 0x020000>;
+                               read-only;
+                       };
+
+                       art: partition@7f0000 {
+                               label = "art";
+                               reg = <0x7f0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&eth0 {
+       status = "okay";
+       mtd-mac-address = <&info 0x8>;
+       phy-handle = <&phy0>;
+};
+
+&wmac {
+       status = "okay";
+       mtd-cal-data = <&art 0x1000>;
+       mtd-mac-address = <&info 0x8>;
+};
index f816308a9d9c17012118ae7c6bcc356ffd0e3108..7490aeb1f3b82ca87c64b6c779d5b80ac0d2a95b 100644 (file)
@@ -1,4 +1,4 @@
-DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME
+DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME TPLINK_BOARD_ID
 
 define rootfs_align
 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
index 28fac6a631ea208e6affed05ae3dfab95f3a7254..537dafa15251bcfeb58b8d84f0470220efe3ef43 100644 (file)
@@ -13,6 +13,24 @@ define Device/tl-archer-c7-v2
 endef
 TARGET_DEVICES += tl-archer-c7-v2
 
+define Device/tl-re450-v2
+  $(Device/tplink)
+  ATH_SOC := qca9563
+  IMAGE_SIZE := 6016k
+  DEVICE_TITLE := TP-LINK RE450 v2
+  DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
+  TPLINK_HWID := 0x0
+  TPLINK_HWREV := 0
+  TPLINK_BOARD_ID := RE450-V2
+  LOADER_TYPE := elf
+  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
+  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
+    append-metadata | check-size $$$$(IMAGE_SIZE)
+  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+  SUPPORTED_DEVICES := tplink,re450-v2
+endef
+TARGET_DEVICES += tl-re450-v2
+
 define Device/tl-wdr3600
   $(Device/tplink-8mlzma)
   ATH_SOC := ar9344
index f1883cd63697ed8b4cced59d32fc420c2baca362..b567b2950cd27a51c4b9c3902ccc06e61b0ad509 100644 (file)
@@ -1079,6 +1079,46 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "file-system"
        },
 
+       /** Firmware layout for the RE450 v2 */
+       {
+               .id = "RE450-V2",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
+                       "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
+               .support_trail = '\x00',
+               .soft_ver = NULL,
+
+               /* We're using a dynamic kernel/rootfs split here */
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x20000},
+                       {"firmware", 0x20000, 0x5e0000},
+                       {"partition-table", 0x600000, 0x02000},
+                       {"default-mac", 0x610000, 0x00020},
+                       {"pin", 0x610100, 0x00020},
+                       {"product-info", 0x611100, 0x01000},
+                       {"soft-version", 0x620000, 0x01000},
+                       {"support-list", 0x621000, 0x01000},
+                       {"profile", 0x622000, 0x08000},
+                       {"user-config", 0x630000, 0x10000},
+                       {"default-config", 0x640000, 0x10000},
+                       {"radio", 0x7f0000, 0x10000},
+
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
        {}
 };