0109-ar71xx-add-support-for-TP-LINK-TL-WR842N-ND-v3.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 3 Jul 2016 22:14:18 +0200
  3. Subject: ar71xx: add support for TP-LINK TL-WR842N/ND v3
  4. - CPU QCA9531-BL3A
  5. - RAM: 64MB
  6. - flash: 16MB
  7. - USB
  8. AP143 platform, similar to tl-wr841n v10/v11, but with USB
  9. Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
  10. Backport of LEDE 0b45bec22c59cc6e6b2fa71dc9a88386c5587132
  11. diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
  12. index f182d60..c3aeffc 100644
  13. --- a/target/linux/ar71xx/base-files/etc/diag.sh
  14. +++ b/target/linux/ar71xx/base-files/etc/diag.sh
  15. @@ -276,6 +276,7 @@ get_status_led() {
  16. tl-wr841n-v8 | \
  17. tl-wa830re-v2 | \
  18. tl-wr842n-v2 | \
  19. + tl-wr842n-v3 | \
  20. tl-wr941nd | \
  21. tl-wr941nd-v5)
  22. status_led="tp-link:green:system"
  23. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  24. index 032acc9..e118e0a 100644
  25. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  26. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  27. @@ -515,6 +515,16 @@ tl-wr842n-v2)
  28. ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
  29. ;;
  30. +tl-wr842n-v3)
  31. + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
  32. + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
  33. + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
  34. + ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
  35. + ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
  36. + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  37. + ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
  38. + ;;
  39. +
  40. tl-wa801nd-v2 | \
  41. tl-wa901nd-v3)
  42. ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
  43. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  44. index b8ae576..3c428ba 100755
  45. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  46. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  47. @@ -447,6 +447,7 @@ tl-wr741nd |\
  48. tl-wr741nd-v4 |\
  49. tl-wr841n-v7 |\
  50. tl-wr841n-v9 |\
  51. +tl-wr842n-v3 |\
  52. whr-g301n |\
  53. whr-hp-g300n |\
  54. whr-hp-gn |\
  55. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  56. index 5119b36..e4a617e 100755
  57. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  58. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  59. @@ -863,6 +863,9 @@ ar71xx_board_detect() {
  60. *"TL-WR842N/ND v2")
  61. name="tl-wr842n-v2"
  62. ;;
  63. + *"TL-WR842N/ND v3")
  64. + name="tl-wr842n-v3"
  65. + ;;
  66. *TL-WR941ND)
  67. name="tl-wr941nd"
  68. ;;
  69. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  70. index f33419f..2a1abf3 100755
  71. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  72. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  73. @@ -365,6 +365,7 @@ platform_check_image() {
  74. tl-wr841n-v8 | \
  75. tl-wr841n-v9 | \
  76. tl-wr842n-v2 | \
  77. + tl-wr842n-v3 | \
  78. tl-wr941nd | \
  79. tl-wr941nd-v5 | \
  80. tl-wr941nd-v6 | \
  81. 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
  82. index 3e5c2a2..0209603 100644
  83. --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
  84. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
  85. @@ -1,7 +1,8 @@
  86. /*
  87. - * TP-LINK TL-WR841N/ND v9
  88. + * TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3
  89. *
  90. * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
  91. + * Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
  92. *
  93. * This program is free software; you can redistribute it and/or modify it
  94. * under the terms of the GNU General Public License version 2 as published
  95. @@ -19,6 +20,7 @@
  96. #include "dev-gpio-buttons.h"
  97. #include "dev-leds-gpio.h"
  98. #include "dev-m25p80.h"
  99. +#include "dev-usb.h"
  100. #include "dev-wmac.h"
  101. #include "machtypes.h"
  102. @@ -33,6 +35,20 @@
  103. #define TL_WR841NV9_GPIO_BTN_RESET 12
  104. #define TL_WR841NV9_GPIO_BTN_WIFI 17
  105. +#define TL_WR842NV3_GPIO_LED_SYSTEM 2
  106. +#define TL_WR842NV3_GPIO_LED_WLAN 3
  107. +#define TL_WR842NV3_GPIO_LED_WAN_RED 4
  108. +#define TL_WR842NV3_GPIO_LED_WAN_GREEN 11
  109. +#define TL_WR842NV3_GPIO_LED_LAN1 12
  110. +#define TL_WR842NV3_GPIO_LED_LAN2 13
  111. +#define TL_WR842NV3_GPIO_LED_LAN3 14
  112. +#define TL_WR842NV3_GPIO_LED_LAN4 15
  113. +#define TL_WR842NV3_GPIO_LED_3G 16
  114. +#define TL_WR842NV3_GPIO_LED_WPS 17
  115. +
  116. +#define TL_WR842NV3_GPIO_BTN_RESET 1
  117. +#define TL_WR842NV3_GPIO_BTN_WIFI 0
  118. +
  119. #define TL_WR841NV9_KEYS_POLL_INTERVAL 20 /* msecs */
  120. #define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL)
  121. @@ -95,6 +111,68 @@ static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = {
  122. }
  123. };
  124. +static struct gpio_led tl_wr842n_v3_leds_gpio[] __initdata = {
  125. + {
  126. + .name = "tp-link:green:lan1",
  127. + .gpio = TL_WR842NV3_GPIO_LED_LAN1,
  128. + .active_low = 1,
  129. + }, {
  130. + .name = "tp-link:green:lan2",
  131. + .gpio = TL_WR842NV3_GPIO_LED_LAN2,
  132. + .active_low = 1,
  133. + }, {
  134. + .name = "tp-link:green:lan3",
  135. + .gpio = TL_WR842NV3_GPIO_LED_LAN3,
  136. + .active_low = 1,
  137. + }, {
  138. + .name = "tp-link:green:lan4",
  139. + .gpio = TL_WR842NV3_GPIO_LED_LAN4,
  140. + .active_low = 1,
  141. + }, {
  142. + .name = "tp-link:green:wan",
  143. + .gpio = TL_WR842NV3_GPIO_LED_WAN_GREEN,
  144. + .active_low = 1,
  145. + }, {
  146. + .name = "tp-link:red:wan",
  147. + .gpio = TL_WR842NV3_GPIO_LED_WAN_RED,
  148. + .active_low = 1,
  149. + }, {
  150. + .name = "tp-link:green:wlan",
  151. + .gpio = TL_WR842NV3_GPIO_LED_WLAN,
  152. + .active_low = 1,
  153. + }, {
  154. + .name = "tp-link:green:system",
  155. + .gpio = TL_WR842NV3_GPIO_LED_SYSTEM,
  156. + .active_low = 1,
  157. + }, {
  158. + .name = "tp-link:green:3g",
  159. + .gpio = TL_WR842NV3_GPIO_LED_3G,
  160. + .active_low = 1,
  161. + }, {
  162. + .name = "tp-link:green:wps",
  163. + .gpio = TL_WR842NV3_GPIO_LED_WPS,
  164. + .active_low = 1,
  165. + },
  166. +};
  167. +
  168. +static struct gpio_keys_button tl_wr842n_v3_gpio_keys[] __initdata = {
  169. + {
  170. + .desc = "Reset button",
  171. + .type = EV_KEY,
  172. + .code = KEY_RESTART,
  173. + .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
  174. + .gpio = TL_WR842NV3_GPIO_BTN_RESET,
  175. + .active_low = 1,
  176. + }, {
  177. + .desc = "WIFI button",
  178. + .type = EV_KEY,
  179. + .code = KEY_RFKILL,
  180. + .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
  181. + .gpio = TL_WR842NV3_GPIO_BTN_WIFI,
  182. + .active_low = 1,
  183. + }
  184. +};
  185. +
  186. static void __init tl_ap143_setup(void)
  187. {
  188. @@ -142,3 +220,20 @@ static void __init tl_wr841n_v9_setup(void)
  189. MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9",
  190. tl_wr841n_v9_setup);
  191. +
  192. +static void __init tl_wr842n_v3_setup(void)
  193. +{
  194. + tl_ap143_setup();
  195. +
  196. + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr842n_v3_leds_gpio),
  197. + tl_wr842n_v3_leds_gpio);
  198. +
  199. + ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
  200. + ARRAY_SIZE(tl_wr842n_v3_gpio_keys),
  201. + tl_wr842n_v3_gpio_keys);
  202. +
  203. + ath79_register_usb();
  204. +}
  205. +
  206. +MIPS_MACHINE(ATH79_MACH_TL_WR842N_V3, "TL-WR842N-v3", "TP-LINK TL-WR842N/ND v3",
  207. + tl_wr842n_v3_setup);
  208. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  209. index b790610..e074f8a 100644
  210. --- a/target/linux/ar71xx/image/Makefile
  211. +++ b/target/linux/ar71xx/image/Makefile
  212. @@ -607,6 +607,13 @@ define Device/tl-wr842n-v2
  213. TPLINK_HWID := 0x8420002
  214. endef
  215. +define Device/tl-wr842n-v3
  216. + $(Device/tplink-16mlzma)
  217. + BOARDNAME := TL-WR842N-v3
  218. + DEVICE_PROFILE := TLWR842
  219. + TPLINK_HWID := 0x08420003
  220. +endef
  221. +
  222. define Device/tl-wr843nd-v1
  223. $(Device/tplink-4mlzma)
  224. BOARDNAME := TL-WR841N-v8
  225. @@ -620,7 +627,7 @@ define Device/tl-wr847n-v8
  226. DEVICE_PROFILE := TLWR841
  227. TPLINK_HWID := 0x08470008
  228. endef
  229. -TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr841n-v11 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
  230. +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
  231. define Device/tl-wr941nd-v5
  232. $(Device/tplink-4mlzma)
  233. 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
  234. index dbd3fca..4a53355 100644
  235. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  236. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  237. @@ -1,6 +1,6 @@
  238. --- a/arch/mips/ath79/machtypes.h
  239. +++ b/arch/mips/ath79/machtypes.h
  240. -@@ -16,22 +16,201 @@
  241. +@@ -16,22 +16,202 @@
  242. enum ath79_mach_type {
  243. ATH79_MACH_GENERIC = 0,
  244. @@ -147,6 +147,7 @@
  245. + ATH79_MACH_TL_WR841N_V8, /* TP-LINK TL-WR841N/ND v8 */
  246. + ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */
  247. + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
  248. ++ ATH79_MACH_TL_WR842N_V3, /* TP-LINK TL-WR842N/ND v3 */
  249. + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
  250. + ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
  251. + ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
  252. @@ -284,7 +285,7 @@
  253. config ATH79_MACH_AP121
  254. bool "Atheros AP121 reference board"
  255. select SOC_AR933X
  256. -@@ -11,62 +84,1050 @@ config ATH79_MACH_AP121
  257. +@@ -11,62 +84,1051 @@ config ATH79_MACH_AP121
  258. select ATH79_DEV_M25P80
  259. select ATH79_DEV_USB
  260. select ATH79_DEV_WMAC
  261. @@ -1235,13 +1236,14 @@
  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. ++ bool "TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3 support"
  273. ++ select SOC_QCA953X
  274. ++ select ATH79_DEV_ETH
  275. ++ select ATH79_DEV_GPIO_BUTTONS
  276. ++ select ATH79_DEV_LEDS_GPIO
  277. ++ select ATH79_DEV_M25P80
  278. ++ select ATH79_DEV_USB
  279. ++ select ATH79_DEV_WMAC
  280. +
  281. +config ATH79_MACH_TL_WR941ND
  282. + bool "TP-LINK TL-WR941ND support"
  283. @@ -1364,7 +1366,7 @@
  284. config ATH79_MACH_UBNT_XM
  285. bool "Ubiquiti Networks XM/UniFi boards"
  286. -@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM
  287. +@@ -83,6 +1145,117 @@ config ATH79_MACH_UBNT_XM
  288. Say 'Y' here if you want your kernel to support the
  289. Ubiquiti Networks XM (rev 1.0) board.
  290. @@ -1482,7 +1484,7 @@
  291. endmenu
  292. config SOC_AR71XX
  293. -@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
  294. +@@ -124,7 +1297,10 @@ config ATH79_DEV_DSA
  295. config ATH79_DEV_ETH
  296. def_bool n
  297. @@ -1494,7 +1496,7 @@
  298. def_bool n
  299. config ATH79_DEV_GPIO_BUTTONS
  300. -@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
  301. +@@ -154,6 +1330,11 @@ config ATH79_PCI_ATH9K_FIXUP
  302. def_bool n
  303. config ATH79_ROUTERBOOT