[LEDE-DEV] [PATCH] ar71xx: add support for TP-Link TL-WDR5600 v1

Jie Ke soundtrack9407 at gmail.com
Fri Mar 31 04:06:33 PDT 2017


From: Soundtrack9407 <soundtrack9407 at gmail.com>

Specifications:
- SoC: Qualcomm QCA9561 (750MHz)
- RAM: 64MB
- Storage: 8MB (Winbond w25q64)
- Wireless: Qualcomm QCA9561 + QCA9887
- Ethernet: 4+1 x 100M
http://www.tp-link.com.cn/product_415.html

Signed-off-by: Soundtrack9407 <soundtrack9407 at gmail.com>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |   7 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |   1 +
 target/linux/ar71xx/base-files/etc/diag.sh         |   1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   6 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   2 +
 target/linux/ar71xx/config-4.4                     |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  10 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../files/arch/mips/ath79/mach-tl-wdr5600-v1.c     | 143 +++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/image/tp-link.mk               |  13 ++
 12 files changed, 187 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr5600-v1.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 32d4931..82b08f4 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -644,6 +644,13 @@ tl-wdr4900-v2)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:blue:wlan2g" "phy0tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:blue:wlan5g" "phy1tpt"
 	;;
+tl-wdr5600-v1)
+	ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
+	ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
+	ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04"
+	ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08"
+	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
+	;;
 tl-wdr6500-v2|\
 tl-wr741nd)
 	ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
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 a55e50a..6ea3e73 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -292,6 +292,7 @@ ar71xx_setup_interfaces()
 	r6100|\
 	smart-300|\
 	tl-mr3420-v2|\
+	tl-wdr5600-v1|\
 	tl-wdr6500-v2|\
 	tl-wr841n-v8|\
 	tl-wr940n-v4|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 461d0da..3d23502 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -409,6 +409,7 @@ get_status_led() {
 	tl-wr2543n)
 		status_led="tp-link:green:wps"
 		;;
+	tl-wdr5600-v1|\
 	tl-wdr6500-v2)
 		status_led="tp-link:white:system"
 		;;
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 4938e26..bdb1c35 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -94,6 +94,7 @@ case "$FIRMWARE" in
 		;;
 	archer-c59-v1|\
 	archer-c60-v1|\
+	tl-wdr5600-v1|\
 	tl-wdr6500-v2)
 		ath10kcal_extract "art" 20480 2116
 		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 8c87737..a0bdd02 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -309,6 +309,9 @@ tplink_board_detect() {
 	"49000002")
 		model="TP-Link TL-WDR4900"
 		;;
+	"56000001")
+		model="TP-Link TL-WDR5600"
+		;;
 	"65000002")
 		model="TP-Link TL-WDR6500"
 		;;
@@ -1046,6 +1049,9 @@ ar71xx_board_detect() {
 	*"TL-WDR4900 v2")
 		name="tl-wdr4900-v2"
 		;;
