[LEDE-DEV] [PATCH] ar71xx: Added support for the TP-Link WA855RE V1
Matthias Schiffer
mschiffer at universe-factory.net
Mon Dec 19 09:30:24 PST 2016
As mentioned on IRC, I found a few more minor issues. I could fix them up
myself when merging your patch, but if you do it yourself, you'll learn a
few more things to pay attention to for future patch submissions :)
On 12/19/2016 06:06 PM, Federico Cappon wrote:
> The device it's similar to the WR841N/ND v9 but without the internal switch.
>
> For now the only way to install Lede is through the serial interface, becouse in the original OEM Firmware Upgrader, we can't change the partition table to make space for Lede
> For install Lede, after soldering the serial, follow the istruction for the WR841N/ND v9
Please wrap all but the first line of the commit message to 75 columns.
Also, while not that important, the convention is to write commit messages
in present tense, so "ar71xx: add support ..." would be an even better
title. There are also a few typos in the message, and LEDE should be
written in capital letters.
>
> Signed-off-by: Federico Cappon <dududede371 at gmail.com>
> ---
> .../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 | 116 +++++++++++++++++++++
> .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
> target/linux/ar71xx/image/tp-link.mk | 11 ++
> target/linux/ar71xx/mikrotik/config-default | 1 +
> target/linux/ar71xx/nand/config-default | 1 +
> 12 files changed, 152 insertions(+)
> create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c
>
> 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..48d75f0 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
> +
Whitespace in a blank line.
> +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
Line ending with whitespace.
>
> 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..6bd156e
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa855re-v1.c
> @@ -0,0 +1,116 @@
> +/*
> + * 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-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 = {
> + {
This line has a space after the tab.
> + .name = "tp-link:green:power",
> + .gpio = TL_WA855REV1_GPIO_LED_GREEN,
> + .active_low = 0,
> + },
> + {
Space after tab.
> + .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,
> + },
> + {
Space after tab.
> + .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);
> +
File ending while a blank line.
> 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..44ba722 100644
> --- a/target/linux/ar71xx/image/tp-link.mk
> +++ b/target/linux/ar71xx/image/tp-link.mk
> @@ -371,6 +371,17 @@ 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
I found a reason to change this to 0x08550001 after all (and the
corresponding line in tplink_board_detect): tplink_board_detect will use
the last byte as revision number, so /tmp/sysinfo/model would end with "v0"
like this.
> + IMAGES := sysupgrade.bin
This line is indented with a tab instead of spaces like the surrounding lines.
> +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
> # 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
> diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
> index 7a1d080..310dc57 100644
> --- a/target/linux/ar71xx/nand/config-default
> +++ b/target/linux/ar71xx/nand/config-default
> @@ -44,6 +44,7 @@
> # CONFIG_ATH79_MACH_TL_MR13U is not set
> # CONFIG_ATH79_MACH_TL_MR3020 is not set
> # CONFIG_ATH79_MACH_TL_MR3X20 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_WDR3500 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/20161219/e3d2823a/attachment.sig>
More information about the Lede-dev
mailing list