ar71xx: add support for the TP-LINK TL-WR841N/ND v9
authorFelix Fietkau <nbd@openwrt.org>
Mon, 7 Apr 2014 08:00:02 +0000 (08:00 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 7 Apr 2014 08:00:02 +0000 (08:00 +0000)
Everything seems to be working fine. Potential issues:

* VLAN port IDs are reversed with regard to the numbers on the case.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
SVN-Revision: 40400

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
target/linux/ar71xx/base-files/etc/uci-defaults/02_network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-3.10
target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c [new file with mode: 0644]
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.10/708-MIPS-ath79-TL-WR841v9-support.patch [new file with mode: 0644]

index 0e1fe5c..d81173d 100755 (executable)
@@ -178,6 +178,9 @@ get_status_led() {
        tl-wr720n-v3)
                status_led="tp-link:blue:system"
                ;;
+       tl-wr841n-v9)
+               status_led="tp-link:green:qss"
+               ;;
        tl-wr2543n)
                status_led="tp-link:green:wps"
                ;;
index a986dbc..c4d3ef8 100755 (executable)
@@ -261,6 +261,15 @@ tl-wr841n-v8)
        ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
        ;;
 
+tl-wr841n-v9)
+       ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+       ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
+       ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+       ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
+       ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+       ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+       ;;
+
 tl-wr842n-v2)
        ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
        ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
index c8ee86b..a78f7f9 100755 (executable)
@@ -295,6 +295,7 @@ tl-wdr3500 |\
 tl-wr741nd |\
 tl-wr741nd-v4 |\
 tl-wr841n-v7 |\
+tl-wr841n-v9 |\
 whr-g301n |\
 whr-hp-g300n |\
 whr-hp-gn |\
index 99d91ae..a2bbefd 100755 (executable)
@@ -538,6 +538,9 @@ ar71xx_board_detect() {
        *"TL-WR841N/ND v8")
                name="tl-wr841n-v8"
                ;;
+       *"TL-WR841N/ND v9")
+               name="tl-wr841n-v9"
+               ;;
        *"TL-WR842N/ND v2")
                name="tl-wr842n-v2"
                ;;
