123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- From: Matthias Schiffer <mschiffer@universe-factory.net>
- Date: Sun, 3 Jul 2016 22:14:18 +0200
- Subject: ar71xx: add support for TP-LINK TL-WR842N/ND v3
- - 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>
- Backport of LEDE 0b45bec22c59cc6e6b2fa71dc9a88386c5587132
- diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
- index cb92349cab833179a87a195b94e2539cc5ce3e79..2c5d6af8f4e2c5ce71adc0b63d32b8506e01b6a2 100644
- --- a/target/linux/ar71xx/base-files/etc/diag.sh
- +++ b/target/linux/ar71xx/base-files/etc/diag.sh
- @@ -280,6 +280,7 @@ get_status_led() {
- tl-wr841n-v11 | \
- tl-wa830re-v2 | \
- tl-wr842n-v2 | \
- + tl-wr842n-v3 | \
- tl-wr941nd | \
- tl-wr941nd-v5)
- status_led="tp-link:green:system"
- diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
- index d81358d6bf9103ffeb2929b06d3ab01efffe931c..14aa7bc5e56c0d7be435ba3a1803416075eccb58 100644
- --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
- +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
- @@ -523,6 +523,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"
- diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- index ac3deb8aa2ed4717e2bd682cb4ffd7d32c50134f..ca9c5771d72681557f4139c0e58f4d7a656bd741 100755
- --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
- @@ -449,6 +449,7 @@ tl-wr741nd-v4 |\
- tl-wr841n-v7 |\
- tl-wr841n-v9 |\
- tl-wr841n-v11 |\
- +tl-wr842n-v3 |\
- whr-g301n |\
- whr-hp-g300n |\
- whr-hp-gn |\
- diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
- index f242980b3e401f2e9de2b8abe7e984b24a71db5a..fcd0bc35227de9b6a02c10c1bebf2413bdc555bf 100755
- --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
- +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
- @@ -869,6 +869,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"
- ;;
- diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
- index d816f211891d6a259930f2781574504ea62b4e16..53284df5e2da19d8012361e9560244af898d3c2c 100755
- --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
- +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
- @@ -367,6 +367,7 @@ platform_check_image() {
- tl-wr841n-v9 | \
- tl-wr841n-v11 | \
- tl-wr842n-v2 | \
- + tl-wr842n-v3 | \
- tl-wr941nd | \
- tl-wr941nd-v5 | \
- tl-wr941nd-v6 | \
- 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
- index 004f71961396cd33cfd381aca386706104a7b757..ebaed15a49113133f59f069325898a00f5612fef 100644
- --- 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
- @@ -1,9 +1,16 @@
- /*
- +<<<<<<< HEAD
- * TP-LINK TL-WR841N/ND v9/v11
- *
- * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
- * Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
- * Copyright (C) 2016 Stijn Segers <francesco.borromini@gmail.com>
- +=======
- + * 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>
- +>>>>>>> ar71xx: add support for TP-LINK TL-WR842N/ND v3
- *
- * 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
- @@ -49,6 +56,20 @@
- #define TL_WR841NV11_GPIO_BTN_RESET 12
- #define TL_WR841NV11_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)
-
- @@ -151,6 +172,68 @@ static struct gpio_led tl_wr841n_v11_leds_gpio[] __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)
- {
- u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
- @@ -212,3 +295,20 @@ static void __init tl_wr841n_v11_setup(void)
-
- MIPS_MACHINE(ATH79_MACH_TL_WR841N_V11, "TL-WR841N-v11", "TP-LINK TL-WR841N/ND v11",
- tl_wr841n_v11_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);
- diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
- index 05eea0b16c362ba5f70c9f435dbe312087b319c2..d66bd25fe01544224a69e3f35f020f2e4130c8b3 100644
- --- a/target/linux/ar71xx/image/Makefile
- +++ b/target/linux/ar71xx/image/Makefile
- @@ -607,6 +607,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
- @@ -620,7 +627,7 @@ define Device/tl-wr847n-v8
- DEVICE_PROFILE := TLWR841
- TPLINK_HWID := 0x08470008
- endef
- -TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr841n-v11 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
- +TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr841n-v11 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
-
- define Device/tl-wr941nd-v5
- $(Device/tplink-4mlzma)
- diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
- index debde6e6a552e71b551d8c01ba06af03013407bf..d4b417bfb78606ddb84076ad8c927952e65118c2 100644
- --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
- +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
- @@ -1,6 +1,6 @@
- --- a/arch/mips/ath79/machtypes.h
- +++ b/arch/mips/ath79/machtypes.h
- -@@ -16,22 +16,202 @@
- +@@ -16,22 +16,203 @@
-
- enum ath79_mach_type {
- ATH79_MACH_GENERIC = 0,
- @@ -148,6 +148,7 @@
- + ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */
- + ATH79_MACH_TL_WR841N_V11, /* TP-LINK TL-WR841N/ND v11 */
- + 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 */
- @@ -285,7 +286,7 @@
- config ATH79_MACH_AP121
- bool "Atheros AP121 reference board"
- select SOC_AR933X
- -@@ -11,62 +84,1050 @@ config ATH79_MACH_AP121
- +@@ -11,62 +84,1051 @@ config ATH79_MACH_AP121
- select ATH79_DEV_M25P80
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
- @@ -1236,13 +1237,14 @@
- + 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"
- @@ -1365,7 +1367,7 @@
-
- config ATH79_MACH_UBNT_XM
- bool "Ubiquiti Networks XM/UniFi boards"
- -@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM
- +@@ -83,6 +1145,117 @@ config ATH79_MACH_UBNT_XM
- Say 'Y' here if you want your kernel to support the
- Ubiquiti Networks XM (rev 1.0) board.
-
- @@ -1483,7 +1485,7 @@
- endmenu
-
- config SOC_AR71XX
- -@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
- +@@ -124,7 +1297,10 @@ config ATH79_DEV_DSA
- config ATH79_DEV_ETH
- def_bool n
-
- @@ -1495,7 +1497,7 @@
- def_bool n
-
- config ATH79_DEV_GPIO_BUTTONS
- -@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
- +@@ -154,6 +1330,11 @@ config ATH79_PCI_ATH9K_FIXUP
- def_bool n
-
- config ATH79_ROUTERBOOT
|