From 9fec39a03388677ce5c8e56de8f049391b8c4ed7 Mon Sep 17 00:00:00 2001 From: Federico Cappon Date: Fri, 9 Jun 2017 15:11:39 +0000 Subject: [PATCH] ar71xx: add support for TP-Link TL-WA855RE v1 TP-Link TL-WA855RE v1 is a wall-plug N300 Wi-Fi range extender, based on Qualcomm/Atheros QCA9533 v2. Short specification: - 550/397/198 MHz (CPU/DDR/AHB) - 1x 10/100 Mbps Ethernet - 32 MB of RAM (DDR1) - 4 MB of FLASH - 2T2R 2.4 GHz - 2x external antennas - 2x LED (green and orange in the same package), 2x button - UART: TP5(TX) and TP4(RX) test points on PCB Flash instruction: use "factory" image directly in vendor GUI. Warning: this device does not include any kind of recovery mechanism in the bootloader and disassembling process is not trivial. You can access vendor firmware over serial line using: - login: root - password: sohoadmin Image was tested only in EU version of the device, but should work also with the same device version sold in other countries. Signed-off-by: Federico Cappon --- .../ar71xx/base-files/etc/board.d/02_network | 1 + target/linux/ar71xx/base-files/etc/diag.sh | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 +++ .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-4.4 | 1 + .../files/arch/mips/ath79/Kconfig.openwrt | 9 +++++ .../ar71xx/files/arch/mips/ath79/Makefile | 1 + .../files/arch/mips/ath79/mach-tl-wax50re.c | 33 ++++++++++++++++ .../ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/tp-link.mk | 25 +++++++++--- target/linux/ar71xx/mikrotik/config-default | 1 + target/linux/ar71xx/nand/config-default | 1 + tools/firmware-utils/src/tplink-safeloader.c | 39 +++++++++++++++++++ 13 files changed, 114 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 709030ceb3..a7a9921faf 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -117,6 +117,7 @@ ar71xx_setup_interfaces() tl-wa830re-v2|\ tl-wa850re|\ tl-wa850re-v2|\ + tl-wa855re-v1)|\ tl-wa901nd|\ tl-wa901nd-v2|\ tl-wa901nd-v3|\ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 936a1148d0..0bb338a573 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -369,6 +369,7 @@ get_status_led() { tl-wa850re-v2) status_led="tp-link:blue:re" ;; + tl-wa855re-v1|\ tl-wa860re) status_led="tp-link:green:power" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index ecc8dab36c..3f781a8e5c 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -234,6 +234,9 @@ tplink_board_detect() { "085000"*) model="TP-Link TL-WA850RE" ;; + "085500"*) + model="TP-Link TL-WA855RE" + ;; "086000"*) model="TP-Link TL-WA860RE" ;; @@ -1058,6 +1061,9 @@ ar71xx_board_detect() { *"TL-WA850RE v2") name="tl-wa850re-v2" ;; + *"TL-WA855RE v1") + name="tl-wa855re-v1" + ;; *"TL-WA860RE") name="tl-wa860re" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 60e41c862e..454af2c3e6 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -411,6 +411,7 @@ platform_check_image() { tl-wa830re-v2|\ tl-wa850re|\ tl-wa850re-v2|\ + tl-wa855re-v1|\ tl-wa860re|\ tl-wa901nd-v2|\ tl-wa901nd-v3|\ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 6ff9700cdc..8be13e16cd 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -183,6 +183,7 @@ CONFIG_ATH79_MACH_TL_WA7210N_V2=y CONFIG_ATH79_MACH_TL_WA801ND_V3=y CONFIG_ATH79_MACH_TL_WA830RE_V2=y CONFIG_ATH79_MACH_TL_WA850RE_V2=y +CONFIG_ATH79_MACH_TL_WA855RE_V1=y CONFIG_ATH79_MACH_TL_WA901ND=y CONFIG_ATH79_MACH_TL_WA901ND_V2=y CONFIG_ATH79_MACH_TL_WA901ND_V4=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 0df5a88dc3..0ae9a11ff6 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -1503,6 +1503,15 @@ config ATH79_MACH_TL_WA850RE_V2 select ATH79_DEV_M25P80 select ATH79_DEV_WMAC +config ATH79_MACH_TL_WA855RE_V1 + bool "TP-LINK TL-WA855RE V1 support" + select SOC_QCA953X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + config ATH79_MACH_TL_WA901ND bool "TP-LINK TL-WA901ND/TL-WA7510N support" select SOC_AR724X diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index 5a848d0399..869920ca30 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -188,6 +188,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WA7210N_V2) += mach-tl-wa7210n-v2.o obj-$(CONFIG_ATH79_MACH_TL_WA801ND_V3) += mach-tl-wa801nd-v3.o obj-$(CONFIG_ATH79_MACH_TL_WA830RE_V2) += mach-tl-wa830re-v2.o obj-$(CONFIG_ATH79_MACH_TL_WA850RE_V2) += mach-tl-wax50re.o +obj-$(CONFIG_ATH79_MACH_TL_WA855RE_V1) += mach-tl-wax50re.o obj-$(CONFIG_ATH79_MACH_TL_WA901ND) += mach-tl-wa901nd.o obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V2) += mach-tl-wa901nd-v2.o obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V4) += mach-tl-wa901nd-v4.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c index d7a1af4e2c..955628fecb 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c @@ -3,11 +3,14 @@ * - TL-WA750RE v1 * - TL-WA801ND v2 * - TL-WA850RE v1/v2 + * - TL-WA855RE v1 * - TL-WA901ND v3 * * Copyright (C) 2013 Martijn Zilverschoon * Copyright (C) 2013 Jiri Pirko * Copyright (C) 2017 Piotr Dymacz + * Copyright (C) 2017 Federico Cappon + * Copyright (C) 2017 Nicolò Veronese * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published @@ -48,6 +51,9 @@ #define TL_WA850RE_V2_GPIO_ENABLE_LEDS 15 +#define TL_WA855REV1_GPIO_LED_RED 11 +#define TL_WA855REV1_GPIO_LED_GREEN 12 + #define TL_WA860RE_GPIO_LED_WLAN_ORANGE 0 #define TL_WA860RE_GPIO_LED_WLAN_GREEN 2 #define TL_WA860RE_GPIO_LED_POWER_ORANGE 12 @@ -184,6 +190,18 @@ static struct gpio_led tl_wa850re_v2_leds_gpio[] __initdata = { }, }; +static struct gpio_led tl_wa855re_v1_leds_gpio[] __initdata = { + { + .name = "tp-link:green:power", + .gpio = TL_WA855REV1_GPIO_LED_GREEN, + .active_low = 0, + }, { + .name = "tp-link:red:power", + .gpio = TL_WA855REV1_GPIO_LED_RED, + .active_low = 0, + }, +}; + static struct gpio_led tl_wa860re_leds_gpio[] __initdata = { { .name = "tp-link:green:lan", @@ -383,6 +401,21 @@ static void __init tl_wa850re_v2_setup(void) MIPS_MACHINE(ATH79_MACH_TL_WA850RE_V2, "TL-WA850RE-V2", "TP-LINK TL-WA850RE v2", tl_wa850re_v2_setup); +static void __init tl_wa855re_v1_setup(void) +{ + tl_ap143_setup(); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa855re_v1_leds_gpio), + tl_wa855re_v1_leds_gpio); + + ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tl_wax50re_gpio_keys), + tl_wax50re_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_TL_WA855RE_V1, "TL-WA855RE-v1", "TP-LINK TL-WA855RE v1", + tl_wa855re_v1_setup); + static void __init tl_wa860re_setup(void) { tl_ap123_setup(); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 8d0dfd662b..618abfb1dc 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -226,6 +226,7 @@ enum ath79_mach_type { ATH79_MACH_TL_WA830RE_V2, /* TP-LINK TL-WA830RE v2 */ ATH79_MACH_TL_WA850RE, /* TP-LINK TL-WA850RE */ ATH79_MACH_TL_WA850RE_V2, /* TP-LINK TL-WA850RE v2 */ + ATH79_MACH_TL_WA855RE_V1, /* TP-LINK TL-WA855RE v1 */ ATH79_MACH_TL_WA860RE, /* TP-LINK TL-WA860RE */ ATH79_MACH_TL_WA901ND, /* TP-LINK TL-WA901ND */ ATH79_MACH_TL_WA901ND_V2, /* TP-LINK TL-WA901ND v2 */ diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk index a9c3cdd961..243c15a858 100644 --- a/target/linux/ar71xx/image/tp-link.mk +++ b/target/linux/ar71xx/image/tp-link.mk @@ -496,18 +496,31 @@ define Device/tl-wa850re-v1 TPLINK_HWID := 0x08500001 endef -define Device/tl-wa850re-v2 +define Device/tl-wa85xre $(Device/tplink) + KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-kernel + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory + MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),2304k(rootfs),256k(config)ro,64k(art)ro,3648k@0x20000(firmware) +endef + +define Device/tl-wa850re-v2 + $(Device/tl-wa85xre) DEVICE_TITLE := TP-LINK TL-WA850RE v2 DEVICE_PACKAGES := rssileds BOARDNAME := TL-WA850RE-V2 DEVICE_PROFILE := TLWA850 TPLINK_BOARD_NAME := TLWA850REV2 TPLINK_HWID := 0x08500002 - KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-kernel - IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade - IMAGE/factory.bin := append-rootfs | tplink-safeloader factory - MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),2304k(rootfs),256k(config)ro,64k(art)ro,3648k@0x20000(firmware) +endef + +define Device/tl-wa855re-v1 + $(Device/tl-wa85xre) + DEVICE_TITLE := TP-LINK TL-WA855RE v1 + BOARDNAME := TL-WA855RE-v1 + DEVICE_PROFILE := TLWA855RE + TPLINK_HWID := 0x08550001 + TPLINK_BOARD_NAME := TLWA855REV1 endef define Device/tl-wa860re-v1 @@ -517,7 +530,7 @@ define Device/tl-wa860re-v1 DEVICE_PROFILE := TLWA860 TPLINK_HWID := 0x08600001 endef -TARGET_DEVICES += tl-wa801nd-v1 tl-wa801nd-v2 tl-wa801nd-v3 tl-wa830re-v1 tl-wa830re-v2 tl-wa850re-v1 tl-wa850re-v2 tl-wa860re-v1 +TARGET_DEVICES += tl-wa801nd-v1 tl-wa801nd-v2 tl-wa801nd-v3 tl-wa830re-v1 tl-wa830re-v2 tl-wa850re-v1 tl-wa850re-v2 tl-wa855re-v1 tl-wa860re-v1 define Device/tl-wa901nd-v1 $(Device/tplink-4m) diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index d0c8e49189..6b87871b9a 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -146,6 +146,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y # CONFIG_ATH79_MACH_TL_WA801ND_V3 is not set # CONFIG_ATH79_MACH_TL_WA830RE_V2 is not set # CONFIG_ATH79_MACH_TL_WA850RE_V2 is not set +# CONFIG_ATH79_MACH_TL_WA855RE_V1 is not set # CONFIG_ATH79_MACH_TL_WA901ND is not set # CONFIG_ATH79_MACH_TL_WA901ND_V2 is not set # CONFIG_ATH79_MACH_TL_WA901ND_V4 is not set diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default index 8420e15fb4..0e1827663a 100644 --- a/target/linux/ar71xx/nand/config-default +++ b/target/linux/ar71xx/nand/config-default @@ -135,6 +135,7 @@ CONFIG_ATH79_MACH_RAMBUTAN=y # CONFIG_ATH79_MACH_TL_WA801ND_V3 is not set # CONFIG_ATH79_MACH_TL_WA830RE_V2 is not set # CONFIG_ATH79_MACH_TL_WA850RE_V2 is not set +# CONFIG_ATH79_MACH_TL_WA855RE_V1 is not set # CONFIG_ATH79_MACH_TL_WA901ND is not set # CONFIG_ATH79_MACH_TL_WA901ND_V2 is not set # CONFIG_ATH79_MACH_TL_WA901ND_V4 is not set diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index d2a1cb69ed..b1c95d2b7e 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -558,6 +558,45 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system" }, + /** Firmware layout for the TL-WA855RE v1 */ + { + .id = "TLWA855REV1", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n" + "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n", + .support_trail = '\x00', + .soft_ver = NULL, + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"os-image", 0x20000, 0x150000}, + {"file-system", 0x170000, 0x240000}, + {"partition-table", 0x3b0000, 0x02000}, + {"default-mac", 0x3c0000, 0x00020}, + {"pin", 0x3c0100, 0x00020}, + {"product-info", 0x3c1000, 0x01000}, + {"soft-version", 0x3c2000, 0x00100}, + {"support-list", 0x3c3000, 0x01000}, + {"profile", 0x3c4000, 0x08000}, + {"user-config", 0x3d0000, 0x10000}, + {"default-config", 0x3e0000, 0x10000}, + {"radio", 0x3f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + /** Firmware layout for the TL-WR1043 v4 */ { .id = "TLWR1043NDV4", -- 2.30.2