ar71xx: Added support for TL-WA801NDv3
authorJohn Crispin <john@openwrt.org>
Fri, 12 Feb 2016 08:30:28 +0000 (08:30 +0000)
committerJohn Crispin <john@openwrt.org>
Fri, 12 Feb 2016 08:30:28 +0000 (08:30 +0000)
Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
SVN-Revision: 48705

target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/config-4.1
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/Makefile
target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/image/Makefile
tools/firmware-utils/src/mktplinkfw.c

index 51a1b645070eb5d4fbb0c9541a5eaef77ad56119..e12367cf0faf4992b56df579a980cb6ffcd5475a 100755 (executable)
@@ -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"
        ;;
index 34d57413239ff12ae323800be13e136db4e755b2..e5b7fec4dcf834fc21424507ca72b535006f9cb1 100755 (executable)
@@ -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"
                ;;
index fe1dd68263b94d761b566ca83addfdc5c65d5d5f..627ae5d8bee694edf1a09721355bc74328ce241e 100644 (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
index da2641440e7d9df1948905e90d8c6986262f6d7e..069d33801a81fa94b908182b3a5871fd152cd911 100644 (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
index 991f6f2aa5cc96e06dda8db7d28736fea7d7909e..ac82a638bdf633dc4149b720d9dd63c79c5cfce3 100644 (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
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 (file)
index 0000000..39cdb10
--- /dev/null
@@ -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);
index 95346940ebc721f4bdc3b5d8d3f3dcca374b428c..a3c4274769f6f1245ebd445f5150fbfb7723767e 100644 (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 */
index 5768cbd97bc635950ae6790410bbfeee675bcaef..1bb0ac95bc0ec56c113f3c99dd63f6b9ed3de829 100644 (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)
index 085eb4c39d7ca6438029a8f0c1e6d541fa126931..9fd5e3830a4b1ec059d492d22c5877edd8ffdbdc 100644 (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;
 }
-