ar71xx: add support for TP-LINK TL-WR840N v2 and v3

This patch adds support for the TP-LINK TL-WR840N v2 and v3.

- SoC: Qualcomm QCA9533-BL3A (650 MHz)
- RAM: 32 MiB (Zentel A3S56D40GTP)
- Flash: 4 MiB
   (v2: Macronix MX 25L323F)
   (v3: Winbond 25Q32FVSIG)
- LAN: 4x 100M
- WAN: 1x 100M

Signed-off-by: Vaclav Svoboda <svoboda@neng.cz>
openwrt-18.06
Vaclav Svoboda 2017-03-16 01:43:43 +01:00 committed by Piotr Dymacz
parent 978998628f
commit 0d9adb4832
13 changed files with 115 additions and 2 deletions

View File

@ -692,6 +692,12 @@ tl-wr941nd-v6)
ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:wlan" "phy0tpt"
;;
tl-wr840n-v2|\
tl-wr840n-v3)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x1E"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
tl-wr841n-v9|\
tl-wr841n-v11|\
tl-wr842n-v3)

View File

@ -44,6 +44,8 @@ ar71xx_setup_interfaces()
tl-wdr3500|\
tl-wr741nd|\
tl-wr741nd-v4|\
tl-wr840n-v2|\
tl-wr840n-v3|\
tl-wr841n-v11|\
tl-wr841n-v9|\
tl-wr842n-v3|\

View File

@ -379,6 +379,8 @@ get_status_led() {
tl-wr741nd|\
tl-wr741nd-v4|\
tl-wa801nd-v3|\
tl-wr840n-v2|\
tl-wr840n-v3|\
tl-wr841n-v1|\
tl-wr841n-v7|\
tl-wr841n-v8|\

View File

@ -1100,6 +1100,12 @@ ar71xx_board_detect() {
*"TL-WR810N")
name="tl-wr810n"
;;
*"TL-WR840N v2")
name="tl-wr840n-v2"
;;
*"TL-WR840N v3")
name="tl-wr840n-v3"
;;
*"TL-WR841N v1")
name="tl-wr841n-v1"
;;

View File

@ -428,6 +428,8 @@ platform_check_image() {
tl-wr802n-v1|\
tl-wr802n-v2|\
tl-wr810n|\
tl-wr840n-v2|\
tl-wr840n-v3|\
tl-wr841n-v11|\
tl-wr841n-v1|\
tl-wr841n-v7|\

View File

@ -196,6 +196,7 @@ CONFIG_ATH79_MACH_TL_WR741ND_V4=y
CONFIG_ATH79_MACH_TL_WR802N_V1=y
CONFIG_ATH79_MACH_TL_WR802N_V2=y
CONFIG_ATH79_MACH_TL_WR810N=y
CONFIG_ATH79_MACH_TL_WR840N_V2=y
CONFIG_ATH79_MACH_TL_WR841N_V1=y
CONFIG_ATH79_MACH_TL_WR841N_V8=y
CONFIG_ATH79_MACH_TL_WR841N_V9=y

View File

@ -1568,6 +1568,15 @@ config ATH79_MACH_TL_WR810N
select ATH79_DEV_USB
select ATH79_DEV_WMAC
config ATH79_MACH_TL_WR840N_V2
bool "TP-LINK TL-WR840N v2/v3 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_WR841N_V1
bool "TP-LINK TL-WR841N v1 support"
select SOC_AR71XX

View File

@ -201,6 +201,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4) += mach-tl-wr741nd-v4.o
obj-$(CONFIG_ATH79_MACH_TL_WR802N_V1) += mach-tl-wr802n.o
obj-$(CONFIG_ATH79_MACH_TL_WR802N_V2) += mach-tl-wr802n-v2.o
obj-$(CONFIG_ATH79_MACH_TL_WR810N) += mach-tl-wr810n.o
obj-$(CONFIG_ATH79_MACH_TL_WR840N_V2) += mach-tl-wr841n-v9.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

View File

