0020-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sat, 29 Mar 2014 21:12:15 +0100
  3. Subject: ar71xx: add support for the TP-LINK TL-WR841N/ND v9
  4. diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
  5. index b206438..0bf2dd1 100755
  6. --- a/target/linux/ar71xx/base-files/etc/diag.sh
  7. +++ b/target/linux/ar71xx/base-files/etc/diag.sh
  8. @@ -144,6 +144,9 @@ get_status_led() {
  9. tl-wr703n)
  10. status_led="tp-link:blue:system"
  11. ;;
  12. + tl-wr841n-v9)
  13. + status_led="tp-link:green:qss"
  14. + ;;
  15. tl-wr2543n)
  16. status_led="tp-link:green:wps"
  17. ;;
  18. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
  19. index 48b8154..43bc24d 100755
  20. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds
  21. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
  22. @@ -163,6 +163,15 @@ tl-wr841n-v8)
  23. ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  24. ;;
  25. +tl-wr841n-v9)
  26. + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
  27. + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
  28. + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
  29. + ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
  30. + ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
  31. + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  32. + ;;
  33. +
  34. tl-wr941nd | \
  35. tl-wr1041n-v2)
  36. ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  37. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network
  38. index a36036f..a1dfda0 100755
  39. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
  40. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network
  41. @@ -192,6 +192,7 @@ tl-wdr3500 |\
  42. tl-wr741nd |\
  43. tl-wr741nd-v4 |\
  44. tl-wr841n-v7 |\
  45. +tl-wr841n-v9 |\
  46. whr-g301n |\
  47. whr-hp-g300n |\
  48. whr-hp-gn |\
  49. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  50. index 8d71352..ca174da 100755
  51. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  52. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  53. @@ -381,6 +381,9 @@ ar71xx_board_detect() {
  54. *"TL-WR841N/ND v8")
  55. name="tl-wr841n-v8"
  56. ;;
  57. + *"TL-WR841N/ND v9")
  58. + name="tl-wr841n-v9"
  59. + ;;
  60. *TL-WR941ND)
  61. name="tl-wr941nd"
  62. ;;
  63. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  64. index e52ad9e..7168b4e 100755
  65. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  66. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  67. @@ -163,6 +163,7 @@ platform_check_image() {
  68. tl-wr841n-v1 | \
  69. tl-wr841n-v7 | \
  70. tl-wr841n-v8 | \
  71. + tl-wr841n-v9 | \
  72. tl-wr941nd | \
  73. tl-wr1041n-v2 | \
  74. tl-wr1043nd | \
  75. diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3
  76. index 1c3ba3c..82d4d21 100644
  77. --- a/target/linux/ar71xx/config-3.3
  78. +++ b/target/linux/ar71xx/config-3.3
  79. @@ -70,6 +70,7 @@ CONFIG_ATH79_MACH_TL_WR741ND=y
  80. CONFIG_ATH79_MACH_TL_WR741ND_V4=y
  81. CONFIG_ATH79_MACH_TL_WR841N_V1=y
  82. CONFIG_ATH79_MACH_TL_WR841N_V8=y
  83. +CONFIG_ATH79_MACH_TL_WR841N_V9=y
  84. CONFIG_ATH79_MACH_TL_WR941ND=y
  85. CONFIG_ATH79_MACH_UBNT=y
  86. CONFIG_ATH79_MACH_UBNT_XM=y
  87. 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
  88. new file mode 100644
  89. index 0000000..c28afc6
  90. --- /dev/null
  91. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
  92. @@ -0,0 +1,138 @@
  93. +/*
  94. + * TP-LINK TL-WR841N/ND v9
  95. + *
  96. + * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
  97. + *
  98. + * This program is free software; you can redistribute it and/or modify it
  99. + * under the terms of the GNU General Public License version 2 as published
  100. + * by the Free Software Foundation.
  101. + */
  102. +
  103. +#include <linux/gpio.h>
  104. +#include <linux/platform_device.h>
  105. +
  106. +#include <asm/mach-ath79/ath79.h>
  107. +#include <asm/mach-ath79/ar71xx_regs.h>
  108. +
  109. +#include "common.h"
  110. +#include "dev-eth.h"
  111. +#include "dev-gpio-buttons.h"
  112. +#include "dev-leds-gpio.h"
  113. +#include "dev-m25p80.h"
  114. +#include "dev-wmac.h"
  115. +#include "machtypes.h"
  116. +
  117. +#define TL_WR841NV9_GPIO_LED_WLAN 13
  118. +#define TL_WR841NV9_GPIO_LED_QSS 3
  119. +#define TL_WR841NV9_GPIO_LED_WAN 4
  120. +#define TL_WR841NV9_GPIO_LED_LAN1 16
  121. +#define TL_WR841NV9_GPIO_LED_LAN2 15
  122. +#define TL_WR841NV9_GPIO_LED_LAN3 14
  123. +#define TL_WR841NV9_GPIO_LED_LAN4 11
  124. +
  125. +#define TL_WR841NV9_GPIO_BTN_RESET 12
  126. +#define TL_WR841NV9_GPIO_BTN_WIFI 17
  127. +
  128. +#define TL_WR841NV9_KEYS_POLL_INTERVAL 20 /* msecs */
  129. +#define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL)
  130. +
  131. +static const char *tl_wr841n_v9_part_probes[] = {
  132. + "tp-link",
  133. + NULL,
  134. +};
  135. +
  136. +static struct flash_platform_data tl_wr841n_v9_flash_data = {
  137. + .part_probes = tl_wr841n_v9_part_probes,
  138. +};
  139. +
  140. +static struct gpio_led tl_wr841n_v9_leds_gpio[] __initdata = {
  141. + {
  142. + .name = "tp-link:green:lan1",
  143. + .gpio = TL_WR841NV9_GPIO_LED_LAN1,
  144. + .active_low = 1,
  145. + }, {
  146. + .name = "tp-link:green:lan2",
  147. + .gpio = TL_WR841NV9_GPIO_LED_LAN2,
  148. + .active_low = 1,
  149. + }, {
  150. + .name = "tp-link:green:lan3",
  151. + .gpio = TL_WR841NV9_GPIO_LED_LAN3,
  152. + .active_low = 1,
  153. + }, {
  154. + .name = "tp-link:green:lan4",
  155. + .gpio = TL_WR841NV9_GPIO_LED_LAN4,
  156. + .active_low = 1,
  157. + }, {
  158. + .name = "tp-link:green:qss",
  159. + .gpio = TL_WR841NV9_GPIO_LED_QSS,
  160. + .active_low = 1,
  161. + }, {
  162. + .name = "tp-link:green:wan",
  163. + .gpio = TL_WR841NV9_GPIO_LED_WAN,
  164. + .active_low = 1,
  165. + }, {
  166. + .name = "tp-link:green:wlan",
  167. + .gpio = TL_WR841NV9_GPIO_LED_WLAN,
  168. + .active_low = 1,
  169. + },
  170. +};
  171. +
  172. +static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = {
  173. + {
  174. + .desc = "Reset button",
  175. + .type = EV_KEY,
  176. + .code = KEY_RESTART,
  177. + .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
  178. + .gpio = TL_WR841NV9_GPIO_BTN_RESET,
  179. + .active_low = 1,
  180. + }, {
  181. + .desc = "WIFI button",
  182. + .type = EV_KEY,
  183. + .code = KEY_RFKILL,
  184. + .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
  185. + .gpio = TL_WR841NV9_GPIO_BTN_WIFI,
  186. + .active_low = 1,
  187. + }
  188. +};
  189. +
  190. +
  191. +static void __init tl_ap143_setup(void)
  192. +{
  193. + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  194. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  195. + u8 tmpmac[ETH_ALEN];
  196. +
  197. + ath79_register_m25p80(&tl_wr841n_v9_flash_data);
  198. +
  199. + ath79_setup_ar933x_phy4_switch(false, false);
  200. +
  201. + ath79_register_mdio(0, 0x0);
  202. +
  203. + /* LAN */
  204. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
  205. + ath79_register_eth(1);
  206. +
  207. + /* WAN */
  208. + ath79_switch_data.phy4_mii_en = 1;
  209. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  210. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  211. + ath79_register_eth(0);
  212. +
  213. + ath79_init_mac(tmpmac, mac, 0);
  214. + ath79_register_wmac(ee, tmpmac);
  215. +}
  216. +
  217. +static void __init tl_wr841n_v9_setup(void)
  218. +{
  219. + tl_ap143_setup();
  220. +
  221. + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v9_leds_gpio),
  222. + tl_wr841n_v9_leds_gpio);
  223. +
  224. + ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
  225. + ARRAY_SIZE(tl_wr841n_v9_gpio_keys),
  226. + tl_wr841n_v9_gpio_keys);
  227. +}
  228. +
  229. +MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9",
  230. + tl_wr841n_v9_setup);
  231. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  232. index 01d1e67..c270f73 100644
  233. --- a/target/linux/ar71xx/image/Makefile
  234. +++ b/target/linux/ar71xx/image/Makefile
  235. @@ -879,6 +879,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR7
  236. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR740NV4,tl-wr740n-v4,TL-WR741ND-v4,ttyATH0,115200,0x07400004,1,4Mlzma))
  237. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR741NV4,tl-wr741nd-v4,TL-WR741ND-v4,ttyATH0,115200,0x07410004,1,4Mlzma))
  238. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma))
  239. +$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR841NV9,tl-wr841n-v9,TL-WR841N-v9,ttyS0,115200,0x08410009,1,4Mlzma))
  240. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR1041,tl-wr1041n-v2,TL-WR1041N-v2,ttyS0,115200,0x10410002,1,4Mlzma))
  241. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
  242. $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR3500V1,tl-wdr3500-v1,TL-WDR3500,ttyS0,115200,0x35000001,1,8Mlzma))
  243. @@ -924,7 +925,7 @@ $(eval $(call MultiProfile,TLWA901,TLWA901NV1 TLWA901NV2))
  244. $(eval $(call MultiProfile,TLWA7510,TLWA7510NV1))
  245. $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3 TLWR740NV4))
  246. $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4))
  247. -$(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8))
  248. +$(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8 TLWR841NV9))
  249. $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
  250. $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4310V1))
  251. $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTUNIFI UBNTUNIFIOUTDOOR))
  252. diff --git a/target/linux/ar71xx/patches-3.3/708-MIPS-ath79-TL-WR841v9-support.patch b/target/linux/ar71xx/patches-3.3/708-MIPS-ath79-TL-WR841v9-support.patch
  253. new file mode 100644
  254. index 0000000..37425a6
  255. --- /dev/null
  256. +++ b/target/linux/ar71xx/patches-3.3/708-MIPS-ath79-TL-WR841v9-support.patch
  257. @@ -0,0 +1,38 @@
  258. +--- a/arch/mips/ath79/Kconfig
  259. ++++ b/arch/mips/ath79/Kconfig
  260. +@@ -547,6 +547,15 @@ config ATH79_MACH_TL_WR841N_V8
  261. + select ATH79_DEV_M25P80
  262. + select ATH79_DEV_WMAC
  263. +
  264. ++config ATH79_MACH_TL_WR841N_V9
  265. ++ bool "TP-LINK TL-WR841N/ND v9 support"
  266. ++ select SOC_QCA953X
  267. ++ select ATH79_DEV_ETH
  268. ++ select ATH79_DEV_GPIO_BUTTONS
  269. ++ select ATH79_DEV_LEDS_GPIO
  270. ++ select ATH79_DEV_M25P80
  271. ++ select ATH79_DEV_WMAC
  272. ++
  273. + config ATH79_MACH_TL_WR941ND
  274. + bool "TP-LINK TL-WR941ND support"
  275. + select SOC_AR913X
  276. +--- a/arch/mips/ath79/Makefile
  277. ++++ b/arch/mips/ath79/Makefile
  278. +@@ -85,6 +85,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR741ND) += m
  279. + obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4) += mach-tl-wr741nd-v4.o
  280. + obj-$(CONFIG_ATH79_MACH_TL_WR841N_V1) += mach-tl-wr841n.o
  281. + obj-$(CONFIG_ATH79_MACH_TL_WR841N_V8) += mach-tl-wr841n-v8.o
  282. ++obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o
  283. + obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o
  284. + obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2) += mach-tl-wr1041n-v2.o
  285. + obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o
  286. +--- a/arch/mips/ath79/machtypes.h
  287. ++++ b/arch/mips/ath79/machtypes.h
  288. +@@ -90,6 +90,7 @@ enum ath79_mach_type {
  289. + ATH79_MACH_TL_WR841N_V1, /* TP-LINK TL-WR841N v1 */
  290. + ATH79_MACH_TL_WR841N_V7, /* TP-LINK TL-WR841N/ND v7 */
  291. + ATH79_MACH_TL_WR841N_V8, /* TP-LINK TL-WR841N/ND v8 */
  292. ++ ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */
  293. + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
  294. + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
  295. + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */