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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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 5c38c54..2f0855c 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 af92b01..9c7c139 100755
  51. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  52. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  53. @@ -799,6 +799,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 ab69e4f..f181a63 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..55b4c00
  102. --- /dev/null
  103. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c
  104. @@ -0,0 +1,151 @@
  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. + ath79_switch_data.phy_poll_mask = BIT(0);
  245. + ath79_eth0_data.phy_mask = BIT(0);
  246. +
  247. + ath79_register_eth(0);
  248. + ath79_register_eth(1);
  249. +
  250. + ath79_register_wmac(ee, mac);
  251. +
  252. +}
  253. +
  254. +MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V6, "TL-WR941ND-v6", "TP-LINK TL-WR941N/ND v6",
  255. + tl_wr941nd_v6_setup);
  256. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  257. index 3a17420..cc25be7 100644
  258. --- a/target/linux/ar71xx/image/Makefile
  259. +++ b/target/linux/ar71xx/image/Makefile
  260. @@ -600,7 +600,7 @@ endef
  261. define Device/tl-wr941nd-v6
  262. $(Device/tplink-4mlzma)
  263. - BOARDNAME := TL-WDR3500
  264. + BOARDNAME := TL-WR941ND-v6
  265. DEVICE_PROFILE := TLWR941
  266. TPLINK_HWID := 0x09410006
  267. endef
  268. 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
  269. index 2fa041b..185cb9c 100644
  270. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  271. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  272. @@ -1,6 +1,6 @@
  273. --- a/arch/mips/ath79/machtypes.h
  274. +++ b/arch/mips/ath79/machtypes.h
  275. -@@ -16,22 +16,197 @@
  276. +@@ -16,22 +16,198 @@
  277. enum ath79_mach_type {
  278. ATH79_MACH_GENERIC = 0,
  279. @@ -148,6 +148,7 @@
  280. + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
  281. + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
  282. + ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
  283. ++ ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
  284. + ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
  285. + ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
  286. ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
  287. @@ -271,7 +272,7 @@
  288. config ATH79_MACH_AP121
  289. bool "Atheros AP121 reference board"
  290. select SOC_AR933X
  291. -@@ -11,62 +75,1041 @@ config ATH79_MACH_AP121
  292. +@@ -11,62 +75,1050 @@ config ATH79_MACH_AP121
  293. select ATH79_DEV_M25P80
  294. select ATH79_DEV_USB
  295. select ATH79_DEV_WMAC
  296. @@ -1246,6 +1247,15 @@
  297. + select ATH79_DEV_M25P80
  298. + select ATH79_DEV_WMAC
  299. +
  300. ++config ATH79_MACH_TL_WR941ND_V6
  301. ++ bool "TP-LINK TL-WR941ND v6 support"
  302. ++ select SOC_QCA956X
  303. ++ select ATH79_DEV_ETH
  304. ++ select ATH79_DEV_GPIO_BUTTONS
  305. ++ select ATH79_DEV_LEDS_GPIO
  306. ++ select ATH79_DEV_M25P80
  307. ++ select ATH79_DEV_WMAC
  308. ++
  309. +config ATH79_MACH_TL_WR1041N_V2
  310. + bool "TP-LINK TL-WR1041N v2 support"
  311. + select SOC_AR934X
  312. @@ -1474,7 +1484,7 @@
  313. endif
  314. --- a/arch/mips/ath79/Makefile
  315. +++ b/arch/mips/ath79/Makefile
  316. -@@ -38,9 +38,126 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  317. +@@ -38,9 +38,127 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  318. #
  319. # Machines
  320. #
  321. @@ -1566,6 +1576,7 @@
  322. +obj-$(CONFIG_ATH79_MACH_TL_WR841N_V8) += mach-tl-wr841n-v8.o
  323. +obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o
  324. +obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o
  325. ++obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6) += mach-tl-wr941nd-v6.o
  326. +obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2) += mach-tl-wr1041n-v2.o
  327. +obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o
  328. +obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) += mach-tl-wr1043nd-v2.o