Ver código fonte

ar71xx-generic: add support for UniFi AC PRO/LITE (LITE untested)

Also backport some patches improving QCA956x support.
Matthias Schiffer 8 anos atrás
pai
commit
087112a09b

+ 1 - 1
package/gluon-core/files/lib/gluon/upgrade/020-interfaces

@@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then
   local lan_ifname = uci:get('network', 'lan', 'ifname')
   local wan_ifname = uci:get('network', 'wan', 'ifname')
 
-  if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then
+  if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then
     lan_ifname, wan_ifname = wan_ifname, lan_ifname
   end
 

+ 1 - 1
package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname

@@ -8,7 +8,7 @@ if sysconfig.setup_ifname then
    os.exit(0)
 end
 
-if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then
+if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then
    sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname
 else
    sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname

+ 46 - 0
patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch

@@ -0,0 +1,46 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 20:59:44 +0200
+Subject: ath79: dev-eth: fix QCA9561 set phy interface mode and mask
+
+QCA9563 and QCA9561 are two series of Qualcomm SoC Dragonfly. The only different
+is QCA9563 w/o internal switch. It has one GMAC with SGMII interface. But they
+have the same device ID(0x1150). So they share the same codes.
+
+Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
+
+Backport of OpenWrt r46971
+
+diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+index ff94e2e..31d2438 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+@@ -633,7 +633,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
+ 		case ATH79_SOC_AR9330:
+ 		case ATH79_SOC_AR9331:
+ 		case ATH79_SOC_QCA9533:
+-		case ATH79_SOC_QCA9561:
+ 		case ATH79_SOC_TP9343:
+ 			pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
+ 			break;
+@@ -667,6 +666,11 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
+ 			}
+ 			break;
+ 
++		case ATH79_SOC_QCA9561:
++			if (!pdata->phy_if_mode)
++				pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
++			break;
++
+ 		default:
+ 			BUG();
+ 		}
+@@ -1035,7 +1039,8 @@ void __init ath79_register_eth(unsigned int id)
+ 					   AR933X_RESET_GE0_MDIO;
+ 			pdata->set_speed = ath79_set_speed_dummy;
+ 
+-			pdata->phy_mask = BIT(4);
++			if (!pdata->phy_mask)
++				pdata->phy_mask = BIT(4);
+ 		} else {
+ 			pdata->reset_bit = AR933X_RESET_GE1_MAC |
+ 					   AR933X_RESET_GE1_MDIO;

+ 33 - 0
patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch

@@ -0,0 +1,33 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 22:58:50 +0200
+Subject: ar71xx: use correct PLL configuration register bitmask for QCA956x SoC.
+
+Incorrect value causes clock inaccuracy as huge as 1/60.
+
+Signed-off-by: Dmitry Ivanov <dima@ubnt.com>
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+Backport of OpenWrt r47363
+
+diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+index b5c88e9..d3a14b2 100644
+--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+@@ -529,7 +529,7 @@
+ +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT		0
+ +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK		0x1f
+ +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT		5
+-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK		0x3fff
+++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK		0x1fff
+ +#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT		18
+ +#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK		0x1ff
+ +
+@@ -541,7 +541,7 @@
+ +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT		0
+ +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK		0x1f
+ +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT		5
+-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK		0x3fff
+++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK		0x1fff
+ +#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT		18
+ +#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK		0x1ff
+ +

+ 381 - 0
patches/openwrt/0038-ar71xx-update-QCA956x-support.patch

@@ -0,0 +1,381 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 22:18:40 +0200
+Subject: ar71xx: update QCA956x support
+
+- separate qca956x and tp9343 (they use different IDs)
+- rename qca9561->qca956x for consistency
+- add missing bits (device reset, gpio output select)
+- fix wmac setup
+
+Signed-off-by: Roman Yeryomin <roman@advem.lv>
+
+Backport of OpenWrt r47981
+
+diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+index d3a14b2..61b8976 100644
+--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+@@ -105,7 +105,7 @@
+  		qca953x_clocks_init();
+  	else if (soc_is_qca955x())
+  		qca955x_clocks_init();
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		qca956x_clocks_init();
+  	else
+  		BUG();
+@@ -116,7 +116,7 @@
+  		reg = QCA953X_RESET_REG_RESET_MODULE;
+  	else if (soc_is_qca955x())
+  		reg = QCA955X_RESET_REG_RESET_MODULE;
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		reg = QCA956X_RESET_REG_RESET_MODULE;
+  	else
+  		panic("Reset register not defined for this SOC");
+@@ -125,20 +125,30 @@
+  		reg = QCA953X_RESET_REG_RESET_MODULE;
+  	else if (soc_is_qca955x())
+  		reg = QCA955X_RESET_REG_RESET_MODULE;
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		reg = QCA956X_RESET_REG_RESET_MODULE;
+  	else
+  		panic("Reset register not defined for this SOC");
+  
++@@ -133,6 +137,8 @@ u32 ath79_device_reset_get(u32 mask)
++ 		reg = AR933X_RESET_REG_RESET_MODULE;
++ 	else if (soc_is_ar934x())
++ 		reg = AR934X_RESET_REG_RESET_MODULE;
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+++		reg = QCA956X_RESET_REG_RESET_MODULE;
++ 	else
++ 		BUG();
++ 
+ --- a/arch/mips/ath79/dev-common.c
+ +++ b/arch/mips/ath79/dev-common.c
+-@@ -94,7 +94,8 @@ void __init ath79_register_uart(void)
++@@ -94,7 +94,9 @@ void __init ath79_register_uart(void)
+  	    soc_is_ar913x() ||
+  	    soc_is_ar934x() ||
+  	    soc_is_qca953x() ||
+ -	    soc_is_qca955x()) {
+ +	    soc_is_qca955x() ||
+-+	    soc_is_qca956x()) {
+++	    soc_is_qca956x() ||
+++	    soc_is_tp9343()) {
+  		ath79_uart_data[0].uartclk = uart_clk_rate;
+  		platform_device_register(&ath79_uart_device);
+  	} else if (soc_is_ar933x()) {
+@@ -168,14 +178,14 @@
+  		qca953x_usb_setup();
+  	else if (soc_is_qca955x())
+  		qca955x_usb_setup();
+-+	else if (soc_is_qca9561())
+++	else if (soc_is_qca956x())
+ +		qca956x_usb_setup();
+  	else
+  		BUG();
+  }
+ --- a/arch/mips/ath79/dev-wmac.c
+ +++ b/arch/mips/ath79/dev-wmac.c
+-@@ -189,6 +189,24 @@ static void qca955x_wmac_setup(void)
++@@ -189,6 +189,26 @@ static void qca955x_wmac_setup(void)
+  		ath79_wmac_data.is_clk_25mhz = true;
+  }
+  
+@@ -195,16 +205,18 @@
+ +		ath79_wmac_data.is_clk_25mhz = false;
+ +	else
+ +		ath79_wmac_data.is_clk_25mhz = true;
+++
+++	ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision;
+ +}
+ +
+  static bool __init
+  ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
+  {
+-@@ -392,6 +410,8 @@ void __init ath79_register_wmac(u8 *cal_
++@@ -392,6 +412,8 @@ void __init ath79_register_wmac(u8 *cal_
+  		qca953x_wmac_setup();
+  	else if (soc_is_qca955x())
+  		qca955x_wmac_setup();
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		qca956x_wmac_setup();
+  	else
+  		BUG();
+@@ -216,27 +228,38 @@
+  	case REV_ID_MAJOR_QCA9556:
+  	case REV_ID_MAJOR_QCA9558:
+ +	case REV_ID_MAJOR_TP9343:
+-+	case REV_ID_MAJOR_QCA9561:
+++	case REV_ID_MAJOR_QCA956X:
+  		_prom_putchar = prom_putchar_ar71xx;
+  		break;
+  
+ --- a/arch/mips/ath79/gpio.c
+ +++ b/arch/mips/ath79/gpio.c
+-@@ -148,7 +148,8 @@ static void __iomem *ath79_gpio_get_func
++@@ -148,7 +148,10 @@ static void __iomem *ath79_gpio_get_func
+  	    soc_is_ar913x() ||
+  	    soc_is_ar933x())
+  		reg = AR71XX_GPIO_REG_FUNC;
+ -	else if (soc_is_ar934x() || soc_is_qca953x())
+ +	else if (soc_is_ar934x() ||
+-+		 soc_is_qca953x() || soc_is_qca956x())
+++		 soc_is_qca953x() ||
+++		 soc_is_qca956x() ||
+++		 soc_is_tp9343())
+  		reg = AR934X_GPIO_REG_FUNC;
+  	else
+  		BUG();
+-@@ -228,12 +229,15 @@ void __init ath79_gpio_init(void)
++@@ -187,7 +190,7 @@ void __init ath79_gpio_output_select(uns
++ 	unsigned int reg;
++ 	u32 t, s;
++ 
++-	BUG_ON(!soc_is_ar934x() && !soc_is_qca953x());
+++	BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
++ 
++ 	if (gpio >= AR934X_GPIO_COUNT)
++ 		return;
++@@ -228,12 +231,15 @@ void __init ath79_gpio_init(void)
+  		ath79_gpio_count = QCA953X_GPIO_COUNT;
+  	else if (soc_is_qca955x())
+  		ath79_gpio_count = QCA955X_GPIO_COUNT;
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		ath79_gpio_count = QCA956X_GPIO_COUNT;
+  	else
+  		BUG();
+@@ -245,23 +268,24 @@
+  	ath79_gpio_chip.ngpio = ath79_gpio_count;
+ -	if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x()) {
+ +	if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x() ||
+-+	    soc_is_qca956x()) {
+++	    soc_is_qca956x() || soc_is_tp9343()) {
+  		ath79_gpio_chip.direction_input = ar934x_gpio_direction_input;
+  		ath79_gpio_chip.direction_output = ar934x_gpio_direction_output;
+  	}
+ --- a/arch/mips/ath79/irq.c
+ +++ b/arch/mips/ath79/irq.c
+-@@ -107,7 +107,8 @@ static void __init ath79_misc_irq_init(v
++@@ -107,7 +107,9 @@ static void __init ath79_misc_irq_init(v
+  		 soc_is_ar933x() ||
+  		 soc_is_ar934x() ||
+  		 soc_is_qca953x() ||
+ -		 soc_is_qca955x())
+ +		 soc_is_qca955x() ||
+-+		 soc_is_qca956x())
+++		 soc_is_qca956x() ||
+++		 soc_is_tp9343())
+  		ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack;
+  	else
+  		BUG();
+-@@ -268,6 +269,97 @@ static void qca955x_irq_init(void)
++@@ -268,6 +270,97 @@ static void qca955x_irq_init(void)
+  	irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
+  }
+  
+@@ -359,21 +383,21 @@
+  asmlinkage void plat_irq_dispatch(void)
+  {
+  	unsigned long pending;
+-@@ -397,6 +489,9 @@ void __init arch_init_irq(void)
++@@ -397,6 +490,9 @@ void __init arch_init_irq(void)
+  	} else if (soc_is_qca955x()) {
+  		ath79_ip2_handler = ath79_default_ip2_handler;
+  		ath79_ip3_handler = ath79_default_ip3_handler;
+-+	} else if (soc_is_qca956x()) {
+++	} else if (soc_is_qca956x() || soc_is_tp9343()) {
+ +		ath79_ip2_handler = ath79_default_ip2_handler;
+ +		ath79_ip3_handler = ath79_default_ip3_handler;
+  	} else {
+  		BUG();
+  	}
+-@@ -411,4 +506,6 @@ void __init arch_init_irq(void)
++@@ -411,4 +507,6 @@ void __init arch_init_irq(void)
+  		qca953x_irq_init();
+  	else if (soc_is_qca955x())
+  		qca955x_irq_init();
+-+	else if (soc_is_qca956x())
+++	else if (soc_is_qca956x() || soc_is_tp9343())
+ +		qca956x_irq_init();
+  }
+ --- a/arch/mips/ath79/Kconfig
+@@ -428,7 +452,7 @@
+  		} else if (soc_is_qca955x()) {
+  			ath79_pci_irq_map = qca955x_pci_irq_map;
+  			ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map);
+-+		} else if (soc_is_qca9561()) {
+++		} else if (soc_is_qca956x()) {
+ +			ath79_pci_irq_map = qca956x_pci_irq_map;
+ +			ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map);
+  		} else {
+@@ -438,7 +462,7 @@
+  						 QCA955X_PCI_MEM_SIZE,
+  						 1,
+  						 ATH79_IP3_IRQ(2));
+-+	} else if (soc_is_qca9561()) {
+++	} else if (soc_is_qca956x()) {
+ +		pdev = ath79_register_pci_ar724x(0,
+ +						 QCA956X_PCI_CFG_BASE1,
+ +						 QCA956X_PCI_CTRL_BASE1,
+@@ -456,15 +480,15 @@
+  		rev = id & QCA955X_REV_ID_REVISION_MASK;
+  		break;
+  
+-+	case REV_ID_MAJOR_TP9343:
+-+		ath79_soc = ATH79_SOC_TP9343;
+-+		chip = "9343";
+++	case REV_ID_MAJOR_QCA956X:
+++		ath79_soc = ATH79_SOC_QCA956X;
+++		chip = "956X";
+ +		rev = id & QCA956X_REV_ID_REVISION_MASK;
+ +		break;
+ +
+-+	case REV_ID_MAJOR_QCA9561:
+-+		ath79_soc = ATH79_SOC_QCA9561;
+-+		chip = "9561";
+++	case REV_ID_MAJOR_TP9343:
+++		ath79_soc = ATH79_SOC_TP9343;
+++		chip = "9343";
+ +		rev = id & QCA956X_REV_ID_REVISION_MASK;
+ +		break;
+ +
+@@ -476,7 +500,7 @@
+  		ath79_soc_rev = rev;
+  
+ -	if (soc_is_qca953x() || soc_is_qca955x())
+-+	if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561())
+++	if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x())
+  		sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
+  			chip, ver, rev);
+ +	else if (soc_is_tp9343())
+@@ -511,7 +535,21 @@
+  #define AR9300_OTP_BASE		0x14000
+  #define AR9300_OTP_STATUS	0x15f18
+  #define AR9300_OTP_STATUS_TYPE		0x7
+-@@ -375,6 +392,49 @@
++@@ -152,6 +169,13 @@
++ #define AR9300_OTP_READ_DATA	0x15f1c
++ 
++ /*
+++ * Hidden Registers
+++ */
+++#define QCA956X_DAM_RESET_OFFSET	0xb90001bc
+++#define QCA956X_DAM_RESET_SIZE		0x4
+++#define QCA956X_INLINE_CHKSUM_ENG	BIT(27)
+++
+++/*
++  * DDR_CTRL block
++  */
++ #define AR71XX_DDR_REG_PCI_WIN0		0x7c
++@@ -375,6 +399,49 @@
+  #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL		BIT(21)
+  #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
+  
+@@ -561,7 +599,7 @@
+  /*
+   * USB_CONFIG block
+   */
+-@@ -422,6 +482,11 @@
++@@ -422,6 +489,11 @@
+  #define QCA955X_RESET_REG_BOOTSTRAP		0xb0
+  #define QCA955X_RESET_REG_EXT_INT_STATUS	0xac
+  
+@@ -573,7 +611,7 @@
+  #define MISC_INT_ETHSW			BIT(12)
+  #define MISC_INT_TIMER4			BIT(10)
+  #define MISC_INT_TIMER3			BIT(9)
+-@@ -596,6 +661,8 @@
++@@ -596,6 +668,8 @@
+  
+  #define QCA955X_BOOTSTRAP_REF_CLK_40	BIT(4)
+  
+@@ -582,7 +620,7 @@
+  #define AR934X_PCIE_WMAC_INT_WMAC_MISC		BIT(0)
+  #define AR934X_PCIE_WMAC_INT_WMAC_TX		BIT(1)
+  #define AR934X_PCIE_WMAC_INT_WMAC_RXLP		BIT(2)
+-@@ -663,6 +730,37 @@
++@@ -663,6 +737,37 @@
+  	 QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
+  	 QCA955X_EXT_INT_PCIE_RC2_INT3)
+  
+@@ -620,16 +658,16 @@
+  #define REV_ID_MAJOR_MASK		0xfff0
+  #define REV_ID_MAJOR_AR71XX		0x00a0
+  #define REV_ID_MAJOR_AR913X		0x00b0
+-@@ -678,6 +776,8 @@
++@@ -678,6 +783,8 @@
+  #define REV_ID_MAJOR_QCA9533_V2		0x0160
+  #define REV_ID_MAJOR_QCA9556		0x0130
+  #define REV_ID_MAJOR_QCA9558		0x1130
+ +#define REV_ID_MAJOR_TP9343		0x0150
+-+#define REV_ID_MAJOR_QCA9561		0x1150
+++#define REV_ID_MAJOR_QCA956X		0x1150
+  
+  #define AR71XX_REV_ID_MINOR_MASK	0x3
+  #define AR71XX_REV_ID_MINOR_AR7130	0x0
+-@@ -702,6 +802,8 @@
++@@ -702,6 +809,8 @@
+  
+  #define QCA955X_REV_ID_REVISION_MASK	0xf
+  
+@@ -638,7 +676,7 @@
+  /*
+   * SPI block
+   */
+-@@ -766,6 +868,19 @@
++@@ -766,6 +875,19 @@
+  #define QCA953X_GPIO_OUT_MUX_LED_LINK4		44
+  #define QCA953X_GPIO_OUT_MUX_LED_LINK5		45
+  
+@@ -658,7 +696,7 @@
+  #define AR71XX_GPIO_COUNT		16
+  #define AR7240_GPIO_COUNT		18
+  #define AR7241_GPIO_COUNT		20
+-@@ -774,6 +889,7 @@
++@@ -774,6 +896,7 @@
+  #define AR934X_GPIO_COUNT		23
+  #define QCA953X_GPIO_COUNT		18
+  #define QCA955X_GPIO_COUNT		24
+@@ -673,11 +711,11 @@
+  	ATH79_SOC_QCA9556,
+  	ATH79_SOC_QCA9558,
+ +	ATH79_SOC_TP9343,
+-+	ATH79_SOC_QCA9561,
+++	ATH79_SOC_QCA956X,
+  };
+  
+  extern enum ath79_soc_type ath79_soc;
+-@@ -126,6 +128,21 @@ static inline int soc_is_qca955x(void)
++@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void)
+  	return soc_is_qca9556() || soc_is_qca9558();
+  }
+  
+@@ -685,15 +723,20 @@
+ +{
+ +	return ath79_soc == ATH79_SOC_TP9343;
+ +}
+-+ 
+++
+ +static inline int soc_is_qca9561(void)
+ +{
+-+	return ath79_soc == ATH79_SOC_QCA9561;
+++	return ath79_soc == ATH79_SOC_QCA956X;
+++}
+++
+++static inline int soc_is_qca9563(void)
+++{
+++	return ath79_soc == ATH79_SOC_QCA956X;
+ +}
+ +
+ +static inline int soc_is_qca956x(void)
+ +{
+-+	return soc_is_tp9343() || soc_is_qca9561();
+++	return soc_is_qca9561() || soc_is_qca9563();
+ +}
+ +
+  extern void __iomem *ath79_ddr_base;

