0110-ar71xx-Fix-TL-WR841N-v11-LEDs-use-separate-machine.patch 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 3 Jul 2016 22:21:13 +0200
  3. Subject: ar71xx: Fix TL-WR841N v11 LEDs, use separate machine
  4. Signed-off-by: Stijn Segers <francesco.borromini@inventati.org>
  5. Backport of LEDE d2a91f9853a9bfb47cb5d6e3078372f3f85557c5
  6. diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
  7. index c3aeffc..ef59d11 100644
  8. --- a/target/linux/ar71xx/base-files/etc/diag.sh
  9. +++ b/target/linux/ar71xx/base-files/etc/diag.sh
  10. @@ -274,6 +274,7 @@ get_status_led() {
  11. tl-wr841n-v1 | \
  12. tl-wr841n-v7 | \
  13. tl-wr841n-v8 | \
  14. + tl-wr841n-v11 | \
  15. tl-wa830re-v2 | \
  16. tl-wr842n-v2 | \
  17. tl-wr842n-v3 | \
  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 e118e0a..9a0d7eb 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. @@ -496,7 +496,8 @@ tl-wa830re-v2)
  23. ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
  24. ;;
  25. -tl-wr841n-v9)
  26. +tl-wr841n-v9 | \
  27. +tl-wr841n-v11)
  28. ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
  29. ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
  30. ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
  31. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  32. index 3c428ba..d5603d7 100755
  33. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  34. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  35. @@ -447,6 +447,7 @@ tl-wr741nd |\
  36. tl-wr741nd-v4 |\
  37. tl-wr841n-v7 |\
  38. tl-wr841n-v9 |\
  39. +tl-wr841n-v11 |\
  40. tl-wr842n-v3 |\
  41. whr-g301n |\
  42. whr-hp-g300n |\
  43. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  44. index e4a617e..beca73a 100755
  45. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  46. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  47. @@ -860,6 +860,9 @@ ar71xx_board_detect() {
  48. *"TL-WR841N/ND v9")
  49. name="tl-wr841n-v9"
  50. ;;
  51. + *"TL-WR841N/ND v11")
  52. + name="tl-wr841n-v11"
  53. + ;;
  54. *"TL-WR842N/ND v2")
  55. name="tl-wr842n-v2"
  56. ;;
  57. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  58. index 2a1abf3..f50cd53 100755
  59. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  60. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  61. @@ -364,6 +364,7 @@ platform_check_image() {
  62. tl-wr841n-v7 | \
  63. tl-wr841n-v8 | \
  64. tl-wr841n-v9 | \
  65. + tl-wr841n-v11 | \
  66. tl-wr842n-v2 | \
  67. tl-wr842n-v3 | \
  68. tl-wr941nd | \
  69. 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
  70. index 0209603..f806568 100644
  71. --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
  72. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
  73. @@ -1,8 +1,9 @@
  74. /*
  75. - * TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3
  76. + * TP-LINK TL-WR841N/ND v9/v11 / TL-WR842N/ND v3
  77. *
  78. * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
  79. * Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
  80. + * Copyright (C) 2016 Stijn Segers <francesco.borromini@gmail.com>
  81. *
  82. * This program is free software; you can redistribute it and/or modify it
  83. * under the terms of the GNU General Public License version 2 as published
  84. @@ -35,6 +36,19 @@
  85. #define TL_WR841NV9_GPIO_BTN_RESET 12
  86. #define TL_WR841NV9_GPIO_BTN_WIFI 17
  87. +#define TL_WR841NV11_GPIO_LED_SYSTEM 1
  88. +#define TL_WR841NV11_GPIO_LED_QSS 3
  89. +#define TL_WR841NV11_GPIO_LED_WAN 4
  90. +#define TL_WR841NV11_GPIO_LED_WAN_STATUS 2
  91. +#define TL_WR841NV11_GPIO_LED_WLAN 13
  92. +#define TL_WR841NV11_GPIO_LED_LAN1 16
  93. +#define TL_WR841NV11_GPIO_LED_LAN2 15
  94. +#define TL_WR841NV11_GPIO_LED_LAN3 14
  95. +#define TL_WR841NV11_GPIO_LED_LAN4 11
  96. +
  97. +#define TL_WR841NV11_GPIO_BTN_RESET 12
  98. +#define TL_WR841NV11_GPIO_BTN_WIFI 17
  99. +
  100. #define TL_WR842NV3_GPIO_LED_SYSTEM 2
  101. #define TL_WR842NV3_GPIO_LED_WLAN 3
  102. #define TL_WR842NV3_GPIO_LED_WAN_RED 4
  103. @@ -111,6 +125,46 @@ static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = {
  104. }
  105. };
  106. +static struct gpio_led tl_wr841n_v11_leds_gpio[] __initdata = {
  107. + {
  108. + .name = "tp-link:green:lan1",
  109. + .gpio = TL_WR841NV9_GPIO_LED_LAN1,
  110. + .active_low = 1,
  111. + }, {
  112. + .name = "tp-link:green:lan2",
  113. + .gpio = TL_WR841NV9_GPIO_LED_LAN2,
  114. + .active_low = 1,
  115. + }, {
  116. + .name = "tp-link:green:lan3",
  117. + .gpio = TL_WR841NV9_GPIO_LED_LAN3,
  118. + .active_low = 1,
  119. + }, {
  120. + .name = "tp-link:green:lan4",
  121. + .gpio = TL_WR841NV9_GPIO_LED_LAN4,
  122. + .active_low = 1,
  123. + }, {
  124. + .name = "tp-link:green:qss",
  125. + .gpio = TL_WR841NV9_GPIO_LED_QSS,
  126. + .active_low = 1,
  127. + }, {
  128. + .name = "tp-link:green:system",
  129. + .gpio = TL_WR841NV11_GPIO_LED_SYSTEM,
  130. + .active_low = 1,
  131. + }, {
  132. + .name = "tp-link:green:wan",
  133. + .gpio = TL_WR841NV9_GPIO_LED_WAN,
  134. + .active_low = 1,
  135. + }, {
  136. + .name = "tp-link:green:wan_status",
  137. + .gpio = TL_WR841NV11_GPIO_LED_WAN_STATUS,
  138. + .active_low = 1,
  139. + }, {
  140. + .name = "tp-link:green:wlan",
  141. + .gpio = TL_WR841NV9_GPIO_LED_WLAN,
  142. + .active_low = 1,
  143. + },
  144. +};
  145. +
  146. static struct gpio_led tl_wr842n_v3_leds_gpio[] __initdata = {
  147. {
  148. .name = "tp-link:green:lan1",
  149. @@ -221,6 +275,21 @@ static void __init tl_wr841n_v9_setup(void)
  150. MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9",
  151. tl_wr841n_v9_setup);
  152. +static void __init tl_wr841n_v11_setup(void)
  153. +{
  154. + tl_ap143_setup();
  155. +
  156. + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v11_leds_gpio),
  157. + tl_wr841n_v11_leds_gpio);
  158. +
  159. + ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
  160. + ARRAY_SIZE(tl_wr841n_v9_gpio_keys),
  161. + tl_wr841n_v9_gpio_keys);
  162. +}
  163. +
  164. +MIPS_MACHINE(ATH79_MACH_TL_WR841N_V11, "TL-WR841N-v11", "TP-LINK TL-WR841N/ND v11",
  165. + tl_wr841n_v11_setup);
  166. +
  167. static void __init tl_wr842n_v3_setup(void)
  168. {
  169. tl_ap143_setup();
  170. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  171. index 392dec4..6d46c1e 100644
  172. --- a/target/linux/ar71xx/image/Makefile
  173. +++ b/target/linux/ar71xx/image/Makefile
  174. @@ -595,7 +595,7 @@ endef
  175. define Device/tl-wr841n-v11
  176. $(Device/tplink-4mlzma)
  177. - BOARDNAME := TL-WR841N-v9
  178. + BOARDNAME := TL-WR841N-v11
  179. DEVICE_PROFILE := TLWR841
  180. TPLINK_HWID := 0x08410011
  181. endef
  182. 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
  183. index 4a53355..d4b417b 100644
  184. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  185. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  186. @@ -1,6 +1,6 @@
  187. --- a/arch/mips/ath79/machtypes.h
  188. +++ b/arch/mips/ath79/machtypes.h
  189. -@@ -16,22 +16,202 @@
  190. +@@ -16,22 +16,203 @@
  191. enum ath79_mach_type {
  192. ATH79_MACH_GENERIC = 0,
  193. @@ -146,6 +146,7 @@
  194. + ATH79_MACH_TL_WR841N_V7, /* TP-LINK TL-WR841N/ND v7 */
  195. + ATH79_MACH_TL_WR841N_V8, /* TP-LINK TL-WR841N/ND v8 */
  196. + ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */
  197. ++ ATH79_MACH_TL_WR841N_V11, /* TP-LINK TL-WR841N/ND v11 */
  198. + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
  199. + ATH79_MACH_TL_WR842N_V3, /* TP-LINK TL-WR842N/ND v3 */
  200. + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */