[OpenWrt-Devel] [PATCH] ath79: add support for TP-Link RE450 v2

Mathias Kresin dev at kresin.me
Thu Jun 28 14:54:29 EDT 2018


Thanks a lot for the patch.

Due to today's changes you most likely need to rebase your patch. Find 
more comments inline.

Mathias

2018-06-28 19:30 GMT+02:00 Peter Lundkvist <peter.lundkvist at gmail.com>:
> 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 at gmail.com>
> ---
>  target/linux/ath79/base-files/etc/board.d/01_leds  |   4 +
>  .../linux/ath79/base-files/etc/board.d/02_network  |   1 +
>  .../etc/hotplug.d/firmware/11-ath10k-caldata       |   4 +
>  target/linux/ath79/dts/qca9563_tl-re450-v2.dts     | 201 +++++++++++++++++++++
>  target/linux/ath79/image/common-tp-link.mk         |   2 +-
>  target/linux/ath79/image/generic-tp-link.mk        |  18 ++
>  tools/firmware-utils/src/tplink-safeloader.c       |  40 ++++
>  7 files changed, 269 insertions(+), 1 deletion(-)
>  create mode 100644 target/linux/ath79/dts/qca9563_tl-re450-v2.dts
>
> diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds
> index 29416ad83e..f580b65783 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -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"
>         ;;
> 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 e2a45b0526..bad3e735d6 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -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,ubnt-unifiac-lite"|\
> 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 20df5a220f..8912ea124b 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
> @@ -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
> index 0000000000..0b1c3f50aa
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9563_tl-re450-v2.dts
> @@ -0,0 +1,201 @@
> +// 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";
> +
> +       memory at 0 {
> +               device_type = "memory";
> +               reg = <0x0 0x4000000>;
> +       };

Please drop the memory node. It has been shown that it isn't required.

> +
> +       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>;
> +                       linux,default-trigger = "heartbeat";

Please drop the heartbeat trigger and only let our diag script handle 
the led.

> +               };
> +
> +               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 at 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 at 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 at 0 {
> +                               label = "u-boot";
> +                               reg = <0x000000 0x020000>;
> +                               read-only;
> +                       };
> +
> +                       partition at 20000 {
> +                               label = "firmware";
> +                               reg = <0x020000 0x5e0000>;
> +                       };
> +
> +                       partition at 600000 {
> +                               label = "partition-table";
> +                               reg = <0x600000 0x010000>;
> +                               read-only;
> +                       };
> +
> +                       info: partition at 610000 {
> +                               label = "product-info";
> +                               reg = <0x610000 0x020000>;
> +                               read-only;
> +                       };
> +
> +                       partition at 630000 {
> +                               label = "config";
> +                               reg = <0x630000 0x020000>;
> +                               read-only;
> +                       };
> +
> +                       art: partition at 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>;
> +};
> diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk
> index f816308a9d..7490aeb1f3 100644
> --- a/target/linux/ath79/image/common-tp-link.mk
> +++ b/target/linux/ath79/image/common-tp-link.mk
> @@ -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))))))
> diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
> index f048acc673..b2027c4254 100644
> --- a/target/linux/ath79/image/generic-tp-link.mk
> +++ b/target/linux/ath79/image/generic-tp-link.mk
> @@ -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 tl-re450-v2

Drop the tl-re450-v2 here. For all other boards it was added for 
compatibility reasons. The ar71xx images are using the "legacy" 
userspace boardnames and refusing an image not marked as compatible with 
the "legacy" boardname. An issue you don't have.

Mathias

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list