+ 176 - 0
patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch

@@ -0,0 +1,176 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:00:16 +0200
+Subject: ar71xx: fold patch 622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch into files/
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+Backport of OpenWrt r48650
+
+diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+index 31d2438..2efb9c7 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+@@ -198,7 +198,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 	case ATH79_SOC_AR9330:
+ 	case ATH79_SOC_AR9331:
+ 	case ATH79_SOC_QCA9533:
+-	case ATH79_SOC_QCA9561:
+ 	case ATH79_SOC_TP9343:
+ 		mdio_dev = &ath79_mdio1_device;
+ 		mdio_data = &ath79_mdio1_data;
+@@ -209,6 +208,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 	case ATH79_SOC_AR9344:
+ 	case ATH79_SOC_QCA9556:
+ 	case ATH79_SOC_QCA9558:
++	case ATH79_SOC_QCA956X:
+ 		if (id == 0) {
+ 			mdio_dev = &ath79_mdio0_device;
+ 			mdio_data = &ath79_mdio0_data;
+@@ -258,7 +258,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 		break;
+ 
+ 	case ATH79_SOC_QCA9533:
+-	case ATH79_SOC_QCA9561:
+ 	case ATH79_SOC_TP9343:
+ 		mdio_data->builtin_switch = 1;
+ 		break;
+@@ -268,6 +267,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 		mdio_data->is_ar934x = 1;
+ 		break;
+ 
++	case ATH79_SOC_QCA956X:
++		if (id == 1)
++			mdio_data->builtin_switch = 1;
++		break;
++
+ 	default:
+ 		break;
+ 	}
+@@ -387,6 +391,16 @@ static void qca955x_set_speed_sgmii(int speed)
+ 	iounmap(base);
+ }
+ 
++static void qca956x_set_speed_sgmii(int speed)
++{
++	void __iomem *base;
++	u32 val = ath79_get_eth_pll(0, speed);
++
++	base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
++	__raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG);
++	iounmap(base);
++}
++
+ static void ath79_set_speed_dummy(int speed)
+ {
+ }
+@@ -517,6 +531,10 @@ struct ag71xx_switch_platform_data ath79_switch_data;
+ #define AR934X_PLL_VAL_100	0x00000101
+ #define AR934X_PLL_VAL_10	0x00001616
+ 
++#define QCA956X_PLL_VAL_1000	0x03000000
++#define QCA956X_PLL_VAL_100	0x00000101
++#define QCA956X_PLL_VAL_10	0x00001919
++
+ static void __init ath79_init_eth_pll_data(unsigned int id)
+ {
+ 	struct ath79_eth_pll_data *pll_data;
+@@ -575,13 +593,18 @@ static void __init ath79_init_eth_pll_data(unsigned int id)
+ 	case ATH79_SOC_QCA9533:
+ 	case ATH79_SOC_QCA9556:
+ 	case ATH79_SOC_QCA9558:
+-	case ATH79_SOC_QCA9561:
+ 	case ATH79_SOC_TP9343:
+ 		pll_10 = AR934X_PLL_VAL_10;
+ 		pll_100 = AR934X_PLL_VAL_100;
+ 		pll_1000 = AR934X_PLL_VAL_1000;
+ 		break;
+ 
++	case ATH79_SOC_QCA956X:
++		pll_10 = QCA956X_PLL_VAL_10;
++		pll_100 = QCA956X_PLL_VAL_100;
++		pll_1000 = QCA956X_PLL_VAL_1000;
++		break;
++
+ 	default:
+ 		BUG();
+ 	}
+@@ -656,6 +679,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
+ 
+ 		case ATH79_SOC_QCA9556:
+ 		case ATH79_SOC_QCA9558:
++		case ATH79_SOC_QCA956X:
+ 			switch (pdata->phy_if_mode) {
+ 			case PHY_INTERFACE_MODE_MII:
+ 			case PHY_INTERFACE_MODE_RGMII:
+@@ -666,11 +690,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
+ 			}
+ 			break;
+ 
+-		case ATH79_SOC_QCA9561:
+-			if (!pdata->phy_if_mode)
+-				pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
+-			break;
+-
+ 		default:
+ 			BUG();
+ 		}
+@@ -699,7 +718,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
+ 		case ATH79_SOC_AR7241:
+ 		case ATH79_SOC_AR9330:
+ 		case ATH79_SOC_AR9331:
+-		case ATH79_SOC_QCA9561:
++		case ATH79_SOC_QCA956X:
+ 		case ATH79_SOC_TP9343:
+ 			pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ 			break;
+@@ -1032,7 +1051,6 @@ void __init ath79_register_eth(unsigned int id)
+ 			pdata->fifo_cfg3 = 0x01f00140;
+ 		break;
+ 
+-	case ATH79_SOC_QCA9561:
+ 	case ATH79_SOC_TP9343:
+ 		if (id == 0) {
+ 			pdata->reset_bit = AR933X_RESET_GE0_MAC |
+@@ -1100,6 +1118,34 @@ void __init ath79_register_eth(unsigned int id)
+ 			pdata->fifo_cfg3 = 0x01f00140;
+ 		break;
+ 
++	case ATH79_SOC_QCA956X:
++		if (id == 0) {
++			pdata->reset_bit = QCA955X_RESET_GE0_MAC |
++					   QCA955X_RESET_GE0_MDIO;
++			if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
++				pdata->set_speed = qca956x_set_speed_sgmii;
++			else
++				/* FIXME */
++				pdata->set_speed = ath79_set_speed_dummy;
++		} else {
++			pdata->reset_bit = QCA955X_RESET_GE1_MAC |
++					   QCA955X_RESET_GE1_MDIO;
++			/* FIXME */
++			pdata->set_speed = ath79_set_speed_dummy;
++		}
++
++		pdata->ddr_flush = ath79_ddr_no_flush;
++		pdata->has_gbit = 1;
++		pdata->is_ar724x = 1;
++
++		if (!pdata->fifo_cfg1)
++			pdata->fifo_cfg1 = 0x0010ffff;
++		if (!pdata->fifo_cfg2)
++			pdata->fifo_cfg2 = 0x015500aa;
++		if (!pdata->fifo_cfg3)
++			pdata->fifo_cfg3 = 0x01f00140;
++		break;
++
+ 	default:
+ 		BUG();
+ 	}
+@@ -1140,7 +1186,6 @@ void __init ath79_register_eth(unsigned int id)
+ 		case ATH79_SOC_AR9330:
+ 		case ATH79_SOC_AR9331:
+ 		case ATH79_SOC_QCA9533:
+-		case ATH79_SOC_QCA9561:
+ 		case ATH79_SOC_TP9343:
+ 			pdata->mii_bus_dev = &ath79_mdio1_device.dev;
+ 			break;

