From: Matthias Schiffer Date: Fri, 13 May 2016 20:47:26 +0200 Subject: ar71xx: Support for Ubiquiti UniFi AP AC LITE Add support for the Ubiquiti UniFi AP AC LITE Signed-off-by: P.Wassi Backport of OpenWrt r48711 diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 486879f..3adc449 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -309,7 +309,8 @@ get_status_led() { unifi) status_led="ubnt:green:dome" ;; - uap-pro) + uap-pro | \ + unifiac) status_led="ubnt:white:dome" ;; unifi-outdoor-plus) diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index 032c671..a79376a 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -369,6 +369,7 @@ tl-wa901nd-v3 |\ tl-wa901nd-v4 |\ tl-wr703n |\ tube2h |\ +unifiac |\ wndap360 |\ mynet-rext |\ wp543) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 4780e2f..0fd139c 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -902,6 +902,9 @@ ar71xx_board_detect() { *UniFi) name="unifi" ;; + *"UniFi-AC") + name="unifiac" + ;; *"UniFi AP Pro") name="uap-pro" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 024e493..fff1c3c 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -252,6 +252,7 @@ platform_check_image() { wlae-ag300n | \ nbg460n_550n_550nh | \ unifi | \ + unifiac | \ unifi-outdoor | \ carambola2 | \ weio ) diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 index e0d52d9..a068cc5 100644 --- a/target/linux/ar71xx/config-3.18 +++ b/target/linux/ar71xx/config-3.18 @@ -141,6 +141,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y CONFIG_ATH79_MACH_TL_WR941ND_V6=y CONFIG_ATH79_MACH_TUBE2H=y CONFIG_ATH79_MACH_UBNT=y +CONFIG_ATH79_MACH_UBNT_UNIFIAC=y CONFIG_ATH79_MACH_UBNT_XM=y CONFIG_ATH79_MACH_WEIO=y CONFIG_ATH79_MACH_WHR_HP_G300N=y @@ -324,7 +325,7 @@ CONFIG_SOC_AR933X=y CONFIG_SOC_AR934X=y CONFIG_SOC_QCA953X=y CONFIG_SOC_QCA955X=y -# CONFIG_SOC_QCA956X is not set +CONFIG_SOC_QCA956X=y CONFIG_SPI=y CONFIG_SPI_AP83=y CONFIG_SPI_ATH79=y 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 new file mode 100644 index 0000000..3617ca7 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c @@ -0,0 +1,109 @@ +/* + * Ubiquiti UniFi AC (LITE) board support + * + * Copyright (C) 2015-2016 P. Wassi + * + * Derived from: mach-ubnt-xm.c + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-wmac.h" +#include "machtypes.h" + + +#define UNIFIAC_KEYS_POLL_INTERVAL 20 +#define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL) + +#define UNIFIAC_GPIO_LED_WHITE 7 +#define UNIFIAC_GPIO_LED_BLUE 8 + +#define UNIFIAC_GPIO_BTN_RESET 2 + +#define UNIFIAC_MAC0_OFFSET 0x0000 +#define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000 +#define UNIFIAC_PCI_CALDATA_OFFSET 0x5000 + + +static struct flash_platform_data ubnt_unifiac_flash_data = { + /* mx25l12805d and mx25l12835f have the same JEDEC ID */ + .type = "mx25l12805d", +}; + +static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = { + { + .name = "ubnt:white:dome", + .gpio = UNIFIAC_GPIO_LED_WHITE, + .active_low = 0, + }, { + .name = "ubnt:blue:dome", + .gpio = UNIFIAC_GPIO_LED_BLUE, + .active_low = 0, + } +}; + +static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL, + .gpio = UNIFIAC_GPIO_BTN_RESET, + .active_low = 1, + } +}; + +static void __init ubnt_unifiac_setup(void) +{ + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(&ubnt_unifiac_flash_data); + + + ath79_init_mac(ath79_eth0_data.mac_addr, + eeprom + UNIFIAC_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_pll_data.pll_10 = 0x00001313; + + ath79_register_mdio(0, ~BIT(4)); + ath79_register_eth(0); + + + ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); + + + ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); + + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), + ubnt_unifiac_leds_gpio); + + ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ubnt_unifiac_gpio_keys), + ubnt_unifiac_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC", + ubnt_unifiac_setup); diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk index d8e24d0..94eff18 100644 --- a/target/linux/ar71xx/generic/profiles/ubnt.mk +++ b/target/linux/ar71xx/generic/profiles/ubnt.mk @@ -38,6 +38,17 @@ endef $(eval $(call Profile,UBNTUNIFI)) +define Profile/UBNTUNIFIAC + NAME:=Ubiquiti UniFi AP AC + PACKAGES:=kmod-ath10k ath10k-firmware-qca988x +endef + +define Profile/UBNTUNIFIAC/Description + Package set optimized for the Ubiquiti UniFi AP AC. +endef + +$(eval $(call Profile,UBNTUNIFIAC)) + define Profile/UBNTUNIFIOUTDOOR NAME:=Ubiquiti UniFiAP Outdoor PACKAGES:= diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 0783381..aaaf89a 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -740,6 +740,16 @@ define Device/oolite endef TARGET_DEVICES += oolite +define Device/ubnt-unifiac + DEVICE_PROFILE := UBNT UBNTUNIFIAC + IMAGE_SIZE := 7744k + MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + BOARDNAME := UBNT-UF-AC +endef +TARGET_DEVICES += ubnt-unifiac + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) # $(1): rootfs type. diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index b8a7bf1..2b1fe24 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -97,6 +97,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y # CONFIG_ATH79_MACH_TUBE2H is not set # CONFIG_ATH79_MACH_UBNT is not set # CONFIG_ATH79_MACH_UBNT_XM is not set +# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set # CONFIG_ATH79_MACH_WHR_HP_G300N is not set # CONFIG_ATH79_MACH_WLAE_AG300N is not set # CONFIG_ATH79_MACH_WLR8100 is not set diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default index 626d676..f62cf1a 100644 --- a/target/linux/ar71xx/nand/config-default +++ b/target/linux/ar71xx/nand/config-default @@ -59,6 +59,7 @@ # CONFIG_ATH79_MACH_TL_WR941ND is not set # CONFIG_ATH79_MACH_UBNT is not set # CONFIG_ATH79_MACH_UBNT_XM is not set +# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set # CONFIG_ATH79_MACH_WHR_HP_G300N is not set # CONFIG_ATH79_MACH_WLAE_AG300N is not set # CONFIG_ATH79_MACH_WNDAP360 is not set 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 index 76aeb94..27dc73f 100644 --- 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 @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,22 +16,200 @@ +@@ -16,22 +16,201 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -165,6 +165,7 @@ + ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ ++ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */ ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ @@ -1098,10 +1099,7 @@ + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC - --config ATH79_MACH_AP136 -- bool "Atheros AP136/AP135 reference board" -- select SOC_QCA955X ++ +config ATH79_MACH_TL_WA7210N_V2 + bool "TP-LINK TL-WA7210N v2 support" + select SOC_AR724X @@ -1116,19 +1114,12 @@ + bool "TP-LINK TL-WA830RE v2 support" + select SOC_AR934X + select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_NFC -- select ATH79_DEV_SPI ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros AP136 or AP135 reference boards. - --config ATH79_MACH_AP81 -- bool "Atheros AP81 reference board" ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++ +config ATH79_MACH_TL_WA901ND + bool "TP-LINK TL-WA901ND/TL-WA7510N support" + select SOC_AR724X @@ -1140,11 +1131,11 @@ + +config ATH79_MACH_TL_WA901ND_V2 + bool "TP-LINK TL-WA901ND v2 support" - select SOC_AR913X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 ++ select SOC_AR913X ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + +config ATH79_MACH_TL_WDR3500 @@ -1155,34 +1146,13 @@ + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros AP81 reference board. - --config ATH79_MACH_DB120 -- bool "Atheros DB120 reference board" ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++ +config ATH79_MACH_TL_WDR4300 + bool "TP-LINK TL-WDR3600/4300/4310 board support" - select SOC_AR934X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 -- select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros DB120 reference board. - --config ATH79_MACH_PB44 -- bool "Atheros PB44 reference board" -+config ATH79_MACH_TL_WR703N -+ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" -+ select SOC_AR933X ++ select SOC_AR934X ++ select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO @@ -1190,8 +1160,8 @@ + select ATH79_DEV_USB + select ATH79_DEV_WMAC + -+config ATH79_MACH_TL_WR720N_V3 -+ bool "TP-LINK TL-WR720N v3/v4 support" ++config ATH79_MACH_TL_WR703N ++ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" + select SOC_AR933X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS @@ -1199,7 +1169,28 @@ + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC -+ + +-config ATH79_MACH_AP136 +- bool "Atheros AP136/AP135 reference board" +- select SOC_QCA955X ++config ATH79_MACH_TL_WR720N_V3 ++ bool "TP-LINK TL-WR720N v3/v4 support" ++ select SOC_AR933X ++ select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO +- select ATH79_DEV_NFC +- select ATH79_DEV_SPI ++ select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC +- help +- Say 'Y' here if you want your kernel to support the +- Atheros AP136 or AP135 reference boards. + +-config ATH79_MACH_AP81 +- bool "Atheros AP81 reference board" +- select SOC_AR913X +config ATH79_MACH_TL_WR741ND + bool "TP-LINK TL-WR741ND support" + select SOC_AR724X @@ -1212,21 +1203,25 @@ +config ATH79_MACH_TL_WR741ND_V4 + bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support" + select SOC_AR933X -+ select ATH79_DEV_ETH -+ select ATH79_DEV_GPIO_BUTTONS -+ select ATH79_DEV_LEDS_GPIO -+ select ATH79_DEV_M25P80 -+ select ATH79_DEV_USB -+ select ATH79_DEV_WMAC -+ -+config ATH79_MACH_TL_WR841N_V1 -+ bool "TP-LINK TL-WR841N v1 support" - select SOC_AR71XX -+ select ATH79_DEV_DSA select ATH79_DEV_ETH select ATH79_DEV_GPIO_BUTTONS select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_DEV_WMAC +- help +- Say 'Y' here if you want your kernel to support the +- Atheros AP81 reference board. + +-config ATH79_MACH_DB120 +- bool "Atheros DB120 reference board" ++config ATH79_MACH_TL_WR841N_V1 ++ bool "TP-LINK TL-WR841N v1 support" ++ select SOC_AR71XX ++ select ATH79_DEV_DSA ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + +config ATH79_MACH_TL_WR841N_V8 @@ -1269,15 +1264,21 @@ + +config ATH79_MACH_TL_WR1041N_V2 + bool "TP-LINK TL-WR1041N v2 support" -+ select SOC_AR934X -+ select ATH79_DEV_AP9X_PCI if PCI -+ select ATH79_DEV_ETH -+ select ATH79_DEV_GPIO_BUTTONS -+ select ATH79_DEV_LEDS_GPIO -+ select ATH79_DEV_M25P80 -+ select ATH79_DEV_USB -+ select ATH79_DEV_WMAC -+ + select SOC_AR934X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 +- select ATH79_DEV_NFC + select ATH79_DEV_USB + select ATH79_DEV_WMAC +- help +- Say 'Y' here if you want your kernel to support the +- Atheros DB120 reference board. + +-config ATH79_MACH_PB44 +- bool "Atheros PB44 reference board" +config ATH79_MACH_TL_WR1043ND + bool "TP-LINK TL-WR1043ND support" + select SOC_AR913X @@ -1320,11 +1321,12 @@ + +config ATH79_MACH_TEW_673GRU + bool "TRENDnet TEW-673GRU support" -+ select SOC_AR71XX + select SOC_AR71XX + select ATH79_DEV_AP9X_PCI if PCI -+ select ATH79_DEV_ETH -+ select ATH79_DEV_GPIO_BUTTONS -+ select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO +- select ATH79_DEV_SPI + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + select ATH79_NVRAM @@ -1362,10 +1364,20 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM/UniFi boards" -@@ -83,6 +1144,106 @@ config ATH79_MACH_UBNT_XM +@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. ++config ATH79_MACH_UBNT_UNIFIAC ++ bool "Ubiquiti UniFi AC (LITE) support" ++ select SOC_QCA956X ++ select ATH79_DEV_AP9X_PCI if PCI ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +config ATH79_MACH_WEIO + bool "WeIO board" + select SOC_AR933X @@ -1469,7 +1481,7 @@ endmenu config SOC_AR71XX -@@ -124,7 +1285,10 @@ config ATH79_DEV_DSA +@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -1481,7 +1493,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -154,6 +1318,11 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP def_bool n config ATH79_ROUTERBOOT @@ -1495,7 +1507,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,128 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -1597,6 +1609,7 @@ +obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.o +obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o +obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o ++obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o +obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o