ar71xx: add support for TP-LINK TL-WR842N/ND v3
authorCezary Jackiewicz <cezary.jackiewicz@gmail.com>
Sat, 14 May 2016 16:12:46 +0000 (18:12 +0200)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Sat, 14 May 2016 19:45:16 +0000 (21:45 +0200)
- CPU QCA9531-BL3A
- RAM: 64MB
- flash: 16MB
- USB

AP143 platform, similar to tl-wr841n v10/v11, but with USB

Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
target/linux/ar71xx/base-files/etc/board.d/01_leds
target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/image/Makefile

index 39b21ca519fe1888f1248b669d9a89c2f10e9389..f6ea9a85013bff0099dc8155eb49a1eda5266e6c 100755 (executable)
@@ -626,6 +626,16 @@ tl-wr842n-v2)
        ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
        ;;
 
+tl-wr842n-v3)
+       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"
+       ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
+       ;;
+
 tl-wa801nd-v2 | \
 tl-wa901nd-v3)
        ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
index 449af63ac02f6b6656354c40167238628c719f20..e7da0653e20c97395c93aaf3e124e3aaa9cb83db 100755 (executable)
@@ -461,6 +461,7 @@ tl-wr741nd |\
 tl-wr741nd-v4 |\
 tl-wr841n-v7 |\
 tl-wr841n-v9 |\
+tl-wr842n-v3 |\
 whr-g301n |\
 whr-hp-g300n |\
 whr-hp-gn |\
index 3b5e2993335be02ce206258febe73e286ec95e99..5e6d305593da344264f65ac0b74ef6cb24b0b52c 100644 (file)
@@ -321,6 +321,7 @@ get_status_led() {
        tl-wr841n-v8 | \
        tl-wa830re-v2 | \
        tl-wr842n-v2 | \
+       tl-wr842n-v3 | \
        tl-wr941nd | \
        tl-wr941nd-v5)
                status_led="tp-link:green:system"
index 6c2b51ae2bf1daa89575a04a4fa7bd0e59eeb2c5..eb87dd4ecb8e9cedbd3421013bcf9f039e8453e0 100755 (executable)
@@ -910,6 +910,9 @@ ar71xx_board_detect() {
        *"TL-WR842N/ND v2")
                name="tl-wr842n-v2"
                ;;
+       *"TL-WR842N/ND v3")
+               name="tl-wr842n-v3"
+               ;;
        *TL-WR941ND)
                name="tl-wr941nd"
                ;;
index 9b771b73bad39dad5b9b0176a02999992537a871..0d6aa6b67e87113308970a33b69e0728d01ddd99 100755 (executable)
@@ -386,6 +386,7 @@ platform_check_image() {
        tl-wr841n-v8 | \
        tl-wr841n-v9 | \
        tl-wr842n-v2 | \
+       tl-wr842n-v3 | \
        tl-wr941nd | \
        tl-wr941nd-v5 | \
        tl-wr941nd-v6 | \
index 79d2d9d452476242f5d87e2820ed3f0b39084dd4..ac2cdaec3cf43063c7f42daaa9a2213ee07037cb 100644 (file)
@@ -1314,13 +1314,14 @@ config ATH79_MACH_TL_WR841N_V8
        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
+       bool "TP-LINK TL-WR841N/ND v9/TL-WR842N/ND 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_USB
+       select ATH79_DEV_WMAC
 
 config ATH79_MACH_TL_WR941ND
        bool "TP-LINK TL-WR941ND support"
index 3e5c2a2522b5d08b8a1112e2df43655daae37609..02096031db9ca7fc632044618806d9d395cfb930 100644 (file)
@@ -1,7 +1,8 @@
 /*
- *  TP-LINK TL-WR841N/ND v9
+ *  TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3
  *
  *  Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
+ *  Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
  *
  *  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
@@ -19,6 +20,7 @@
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
 #include "dev-m25p80.h"
+#include "dev-usb.h"
 #include "dev-wmac.h"
 #include "machtypes.h"
 
 #define TL_WR841NV9_GPIO_BTN_RESET     12
 #define TL_WR841NV9_GPIO_BTN_WIFI      17
 
+#define TL_WR842NV3_GPIO_LED_SYSTEM    2
+#define TL_WR842NV3_GPIO_LED_WLAN      3
+#define TL_WR842NV3_GPIO_LED_WAN_RED   4
+#define TL_WR842NV3_GPIO_LED_WAN_GREEN 11
+#define TL_WR842NV3_GPIO_LED_LAN1      12
+#define TL_WR842NV3_GPIO_LED_LAN2      13
+#define TL_WR842NV3_GPIO_LED_LAN3      14
+#define TL_WR842NV3_GPIO_LED_LAN4      15
+#define TL_WR842NV3_GPIO_LED_3G                16
+#define TL_WR842NV3_GPIO_LED_WPS       17
+
+#define TL_WR842NV3_GPIO_BTN_RESET     1
+#define TL_WR842NV3_GPIO_BTN_WIFI      0
+
 #define TL_WR841NV9_KEYS_POLL_INTERVAL 20      /* msecs */
 #define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL)
 
@@ -95,6 +111,68 @@ static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = {
        }
 };
 
+static struct gpio_led tl_wr842n_v3_leds_gpio[] __initdata = {
+       {
+               .name           = "tp-link:green:lan1",
+               .gpio           = TL_WR842NV3_GPIO_LED_LAN1,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan2",
+               .gpio           = TL_WR842NV3_GPIO_LED_LAN2,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan3",
+               .gpio           = TL_WR842NV3_GPIO_LED_LAN3,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:lan4",
+               .gpio           = TL_WR842NV3_GPIO_LED_LAN4,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wan",
+               .gpio           = TL_WR842NV3_GPIO_LED_WAN_GREEN,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:red:wan",
+               .gpio           = TL_WR842NV3_GPIO_LED_WAN_RED,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wlan",
+               .gpio           = TL_WR842NV3_GPIO_LED_WLAN,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:system",
+               .gpio           = TL_WR842NV3_GPIO_LED_SYSTEM,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:3g",
+               .gpio           = TL_WR842NV3_GPIO_LED_3G,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wps",
+               .gpio           = TL_WR842NV3_GPIO_LED_WPS,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button tl_wr842n_v3_gpio_keys[] __initdata = {
+       {
+               .desc           = "Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = TL_WR842NV3_GPIO_BTN_RESET,
+               .active_low     = 1,
+       }, {
+               .desc           = "WIFI button",
+               .type           = EV_KEY,
+               .code           = KEY_RFKILL,
+               .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = TL_WR842NV3_GPIO_BTN_WIFI,
+               .active_low     = 1,
+       }
+};
+
 
 static void __init tl_ap143_setup(void)
 {
@@ -142,3 +220,20 @@ static void __init tl_wr841n_v9_setup(void)
 
 MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9",
             tl_wr841n_v9_setup);
+
+static void __init tl_wr842n_v3_setup(void)
+{
+       tl_ap143_setup();
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr842n_v3_leds_gpio),
+                                tl_wr842n_v3_leds_gpio);
+
+       ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wr842n_v3_gpio_keys),
+                                       tl_wr842n_v3_gpio_keys);
+
+       ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR842N_V3, "TL-WR842N-v3", "TP-LINK TL-WR842N/ND v3",
+            tl_wr842n_v3_setup);
index f50062f39dc4a7f8dc50c24a29d0011f6579da93..f53efff0b60b6fcfb1b23303e73859f681499ab2 100644 (file)
@@ -200,6 +200,7 @@ enum ath79_mach_type {
        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_WR842N_V3,        /* TP-LINK TL-WR842N/ND v3 */
        ATH79_MACH_TL_WR941ND,          /* TP-LINK TL-WR941ND */
        ATH79_MACH_TL_WR941ND_V5,       /* TP-LINK TL-WR941ND v5 */
        ATH79_MACH_TL_WR941ND_V6,       /* TP-LINK TL-WR941ND v6 */
index 049abf311eac58358ab10d6621bf2fa58ada09e1..96122d77aeb217b49ecbfc5938767ab9bf6b376c 100644 (file)
@@ -895,6 +895,13 @@ define Device/tl-wr842n-v2
     TPLINK_HWID := 0x8420002
 endef
 
+define Device/tl-wr842n-v3
+    $(Device/tplink-16mlzma)
+    BOARDNAME := TL-WR842N-v3
+    DEVICE_PROFILE := TLWR842
+    TPLINK_HWID := 0x08420003
+endef
+
 define Device/tl-wr843nd-v1
     $(Device/tplink-4mlzma)
     BOARDNAME := TL-WR841N-v8
@@ -908,7 +915,7 @@ define Device/tl-wr847n-v8
     DEVICE_PROFILE := TLWR841
     TPLINK_HWID := 0x08470008
 endef
-TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
+TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
 
 define Device/tl-wr941nd-v2
     $(Device/tplink-4m)