Since both the wa750, wa850, wa801nd_v2 and the wa901nd_v3, I did some 
refactoring of the file mach-tl-wax50re.c
This way it is a bit easier to add other tp-link range extenders based on the 
Atheros ap123 reference board with one lan port.

This patch supersedes 4500


Signed-off-by: Martijn Zilverschoon <thefriedzom...@gmail.com>

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c
index 2f82f48..f587b72 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c
@@ -31,6 +31,9 @@
 #define TL_WAX50RE_GPIO_LED_SIGNAL4    3
 #define TL_WAX50RE_GPIO_LED_SIGNAL5    4
 
+#define TL_WA801ND_V2_GPIO_LED_LAN     18
+#define TL_WA801ND_V2_GPIO_LED_SYSTEM 14
+
 #define TL_WAX50RE_GPIO_BTN_RESET      17
 #define TL_WAX50RE_GPIO_BTN_WPS                16
 
@@ -137,6 +140,26 @@ static struct gpio_keys_button tl_wax50re_gpio_keys[] 
__initdata = {
        },
 };
 
+static struct gpio_led tl_wa801nd_v2_leds_gpio[] __initdata = {
+       {
+               .name           = "tp-link:green:lan",
+               .gpio           = TL_WA801ND_V2_GPIO_LED_LAN,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:wlan",
+               .gpio           = TL_WAX50RE_GPIO_LED_WLAN,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:qss",
+               .gpio           = TL_WAX50RE_GPIO_LED_RE,
+               .active_low     = 1,
+       }, {
+               .name           = "tp-link:green:system",
+               .gpio           = TL_WA801ND_V2_GPIO_LED_SYSTEM,
+               .active_low     = 1,
+       },
+};
+
 static void __init tl_ap123_setup(void)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
@@ -156,10 +179,6 @@ static void __init tl_ap123_setup(void)
        ath79_register_eth(0);
 
        ath79_register_wmac(ee, mac);
-
-       ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wax50re_gpio_keys),
-                                       tl_wax50re_gpio_keys);
 }
 
 static void  __init tl_wa750re_setup(void)
@@ -167,17 +186,53 @@ static void  __init tl_wa750re_setup(void)
        tl_ap123_setup();
        ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa750re_leds_gpio),
                                 tl_wa750re_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wax50re_gpio_keys),
+                                       tl_wax50re_gpio_keys);
 }
 
 MIPS_MACHINE(ATH79_MACH_TL_WA750RE, "TL-WA750RE", "TP-LINK TL-WA750RE",
             tl_wa750re_setup);
 
+static void __init tl_wa801nd_v2_setup(void)
+{
+       tl_ap123_setup();
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801nd_v2_leds_gpio),
+                       tl_wa801nd_v2_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wax50re_gpio_keys),
+                                       tl_wax50re_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V2, "TL-WA801ND-v2", "TP-LINK TL-WA801ND 
v2",
+                       tl_wa801nd_v2_setup);
+
 static void  __init tl_wa850re_setup(void)
 {
        tl_ap123_setup();
        ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa850re_leds_gpio),
                                 tl_wa850re_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wax50re_gpio_keys),
+                                       tl_wax50re_gpio_keys);
 }
 
 MIPS_MACHINE(ATH79_MACH_TL_WA850RE, "TL-WA850RE", "TP-LINK TL-WA850RE",
             tl_wa850re_setup);
+
+static void __init tl_wa901nd_v3_setup(void)
+{
+       tl_ap123_setup();
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801nd_v2_leds_gpio),
+                       tl_wa801nd_v2_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(tl_wax50re_gpio_keys) - 1,
+                                       tl_wax50re_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V3, "TL-WA901ND-v3", "TP-LINK TL-WA901ND 
v3",
+                       tl_wa901nd_v3_setup);
diff --git 
a/target/linux/ar71xx/patches-3.10/620-MIPS-ath79-TL-WA801ND-v2_TL-WA901ND-v3_support.patch
 
b/target/linux/ar71xx/patches-3.10/620-MIPS-ath79-TL-WA801ND-v2_TL-WA901ND-v3_support.patch
new file mode 100644
index 0000000..6902d93
--- /dev/null
+++ 
b/target/linux/ar71xx/patches-3.10/620-MIPS-ath79-TL-WA801ND-v2_TL-WA901ND-v3_support.patch
@@ -0,0 +1,16 @@
+Index: linux-3.10.21/arch/mips/ath79/machtypes.h
+===================================================================
+--- linux-3.10.21.orig/arch/mips/ath79/machtypes.h     2013-12-05 
00:28:45.056115798 +0100
++++ linux-3.10.21/arch/mips/ath79/machtypes.h  2013-12-05 00:32:02.509186557 
+0100
+@@ -99,9 +99,11 @@
+       ATH79_MACH_TL_MR3420_V2,        /* TP-LINK TL-MR3420 v2 */
+       ATH79_MACH_TL_WA750RE,          /* TP-LINK TL-WA750RE */
+       ATH79_MACH_TL_WA7510N_V1,       /* TP-LINK TL-WA7510N v1*/
++      ATH79_MACH_TL_WA801ND_V2,       /* TP-LINK TL-WA801ND v2 */
+       ATH79_MACH_TL_WA850RE,          /* TP-LINK TL-WA850RE */
+       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 */
+       ATH79_MACH_TL_WDR3500,          /* TP-LINK TL-WDR3500 */
+       ATH79_MACH_TL_WDR4300,          /* TP-LINK TL-WDR4300 */
+       ATH79_MACH_TL_WR1041N_V2,       /* TP-LINK TL-WR1041N v2 */
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to