ar71xx: Added support for TL-WA801NDv3

Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>

SVN-Revision: 48705
This commit is contained in:
John Crispin 2016-02-12 08:30:28 +00:00
parent 8c7aa9b6e1
commit d6cb792d21
9 changed files with 166 additions and 4 deletions

View file

@ -370,7 +370,8 @@ cap324)
ucidef_set_interface_lan "eth0" "dhcp"
;;
arduino-yun | \
arduino-yun |\
tl-wa801nd-v3 |\
dir-505-a1)
ucidef_set_interface_lan "eth1"
;;

View file

@ -824,6 +824,9 @@ ar71xx_board_detect() {
*"TL-WA801ND v2")
name="tl-wa801nd-v2"
;;
*"TL-WA801ND v3")
name="tl-wa801nd-v3"
;;
*TL-WA901ND)
name="tl-wa901nd"
;;

View file

@ -134,6 +134,7 @@ CONFIG_ATH79_MACH_TL_MR3020=y
CONFIG_ATH79_MACH_TL_MR3X20=y
CONFIG_ATH79_MACH_TL_WA701ND_V2=y
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_WA901ND=y
CONFIG_ATH79_MACH_TL_WA901ND_V2=y

View file

@ -1090,7 +1090,14 @@ config ATH79_MACH_TL_WA7210N_V2
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
config ATH79_MACH_TL_WA801ND_V3
bool "TP-LINK TL-WA801ND 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_WA830RE_V2
bool "TP-LINK TL-WA830RE v2 support"
select SOC_AR934X

View file

@ -143,6 +143,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WAX50RE) += mach-tl-wax50re.o
obj-$(CONFIG_ATH79_MACH_TL_WA701ND_V2) += mach-tl-wa701nd-v2.o
obj-$(CONFIG_ATH79_MACH_TL_WA7210N_V2) += mach-tl-wa7210n-v2.o
obj-$(CONFIG_ATH79_MACH_TL_WA830RE_V2) += mach-tl-wa830re-v2.o
obj-$(CONFIG_ATH79_MACH_TL_WA801ND_V3) += mach-tl-wa801nd-v3.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_WDR3320_V2) += mach-tl-wdr3320-v2.o

View file

@ -0,0 +1,136 @@
/*
* TP-LINK TL-WA801ND v3 adapted from TP-LINK TL-WR841N/ND v9
*
* Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
* Copyright (C) 2016 Tiziano Bacocco <tizbac2@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/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_WA801NDV3_GPIO_LED_WLAN 12
#define TL_WA801NDV3_GPIO_LED_QSS 13
#define TL_WA801NDV3_GPIO_LED_SECURITY_RED 11
#define TL_WA801NDV3_GPIO_LED_SECURITY_GREEN 15
#define TL_WA801NDV3_GPIO_LED_LAN 3
#define TL_WA801NDV3_GPIO_BTN_RESET 2
#define TL_WA801NDV3_GPIO_BTN_WIFI 1
#define TL_WA801NDV3_KEYS_POLL_INTERVAL 20 /* msecs */
#define TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA801NDV3_KEYS_POLL_INTERVAL)
static const char *tl_wa801n_v3_part_probes[] = {
"tp-link",
NULL,
};
static struct flash_platform_data tl_wa801n_v3_flash_data = {
.part_probes = tl_wa801n_v3_part_probes,
};
static struct gpio_led tl_wa801n_v3_leds_gpio[] __initdata = {
{
.name = "tp-link:green:qss",
.gpio = TL_WA801NDV3_GPIO_LED_QSS,
.active_low = 1,
}, {
.name = "tp-link:green:lan",
.gpio = TL_WA801NDV3_GPIO_LED_LAN,
.active_low = 1,
}, {
.name = "tp-link:green:wlan",
.gpio = TL_WA801NDV3_GPIO_LED_WLAN,
.active_low = 1,
}, {
.name = "tp-link:red:security",
.gpio = TL_WA801NDV3_GPIO_LED_SECURITY_RED,
.active_low = 0,
}, {
.name = "tp-link:green:security",
.gpio = TL_WA801NDV3_GPIO_LED_SECURITY_GREEN,
.active_low = 0,
}
};
static struct gpio_keys_button tl_wa801n_v3_gpio_keys[] __initdata = {
{
.desc = "Reset button",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WA801NDV3_GPIO_BTN_RESET,
.active_low = 1,
}, {
.desc = "WIFI button",
.type = EV_KEY,
.code = KEY_RFKILL,
.debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WA801NDV3_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_wa801n_v3_flash_data);
ath79_setup_ar933x_phy4_switch(false, false);
ath79_register_mdio(0, 0x0);
/* LAN */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.duplex = DUPLEX_FULL;
ath79_switch_data.phy_poll_mask |= BIT(4);
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
ath79_register_eth(1);
/* WAN */
ath79_switch_data.phy4_mii_en = 1;
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
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, 1);
ath79_register_eth(0);
ath79_init_mac(tmpmac, mac, 0);
ath79_register_wmac(ee, tmpmac);
}
static void __init tl_wa801n_v3_setup(void)
{
tl_ap143_setup();
ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801n_v3_leds_gpio),
tl_wa801n_v3_leds_gpio);
ath79_register_gpio_keys_polled(1, TL_WA801NDV3_KEYS_POLL_INTERVAL,
ARRAY_SIZE(tl_wa801n_v3_gpio_keys),
tl_wa801n_v3_gpio_keys);
}
MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V3, "TL-WA801ND-v3", "TP-LINK TL-WA801ND v3",
tl_wa801n_v3_setup);

