From f7e3bdc0a987c2be559c18acf6151945a518f6b0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 3 Feb 2015 17:24:13 +0100 Subject: [PATCH] Add support the TP-LINK TL-WR941ND v5 and v6 (v6 untested) --- ...upport-for-the-TP-LINK-TL-WR941ND-v5.patch | 229 ++++++++++++++++++ targets/ar71xx-generic/profiles.mk | 6 +- 2 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 patches/openwrt/0015-Add-support-for-the-TP-LINK-TL-WR941ND-v5.patch diff --git a/patches/openwrt/0015-Add-support-for-the-TP-LINK-TL-WR941ND-v5.patch b/patches/openwrt/0015-Add-support-for-the-TP-LINK-TL-WR941ND-v5.patch new file mode 100644 index 00000000..8e0b92ac --- /dev/null +++ b/patches/openwrt/0015-Add-support-for-the-TP-LINK-TL-WR941ND-v5.patch @@ -0,0 +1,229 @@ +From: Matthias Schiffer +Date: Tue, 3 Feb 2015 16:54:22 +0100 +Subject: Add support for the TP-LINK TL-WR941ND v5 + +This device is very similar to the TL-WR841N v8, only two LED GPIOs are +different. + +Signed-off-by: Matthias Schiffer + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 924766d..f0d5d70 100755 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -214,7 +214,8 @@ get_status_led() { + tl-wr841n-v8 | \ + tl-wa830re-v2 | \ + tl-wr842n-v2 | \ +- tl-wr941nd) ++ tl-wr941nd | \ ++ tl-wr941nd-v5) + status_led="tp-link:green:system" + ;; + archer-c5 | \ +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 ee90c52..a74b8f4 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -345,7 +345,8 @@ tl-wr741nd-v4) + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt" + ;; + +-tl-wr841n-v8) ++tl-wr841n-v8 | \ ++tl-wr941nd-v5) + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04" + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08" +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 c494310..3ccb917 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -211,6 +211,7 @@ smart-300 | \ + tl-mr3420-v2 |\ + tl-wr841n-v8 |\ + tl-wr842n-v2 |\ ++tl-wr941nd-v5 |\ + wnr2000-v3 |\ + wnr2200 |\ + wnr612-v2) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index b0a0bd6..c03fe72 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -681,6 +681,9 @@ ar71xx_board_detect() { + *TL-WR941ND) + name="tl-wr941nd" + ;; ++ *"TL-WR941N/ND v5") ++ name="tl-wr941nd-v5" ++ ;; + *"TL-WR703N v1") + name="tl-wr703n" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index a566b62..e512f41 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -326,6 +326,7 @@ platform_check_image() { + tl-wr841n-v9 | \ + tl-wr842n-v2 | \ + tl-wr941nd | \ ++ tl-wr941nd-v5 | \ + tl-wr1041n-v2 | \ + tl-wr1043nd | \ + tl-wr1043nd-v2 | \ +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c +index 0099b15..73cfdd9 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c +@@ -38,6 +38,15 @@ + #define TL_MR3420V2_GPIO_LED_3G 11 + #define TL_MR3420V2_GPIO_USB_POWER 4 + ++#define TL_WR941NDV5_GPIO_LED_WLAN 13 ++#define TL_WR941NDV5_GPIO_LED_QSS 15 ++#define TL_WR941NDV5_GPIO_LED_WAN 18 ++#define TL_WR941NDV5_GPIO_LED_LAN1 19 ++#define TL_WR941NDV5_GPIO_LED_LAN2 20 ++#define TL_WR941NDV5_GPIO_LED_LAN3 2 ++#define TL_WR941NDV5_GPIO_LED_LAN4 3 ++#define TL_WR941NDV5_GPIO_LED_SYSTEM 14 ++ + #define TL_WR841NV8_KEYS_POLL_INTERVAL 20 /* msecs */ + #define TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV8_KEYS_POLL_INTERVAL) + +@@ -127,6 +136,42 @@ static struct gpio_keys_button tl_mr3420v2_gpio_keys[] __initdata = { + } + }; + ++static struct gpio_led tl_wr941nd_v5_leds_gpio[] __initdata = { ++ { ++ .name = "tp-link:green:lan1", ++ .gpio = TL_WR941NDV5_GPIO_LED_LAN1, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:lan2", ++ .gpio = TL_WR941NDV5_GPIO_LED_LAN2, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:lan3", ++ .gpio = TL_WR941NDV5_GPIO_LED_LAN3, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:lan4", ++ .gpio = TL_WR941NDV5_GPIO_LED_LAN4, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:qss", ++ .gpio = TL_WR941NDV5_GPIO_LED_QSS, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:system", ++ .gpio = TL_WR941NDV5_GPIO_LED_SYSTEM, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:wan", ++ .gpio = TL_WR941NDV5_GPIO_LED_WAN, ++ .active_low = 1, ++ }, { ++ .name = "tp-link:green:wlan", ++ .gpio = TL_WR941NDV5_GPIO_LED_WLAN, ++ .active_low = 1, ++ }, ++}; ++ + static void __init tl_ap123_setup(void) + { + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); +@@ -223,3 +268,19 @@ static void __init tl_mr3420v2_setup(void) + + MIPS_MACHINE(ATH79_MACH_TL_MR3420_V2, "TL-MR3420-v2", "TP-LINK TL-MR3420 v2", + tl_mr3420v2_setup); ++ ++ ++static void __init tl_wr941nd_v5_setup(void) ++{ ++ tl_ap123_setup(); ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v5_leds_gpio), ++ tl_wr941nd_v5_leds_gpio); ++ ++ ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(tl_wr841n_v8_gpio_keys), ++ tl_wr841n_v8_gpio_keys); ++} ++ ++MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V5, "TL-WR941ND-v5", "TP-LINK TL-WR941N/ND v5", ++ tl_wr941nd_v5_setup); +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 3fdaf47..ba16c7b 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -1242,6 +1242,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA801NV2,tl-wa801nd-v2,TL-WA801 + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA850,tl-wa850re-v1,TL-WA850RE,ttyS0,115200,0x08500001,1,4Mlzma)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA860,tl-wa860re-v1,TL-WA860RE,ttyS0,115200,0x08600001,1,4Mlzma)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWA901NV3,tl-wa901nd-v3,TL-WA901ND-v3,ttyS0,115200,0x09010003,1,4Mlzma)) ++$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR941NV5,tl-wr941nd-v5,TL-WR941ND-v5,ttyS0,115200,0x09410005,1,4Mlzma)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR941NV6,tl-wr941nd-v6,TL-WDR3500,ttyS0,115200,0x09410006,1,4Mlzma)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1041,tl-wr1041n-v2,TL-WR1041N-v2,ttyS0,115200,0x10410002,1,4Mlzma)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR1043ND-v2,ttyS0,115200,0x10430002,1,8M)) +@@ -1319,7 +1320,7 @@ $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4)) + $(eval $(call MultiProfile,TLWR743,TLWR743NV1 TLWR743NV2)) + $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8 TLWR841NV9)) + $(eval $(call MultiProfile,TLWR842,TLWR842V1 TLWR842V2)) +-$(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV6)) ++$(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV5 TLWR941NV6)) + $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2)) + $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1)) + $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M)) +diff --git a/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch +index 516d52d..3722519 100644 +--- a/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.10/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,145 @@ ++@@ -16,22 +16,146 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -108,6 +108,7 @@ + + ATH79_MACH_TL_WR841N_V8, /* TP-LINK TL-WR841N/ND v8 */ + + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */ + + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */ +++ ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */ + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + + ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ +diff --git a/target/linux/ar71xx/patches-3.10/720-MIPS-ath79-add-Tube2H-support.patch b/target/linux/ar71xx/patches-3.10/720-MIPS-ath79-add-Tube2H-support.patch +index c4aa70c..7a3754b 100644 +--- a/target/linux/ar71xx/patches-3.10/720-MIPS-ath79-add-Tube2H-support.patch ++++ b/target/linux/ar71xx/patches-3.10/720-MIPS-ath79-add-Tube2H-support.patch +@@ -1,13 +1,13 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -141,6 +141,7 @@ enum ath79_mach_type { +- ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */ ++@@ -143,6 +143,7 @@ enum ath79_mach_type { + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */ + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */ ++ ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */ + + ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */ + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ +- ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ ++ ATH79_MACH_UBNT_LOCO_M_XW, /* Ubiquiti Loco M XW */ + --- a/arch/mips/ath79/Kconfig + +++ b/arch/mips/ath79/Kconfig + @@ -29,6 +29,15 @@ config ATH79_MACH_ALFA_NX +@@ -28,7 +28,7 @@ + select SOC_AR724X + --- a/arch/mips/ath79/Makefile + +++ b/arch/mips/ath79/Makefile +-@@ -116,6 +116,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) ++@@ -117,6 +117,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) + obj-$(CONFIG_ATH79_MACH_TL_WR2543N) += mach-tl-wr2543n.o + obj-$(CONFIG_ATH79_MACH_TL_WR703N) += mach-tl-wr703n.o + obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.o diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index acf35e0d..f4511983 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -46,11 +46,15 @@ $(eval $(call GluonProfile,TLWR842)) $(eval $(call GluonModel,TLWR842,tl-wr842n-v1-squashfs,tp-link-tl-wr842n-nd-v1)) $(eval $(call GluonModel,TLWR842,tl-wr842n-v2-squashfs,tp-link-tl-wr842n-nd-v2)) -# TL-WR941N/ND v2, v3, v4 +# TL-WR941N/ND v2, v3, v4, v5, v6 $(eval $(call GluonProfile,TLWR941)) $(eval $(call GluonModel,TLWR941,tl-wr941nd-v2-squashfs,tp-link-tl-wr941n-nd-v2)) $(eval $(call GluonModel,TLWR941,tl-wr941nd-v3-squashfs,tp-link-tl-wr941n-nd-v3)) $(eval $(call GluonModel,TLWR941,tl-wr941nd-v4-squashfs,tp-link-tl-wr941n-nd-v4)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v5-squashfs,tp-link-tl-wr941n-nd-v5)) +ifeq ($(BROKEN),1) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v6-squashfs,tp-link-tl-wr941n-nd-v6)) # BROKEN: untested +endif # TL-WR1043N/ND v1, v2 $(eval $(call GluonProfile,TLWR1043))