index d08799e..37ceea6 100755 (executable)
@@ -249,6 +249,7 @@ platform_check_image() {
        tl-wr841n-v1 | \
        tl-wr841n-v7 | \
        tl-wr841n-v8 | \
+       tl-wr841n-v9 | \
        tl-wr842n-v2 | \
        tl-wr941nd | \
        tl-wr1041n-v2 | \
index 0811650..f4d1fd8 100644 (file)
@@ -92,6 +92,7 @@ CONFIG_ATH79_MACH_TL_WR741ND=y
 CONFIG_ATH79_MACH_TL_WR741ND_V4=y
 CONFIG_ATH79_MACH_TL_WR841N_V1=y
 CONFIG_ATH79_MACH_TL_WR841N_V8=y
+CONFIG_ATH79_MACH_TL_WR841N_V9=y
 CONFIG_ATH79_MACH_TL_WR941ND=y
 CONFIG_ATH79_MACH_UBNT=y
 CONFIG_ATH79_MACH_UBNT_XM=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
new file mode 100644 (file)
index 0000000..c28afc6
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ *  TP-LINK TL-WR841N/ND v9
+ *
+ *  Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
+ *
+ *  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_WR841NV9_GPIO_LED_WLAN      13
+#define TL_WR841NV9_GPIO_LED_QSS       3
+#define TL_WR841NV9_GPIO_LED_WAN       4
+#define TL_WR841NV9_GPIO_LED_LAN1      16
+#define TL_WR841NV9_GPIO_LED_LAN2      15
+#define TL_WR841NV9_GPIO_LED_LAN3      14
+#define TL_WR841NV9_GPIO_LED_LAN4      11
+
+#define TL_WR841NV9_GPIO_BTN_RESET     12
+#define TL_WR841NV9_GPIO_BTN_WIFI      17
+
+#define TL_WR841NV9_KEYS_POLL_INTERVAL 20      /* msecs */
+#define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL)
+
+static const char *tl_wr841n_v9_part_probes[] = {
+       "tp-link",
+       NULL,
+};
+
+static struct flash_platform_data tl_wr841n_v9_flash_data = {
+       .part_probes    = tl_wr841n_v9_part_probes,
+};
+
+static struct gpio_led tl_wr841n_v9_leds_gpio[] __initdata = {
+       {
+               .name           = "tp-link:green:lan1",
+               .gpio           = TL_WR841NV9_GPIO_LED_LAN1,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan2",
+               .gpio           = TL_WR841NV9_GPIO_LED_LAN2,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan3",
+               .gpio           = TL_WR841NV9_GPIO_LED_LAN3,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan4",
+               .gpio           = TL_WR841NV9_GPIO_LED_LAN4,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:qss",
+               .gpio           = TL_WR841NV9_GPIO_LED_QSS,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wan",
+               .gpio           = TL_WR841NV9_GPIO_LED_WAN,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wlan",
+               .gpio           = TL_WR841NV9_GPIO_LED_WLAN,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = {
+       {
+               .desc           = "Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = TL_WR841NV9_GPIO_BTN_RESET,
+               .active_low     = 1,
+       }, {
+               .desc           = "WIFI button",
+               .type           = EV_KEY,
+               .code           = KEY_RFKILL,
+               .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = TL_WR841NV9_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_wr841n_v9_flash_data);
+
+       ath79_setup_ar933x_phy4_switch(false, false);
+
+       ath79_register_mdio(0, 0x0);
+
+       /* LAN */
+       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_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_wr841n_v9_setup(void)
+{
+       tl_ap143_setup();
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v9_leds_gpio),
+                                tl_wr841n_v9_leds_gpio);
+
+       ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wr841n_v9_gpio_keys),
+                                       tl_wr841n_v9_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9",
+            tl_wr841n_v9_setup);
index 6e0ffe0..56ad1e1 100644 (file)
@@ -1039,6 +1039,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR741NV4,tl-wr741nd-v4,TL-WR741
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR743NV2,tl-wr743nd-v2,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA750,tl-wa750re-v1,TL-WA750RE,ttyS0,115200,0x07500001,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma))
+$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR841NV9,tl-wr841n-v9,TL-WR841N-v9,ttyS0,115200,0x08410009,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR842V2,tl-wr842n-v2,TL-WR842N-v2,ttyS0,115200,0x8420002,1,8Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA801NV2,tl-wa801nd-v2,TL-WA801ND-v2,ttyS0,115200,0x08010002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA850,tl-wa850re-v1,TL-WA850RE,ttyS0,115200,0x08500001,1,4Mlzma))
@@ -1108,7 +1109,7 @@ $(eval $(call MultiProfile,TLWR720,TLWR720NV3))
 $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3 TLWR740NV4))
 $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4))
 $(eval $(call MultiProfile,TLWR743,TLWR743NV1 TLWR743NV2))
-$(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8))
+$(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8 TLWR841NV9))
 $(eval $(call MultiProfile,TLWR842,TLWR842V1 TLWR842V2))
 $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV6))
 $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
diff --git a/target/linux/ar71xx/patches-3.10/708-MIPS-ath79-TL-WR841v9-support.patch b/target/linux/ar71xx/patches-3.10/708-MIPS-ath79-TL-WR841v9-support.patch
new file mode 100644 (file)
index 0000000..aefdd66
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -716,6 +716,15 @@ config ATH79_MACH_TL_WR841N_V8
+       select ATH79_DEV_USB
+       select ATH79_DEV_WMAC
++config ATH79_MACH_TL_WR841N_V9
++       bool "TP-LINK TL-WR841N/ND v9 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_WR941ND
+       bool "TP-LINK TL-WR941ND support"
+       select SOC_AR913X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -100,6 +100,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR741ND)        += m
+ obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4)        += mach-tl-wr741nd-v4.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
+ obj-$(CONFIG_ATH79_MACH_TL_WR941ND)   += mach-tl-wr941nd.o
+ obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2)        += mach-tl-wr1041n-v2.o
+ obj-$(CONFIG_ATH79_MACH_TL_WR1043ND)  += mach-tl-wr1043nd.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -123,6 +123,7 @@ enum ath79_mach_type {
+       ATH79_MACH_TL_WR841N_V1,        /* TP-LINK TL-WR841N v1 */
+       ATH79_MACH_TL_WR841N_V7,        /* TP-LINK TL-WR841N/ND v7 */
+       ATH79_MACH_TL_WR841N_V8,        /* TP-LINK TL-WR841N/ND v8 */
++      ATH79_MACH_TL_WR841N_V9,        /* TP-LINK TL-WR841N/ND v9 */
+       ATH79_MACH_TL_WR842N_V2,        /* TP-LINK TL-WR842N/ND v2 */
+       ATH79_MACH_TL_WR941ND,          /* TP-LINK TL-WR941ND */
+       ATH79_MACH_UBNT_AIRROUTER,      /* Ubiquiti AirRouter */