[OpenWrt-Devel] [PATCH] Device support for TP-Link WR802N
Rick P.
pannen at gmail.com
Mon May 2 13:23:37 EDT 2016
From: Rick Pannen <pannen at gmail.com <mailto:pannen at gmail.com>>
Resubmitting patch for the TP-Link WR802N - I hope the format is OK now.
Tested on three different devices. Installs, boots and runs.
Signed-off-by: Rick Pannen <pannen at gmail.com <mailto:pannen at gmail.com>>
---
target/linux/ar71xx/base-files/etc/board.d/01_leds | 4 +
.../linux/ar71xx/base-files/etc/board.d/02_network | 1 +
target/linux/ar71xx/base-files/etc/diag.sh | 3 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 1 +
target/linux/ar71xx/config-4.1 | 1 +
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 ++
target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 +
.../ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c | 98 ++++++++++++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/generic/profiles/tp-link.mk | 9 ++
target/linux/ar71xx/image/Makefile | 9 ++
target/linux/ar71xx/mikrotik/config-default | 1 +
13 files changed, 141 insertions(+)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 39b21ca..8e94887 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -583,6 +583,10 @@ tl-wr741nd-v4)
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
+tl-wr802n)
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:system" "phy0tpt"
+ ;;
+
tl-wr841n-v8 | \
tl-wr941nd-v5)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
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 7724a08..1e44608 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -367,6 +367,7 @@ tl-wa901nd-v2 |\
tl-wa901nd-v3 |\
tl-wa901nd-v4 |\
tl-wr703n |\
+tl-wr802n |\
tube2h |\
unifiac |\
wndap360 |\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 77fa398..d41f802 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -316,6 +316,9 @@ get_status_led() {
tl-wr1043nd-v2 | \
tl-wr741nd | \
tl-wr741nd-v4 | \
+ tl-wr802n)
+ status_led="tp-link:blue:system"
+ ;;
tl-wr841n-v1 | \
tl-wr841n-v7 | \
tl-wr841n-v8 | \
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 588affd..2e43eb4 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -175,6 +175,9 @@ tplink_board_detect() {
"080100"*)
model="TP-Link TL-WA801N/ND"
;;
+ "080200"*)
+ model="TP-Link TL-WR802N"
+ ;;
"083000"*)
model="TP-Link TL-WA830RE"
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 5334600..fb601c1 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -378,6 +378,7 @@ platform_check_image() {
tl-wr720n-v3 | \
tl-wr741nd | \
tl-wr741nd-v4 | \
+ tl-wr802n | \
tl-wr841n-v1 | \
tl-wa830re-v2 | \
tl-wr841n-v7 | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 40cf453..a65f911 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -158,6 +158,7 @@ CONFIG_ATH79_MACH_TL_WR703N=y
CONFIG_ATH79_MACH_TL_WR720N_V3=y
CONFIG_ATH79_MACH_TL_WR741ND=y
CONFIG_ATH79_MACH_TL_WR741ND_V4=y
+CONFIG_ATH79_MACH_TL_WR802N=y
CONFIG_ATH79_MACH_TL_WR841N_V1=y
CONFIG_ATH79_MACH_TL_WR841N_V8=y
CONFIG_ATH79_MACH_TL_WR841N_V9=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index e6879a9..f24648b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1284,6 +1284,15 @@ config ATH79_MACH_TL_WR741ND_V4
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_TL_WR802N
+ bool "TP-LINK TL-WR802N support"
+ select SOC_QCA953X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79
+
config ATH79_MACH_TL_WR841N_V1
bool "TP-LINK TL-WR841N v1 support"
select SOC_AR71XX
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 61dfccc..c3d274a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -159,6 +159,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WDR4300) += mach-tl-wdr4300.o
obj-$(CONFIG_ATH79_MACH_TL_WDR6500_V2) += mach-tl-wdr6500-v2.o
obj-$(CONFIG_ATH79_MACH_TL_WR741ND) += mach-tl-wr741nd.o
obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4) += mach-tl-wr741nd-v4.o
+obj-$(CONFIG_ATH79_MACH_TL_WR802N) += mach-tl-wr802n.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
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c
new file mode 100644
index 0000000..d97d7f9
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c
@@ -0,0 +1,98 @@
+/*
+ * TP-LINK TL-WR802N
+ *
+ * Copyright (C) 2015 Rick Pannen <pannen at gmail.com <mailto:pannen at 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_WR802N_GPIO_LED_SYSTEM 13
+#define TL_WR802N_GPIO_BTN_RESET 11
+
+#define TL_WR802N_KEYS_POLL_INTERVAL 20 /* msecs */
+#define TL_WR802N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR802N_KEYS_POLL_INTERVAL)
+
+static const char *tl_wr802n_part_probes[] = {
+ "tp-link",
+ NULL,
+};
+
+static struct flash_platform_data tl_wr802n_flash_data = {
+ .part_probes = tl_wr802n_part_probes,
+};
+
+static struct gpio_led tl_wr802n_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:blue:system",
+ .gpio = TL_WR802N_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button tl_wr802n_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_WR802N_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR802N_GPIO_BTN_RESET,
+ .active_low = 0,
+ }
+};
+
+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_wr802n_flash_data);
+
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_mdio(0, 0x0);
+
+ /* LAN */
+ 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_wr802n_setup(void)
+{
+ tl_ap143_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr802n_leds_gpio),
+ tl_wr802n_leds_gpio);
+
+ ath79_register_gpio_keys_polled(1, TL_WR802N_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr802n_gpio_keys),
+ tl_wr802n_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR802N, "TL-WR802N", "TP-LINK TL-WR802N",
+ tl_wr802n_setup);
+
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index b2df9c4..62d5d6d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -193,6 +193,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_WR720N_V3, /* TP-LINK TL-WR720N v3/v4 */
ATH79_MACH_TL_WR741ND, /* TP-LINK TL-WR741ND */
ATH79_MACH_TL_WR741ND_V4, /* TP-LINK TL-WR741ND v4 */
+ ATH79_MACH_TL_WR802N, /* TP-LINK TL-WR802N */
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 */
diff --git a/target/linux/ar71xx/generic/profiles/tp-link.mk b/target/linux/ar71xx/generic/profiles/tp-link.mk
index 2875290..ced7ba8 100644
--- a/target/linux/ar71xx/generic/profiles/tp-link.mk
+++ b/target/linux/ar71xx/generic/profiles/tp-link.mk
@@ -331,6 +331,15 @@ define Profile/TLWR743/Description
endef
$(eval $(call Profile,TLWR743))
+define Profile/TLWR802
+ NAME:=TP-LINK TL-WR802N
+ PACKAGES:=
+endef
+
+define Profile/TLWR802/Description
+ Package set optimized for the TP-LINK TL-WR802N.
+endef
+$(eval $(call Profile,TLWR802))
define Profile/TLWR841
NAME:=TP-LINK TL-WR841N/ND
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 3bf005f..08a501d 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -815,6 +815,15 @@ define Device/tl-wr743nd-v2
endef
TARGET_DEVICES += tl-wr740n-v1 tl-wr740n-v3 tl-wr740n-v4 tl-wr740n-v5 tl-wr740n-v6 tl-wr741nd-v1 tl-wr741nd-v2 tl-wr741nd-v4 tl-wr741nd-v5 tl-wr743nd-v1 tl-wr743nd-v2
+define Device/tl-wr802n
+ $(Device/tplink-4mlzma)
+ BOARDNAME := TL-WR802N
+ DEVICE_PROFILE := TLWR802
+ TPLINK_HWID := 0x08020001
+ TPLINK_HWREV := 1
+endef
+TARGET_DEVICES += tl-wr802n
+
define Device/tl-wr841-v1.5
$(Device/tplink-4m)
BOARDNAME := TL-WR841N-v1.5
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 094f2ae..7ce48b4 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -97,6 +97,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
# CONFIG_ATH79_MACH_TL_WR720N_V3 is not set
# CONFIG_ATH79_MACH_TL_WR741ND is not set
# CONFIG_ATH79_MACH_TL_WR741ND_V4 is not set
+# CONFIG_ATH79_MACH_TL_WR802N is not set
# CONFIG_ATH79_MACH_TL_WR841N_V1 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set
# CONFIG_ATH79_MACH_TL_WR841N_V9 is not set
--
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20160502/f8f1b912/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list