+ 22 - 0
patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch

@@ -0,0 +1,22 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:00:41 +0200
+Subject: ar71xx: fix MDIO bus probe on QCA956x
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+Backport of OpenWrt r48651
+
+diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+index 2efb9c7..12a376e 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+@@ -183,7 +183,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 	    ath79_soc == ATH79_SOC_AR9342 ||
+ 	    ath79_soc == ATH79_SOC_AR9344 ||
+ 	    ath79_soc == ATH79_SOC_QCA9556 ||
+-	    ath79_soc == ATH79_SOC_QCA9558)
++	    ath79_soc == ATH79_SOC_QCA9558 ||
++	    ath79_soc == ATH79_SOC_QCA956X)
+ 		max_id = 1;
+ 	else
+ 		max_id = 0;

+ 64 - 0
patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch

@@ -0,0 +1,64 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:01:19 +0200
+Subject: ar71xx: fix qca956x ethernet initialization
+
+Complete internal switch initialization for QCA956X.
+Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520).
+
+Signed-off-by: Weijie Gao <hackpascal@gmail.com>
+
+Backport of OpenWrt r48937
+
+diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+index 12a376e..b43c80a 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+@@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
+ 	case ATH79_SOC_QCA956X:
+ 		if (id == 1)
+ 			mdio_data->builtin_switch = 1;
++		mdio_data->is_ar934x = 1;
+ 		break;
+ 
+ 	default:
+@@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id)
+ 		if (id == 0) {
+ 			pdata->reset_bit = QCA955X_RESET_GE0_MAC |
+ 					   QCA955X_RESET_GE0_MDIO;
++
+ 			if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
+ 				pdata->set_speed = qca956x_set_speed_sgmii;
+ 			else
+-				/* FIXME */
+-				pdata->set_speed = ath79_set_speed_dummy;
++				pdata->set_speed = ath79_set_speed_ge0;
+ 		} else {
+ 			pdata->reset_bit = QCA955X_RESET_GE1_MAC |
+ 					   QCA955X_RESET_GE1_MDIO;
+-			/* FIXME */
++
+ 			pdata->set_speed = ath79_set_speed_dummy;
++
++			pdata->switch_data = &ath79_switch_data;
++
++			pdata->speed = SPEED_1000;
++			pdata->duplex = DUPLEX_FULL;
++
++			/* reset the built-in switch */
++			ath79_device_reset_set(AR934X_RESET_ETH_SWITCH);
++			ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH);
+ 		}
+ 
+ 		pdata->ddr_flush = ath79_ddr_no_flush;
+@@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id)
+ 			/* don't assign any MDIO device by default */
+ 			break;
+ 
++		case ATH79_SOC_QCA956X:
++			if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII)
++				pdata->mii_bus_dev = &ath79_mdio1_device.dev;
++			break;
++
+ 		default:
+ 			pdata->mii_bus_dev = &ath79_mdio0_device.dev;
+ 			break;

