[LEDE-DEV] [PATCH] ar71xx: Added support for the TP-Link WA855RE V1

Matthias Schiffer mschiffer at universe-factory.net
Sun Dec 18 10:17:15 PST 2016


On 12/18/2016 03:35 PM, Federico Cappon wrote:
> The device it's similar to the WR841N/ND v9 but without the internal switch.
> For install Lede, after soldering the serial, follow the istruction for the WR841N/ND v9
> 
> Signed-off-by: Federico Cappon <dududede371 at gmail.com>
> ---
>  target/linux/ar71xx/base-files/etc/board.d/01_leds |   3 +
>  .../linux/ar71xx/base-files/etc/board.d/02_network |   1 +
>  target/linux/ar71xx/base-files/etc/diag.sh         |   3 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh       |   6 ++
>  .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
>  target/linux/ar71xx/config-4.4                     |   1 +
>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   9 ++
>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
>  .../files/arch/mips/ath79/mach-tl-wa855re-v1.c     | 117 +++++++++++++++++++++
>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
>  target/linux/ar71xx/image/tp-link.mk               |  10 ++
>  target/linux/ar71xx/mikrotik/config-default        |   1 +
>  12 files changed, 154 insertions(+)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c

Hi,
thanks for your patch. See inline comments.


> 
> diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> index a840e2f..f0c53c0 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> @@ -624,6 +624,9 @@ tl-wr842n-v3)
>  		;;
>  	esac
>  	;;
> +tl-wa855re-v1)
> +	ucidef_set_led_default "power" "POWER" "tp-link:green:power" "1"
> +	;;

Don't add the LED here, you've already defined in in /etc/diag.sh.


>  tl-wr1043nd|\
>  tl-wr1043nd-v2)
>  	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
> 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 8907605..733bc41 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -105,6 +105,7 @@ ar71xx_setup_interfaces()
>  	tl-wa801nd-v2|\
>  	tl-wa830re-v2|\
>  	tl-wa850re|\
> +	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 d9d8a29..7c72219 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -444,6 +444,9 @@ get_status_led() {
>  	wlr8100)
>  		status_led="sitecom:amber:status"
>  		;;
> +	tl-wa855re-v1)
> +		status_led="tp-link:green:power"
> +		;;
>  	esac
>  }
>  
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 2cfd017..cb6ce9d 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -244,6 +244,9 @@ tplink_board_detect() {
>  	"085000"*)
>  		model="TP-Link TL-WA850RE"
>  		;;
> +	"085501"*)
> +		model="TP-Link TL-WA855RE"
> +		;;
>  	"086000"*)
>  		model="TP-Link TL-WA860RE"
>  		;;
> @@ -951,6 +954,9 @@ ar71xx_board_detect() {
>  	*TL-WA850RE)
>  		name="tl-wa850re"
>  		;;
> +	*"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 42cc1dd..74204a5 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -397,6 +397,7 @@ platform_check_image() {
>  	tl-wr941nd-v5|\
>  	tl-wr941nd-v6|\
>  	tl-wr940n-v4|\
> +	tl-wa855re-v1|\
>  	tl-wr941nd)
>  		local magic_ver="0100"
>  
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> index 58d39ad..35709fd 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linux/ar71xx/config-4.4
> @@ -185,6 +185,7 @@ CONFIG_ATH79_MACH_TL_WR810N=y
>  CONFIG_ATH79_MACH_TL_WR841N_V1=y
>  CONFIG_ATH79_MACH_TL_WR841N_V8=y
>  CONFIG_ATH79_MACH_TL_WR841N_V9=y
> +CONFIG_ATH79_MACH_TL_WA855RE_V1=y
>  CONFIG_ATH79_MACH_TL_WR941ND=y
>  CONFIG_ATH79_MACH_TL_WR941ND_V6=y
>  CONFIG_ATH79_MACH_TL_WR940N_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 824f47f..1f3a746 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> @@ -1472,6 +1472,15 @@ config ATH79_MACH_TL_WR841N_V9
>  	select ATH79_DEV_M25P80
>  	select ATH79_DEV_USB
>  	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_WR941ND
>  	bool "TP-LINK TL-WR941ND support"
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> index 6d558ec..474934f 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> @@ -189,6 +189,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR810N)		+= mach-tl-wr810n.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR841N_V1)		+= mach-tl-wr841n.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR841N_V8)		+= mach-tl-wr841n-v8.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9)		+= mach-tl-wr841n-v9.o
> +obj-$(CONFIG_ATH79_MACH_TL_WA855RE_V1)		+= mach-tl-wa855re-v1.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR941ND)		+= mach-tl-wr941nd.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6)		+= mach-tl-wr941nd-v6.o
>  obj-$(CONFIG_ATH79_MACH_TL_WR940N_V4)		+= mach-tl-wr940n-v4.o
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c
> new file mode 100644
> index 0000000..f0591b4
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c
> @@ -0,0 +1,117 @@
> +/*
> + *  TP-LINK TL-WA855RE v1
> + *
> + *  Copyright (C) 2016 Federico Cappon <dududede371 at gmail.com>
> + *
> + *  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
> + *  by the Free Software Foundation.
> + */
> +
> +#include <linux/gpio.h>
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/mach-ath79/ath79.h>
> +#include <asm/mach-ath79/ar71xx_regs.h>
> +
> +#include "common.h"
> +#include "dev-eth.h"
> +#include "dev-gpio-buttons.h"
> +#include "dev-leds-gpio.h"
> +#include "dev-m25p80.h"
> +#include "dev-usb.h"

