diff options
author | John Crispin <john@openwrt.org> | 2016-02-12 08:30:28 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2016-02-12 08:30:28 +0000 |
commit | d6cb792d21273c7aa101dbfa1072534f35cabf96 (patch) | |
tree | 03d0d8223fce571742f4e281b4e1f1fd3aa4e73c /target/linux/ar71xx | |
parent | 8c7aa9b6e13f45fc0e78452b3a3e40ff2be8d700 (diff) | |
download | upstream-d6cb792d21273c7aa101dbfa1072534f35cabf96.tar.gz upstream-d6cb792d21273c7aa101dbfa1072534f35cabf96.tar.bz2 upstream-d6cb792d21273c7aa101dbfa1072534f35cabf96.zip |
ar71xx: Added support for TL-WA801NDv3
Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
SVN-Revision: 48705
Diffstat (limited to 'target/linux/ar71xx')
-rwxr-xr-x | target/linux/ar71xx/base-files/etc/board.d/02_network | 3 | ||||
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 | ||||
-rw-r--r-- | target/linux/ar71xx/config-4.1 | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c | 136 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/image/Makefile | 9 |
8 files changed, 160 insertions, 3 deletions
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 51a1b64507..e12367cf0f 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -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" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 34d5741323..e5b7fec4dc 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -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" ;; diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1 index fe1dd68263..627ae5d8be 100644 --- a/target/linux/ar71xx/config-4.1 +++ b/target/linux/ar71xx/config-4.1 @@ -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 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 */ diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 5768cbd97b..1bb0ac95bc 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -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) |