+	*"TL-WDR5600 v1")
+		name="tl-wdr5600-v1"
+		;;
 	*"TL-WDR6500 v2")
 		name="tl-wdr6500-v2"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f89ad2c..2e8379a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -413,6 +413,7 @@ platform_check_image() {
 	tl-wdr3500|\
 	tl-wdr4300|\
 	tl-wdr4900-v2|\
+	tl-wdr5600-v1|\
 	tl-wdr6500-v2|\
 	tl-wpa8630|\
 	tl-wr1041n-v2|\
@@ -442,6 +443,7 @@ platform_check_image() {
 		local magic_ver="0100"
 
 		case "$board" in
+		tl-wdr5600-v1|\
 		tl-wdr6500-v2)
 			magic_ver="0200"
 			;;
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 68b408a..d543f53 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -182,6 +182,7 @@ CONFIG_ATH79_MACH_TL_WAX50RE=y
 CONFIG_ATH79_MACH_TL_WDR3320_V2=y
 CONFIG_ATH79_MACH_TL_WDR3500=y
 CONFIG_ATH79_MACH_TL_WDR4300=y
+CONFIG_ATH79_MACH_TL_WDR5600_V1=y
 CONFIG_ATH79_MACH_TL_WDR6500_V2=y
 CONFIG_ATH79_MACH_TL_WPA8630=y
 CONFIG_ATH79_MACH_TL_WR1041N_V2=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 72f3591..7401328 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1487,6 +1487,16 @@ config ATH79_MACH_TL_WDR4300
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
 
+config ATH79_MACH_TL_WDR5600_V1
+	bool "TP-LINK TL-WDR5600 v1 board support"
+	select SOC_QCA956X
+	select ATH79_DEV_AP9X_PCI if PCI
+	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_WDR6500_V2
 	bool "TP-LINK TL-WDR6500 v2 board support"
 	select SOC_QCA956X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 7383244..24a1cd9 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -187,6 +187,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WAX50RE)		+= mach-tl-wax50re.o
 obj-$(CONFIG_ATH79_MACH_TL_WDR3320_V2)		+= mach-tl-wdr3320-v2.o
 obj-$(CONFIG_ATH79_MACH_TL_WDR3500)		+= mach-tl-wdr3500.o
 obj-$(CONFIG_ATH79_MACH_TL_WDR4300)		+= mach-tl-wdr4300.o
+obj-$(CONFIG_ATH79_MACH_TL_WDR5600_V1)		+= mach-tl-wdr5600-v1.o
 obj-$(CONFIG_ATH79_MACH_TL_WDR6500_V2)		+= mach-tl-wdr6500-v2.o
 obj-$(CONFIG_ATH79_MACH_TL_WPA8630)		+= mach-tl-wpa8630.o
 obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2)		+= mach-tl-wr1041n-v2.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr5600-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr5600-v1.c