I think you can remove the dev-usb.h include, as the device doesn't have USB.

> +#include "dev-wmac.h"
> +#include "machtypes.h"
> +
> +#define TL_WA855REV1_GPIO_LED_GREEN 12
> +#define TL_WA855REV1_GPIO_LED_RED 505
> +
> +#define TL_WA855REV1_GPIO_BTN_RESET	17
> +#define TL_WA855REV1_GPIO_BTN_WIFI 16
> +
> +#define TL_WA855REV1_KEYS_POLL_INTERVAL	20	/* msecs */
> +#define TL_WA855REV1_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA855REV1_KEYS_POLL_INTERVAL)
> +
> +static const char *tl_wa855re_v1_part_probes[] = {
> +	"tp-link",
> +	NULL,
> +};
> +
> +static struct flash_platform_data tl_wa855re_v1_flash_data = {
> +	.part_probes	= tl_wa855re_v1_part_probes,
> +};
> +
> +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_keys_button tl_wa855re_v1_gpio_keys[] __initdata = {
> +	{
> +		.desc		= "Reset button",
> +		.type		= EV_KEY,
> +		.code		= KEY_RESTART,
> +		.gpio		= TL_WA855REV1_GPIO_BTN_RESET,
> +		.active_low	= 1,
> +	},
> +	 {
> +		.desc		= "WIFI button",
> +		.type		= EV_KEY,
> +		.code		= KEY_RFKILL,
> +		.debounce_interval = TL_WA855REV1_KEYS_DEBOUNCE_INTERVAL,
> +		.gpio		= TL_WA855REV1_GPIO_BTN_WIFI,
> +		.active_low	= 1,
> +	}
> +};
> +
> +
> +static void __init tl_ap143_setup(void)
> +{
> +	u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
> +	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
> +	u8 tmpmac[ETH_ALEN];
> +
> +	ath79_register_m25p80(&tl_wa855re_v1_flash_data);
> +
> +	ath79_setup_ar933x_phy4_switch(false, false);
> +
> +	ath79_register_mdio(0, 0x0);
> +
> +	/*Single LAN */
> +	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
> +	ath79_eth0_data.duplex = DUPLEX_FULL;
> +	ath79_eth0_data.speed = SPEED_100;
> +	ath79_eth0_data.phy_mask = BIT(4);
> +	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> +	ath79_register_eth(0);
> +
> +
> +	ath79_init_mac(tmpmac, mac, 0);
> +	ath79_register_wmac(ee, tmpmac);
> +}
> +
> +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_WA855REV1_KEYS_POLL_INTERVAL,
> +					ARRAY_SIZE(tl_wa855re_v1_gpio_keys),
> +					tl_wa855re_v1_gpio_keys);
> +}
> +
> +MIPS_MACHINE(ATH79_MACH_TL_WA855RE_V1, "TL-WA855RE-v1", "TP-LINK TL-WA855RE v1",
> +	     tl_wa855re_v1_setup);
> +
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> index ea218d7..405e50a 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> @@ -221,6 +221,7 @@ enum ath79_mach_type {
>  	ATH79_MACH_TL_WR841N_V7,		/* TP-LINK TL-WR841N/ND v7 */
>  	ATH79_MACH_TL_WR841N_V8,		/* TP-LINK TL-WR841N/ND v8 */
>  	ATH79_MACH_TL_WR841N_V9,		/* TP-LINK TL-WR841N/ND v9 */
> +	ATH79_MACH_TL_WA855RE_V1,		/* TP-LINK TL-WA855RE v1 */
>  	ATH79_MACH_TL_WR842N_V2,		/* TP-LINK TL-WR842N/ND v2 */
>  	ATH79_MACH_TL_WR842N_V3,		/* TP-LINK TL-WR842N/ND v3 */
>  	ATH79_MACH_TL_WR941ND,			/* TP-LINK TL-WR941ND */
> diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
> index 97abec0..8eb34ed 100644
> --- a/target/linux/ar71xx/image/tp-link.mk
> +++ b/target/linux/ar71xx/image/tp-link.mk
> @@ -371,6 +371,16 @@ define Device/tl-mr3420-v2
>  endef
>  TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v1 tl-mr3220-v2 tl-mr3420-v1 tl-mr3420-v2
>  
> +define Device/tl-wa855re-v1
> +    $(Device/tplink-4mlzma)
> +    DEVICE_TITLE := TP-LINK TL-WA855RE
> +    BOARDNAME := TL-WA855RE-v1
> +    DEVICE_PROFILE := TLWR855RE
> +    TPLINK_HWID := 0x08550100

Device/tplink-4mlzma is not correct, the stock images use a "mktplinkfw in
safeloader" image format. This explains why you haven't been able to flash
your images without a serial console.

Another device with a similar image format is the TL-WR1043 v4; support for
this device has been added to firmware-utils in my staging tree at:

  https://git.lede-project.org/?p=lede/neoraider/staging.git;a=summary

> +endef
> +
> +TARGET_DEVICES += tl-wa855re-v1
> +
>  define Device/tl-wpa8630
>      $(Device/tplink-8mlzma)
>      DEVICE_TITLE := TP-LINK TL-WPA8630
> diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
> index d8a694a..dd07538 100644
> --- a/target/linux/ar71xx/mikrotik/config-default
> +++ b/target/linux/ar71xx/mikrotik/config-default
> @@ -81,6 +81,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
>  # CONFIG_ATH79_MACH_TL_WA701ND_V2 is not set
>  # CONFIG_ATH79_MACH_TL_WA7210N_V2 is not set
>  # CONFIG_ATH79_MACH_TL_WA830RE_V2 is not set
> +# CONFIG_ATH79_MACH_TL_WA855RE_V1 is not set

Also disable the config symbol in target/linux/ar71xx/nand/config-default.

>  # CONFIG_ATH79_MACH_TL_WA901ND is not set
>  # CONFIG_ATH79_MACH_TL_WA901ND_V2 is not set
>  # CONFIG_ATH79_MACH_TL_WAX50RE is not set
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20161218/db5ea6b4/attachment-0001.sig>


More information about the Lede-dev mailing list