0030-ar71xx-add-support-for-TP-LINK-TL-WR941ND-v6-international-version.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Mon, 2 Nov 2015 19:21:20 +0100
  3. Subject: ar71xx: add support for TP-LINK TL-WR941ND v6 (international version)
  4. diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
  5. index 89fe53c..3e80c32 100644
  6. --- a/target/linux/ar71xx/base-files/etc/diag.sh
  7. +++ b/target/linux/ar71xx/base-files/etc/diag.sh
  8. @@ -279,7 +279,8 @@ get_status_led() {
  9. tl-wdr4300 | \
  10. tl-wr703n | \
  11. tl-wr710n | \
  12. - tl-wr720n-v3)
  13. + tl-wr720n-v3 | \
  14. + tl-wr941nd-v6)
  15. status_led="tp-link:blue:system"
  16. ;;
  17. tl-wr841n-v9)
  18. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  19. index 5241db2..11b3fa0 100644
  20. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  21. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  22. @@ -460,6 +460,15 @@ tl-wr941nd-v5)
  23. ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  24. ;;
  25. +tl-wr941nd-v6)
  26. + ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth0"
  27. + ucidef_set_led_switch "lan1" "LAN1" "tp-link:blue:lan1" "switch0" "0x10"
  28. + ucidef_set_led_switch "lan2" "LAN2" "tp-link:blue:lan2" "switch0" "0x08"
  29. + ucidef_set_led_switch "lan3" "LAN3" "tp-link:blue:lan3" "switch0" "0x04"
  30. + ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
  31. + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:wlan" "phy0tpt"
  32. + ;;
  33. +
  34. tl-wa830re-v2)
  35. ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
  36. ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  37. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  38. index 8143d2d..5a74461 100755
  39. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  40. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  41. @@ -226,6 +226,7 @@ tl-mr3420-v2 |\
  42. tl-wr841n-v8 |\
  43. tl-wr842n-v2 |\
  44. tl-wr941nd-v5 |\
  45. +tl-wr941nd-v6 |\
  46. wnr2000-v3 |\
  47. wnr2000-v4 |\
  48. wnr2200 |\
  49. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  50. index 0b2857d..46af69a 100755
  51. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  52. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  53. @@ -800,6 +800,9 @@ ar71xx_board_detect() {
  54. *"TL-WR941N/ND v5")
  55. name="tl-wr941nd-v5"
  56. ;;
  57. + *"TL-WR941N/ND v6")
  58. + name="tl-wr941nd-v6"
  59. + ;;
  60. *"TL-WR703N v1")
  61. name="tl-wr703n"
  62. ;;
  63. diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
  64. index f11ea8c..fd337e1 100644
  65. --- a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
  66. +++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
  67. @@ -35,6 +35,7 @@ set_preinit_iface() {
  68. tl-wr720n-v3 |\
  69. tl-wr841n-v8 |\
  70. tl-wr842n-v2 |\
  71. + tl-wr941nd-v6 |\
  72. wnr2000-v3 |\
  73. wnr2200 |\
  74. wnr612-v2 |\
  75. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  76. index 8dea48f..2fc1d10 100755
  77. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  78. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  79. @@ -354,6 +354,7 @@ platform_check_image() {
  80. tl-wr842n-v2 | \
  81. tl-wr941nd | \
  82. tl-wr941nd-v5 | \
  83. + tl-wr941nd-v6 | \
  84. tl-wr1041n-v2 | \
  85. tl-wr1043nd | \
  86. tl-wr1043nd-v2 | \
  87. diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
  88. index e9b3c7c..84b5844 100644
  89. --- a/target/linux/ar71xx/config-3.18
  90. +++ b/target/linux/ar71xx/config-3.18
  91. @@ -132,6 +132,7 @@ CONFIG_ATH79_MACH_TL_WR841N_V1=y
  92. CONFIG_ATH79_MACH_TL_WR841N_V8=y
  93. CONFIG_ATH79_MACH_TL_WR841N_V9=y
  94. CONFIG_ATH79_MACH_TL_WR941ND=y
  95. +CONFIG_ATH79_MACH_TL_WR941ND_V6=y
  96. CONFIG_ATH79_MACH_TUBE2H=y
  97. CONFIG_ATH79_MACH_UBNT=y
  98. CONFIG_ATH79_MACH_UBNT_XM=y
  99. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c
  100. new file mode 100644
  101. index 0000000..8c788e2
  102. --- /dev/null
  103. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c
  104. @@ -0,0 +1,149 @@
  105. +/*
  106. + * TP-LINK TL-WR941N/ND v6 board support
  107. + *
  108. + * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
  109. + *
  110. + * This program is free software; you can redistribute it and/or modify it
  111. + * under the terms of the GNU General Public License version 2 as published
  112. + * by the Free Software Foundation.
  113. + */
  114. +
  115. +#include <linux/gpio.h>
  116. +#include <linux/platform_device.h>
  117. +
  118. +#include <asm/mach-ath79/ath79.h>
  119. +#include <asm/mach-ath79/ar71xx_regs.h>
  120. +
  121. +#include "common.h"
  122. +#include "dev-eth.h"
  123. +#include "dev-gpio-buttons.h"
  124. +#include "dev-leds-gpio.h"
  125. +#include "dev-m25p80.h"
  126. +#include "dev-wmac.h"
  127. +#include "machtypes.h"
  128. +
  129. +
  130. +#define TL_WR941ND_V6_GPIO_LED_QSS 3
  131. +#define TL_WR941ND_V6_GPIO_LED_WAN 14
  132. +#define TL_WR941ND_V6_GPIO_LED_WAN_RED 15
  133. +#define TL_WR941ND_V6_GPIO_LED_LAN1 7
  134. +#define TL_WR941ND_V6_GPIO_LED_LAN2 6
  135. +#define TL_WR941ND_V6_GPIO_LED_LAN3 5
  136. +#define TL_WR941ND_V6_GPIO_LED_LAN4 4
  137. +#define TL_WR941ND_V6_GPIO_LED_WLAN 8
  138. +#define TL_WR941ND_V6_GPIO_LED_SYSTEM 18
  139. +
  140. +#define TL_WR941ND_V6_GPIO_BTN_RESET 1
  141. +#define TL_WR941ND_V6_GPIO_BTN_RFKILL 2
  142. +
  143. +#define TL_WR941ND_V6_KEYS_POLL_INTERVAL 20
  144. +#define TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_V6_KEYS_POLL_INTERVAL)
  145. +
  146. +
  147. +static struct gpio_led tl_wr941nd_v6_leds_gpio[] __initdata = {
  148. + {
  149. + .name = "tp-link:blue:qss",
  150. + .gpio = TL_WR941ND_V6_GPIO_LED_QSS,
  151. + .active_low = 1,
  152. + },
  153. + {
  154. + .name = "tp-link:blue:wan",
  155. + .gpio = TL_WR941ND_V6_GPIO_LED_WAN,
  156. + .active_low = 1,
  157. + },
  158. + {
  159. + .name = "tp-link:red:wan",
  160. + .gpio = TL_WR941ND_V6_GPIO_LED_WAN_RED,
  161. + .active_low = 0,
  162. + },
  163. + {
  164. + .name = "tp-link:blue:lan1",
  165. + .gpio = TL_WR941ND_V6_GPIO_LED_LAN1,
  166. + .active_low = 1,
  167. + },
  168. + {
  169. + .name = "tp-link:blue:lan2",
  170. + .gpio = TL_WR941ND_V6_GPIO_LED_LAN2,
  171. + .active_low = 1,
  172. + },
  173. + {
  174. + .name = "tp-link:blue:lan3",
  175. + .gpio = TL_WR941ND_V6_GPIO_LED_LAN3,
  176. + .active_low = 1,
  177. + },
  178. + {
  179. + .name = "tp-link:blue:lan4",
  180. + .gpio = TL_WR941ND_V6_GPIO_LED_LAN4,
  181. + .active_low = 1,
  182. + },
  183. + {
  184. + .name = "tp-link:blue:wlan",
  185. + .gpio = TL_WR941ND_V6_GPIO_LED_WLAN,
  186. + .active_low = 1,
  187. + },
  188. + {
  189. + .name = "tp-link:blue:system",
  190. + .gpio = TL_WR941ND_V6_GPIO_LED_SYSTEM,
  191. + .active_low = 1,
  192. + },
  193. +};
  194. +
  195. +static struct gpio_keys_button tl_wr941nd_v6_gpio_keys[] __initdata = {
  196. + {
  197. + .desc = "Reset button",
  198. + .type = EV_KEY,
  199. + .code = KEY_RESTART,
  200. + .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
  201. + .gpio = TL_WR941ND_V6_GPIO_BTN_RESET,
  202. + .active_low = 1,
  203. + }, {
  204. + .desc = "RFKILL button",
  205. + .type = EV_KEY,
  206. + .code = KEY_RFKILL,
  207. + .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
  208. + .gpio = TL_WR941ND_V6_GPIO_BTN_RFKILL,
  209. + .active_low = 1,
  210. + }
  211. +};
  212. +
  213. +
  214. +static const char *tl_wr941n_v6_part_probes[] = {
  215. + "tp-link",
  216. + NULL,
  217. +};
  218. +
  219. +static struct flash_platform_data tl_wr941n_v6_flash_data = {
  220. + .part_probes = tl_wr941n_v6_part_probes,
  221. +};
  222. +
  223. +
  224. +static void __init tl_wr941nd_v6_setup(void)
  225. +{
  226. + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  227. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  228. +
  229. + ath79_register_m25p80(&tl_wr941n_v6_flash_data);
  230. +
  231. + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v6_leds_gpio),
  232. + tl_wr941nd_v6_leds_gpio);
  233. +
  234. + ath79_register_gpio_keys_polled(-1, TL_WR941ND_V6_KEYS_POLL_INTERVAL,
  235. + ARRAY_SIZE(tl_wr941nd_v6_gpio_keys),
  236. + tl_wr941nd_v6_gpio_keys);
  237. +
  238. + ath79_register_mdio(0, 0x0);
  239. +
  240. + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  241. + ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
  242. +
  243. + ath79_switch_data.phy4_mii_en = 1;
  244. +
  245. + ath79_register_eth(0);
  246. + ath79_register_eth(1);
  247. +
  248. + ath79_register_wmac(ee, mac);
  249. +
  250. +}
  251. +
  252. +MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V6, "TL-WR941ND-v6", "TP-LINK TL-WR941N/ND v6",
  253. + tl_wr941nd_v6_setup);
  254. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  255. index 78d35e1..11fb568 100644
  256. --- a/target/linux/ar71xx/image/Makefile
  257. +++ b/target/linux/ar71xx/image/Makefile
  258. @@ -600,7 +600,7 @@ endef
  259. define Device/tl-wr941nd-v6
  260. $(Device/tplink-4mlzma)
  261. - BOARDNAME := TL-WDR3500
  262. + BOARDNAME := TL-WR941ND-v6
  263. DEVICE_PROFILE := TLWR941
  264. TPLINK_HWID := 0x09410006
  265. endef
  266. 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
  267. index 2fa041b..185cb9c 100644
  268. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  269. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  270. @@ -1,6 +1,6 @@
  271. --- a/arch/mips/ath79/machtypes.h
  272. +++ b/arch/mips/ath79/machtypes.h
  273. -@@ -16,22 +16,197 @@
  274. +@@ -16,22 +16,198 @@
  275. enum ath79_mach_type {
  276. ATH79_MACH_GENERIC = 0,
  277. @@ -148,6 +148,7 @@
  278. + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
  279. + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
  280. + ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
  281. ++ ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
  282. + ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
  283. + ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
  284. ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
  285. @@ -271,7 +272,7 @@
  286. config ATH79_MACH_AP121
  287. bool "Atheros AP121 reference board"
  288. select SOC_AR933X
  289. -@@ -11,62 +75,1041 @@ config ATH79_MACH_AP121
  290. +@@ -11,62 +75,1050 @@ config ATH79_MACH_AP121
  291. select ATH79_DEV_M25P80
  292. select ATH79_DEV_USB
  293. select ATH79_DEV_WMAC
  294. @@ -1246,6 +1247,15 @@
  295. + select ATH79_DEV_M25P80
  296. + select ATH79_DEV_WMAC
  297. +
  298. ++config ATH79_MACH_TL_WR941ND_V6
  299. ++ bool "TP-LINK TL-WR941ND v6 support"
  300. ++ select SOC_QCA956X
  301. ++ select ATH79_DEV_ETH
  302. ++ select ATH79_DEV_GPIO_BUTTONS
  303. ++ select ATH79_DEV_LEDS_GPIO
  304. ++ select ATH79_DEV_M25P80
  305. ++ select ATH79_DEV_WMAC
  306. ++
  307. +config ATH79_MACH_TL_WR1041N_V2
  308. + bool "TP-LINK TL-WR1041N v2 support"
  309. + select SOC_AR934X
  310. @@ -1474,7 +1484,7 @@
  311. endif
  312. --- a/arch/mips/ath79/Makefile
  313. +++ b/arch/mips/ath79/Makefile
  314. -@@ -38,9 +38,126 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  315. +@@ -38,9 +38,127 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  316. #
  317. # Machines
  318. #
  319. @@ -1566,6 +1576,7 @@
  320. +obj-$(CONFIG_ATH79_MACH_TL_WR841N_V8) += mach-tl-wr841n-v8.o
  321. +obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o
  322. +obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o
  323. ++obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6) += mach-tl-wr941nd-v6.o
  324. +obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2) += mach-tl-wr1041n-v2.o
  325. +obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o
  326. +obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) += mach-tl-wr1043nd-v2.o