new file mode 100644
index 0000000..217827a
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr5600-v1.c
@@ -0,0 +1,143 @@
+/*
+ *  TP-LINK TL-WDR5600 v1 support
+ *
+ *  Copyright (C) 2017 Jie Ke <soundtrack9407 at gmail.com>
+ *
+ *  Based on TP-LINK TL-WDR6500 v2 board support
+ *
+ *  Copyright (C) 2015 Weijie Gao <hackpascal 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/pci.h>
+#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-ap9x-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+
+#define TL_WDR5600_V1_GPIO_LED_SYS	21
+#define TL_WDR5600_V1_GPIO_LED_WAN	19
+#define TL_WDR5600_V1_GPIO_LED_LAN1	17
+#define TL_WDR5600_V1_GPIO_LED_LAN2	16
+#define TL_WDR5600_V1_GPIO_LED_LAN3	15
+#define TL_WDR5600_V1_GPIO_LED_LAN4	14
+
+#define TL_WDR5600_V1_GPIO_BTN_RESET	1
+
+#define TL_WDR5600_V1_KEYS_POLL_INTERVAL	20	/* msecs */
+#define TL_WDR5600_V1_KEYS_DEBOUNCE_INTERVAL	(3 * TL_WDR5600_V1_KEYS_POLL_INTERVAL)
+
+#define TL_WDR5600_V1_WMAC_CALDATA_OFFSET	0x1000
+#define TL_WDR5600_V1_PCIE_CALDATA_OFFSET	0x5000
+
+static const char *tl_wdr5600_v1_part_probes[] = {
+	"tp-link-64k",
+	NULL,
+};
+
+static struct flash_platform_data tl_wdr5600_v1_flash_data = {
+	.part_probes	= tl_wdr5600_v1_part_probes,
+};
+
+static struct gpio_led tl_wdr5600_v1_leds_gpio[] __initdata = {
+	{
+		.name		= "tp-link:green:lan1",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_LAN1,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan2",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_LAN2,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan3",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_LAN3,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:lan4",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_LAN4,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:green:wan",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_WAN,
+		.active_low	= 1,
+	}, {
+		.name		= "tp-link:white:system",
+		.gpio		= TL_WDR5600_V1_GPIO_LED_SYS,
+		.active_low	= 0,
+	},
+};
+
+static struct gpio_keys_button tl_wdr5600_v1_gpio_keys[] __initdata = {
+	{
+		.desc		= "Reset button",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = TL_WDR5600_V1_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= TL_WDR5600_V1_GPIO_BTN_RESET,
+		.active_low	= 1,
+	}
+};
+
+
+static void __init tl_ap151_setup(void)
+{
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f00fc00);
+	u8 *ee = (u8 *) KSEG1ADDR(0x1fff0000);
+	u8 tmpmac[ETH_ALEN];
+
+	ath79_register_m25p80(&tl_wdr5600_v1_flash_data);
+
+	ath79_setup_ar933x_phy4_switch(false, false);
+
+	ath79_register_mdio(1, 0x0);
+
+	/* WAN */
+	ath79_switch_data.phy4_mii_en = 1;
+	ath79_switch_data.phy_poll_mask = BIT(4);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+	ath79_eth0_data.phy_mask = BIT(4);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+	ath79_register_eth(0);
+
+	/* LAN */
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+	ath79_eth1_data.duplex = DUPLEX_FULL;
+	ath79_eth1_data.speed = SPEED_100;
+	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+	ath79_register_eth(1);
+
+	ath79_init_mac(tmpmac, mac, -1);
+	ath79_register_wmac(ee + TL_WDR5600_V1_WMAC_CALDATA_OFFSET, tmpmac);
+
+	ath79_register_pci();
+}
+
+static void __init tl_wdr5600_v1_setup(void)
+{
+	tl_ap151_setup();
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wdr5600_v1_leds_gpio),
+				 tl_wdr5600_v1_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, TL_WDR5600_V1_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(tl_wdr5600_v1_gpio_keys),
+					tl_wdr5600_v1_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WDR5600_V1, "TL-WDR5600-v1", "TP-LINK TL-WDR5600 v1",
+	     tl_wdr5600_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index f3277cd..e91328a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -225,6 +225,7 @@ enum ath79_mach_type {
 	ATH79_MACH_TL_WDR3500,			/* TP-LINK TL-WDR3500 */
 	ATH79_MACH_TL_WDR4300,			/* TP-LINK TL-WDR4300 */
 	ATH79_MACH_TL_WDR4900_V2,		/* TP-LINK TL-WDR4900 v2 */
+	ATH79_MACH_TL_WDR5600_V1,		/* TP-LINK TL-WDR5600 v1 */
 	ATH79_MACH_TL_WDR6500_V2,		/* TP-LINK TL-WDR6500 v2 */
 	ATH79_MACH_TL_WPA8630,			/* TP-Link TL-WPA8630 */
 	ATH79_MACH_TL_WR1041N_V2,		/* TP-LINK TL-WR1041N v2 */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index b251135..afc5629 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -259,6 +259,19 @@ $(Device/tl-wdr4300-v1)
 endef
 TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1
 
+define Device/tl-wdr5600-v1
+$(Device/tplink-8mlzma)
+  DEVICE_TITLE := TP-LINK TL-WDR5600v1
+  DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887
+  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
+  KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | mktplinkfw-combined
+  BOARDNAME = TL-WDR5600-v1
+  DEVICE_PROFILE = TLWDR5600V1
+  TPLINK_HWID := 0x56000001
+  TPLINK_HEADER_VERSION := 2
+endef
+TARGET_DEVICES += tl-wdr5600-v1
+
 define Device/tl-wdr6500-v2
 $(Device/tplink-8mlzma)
   DEVICE_TITLE := TP-LINK TL-WDR6500v2
-- 
2.7.4




More information about the Lede-dev mailing list