@ -1,9 +1,10 @@
/*
* TP-LINK TL-WR841N/ND v9/v11 / TL-WR842N/ND v3
* TP-LINK TL-WR840N v2/v3 / TL-WR841N/ND v9/v11 / TL-WR842N/ND v3
*
* Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
* Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
* Copyright (C) 2016 Stijn Segers <francesco.borromini@gmail.com>
* Copyright (C) 2017 Vaclav Svoboda <svoboda@neng.cz>
*
* 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
@ -25,6 +26,14 @@
#include "dev-wmac.h"
#include "machtypes.h"
#define TL_WR840NV2_GPIO_LED_SYSTEM 15
#define TL_WR840NV2_GPIO_LED_WLAN 13
#define TL_WR840NV2_GPIO_LED_WPS 3
#define TL_WR840NV2_GPIO_LED_WAN 4
#define TL_WR840NV2_GPIO_LED_LAN 16
#define TL_WR840NV2_GPIO_BTN_RESET 12
#define TL_WR841NV9_GPIO_LED_WLAN 13
#define TL_WR841NV9_GPIO_LED_QSS 3
#define TL_WR841NV9_GPIO_LED_WAN 4
@ -75,6 +84,41 @@ static struct flash_platform_data tl_wr841n_v9_flash_data = {
.part_probes = tl_wr841n_v9_part_probes,
};
static struct gpio_led tl_wr840n_v2_leds_gpio[] __initdata = {
{
.name = "tp-link:green:system",
.gpio = TL_WR840NV2_GPIO_LED_SYSTEM,
.active_low = 1,
}, {
.name = "tp-link:green:lan",
.gpio = TL_WR840NV2_GPIO_LED_LAN,
.active_low = 1,
}, {
.name = "tp-link:green:wps",
.gpio = TL_WR840NV2_GPIO_LED_WPS,
.active_low = 1,
}, {
.name = "tp-link:green:wan",
.gpio = TL_WR840NV2_GPIO_LED_WAN,
.active_low = 1,
}, {
.name = "tp-link:green:wlan",
.gpio = TL_WR840NV2_GPIO_LED_WLAN,
.active_low = 1,
},
};
static struct gpio_keys_button tl_wr840n_v2_gpio_keys[] __initdata = {
{
.desc = "Reset button",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WR840NV2_GPIO_BTN_RESET,
.active_low = 1,
}
};
static struct gpio_led tl_wr841n_v9_leds_gpio[] __initdata = {
{
.name = "tp-link:green:lan1",
@ -260,6 +304,25 @@ static void __init tl_ap143_setup(void)
ath79_register_wmac(ee, tmpmac);
}
static void __init tl_wr840n_v2_setup(void)
{
tl_ap143_setup();
ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr840n_v2_leds_gpio),
tl_wr840n_v2_leds_gpio);
ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
ARRAY_SIZE(tl_wr840n_v2_gpio_keys),
tl_wr840n_v2_gpio_keys);
}
MIPS_MACHINE(ATH79_MACH_TL_WR840N_V2, "TL-WR840N-v2", "TP-LINK TL-WR840N v2",
tl_wr840n_v2_setup);
MIPS_MACHINE(ATH79_MACH_TL_WR840N_V3, "TL-WR840N-v3", "TP-LINK TL-WR840N v3",
tl_wr840n_v2_setup);
static void __init tl_wr841n_v9_setup(void)
{
tl_ap143_setup();

View File

@ -242,6 +242,8 @@ enum ath79_mach_type {
ATH79_MACH_TL_WR802N_V1, /* TP-LINK TL-WR802N v1 */
ATH79_MACH_TL_WR802N_V2, /* TP-LINK TL-WR802N v2 */
ATH79_MACH_TL_WR810N, /* TP-LINK TL-WR810N */
ATH79_MACH_TL_WR840N_V2, /* TP-LINK TL-WR840N v2 */
ATH79_MACH_TL_WR840N_V3, /* TP-LINK TL-WR840N v3 */
ATH79_MACH_TL_WR841N_V1, /* TP-LINK TL-WR841N v1 */
ATH79_MACH_TL_WR841N_V11, /* TP-LINK TL-WR841N/ND v11 */
ATH79_MACH_TL_WR841N_V7, /* TP-LINK TL-WR841N/ND v7 */

View File

@ -650,6 +650,23 @@ define Device/tl-wr802n-v2
endef
TARGET_DEVICES += tl-wr802n-v1 tl-wr802n-v2
define Device/tl-wr840n-v2
$(Device/tplink-4mlzma)
DEVICE_TITLE := TP-LINK TL-WR840N v2
BOARDNAME := TL-WR840N-v2
DEVICE_PROFILE := TLWR840
TPLINK_HWID := 0x08400002
IMAGES += factory-eu.bin
IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
endef
define Device/tl-wr840n-v3
$(Device/tl-wr840n-v2)
DEVICE_TITLE := TP-LINK TL-WR840N v3
BOARDNAME := TL-WR840N-v3
TPLINK_HWID := 0x08400003
endef
define Device/tl-wr841-v1.5
$(Device/tplink-4m)
DEVICE_TITLE := TP-LINK TL-WR841N/ND v1.5
@ -761,7 +778,7 @@ define Device/tl-wr847n-v8
DEVICE_PROFILE := TLWR841
TPLINK_HWID := 0x08470008
endef
TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
TARGET_DEVICES += tl-wr840n-v2 tl-wr840n-v3 tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
define Device/tl-wr941nd-v2
$(Device/tplink-4m)

View File

@ -161,6 +161,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
# CONFIG_ATH79_MACH_TL_WR802N_V1 is not set
# CONFIG_ATH79_MACH_TL_WR802N_V2 is not set
# CONFIG_ATH79_MACH_TL_WR810N is not set
# CONFIG_ATH79_MACH_TL_WR840N_V2 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V1 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V9 is not set

View File

@ -147,6 +147,7 @@
# CONFIG_ATH79_MACH_TL_WR741ND_V4 is not set
# CONFIG_ATH79_MACH_TL_WR802N_V1 is not set
# CONFIG_ATH79_MACH_TL_WR810N is not set
# CONFIG_ATH79_MACH_TL_WR840N_V2 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V1 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V9 is not set