+ 562 - 0
patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch

@@ -0,0 +1,562 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+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 <p.wassi at gmx.at>
+
+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 5a184cd..8c6ac9a 100644
+--- a/target/linux/ar71xx/base-files/etc/diag.sh
++++ b/target/linux/ar71xx/base-files/etc/diag.sh
+@@ -296,7 +296,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 b2e15bb..e4a1473 100755
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+@@ -366,6 +366,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 ddd6611..8670583 100755
+--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+@@ -881,6 +881,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 c5c1871..4c43166 100755
+--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+@@ -251,6 +251,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 e2ff826..9a81911 100644
+--- a/target/linux/ar71xx/config-3.18
++++ b/target/linux/ar71xx/config-3.18
+@@ -137,6 +137,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
+@@ -320,7 +321,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 <p.wassi at gmx.at>
++ *
++ *  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 <linux/init.h>
++#include <linux/pci.h>
++#include <linux/platform_device.h>
++#include <linux/ath9k_platform.h>
++#include <linux/etherdevice.h>
++
++#include <asm/mach-ath79/ath79.h>
++#include <asm/mach-ath79/irq.h>
++#include <asm/mach-ath79/ar71xx_regs.h>
++
++#include <linux/platform_data/phy-at803x.h>
++
++#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 d42ceef..dd59f2d 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 d6e786d..5a7a72c 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,199 @@
++@@ -16,22 +16,200 @@
+  
+  enum ath79_mach_type {
+  	ATH79_MACH_GENERIC = 0,
+@@ -164,6 +164,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 */
+@@ -1097,10 +1098,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
+@@ -1115,19 +1113,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
+@@ -1139,11 +1130,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
+@@ -1154,34 +1145,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
+@@ -1189,8 +1159,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
+@@ -1198,7 +1168,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
+@@ -1211,21 +1202,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
+@@ -1268,15 +1263,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
+@@ -1319,11 +1320,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
+@@ -1361,10 +1363,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
+@@ -1468,7 +1480,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
+  
+@@ -1480,7 +1492,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
+@@ -1494,7 +1506,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
+  #
+@@ -1596,6 +1608,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

+ 21 - 0
patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch

@@ -0,0 +1,21 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:02:55 +0200
+Subject: ar71xx: Fix eth0 support for Ubiquiti UniFi AP AC
+
+Fix eth0 support for the Ubiquiti UniFi AP AC
+Signed-off-by: Paul Wassi <p.wassi at gmx.at>
+
+Backport of OpenWrt r49277
+
+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
+index 3617ca7..072cf12 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+@@ -84,6 +84,7 @@ static void __init ubnt_unifiac_setup(void)
+ 		       eeprom + UNIFIAC_MAC0_OFFSET, 0);
+ 
+ 	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
++	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ 	ath79_eth0_data.phy_mask = BIT(4);
+ 	ath79_eth0_pll_data.pll_10 = 0x00001313;
+ 

+ 192 - 0
patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch

@@ -0,0 +1,192 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:24:44 +0200
+Subject: ar71xx: Rename unifiac to unifiac-lite
+
+To avoid confusion with different unifiac devices, rename existing target
+"unifiac" to "unifiac-lite", before "unifiac-pro" is introduced.
+
+Signed-off-by: P.Wassi <p.wassi at gmx.at>
+
+Backport of LEDE c855e70491fbd5d432915c4cbeb3b80f3a117e30
+
+diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
+index 8c6ac9a..3d711ca 100644
+--- a/target/linux/ar71xx/base-files/etc/diag.sh
++++ b/target/linux/ar71xx/base-files/etc/diag.sh
+@@ -297,7 +297,7 @@ get_status_led() {
+ 		status_led="ubnt:green:dome"
+ 		;;
+ 	uap-pro | \
+-	unifiac)
++	unifiac-lite)
+ 		status_led="ubnt:white:dome"
+ 		;;
+ 	unifi-outdoor-plus)
+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
+index e6fcec8..fa8a2c8 100644
+--- 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
+@@ -75,7 +75,7 @@ case "$FIRMWARE" in
+ 		ath10kcal_extract "ART" 20480 2116
+ 		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
+ 		;;
+-	unifiac)
++	unifiac-lite)
+ 		ath10kcal_extract "EEPROM" 20480 2116
+ 		;;
+ 	esac
+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 e4a1473..0269e6d 100755
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+@@ -366,7 +366,7 @@ tl-wa901nd-v3 |\
+ tl-wa901nd-v4 |\
+ tl-wr703n |\
+ tube2h |\
+-unifiac |\
++unifiac-lite |\
+ 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 8670583..d3e6db9 100755
+--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+@@ -881,8 +881,8 @@ ar71xx_board_detect() {
+ 	*UniFi)
+ 		name="unifi"
+ 		;;
+-	*"UniFi-AC")
+-		name="unifiac"
++	*"UniFi-AC-LITE")
++		name="unifiac-lite"
+ 		;;
+ 	*"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 4c43166..a1b65b7 100755
+--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+@@ -251,7 +251,7 @@ platform_check_image() {
+ 	wlae-ag300n | \
+ 	nbg460n_550n_550nh | \
+ 	unifi | \
+-	unifiac | \
++	unifiac-lite | \
+ 	unifi-outdoor | \
+ 	carambola2 | \
+ 	weio )
+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
+index 072cf12..31cbe30 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+@@ -73,7 +73,7 @@ static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = {
+ 	}
+ };
+ 
+-static void __init ubnt_unifiac_setup(void)
++static void __init ubnt_unifiac_lite_setup(void)
+ {
+ 	u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
+ 
+@@ -81,7 +81,7 @@ static void __init ubnt_unifiac_setup(void)
+ 
+ 
+ 	ath79_init_mac(ath79_eth0_data.mac_addr,
+-		       eeprom + UNIFIAC_MAC0_OFFSET, 0);
++	               eeprom + UNIFIAC_MAC0_OFFSET, 0);
+ 
+ 	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ 	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+@@ -99,12 +99,12 @@ static void __init ubnt_unifiac_setup(void)
+ 
+ 
+ 	ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
+-				 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);
++	                                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);
++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE",
++	     ubnt_unifiac_lite_setup);
+diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
+index 94eff18..eac0240 100644
+--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
+@@ -38,16 +38,16 @@ endef
+ 
+ $(eval $(call Profile,UBNTUNIFI))
+ 
+-define Profile/UBNTUNIFIAC
+-	NAME:=Ubiquiti UniFi AP AC
++define Profile/UBNTUNIFIACLITE
++	NAME:=Ubiquiti UniFi AP AC LITE/LR
+ 	PACKAGES:=kmod-ath10k ath10k-firmware-qca988x
+ endef
+ 
+-define Profile/UBNTUNIFIAC/Description
+-	Package set optimized for the Ubiquiti UniFi AP AC.
++define Profile/UBNTUNIFIACLITE/Description
++	Package set optimized for the Ubiquiti UniFi AP AC LITE/LR.
+ endef
+ 
+-$(eval $(call Profile,UBNTUNIFIAC))
++$(eval $(call Profile,UBNTUNIFIACLITE))
+ 
+ define Profile/UBNTUNIFIOUTDOOR
+ 	NAME:=Ubiquiti UniFiAP Outdoor
+diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
+index dd59f2d..31aff78 100644
+--- a/target/linux/ar71xx/image/Makefile
++++ b/target/linux/ar71xx/image/Makefile
+@@ -741,14 +741,19 @@ endef
+ TARGET_DEVICES += oolite
+ 
+ define Device/ubnt-unifiac
+-  DEVICE_PROFILE := UBNT UBNTUNIFIAC
++  DEVICE_PROFILE := UBNT
+   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)
++endef
++
++define Device/ubnt-unifiac-lite
++  $(Device/ubnt-unifiac)
++  DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
+   BOARDNAME := UBNT-UF-AC
+ endef
+-TARGET_DEVICES += ubnt-unifiac
++TARGET_DEVICES += ubnt-unifiac-lite
+ 
+ rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
+ 
+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 5a7a72c..0ade403 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
+@@ -164,7 +164,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_UNIFIAC_LITE,	/* Ubiquiti Unifi AC LITE/LR */
+  	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 */
+@@ -1368,7 +1368,7 @@
+  	  Ubiquiti Networks XM (rev 1.0) board.
+  
+ +config ATH79_MACH_UBNT_UNIFIAC
+-+	bool "Ubiquiti UniFi AC (LITE) support"
+++	bool "Ubiquiti UniFi AC (LITE/LR) support"
+ +	select SOC_QCA956X
+ +	select ATH79_DEV_AP9X_PCI if PCI
+ +	select ATH79_DEV_ETH

