0093-ar71xx-add-support-for-TP-Link-WBS210-510.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 5 Jan 2017 16:01:17 +0100
  3. Subject: ar71xx: add support for TP-Link WBS210/510
  4. The devices are mostly identical to the CPE210/510, but use external
  5. antennas.
  6. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  7. Backport of LEDE 1fef80f29cf6bdfcb6cdbd913b9147797b8bc218
  8. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
  9. index 0f7a41589384755ff596d4355ad9fbf1e1087d91..3b86067635e337a0c00a55d035d55382405ef1e7 100644
  10. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
  11. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
  12. @@ -16,7 +16,9 @@ nanostation-m-xw)
  13. ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
  14. ;;
  15. cpe210|\
  16. -cpe510)
  17. +cpe510|\
  18. +wbs210|\
  19. +wbs510)
  20. ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
  21. ;;
  22. esac
  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 fa38568fbc84aad4c85636c3894097c65e30eb9a..d57d8ad5fd3edd8774d30245b3265317778cb140 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. @@ -79,7 +79,9 @@ carambola2)
  28. ;;
  29. cpe210|\
  30. -cpe510)
  31. +cpe510|\
  32. +wbs210|\
  33. +wbs510)
  34. ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20"
  35. ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
  36. ucidef_set_rssimon "wlan0" "200000" "1"
  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 4389bc894f8dd08a9231b35bbb4fba0e9e57560b..f8c43ac0d6f2882444ed277df2f0b2c23721dade 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. @@ -73,7 +73,9 @@ bsb)
  42. ;;
  43. cpe210|\
  44. -cpe510)
  45. +cpe510|\
  46. +wbs210|\
  47. +wbs510)
  48. ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
  49. ucidef_add_switch "switch0" "1" "1"
  50. ucidef_add_switch_vlan "switch0" "1" "0t 5"
  51. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  52. index 5922527da4980fa3b51fdcec2bca96f5962d0f0b..33fdc751034d8cbdec344211f4e2b10afa0e9849 100755
  53. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  54. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  55. @@ -444,6 +444,14 @@ ar71xx_board_detect() {
  56. name="cpe510"
  57. tplink_pharos_board_detect
  58. ;;
  59. + *WBS210)
  60. + name="wbs210"
  61. + tplink_pharos_board_detect
  62. + ;;
  63. + *WBS510)
  64. + name="wbs510"
  65. + tplink_pharos_board_detect
  66. + ;;
  67. *"DB120 reference board")
  68. name="db120"
  69. ;;
  70. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  71. index e61ebf7c2221fd56bb902f14d96cb25d174718ee..a4e37e24cc57da5e90a86a1a5a99c6dfc829e65f 100755
  72. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  73. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  74. @@ -266,7 +266,9 @@ platform_check_image() {
  75. ;;
  76. cpe210|\
  77. - cpe510)
  78. + cpe510|\
  79. + wbs210|\
  80. + wbs510)
  81. tplink_pharos_check_image "$1" && return 0
  82. return 1
  83. ;;
  84. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
  85. index 74daf434e611d1f9d05f7d7516ae918d334b32b7..d2dbed1fe286c44d3188262e984253faaee7edba 100644
  86. --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
  87. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
  88. @@ -30,6 +30,9 @@
  89. #define CPE510_GPIO_LED_L3 15
  90. #define CPE510_GPIO_LED_L4 16
  91. +/* All LEDs/button except for link4 are the same for CPE and WBS series */
  92. +#define WBS510_GPIO_LED_L4 2
  93. +
  94. #define CPE510_GPIO_EXTERNAL_LNA0 18
  95. #define CPE510_GPIO_EXTERNAL_LNA1 19
  96. @@ -67,6 +70,34 @@ static struct gpio_led cpe510_leds_gpio[] __initdata = {
  97. },
  98. };
  99. +static struct gpio_led wbs510_leds_gpio[] __initdata = {
  100. + {
  101. + .name = "tp-link:green:lan0",
  102. + .gpio = CPE510_GPIO_LED_LAN0,
  103. + .active_low = 1,
  104. + }, {
  105. + .name = "tp-link:green:lan1",
  106. + .gpio = CPE510_GPIO_LED_LAN1,
  107. + .active_low = 1,
  108. + }, {
  109. + .name = "tp-link:green:link1",
  110. + .gpio = CPE510_GPIO_LED_L1,
  111. + .active_low = 1,
  112. + }, {
  113. + .name = "tp-link:green:link2",
  114. + .gpio = CPE510_GPIO_LED_L2,
  115. + .active_low = 1,
  116. + }, {
  117. + .name = "tp-link:green:link3",
  118. + .gpio = CPE510_GPIO_LED_L3,
  119. + .active_low = 1,
  120. + }, {
  121. + .name = "tp-link:green:link4",
  122. + .gpio = WBS510_GPIO_LED_L4,
  123. + .active_low = 1,
  124. + },
  125. +};
  126. +
  127. static struct gpio_keys_button cpe510_gpio_keys[] __initdata = {
  128. {
  129. .desc = "Reset button",
  130. @@ -85,9 +116,6 @@ static void __init cpe_setup(u8 *mac)
  131. ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
  132. AR934X_GPIO_FUNC_CLK_OBS4_EN);
  133. - ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio),
  134. - cpe510_leds_gpio);
  135. -
  136. ath79_register_gpio_keys_polled(1, CPE510_KEYS_POLL_INTERVAL,
  137. ARRAY_SIZE(cpe510_gpio_keys),
  138. cpe510_gpio_keys);
  139. @@ -109,6 +137,9 @@ static void __init cpe210_setup(void)
  140. u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
  141. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  142. + ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio),
  143. + cpe510_leds_gpio);
  144. +
  145. cpe_setup(mac);
  146. ath79_register_wmac(ee, mac);
  147. @@ -119,6 +150,22 @@ static void __init cpe510_setup(void)
  148. u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
  149. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  150. + ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio),
  151. + cpe510_leds_gpio);
  152. +
  153. + cpe_setup(mac);
  154. +
  155. + ath79_register_wmac(ee, mac);
  156. +}
  157. +
  158. +static void __init wbs_setup(void)
  159. +{
  160. + u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
  161. + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  162. +
  163. + ath79_register_leds_gpio(-1, ARRAY_SIZE(wbs510_leds_gpio),
  164. + wbs510_leds_gpio);
  165. +
  166. cpe_setup(mac);
  167. ath79_register_wmac(ee, mac);
  168. @@ -129,3 +176,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
  169. MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
  170. cpe510_setup);
  171. +
  172. +MIPS_MACHINE(ATH79_MACH_WBS210, "WBS210", "TP-LINK WBS210",
  173. + wbs_setup);
  174. +
  175. +MIPS_MACHINE(ATH79_MACH_WBS510, "WBS510", "TP-LINK WBS510",
  176. + wbs_setup);
  177. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  178. index 61e221255f6742f9594da168b11af7716d6a720e..459373b9cb96097d155b3d8f4e5fb76701d46d1c 100644
  179. --- a/target/linux/ar71xx/image/Makefile
  180. +++ b/target/linux/ar71xx/image/Makefile
  181. @@ -2166,6 +2166,8 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,
  182. $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE210))
  183. $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
  184. +$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,WBS210,wbs210,WBS210,ttyS0,115200,$$(cpe510_mtdlayout),WBS210))
  185. +$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,WBS510,wbs510,WBS510,ttyS0,115200,$$(cpe510_mtdlayout),WBS510))
  186. $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x))
  187. $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240))
  188. @@ -2229,7 +2231,7 @@ $(eval $(call MultiProfile,TLWR842,TLWR842V1))
  189. $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
  190. $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2 TLWR1043V3))
  191. $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
  192. -$(eval $(call MultiProfile,CPE510,CPE210_220 CPE510_520))
  193. +$(eval $(call MultiProfile,CPE510,CPE210_220 CPE510_520 WBS210 WBS510))
  194. $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
  195. $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTROCKETMXW UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW))
  196. $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
  197. 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
  198. index fb69cf3b9ee51e39c32a9e98de913c1a84bed56a..93ae596bfd9f439daf9295e3d58858c3067160b9 100644
  199. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  200. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  201. @@ -1,6 +1,6 @@
  202. --- a/arch/mips/ath79/machtypes.h
  203. +++ b/arch/mips/ath79/machtypes.h
  204. -@@ -16,22 +16,207 @@
  205. +@@ -16,22 +16,209 @@
  206. enum ath79_mach_type {
  207. ATH79_MACH_GENERIC = 0,
  208. @@ -175,6 +175,8 @@
  209. ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
  210. + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
  211. ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
  212. ++ ATH79_MACH_WBS210, /* TP-LINK WBS210 */
  213. ++ ATH79_MACH_WBS510, /* TP-LINK WBS510 */
  214. + ATH79_MACH_WEIO, /* WeIO board */
  215. + ATH79_MACH_WHR_G301N, /* Buffalo WHR-G301N */
  216. + ATH79_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */