0084-ar71xx-add-GL-AR150-support.patch 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. From: Jan Niehusmann <jan@gondor.com>
  2. Date: Wed, 15 Jun 2016 14:57:47 +0200
  3. Subject: ar71xx: add GL-AR150 support
  4. patch from https://github.com/domino-team/OpenWrt-patches
  5. https://raw.githubusercontent.com/domino-team/OpenWrt-patches/master/AR150%2C%20AR300%2C%20Domino%20-%20CC1505/000-gl-ar150-cc.patch
  6. (and fixed indentation in target/linux/ar71xx/base-files/lib/ar71xx.sh)
  7. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  8. index ae17853..dc8b8d6 100644
  9. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  10. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
  11. @@ -181,6 +181,10 @@ dlan-pro-1200-ac)
  12. ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
  13. ;;
  14. +gl-ar150)
  15. + ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
  16. + ;;
  17. +
  18. gl-inet)
  19. ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
  20. ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
  21. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  22. index 4066506..89a2184 100755
  23. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  24. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  25. @@ -381,6 +381,7 @@ dir-505-a1)
  26. alfa-ap96 |\
  27. alfa-nx |\
  28. ap83 |\
  29. +gl-ar150 |\
  30. gl-inet |\
  31. jwap003 |\
  32. pb42 |\
  33. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  34. index fbf76c8..db908f9 100755
  35. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  36. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  37. @@ -500,6 +500,9 @@ ar71xx_board_detect() {
  38. name="gl-inet"
  39. gl_inet_board_detect
  40. ;;
  41. + *"GL AR150")
  42. + name="gl-ar150"
  43. + ;;
  44. *"EnGenius EPG5000")
  45. name="epg5000"
  46. ;;
  47. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  48. index 4a4c476..aeb4577 100755
  49. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  50. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  51. @@ -215,6 +215,7 @@ platform_check_image() {
  52. dlan-pro-500-wp | \
  53. dlan-pro-1200-ac | \
  54. dragino2 | \
  55. + gl-ar150 | \
  56. epg5000 | \
  57. esr1750 | \
  58. esr900 | \
  59. diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
  60. index 514f7d5..0903ee9 100644
  61. --- a/target/linux/ar71xx/config-3.18
  62. +++ b/target/linux/ar71xx/config-3.18
  63. @@ -69,6 +69,7 @@ CONFIG_ATH79_MACH_ESR1750=y
  64. CONFIG_ATH79_MACH_ESR900=y
  65. CONFIG_ATH79_MACH_EW_DORIN=y
  66. CONFIG_ATH79_MACH_F9K1115V2=y
  67. +CONFIG_ATH79_MACH_GL_AR150=y
  68. CONFIG_ATH79_MACH_GL_INET=y
  69. CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
  70. CONFIG_ATH79_MACH_GS_OOLITE=y
  71. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
  72. new file mode 100644
  73. index 0000000..310182c
  74. --- /dev/null
  75. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
  76. @@ -0,0 +1,125 @@
  77. +/*
  78. + * GL_ar150 board support
  79. + *
  80. + * Copyright (C) 2011 dongyuqi <729650915@qq.com>
  81. + * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
  82. + * Copyright (C) 2013 alzhao <alzhao@gmail.com>
  83. + * Copyright (C) 2014 Michel Stempin <michel.stempin@wanadoo.fr>
  84. + *
  85. + * This program is free software; you can redistribute it and/or modify it
  86. + * under the terms of the GNU General Public License version 2 as published
  87. + * by the Free Software Foundation.
  88. +*/
  89. +
  90. +#include <linux/gpio.h>
  91. +
  92. +#include <asm/mach-ath79/ath79.h>
  93. +
  94. +#include "dev-eth.h"
  95. +#include "dev-gpio-buttons.h"
  96. +#include "dev-leds-gpio.h"
  97. +#include "dev-m25p80.h"
  98. +#include "dev-usb.h"
  99. +#include "dev-wmac.h"
  100. +#include "machtypes.h"
  101. +
  102. +#define GL_AR150_GPIO_LED_WLAN 0
  103. +#define GL_AR150_GPIO_LED_LAN 13
  104. +#define GL_AR150_GPIO_LED_WAN 15
  105. +
  106. +#define GL_AR150_GPIO_BIN_USB 6
  107. +#define GL_AR150_GPIO_BTN_MANUAL 7
  108. +#define GL_AR150_GPIO_BTN_AUTO 8
  109. +#define GL_AR150_GPIO_BTN_RESET 11
  110. +
  111. +#define GL_AR150_KEYS_POLL_INTERVAL 20 /* msecs */
  112. +#define GL_AR150_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR150_KEYS_POLL_INTERVAL)
  113. +
  114. +#define GL_AR150_MAC0_OFFSET 0x0000
  115. +#define GL_AR150_MAC1_OFFSET 0x0000
  116. +#define GL_AR150_CALDATA_OFFSET 0x1000
  117. +#define GL_AR150_WMAC_MAC_OFFSET 0x0000
  118. +
  119. +static struct gpio_led gl_ar150_leds_gpio[] __initdata = {
  120. + {
  121. + .name = "gl_ar150:wlan",
  122. + .gpio = GL_AR150_GPIO_LED_WLAN,
  123. + .active_low = 0,
  124. + },
  125. + {
  126. + .name = "gl_ar150:lan",
  127. + .gpio = GL_AR150_GPIO_LED_LAN,
  128. + .active_low = 0,
  129. + },
  130. + {
  131. + .name = "gl_ar150:wan",
  132. + .gpio = GL_AR150_GPIO_LED_WAN,
  133. + .active_low = 0,
  134. + .default_state = 1,
  135. + },
  136. +};
  137. +
  138. +static struct gpio_keys_button gl_ar150_gpio_keys[] __initdata = {
  139. + {
  140. + .desc = "BTN_7",
  141. + .type = EV_KEY,
  142. + .code = BTN_7,
  143. + .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
  144. + .gpio = GL_AR150_GPIO_BTN_MANUAL,
  145. + .active_low = 0,
  146. + },
  147. + {
  148. + .desc = "BTN_8",
  149. + .type = EV_KEY,
  150. + .code = BTN_8,
  151. + .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
  152. + .gpio = GL_AR150_GPIO_BTN_AUTO,
  153. + .active_low = 0,
  154. + },
  155. + {
  156. + .desc = "reset",
  157. + .type = EV_KEY,
  158. + .code = KEY_RESTART,
  159. + .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
  160. + .gpio = GL_AR150_GPIO_BTN_RESET,
  161. + .active_low = 0,
  162. + },
  163. +};
  164. +
  165. +static void __init gl_ar150_setup(void)
  166. +{
  167. +
  168. + /* ART base address */
  169. + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
  170. +
  171. + /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
  172. + ath79_setup_ar933x_phy4_switch(false, false);
  173. +
  174. + /* register flash. */
  175. + ath79_register_m25p80(NULL);
  176. +
  177. + /* register gpio LEDs and keys */
  178. + ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar150_leds_gpio),
  179. + gl_ar150_leds_gpio);
  180. + ath79_register_gpio_keys_polled(-1, GL_AR150_KEYS_POLL_INTERVAL,
  181. + ARRAY_SIZE(gl_ar150_gpio_keys),
  182. + gl_ar150_gpio_keys);
  183. +
  184. + /* enable usb */
  185. + gpio_request_one(GL_AR150_GPIO_BIN_USB,
  186. + GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
  187. + "USB power");
  188. + ath79_register_usb();
  189. +
  190. + /* register eth0 as WAN, eth1 as LAN */
  191. + ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_AR150_MAC0_OFFSET, 0);
  192. + ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_AR150_MAC1_OFFSET, 0);
  193. + ath79_register_mdio(0, 0x0);
  194. + ath79_register_eth(0);
  195. + ath79_register_eth(1);
  196. +
  197. + /* register wireless mac with cal data */
  198. + ath79_register_wmac(art + GL_AR150_CALDATA_OFFSET, art + GL_AR150_WMAC_MAC_OFFSET);
  199. +}
  200. +
  201. +MIPS_MACHINE(ATH79_MACH_GL_AR150, "GL-AR150", "GL AR150",gl_ar150_setup);
  202. diff --git a/target/linux/ar71xx/generic/profiles/gl-connect.mk b/target/linux/ar71xx/generic/profiles/gl-connect.mk
  203. deleted file mode 100644
  204. index e9377db..0000000
  205. --- a/target/linux/ar71xx/generic/profiles/gl-connect.mk
  206. +++ /dev/null
  207. @@ -1,17 +0,0 @@
  208. -#
  209. -# Copyright (C) 2014 OpenWrt.org
  210. -#
  211. -# This is free software, licensed under the GNU General Public License v2.
  212. -# See /LICENSE for more information.
  213. -#
  214. -
  215. -define Profile/GLINET
  216. - NAME:=GL.iNet
  217. - PACKAGES:=kmod-usb-core kmod-usb2
  218. -endef
  219. -
  220. -define Profile/GLINET/Description
  221. - Package set optimized for the GL-Connect GL.iNet v1.
  222. -endef
  223. -
  224. -$(eval $(call Profile,GLINET))
  225. diff --git a/target/linux/ar71xx/generic/profiles/gli.mk b/target/linux/ar71xx/generic/profiles/gli.mk
  226. new file mode 100644
  227. index 0000000..a6ad661
  228. --- /dev/null
  229. +++ b/target/linux/ar71xx/generic/profiles/gli.mk
  230. @@ -0,0 +1,27 @@
  231. +#
  232. +# Copyright (C) 2013 OpenWrt.org
  233. +#
  234. +# This is free software, licensed under the GNU General Public License v2.
  235. +# See /LICENSE for more information.
  236. +#
  237. +define Profile/GLINET
  238. + NAME:=GL.iNet 6416
  239. + PACKAGES:=kmod-usb-core kmod-usb2
  240. +endef
  241. +
  242. +define Profile/GLINET/Description
  243. + Package set optimized for the GL-Connect GL.iNet v1.
  244. +endef
  245. +
  246. +$(eval $(call Profile,GLINET))
  247. +
  248. +define Profile/GL-AR150
  249. + NAME:=GL AR150
  250. + PACKAGES:=kmod-usb-core kmod-usb2
  251. +endef
  252. +
  253. +define Profile/GL-AR150/Description
  254. + Configuration of GL AR150.
  255. +endef
  256. +
  257. +$(eval $(call Profile,GL-AR150))
  258. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  259. index 06dbb77..a35ded9 100644
  260. --- a/target/linux/ar71xx/image/Makefile
  261. +++ b/target/linux/ar71xx/image/Makefile
  262. @@ -144,6 +144,14 @@ define Device/weio
  263. endef
  264. TARGET_DEVICES += weio
  265. +define Device/gl-ar150
  266. + BOARDNAME = GL-AR150
  267. + IMAGE_SIZE = 16000k
  268. + CONSOLE = ttyATH0,115200
  269. + MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
  270. +endef
  271. +TARGET_DEVICES += gl-ar150
  272. +
  273. define Device/wndr3700
  274. BOARDNAME = WNDR3700
  275. NETGEAR_KERNEL_MAGIC = 0x33373030
  276. diff --git a/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
  277. new file mode 100644
  278. index 0000000..31db581
  279. --- /dev/null
  280. +++ b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
  281. @@ -0,0 +1,39 @@
  282. +--- a/arch/mips/ath79/Kconfig
  283. ++++ b/arch/mips/ath79/Kconfig
  284. +@@ -533,6 +533,16 @@ config ATH79_MACH_GL_INET
  285. + select ATH79_DEV_USB
  286. + select ATH79_DEV_WMAC
  287. +
  288. ++config ATH79_MACH_GL_AR150
  289. ++ bool "GL AR150 support"
  290. ++ select SOC_AR933X
  291. ++ select ATH79_DEV_ETH
  292. ++ select ATH79_DEV_GPIO_BUTTONS
  293. ++ select ATH79_DEV_LEDS_GPIO
  294. ++ select ATH79_DEV_M25P80
  295. ++ select ATH79_DEV_USB
  296. ++ select ATH79_DEV_WMAC
  297. ++
  298. + config ATH79_MACH_EAP300V2
  299. + bool "EnGenius EAP300 v2 support"
  300. + select SOC_AR934X
  301. +--- a/arch/mips/ath79/Makefile
  302. ++++ b/arch/mips/ath79/Makefile
  303. +@@ -78,6 +78,7 @@ obj-$(CONFIG_ATH79_MACH_EL_MINI) += mach
  304. + obj-$(CONFIG_ATH79_MACH_EPG5000) += mach-epg5000.o
  305. + obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o
  306. + obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o
  307. ++obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o
  308. + obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o
  309. + obj-$(CONFIG_ATH79_MACH_GS_MINIBOX_V1) += mach-gs-minibox-v1.o
  310. + obj-$(CONFIG_ATH79_MACH_GS_OOLITE) += mach-gs-oolite.o
  311. +--- a/arch/mips/ath79/machtypes.h
  312. ++++ b/arch/mips/ath79/machtypes.h
  313. +@@ -67,6 +67,7 @@ enum ath79_mach_type {
  314. + ATH79_MACH_ESR1750, /* EnGenius ESR1750 */
  315. + ATH79_MACH_EPG5000, /* EnGenius EPG5000 */
  316. + ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */
  317. ++ ATH79_MACH_GL_AR150, /* GL-AR150 support */
  318. + ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */
  319. + ATH79_MACH_GS_MINIBOX_V1, /* Gainstrong MiniBox V1.0 */
  320. + ATH79_MACH_GS_OOLITE, /* GS OOLITE V1.0 */