+ 274 - 0
patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch

@@ -0,0 +1,274 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 13 May 2016 21:34:05 +0200
+Subject: ar71xx: Add support for Ubiquiti UniFi AP AC PRO
+
+Add support for the Ubiquiti UniFi AP AC PRO
+Signed-off-by: P.Wassi <p.wassi at gmx.at>
+
+Backport of LEDE 8307c2fe686ded345c80318359d5b6679e581fa2
+
+diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
+index 3d711ca..775aac6 100644
+--- a/target/linux/ar71xx/base-files/etc/diag.sh
++++ b/target/linux/ar71xx/base-files/etc/diag.sh
+@@ -297,7 +297,8 @@ get_status_led() {
+ 		status_led="ubnt:green:dome"
+ 		;;
+ 	uap-pro | \
+-	unifiac-lite)
++	unifiac-lite | \
++	unifiac-pro)
+ 		status_led="ubnt:white:dome"
+ 		;;
+ 	unifi-outdoor-plus)
+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
+index fa8a2c8..cde7aaf 100644
+--- 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
+@@ -75,7 +75,8 @@ case "$FIRMWARE" in
+ 		ath10kcal_extract "ART" 20480 2116
+ 		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
+ 		;;
+-	unifiac-lite)
++	unifiac-lite | \
++	unifiac-pro)
+ 		ath10kcal_extract "EEPROM" 20480 2116
+ 		;;
+ 	esac
+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 0269e6d..0a23756 100755
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+@@ -398,6 +398,13 @@ wpj344)
+ 	ucidef_add_switch_vlan "switch0" "2" "0t 2"
+ 	;;
+ 
++unifiac-pro)
++	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
++	ucidef_add_switch "switch0" "1" "1"
++	ucidef_add_switch_vlan "switch0" "1" "0t 2"
++	ucidef_add_switch_vlan "switch0" "2" "0t 3"
++	;;
++
+ wpj531)
+ 	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ 	;;
+diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+index d3e6db9..7fc951a 100755
+--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+@@ -884,6 +884,9 @@ ar71xx_board_detect() {
+ 	*"UniFi-AC-LITE")
+ 		name="unifiac-lite"
+ 		;;
++	*"UniFi-AC-PRO")
++		name="unifiac-pro"
++		;;
+ 	*"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 a1b65b7..0e9833d 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() {
+ 	nbg460n_550n_550nh | \
+ 	unifi | \
+ 	unifiac-lite | \
++	unifiac-pro | \
+ 	unifi-outdoor | \
+ 	carambola2 | \
+ 	weio )
+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
+index 31cbe30..9194bc1 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+@@ -21,6 +21,7 @@
+ #include <asm/mach-ath79/ar71xx_regs.h>
+ 
+ #include <linux/platform_data/phy-at803x.h>
++#include <linux/ar8216_platform.h>
+ 
+ #include "common.h"
+ #include "dev-ap9x-pci.h"
+@@ -29,6 +30,7 @@
+ #include "dev-leds-gpio.h"
+ #include "dev-m25p80.h"
+ #include "dev-wmac.h"
++#include "dev-usb.h"
+ #include "machtypes.h"
+ 
+ 
+@@ -108,3 +110,70 @@ static void __init ubnt_unifiac_lite_setup(void)
+ 
+ MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE",
+ 	     ubnt_unifiac_lite_setup);
++
++static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = {
++	.mode = AR8327_PAD_MAC_SGMII,
++	.sgmii_delay_en = true,
++};
++
++static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = {
++	.pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg,
++	.port0_cfg = {
++		.force_link = 1,
++		.speed = AR8327_PORT_SPEED_1000,
++		.duplex = 1,
++		.txpause = 1,
++		.rxpause = 1,
++	},
++};
++
++
++static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = {
++	{
++		.bus_id = "ag71xx-mdio.0",
++		.phy_addr = 0,
++		.platform_data = &ubnt_unifiac_pro_ar8327_data,
++	},
++};
++
++static void __init ubnt_unifiac_pro_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.mii_bus_dev = &ath79_mdio0_device.dev;
++	ath79_eth0_data.phy_mask = BIT(0);
++
++	mdiobus_register_board_info(ubnt_unifiac_pro_mdio0_info,
++	                            ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info));
++
++	ath79_register_mdio(0, 0x00);
++	ath79_register_eth(0);
++
++
++	ath79_register_usb();
++
++
++	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_PRO, "UBNT-UF-AC-PRO", "Ubiquiti UniFi-AC-PRO",
++	     ubnt_unifiac_pro_setup);
+diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
+index eac0240..69b8398 100644
+--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
+@@ -49,6 +49,17 @@ endef
+ 
+ $(eval $(call Profile,UBNTUNIFIACLITE))
+ 
++define Profile/UBNTUNIFIACPRO
++	NAME:=Ubiquiti UniFi AP AC PRO
++	PACKAGES:=kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2
++endef
++
++define Profile/UBNTUNIFIACPRO/Description
++	Package set optimized for the Ubiquiti UniFi AP AC PRO.
++endef
++
++$(eval $(call Profile,UBNTUNIFIACPRO))
++
+ define Profile/UBNTUNIFIOUTDOOR
+ 	NAME:=Ubiquiti UniFiAP Outdoor
+ 	PACKAGES:=
+diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
+index 31aff78..916d4e2 100644
+--- a/target/linux/ar71xx/image/Makefile
++++ b/target/linux/ar71xx/image/Makefile
+@@ -753,7 +753,13 @@ define Device/ubnt-unifiac-lite
+   DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
+   BOARDNAME := UBNT-UF-AC
+ endef
+-TARGET_DEVICES += ubnt-unifiac-lite
++
++define Device/ubnt-unifiac-pro
++  $(Device/ubnt-unifiac)
++  DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
++  BOARDNAME := UBNT-UF-AC-PRO
++endef
++TARGET_DEVICES += ubnt-unifiac-lite ubnt-unifiac-pro
+ 
+ rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
+ 
+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 0ade403..dbd3fca 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_UAP_PRO,	/* Ubiquiti UniFi AP Pro */
+  	ATH79_MACH_UBNT_UNIFI, 		/* Ubiquiti Unifi */
+ +	ATH79_MACH_UBNT_UNIFIAC_LITE,	/* Ubiquiti Unifi AC LITE/LR */
+++	ATH79_MACH_UBNT_UNIFIAC_PRO,	/* Ubiquiti Unifi AC PRO */
+  	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 */
+@@ -1363,12 +1364,12 @@
+  
+  config ATH79_MACH_UBNT_XM
+  	bool "Ubiquiti Networks XM/UniFi boards"
+-@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM
++@@ -83,6 +1144,117 @@ 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/LR) support"
+++	bool "Ubiquiti UniFi AC (LITE/LR/PRO) support"
+ +	select SOC_QCA956X
+ +	select ATH79_DEV_AP9X_PCI if PCI
+ +	select ATH79_DEV_ETH
+@@ -1376,6 +1377,7 @@
+ +	select ATH79_DEV_LEDS_GPIO
+ +	select ATH79_DEV_M25P80
+ +	select ATH79_DEV_WMAC
+++	select ATH79_DEV_USB
+ +
+ +config ATH79_MACH_WEIO
+ +	bool "WeIO board"
+@@ -1480,7 +1482,7 @@
+  endmenu
+  
+  config SOC_AR71XX
+-@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA
++@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
+  config ATH79_DEV_ETH
+  	def_bool n
+  
+@@ -1492,7 +1494,7 @@
+  	def_bool n
+  
+  config ATH79_DEV_GPIO_BUTTONS
+-@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP
++@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
+  	def_bool n
+  
+  config ATH79_ROUTERBOOT

