aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-02-12 08:30:28 +0000
committerJohn Crispin <blogic@openwrt.org>2016-02-12 08:30:28 +0000
commit463c62d9764fc066d0883a0845a2f4590a0293f2 (patch)
tree0304bd23be4e69a8cd9c8d12914bb67924aba0c6 /target/linux/ar71xx/files
parent44e4a86827da6c81eea6e0dcf4850727ab2a3d00 (diff)
downloadmaster-187ad058-463c62d9764fc066d0883a0845a2f4590a0293f2.tar.gz
master-187ad058-463c62d9764fc066d0883a0845a2f4590a0293f2.tar.bz2
master-187ad058-463c62d9764fc066d0883a0845a2f4590a0293f2.zip
ar71xx: Added support for TL-WA801NDv3
Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48705 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt9
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c136
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/machtypes.h1
4 files changed, 146 insertions, 1 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index da2641440e..069d33801a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -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
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 991f6f2aa5..ac82a638bd 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -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
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c
new file mode 100644
index 0000000000..39cdb10ee3
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c
@@ -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);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 95346940eb..a3c4274769 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -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 */