0041-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Fri, 13 May 2016 21:34:05 +0200
  3. Subject: ar71xx: Add support for Ubiquiti UniFi AP AC PRO
  4. Add support for the Ubiquiti UniFi AP AC PRO
  5. Signed-off-by: P.Wassi <p.wassi at gmx.at>
  6. Backport of LEDE 8307c2fe686ded345c80318359d5b6679e581fa2
  7. diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
  8. index 924c116..cb92349 100644
  9. --- a/target/linux/ar71xx/base-files/etc/diag.sh
  10. +++ b/target/linux/ar71xx/base-files/etc/diag.sh
  11. @@ -310,7 +310,8 @@ get_status_led() {
  12. status_led="ubnt:green:dome"
  13. ;;
  14. uap-pro | \
  15. - unifiac-lite)
  16. + unifiac-lite | \
  17. + unifiac-pro)
  18. status_led="ubnt:white:dome"
  19. ;;
  20. unifi-outdoor-plus)
  21. diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
  22. index 7777734..5eb20bb 100644
  23. --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
  24. +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
  25. @@ -81,7 +81,8 @@ case "$FIRMWARE" in
  26. ath10kcal_extract "ART" 20480 2116
  27. ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
  28. ;;
  29. - unifiac-lite)
  30. + unifiac-lite | \
  31. + unifiac-pro)
  32. ath10kcal_extract "EEPROM" 20480 2116
  33. ;;
  34. esac
  35. diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  36. index 2007042..b59844e 100755
  37. --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  38. +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
  39. @@ -401,6 +401,13 @@ wpj344)
  40. ucidef_add_switch_vlan "switch0" "2" "0t 2"
  41. ;;
  42. +unifiac-pro)
  43. + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
  44. + ucidef_add_switch "switch0" "1" "1"
  45. + ucidef_add_switch_vlan "switch0" "1" "0t 2"
  46. + ucidef_add_switch_vlan "switch0" "2" "0t 3"
  47. + ;;
  48. +
  49. wpj531)
  50. ucidef_set_interfaces_lan_wan "eth0" "eth1"
  51. ;;
  52. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  53. index a8d8896..28f07b8 100755
  54. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  55. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  56. @@ -905,6 +905,9 @@ ar71xx_board_detect() {
  57. *"UniFi-AC-LITE")
  58. name="unifiac-lite"
  59. ;;
  60. + *"UniFi-AC-PRO")
  61. + name="unifiac-pro"
  62. + ;;
  63. *"UniFi AP Pro")
  64. name="uap-pro"
  65. ;;
  66. diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  67. index 90f961f..0228f14 100755
  68. --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  69. +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  70. @@ -253,6 +253,7 @@ platform_check_image() {
  71. nbg460n_550n_550nh | \
  72. unifi | \
  73. unifiac-lite | \
  74. + unifiac-pro | \
  75. unifi-outdoor | \
  76. carambola2 | \
  77. weio )
  78. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
  79. index 31cbe30..9194bc1 100644
  80. --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
  81. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
  82. @@ -21,6 +21,7 @@
  83. #include <asm/mach-ath79/ar71xx_regs.h>
  84. #include <linux/platform_data/phy-at803x.h>
  85. +#include <linux/ar8216_platform.h>
  86. #include "common.h"
  87. #include "dev-ap9x-pci.h"
  88. @@ -29,6 +30,7 @@
  89. #include "dev-leds-gpio.h"
  90. #include "dev-m25p80.h"
  91. #include "dev-wmac.h"
  92. +#include "dev-usb.h"
  93. #include "machtypes.h"
  94. @@ -108,3 +110,70 @@ static void __init ubnt_unifiac_lite_setup(void)
  95. MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE",
  96. ubnt_unifiac_lite_setup);
  97. +
  98. +static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = {
  99. + .mode = AR8327_PAD_MAC_SGMII,
  100. + .sgmii_delay_en = true,
  101. +};
  102. +
  103. +static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = {
  104. + .pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg,
  105. + .port0_cfg = {
  106. + .force_link = 1,
  107. + .speed = AR8327_PORT_SPEED_1000,
  108. + .duplex = 1,
  109. + .txpause = 1,
  110. + .rxpause = 1,
  111. + },
  112. +};
  113. +
  114. +
  115. +static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = {
  116. + {
  117. + .bus_id = "ag71xx-mdio.0",
  118. + .phy_addr = 0,
  119. + .platform_data = &ubnt_unifiac_pro_ar8327_data,
  120. + },
  121. +};
  122. +
  123. +static void __init ubnt_unifiac_pro_setup(void)
  124. +{
  125. + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
  126. +
  127. + ath79_register_m25p80(&ubnt_unifiac_flash_data);
  128. +
  129. +
  130. + ath79_init_mac(ath79_eth0_data.mac_addr,
  131. + eeprom + UNIFIAC_MAC0_OFFSET, 0);
  132. +
  133. + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
  134. + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  135. + ath79_eth0_data.phy_mask = BIT(0);
  136. +
  137. + mdiobus_register_board_info(ubnt_unifiac_pro_mdio0_info,
  138. + ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info));
  139. +
  140. + ath79_register_mdio(0, 0x00);
  141. + ath79_register_eth(0);
  142. +
  143. +
  144. + ath79_register_usb();
  145. +
  146. +
  147. + ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL);
  148. +
  149. +
  150. + ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL);
  151. +
  152. +
  153. + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
  154. + ubnt_unifiac_leds_gpio);
  155. +
  156. + ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL,
  157. + ARRAY_SIZE(ubnt_unifiac_gpio_keys),
  158. + ubnt_unifiac_gpio_keys);
  159. +}
  160. +
  161. +
  162. +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_PRO, "UBNT-UF-AC-PRO", "Ubiquiti UniFi-AC-PRO",
  163. + ubnt_unifiac_pro_setup);
  164. diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
  165. index eac0240..69b8398 100644
  166. --- a/target/linux/ar71xx/generic/profiles/ubnt.mk
  167. +++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
  168. @@ -49,6 +49,17 @@ endef
  169. $(eval $(call Profile,UBNTUNIFIACLITE))
  170. +define Profile/UBNTUNIFIACPRO
  171. + NAME:=Ubiquiti UniFi AP AC PRO
  172. + PACKAGES:=kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2
  173. +endef
  174. +
  175. +define Profile/UBNTUNIFIACPRO/Description
  176. + Package set optimized for the Ubiquiti UniFi AP AC PRO.
  177. +endef
  178. +
  179. +$(eval $(call Profile,UBNTUNIFIACPRO))
  180. +
  181. define Profile/UBNTUNIFIOUTDOOR
  182. NAME:=Ubiquiti UniFiAP Outdoor
  183. PACKAGES:=
  184. diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
  185. index 42ffc69..7c648f2 100644
  186. --- a/target/linux/ar71xx/image/Makefile
  187. +++ b/target/linux/ar71xx/image/Makefile
  188. @@ -753,7 +753,13 @@ define Device/ubnt-unifiac-lite
  189. DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
  190. BOARDNAME := UBNT-UF-AC-LITE
  191. endef
  192. -TARGET_DEVICES += ubnt-unifiac-lite
  193. +
  194. +define Device/ubnt-unifiac-pro
  195. + $(Device/ubnt-unifiac)
  196. + DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
  197. + BOARDNAME := UBNT-UF-AC-PRO
  198. +endef
  199. +TARGET_DEVICES += ubnt-unifiac-lite ubnt-unifiac-pro
  200. rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
  201. 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
  202. index 9a28f58..debde6e 100644
  203. --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  204. +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
  205. @@ -1,6 +1,6 @@
  206. --- a/arch/mips/ath79/machtypes.h
  207. +++ b/arch/mips/ath79/machtypes.h
  208. -@@ -16,22 +16,201 @@
  209. +@@ -16,22 +16,202 @@
  210. enum ath79_mach_type {
  211. ATH79_MACH_GENERIC = 0,
  212. @@ -166,6 +166,7 @@
  213. ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */
  214. ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
  215. + ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */
  216. ++ ATH79_MACH_UBNT_UNIFIAC_PRO, /* Ubiquiti Unifi AC PRO */
  217. ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
  218. + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
  219. ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
  220. @@ -1364,12 +1365,12 @@
  221. config ATH79_MACH_UBNT_XM
  222. bool "Ubiquiti Networks XM/UniFi boards"
  223. -@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM
  224. +@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM
  225. Say 'Y' here if you want your kernel to support the
  226. Ubiquiti Networks XM (rev 1.0) board.
  227. +config ATH79_MACH_UBNT_UNIFIAC
  228. -+ bool "Ubiquiti UniFi AC (LITE/LR) support"
  229. ++ bool "Ubiquiti UniFi AC (LITE/LR/PRO) support"
  230. + select SOC_QCA956X
  231. + select ATH79_DEV_AP9X_PCI if PCI
  232. + select ATH79_DEV_ETH
  233. @@ -1377,6 +1378,7 @@
  234. + select ATH79_DEV_LEDS_GPIO
  235. + select ATH79_DEV_M25P80
  236. + select ATH79_DEV_WMAC
  237. ++ select ATH79_DEV_USB
  238. +
  239. +config ATH79_MACH_WEIO
  240. + bool "WeIO board"
  241. @@ -1481,7 +1483,7 @@
  242. endmenu
  243. config SOC_AR71XX
  244. -@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA
  245. +@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
  246. config ATH79_DEV_ETH
  247. def_bool n
  248. @@ -1493,7 +1495,7 @@
  249. def_bool n
  250. config ATH79_DEV_GPIO_BUTTONS
  251. -@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP
  252. +@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
  253. def_bool n
  254. config ATH79_ROUTERBOOT