View file

@ -168,6 +168,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_WA860RE, /* TP-LINK TL-WA860RE */
ATH79_MACH_TL_WA801ND_V2, /* TP-LINK TL-WA801ND v2 */
ATH79_MACH_TL_WA830RE_V2, /* TP-LINK TL-WA830RE v2 */
ATH79_MACH_TL_WA801ND_V3, /* TP-LINK TL-WA801ND v3 */
ATH79_MACH_TL_WA901ND, /* TP-LINK TL-WA901ND */
ATH79_MACH_TL_WA901ND_V2, /* TP-LINK TL-WA901ND v2 */
ATH79_MACH_TL_WA901ND_V3, /* TP-LINK TL-WA901ND v3 */

View file

@ -986,6 +986,13 @@ define Device/tl-wa801nd-v2
TPLINK_HWID := 0x08010002
endef
define Device/tl-wa801nd-v3
$(Device/tplink-4mlzma)
BOARDNAME := TL-WA801ND-v3
DEVICE_PROFILE := TLWA801
TPLINK_HWID := 0x08010003
endef
define Device/tl-wa830re-v1
$(Device/tplink-4m)
BOARDNAME := TL-WA901ND
@ -1013,7 +1020,7 @@ define Device/tl-wa860re-v1
DEVICE_PROFILE := TLWA860
TPLINK_HWID := 0x08600001
endef
TARGET_DEVICES += tl-wa801nd-v1 tl-wa801nd-v2 tl-wa830re-v1 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
TARGET_DEVICES += tl-wa801nd-v1 tl-wa801nd-v2 tl-wa801nd-v3 tl-wa830re-v1 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
define Device/tl-wa901nd-v1
$(Device/tplink-4m)

View file

@ -51,6 +51,7 @@
#define HWID_TL_WA830RE_V1 0x08300010
#define HWID_TL_WA830RE_V2 0x08300002
#define HWID_TL_WA801ND_V2 0x08010002
#define HWID_TL_WA801ND_V3 0x08010003
#define HWID_TL_WA901ND_V1 0x09010001
#define HWID_TL_WA901ND_V2 0x09010002
#define HWID_TL_WDR4300_V1_IL 0x43008001
@ -298,6 +299,11 @@ static struct board_info boards[] = {
.hw_id = HWID_TL_WA801ND_V2,
.hw_rev = 1,
.layout_id = "4Mlzma",
},{
.id = "TL-WA801NDv3",
.hw_id = HWID_TL_WA801ND_V3,
.hw_rev = 1,
.layout_id = "4Mlzma",
}, {
.id = "TL-WA901NDv1",
.hw_id = HWID_TL_WA901ND_V1,
@ -1219,4 +1225,3 @@ int main(int argc, char *argv[])
out:
return ret;
}