+ 11 - 1
targets/ar71xx-generic/profiles.mk

@@ -160,7 +160,7 @@ $(eval $(call GluonModel,ARCHERC7,archer-c5,tp-link-archer-c5-v1)) # BROKEN: ath
 $(eval $(call GluonModel,ARCHERC7,archer-c7-v2,tp-link-archer-c7-v2)) # BROKEN: ath10k
 endif
 
-## Ubiquiti (everything)
+## Ubiquiti (almost everything)
 $(eval $(call GluonProfile,UBNT))
 $(eval $(call GluonModel,UBNT,ubnt-air-gateway,ubiquiti-airgateway))
 $(eval $(call GluonModel,UBNT,ubnt-airrouter,ubiquiti-airrouter))
@@ -190,6 +190,16 @@ ifneq ($(BROKEN),)
 $(eval $(call GluonModel,UBNT,ubnt-ls-sr71,ubiquiti-ls-sr71)) # BROKEN: Untested
 endif
 
+# Ubiquiti (ath10k)
+ifneq ($(BROKEN),)
+$(eval $(call GluonProfile,UBNTUNIFIACLITE,kmod-ath10k ath10k-firmware-qca988x-ct))
+$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACLITE))
+$(eval $(call GluonModel,UBNTUNIFIACLITE,ubnt-unifiac-lite,ubiquiti-unifi-ac-lite)) # BROKEN: untested, ath10k
+
+$(eval $(call GluonProfile,UBNTUNIFIACPRO,kmod-ath10k ath10k-firmware-qca988x-ct))
+$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACPRO))
+$(eval $(call GluonModel,UBNTUNIFIACPRO,ubnt-unifiac-pro,ubiquiti-unifi-ac-pro)) # BROKEN: ath10k
+endif
 
 ## D-Link