2 * Ubiquiti UniFi AC (LITE) board support
4 * Copyright (C) 2015-2016 P. Wassi <p.wassi at gmx.at>
6 * Derived from: mach-ubnt-xm.c
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/pci.h>
15 #include <linux/platform_device.h>
16 #include <linux/ath9k_platform.h>
17 #include <linux/etherdevice.h>
19 #include <asm/mach-ath79/ath79.h>
20 #include <asm/mach-ath79/irq.h>
21 #include <asm/mach-ath79/ar71xx_regs.h>
23 #include <linux/platform_data/phy-at803x.h>
26 #include "dev-ap9x-pci.h"
28 #include "dev-gpio-buttons.h"
29 #include "dev-leds-gpio.h"
30 #include "dev-m25p80.h"
32 #include "machtypes.h"
35 #define UNIFIAC_KEYS_POLL_INTERVAL 20
36 #define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL)
38 #define UNIFIAC_GPIO_LED_WHITE 7
39 #define UNIFIAC_GPIO_LED_BLUE 8
41 #define UNIFIAC_GPIO_BTN_RESET 2
43 #define UNIFIAC_MAC0_OFFSET 0x0000
44 #define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000
45 #define UNIFIAC_PCI_CALDATA_OFFSET 0x5000
48 static struct flash_platform_data ubnt_unifiac_flash_data = {
49 /* mx25l12805d and mx25l12835f have the same JEDEC ID */
50 .type = "mx25l12805d",
53 static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = {
55 .name = "ubnt:white:dome",
56 .gpio = UNIFIAC_GPIO_LED_WHITE,
59 .name = "ubnt:blue:dome",
60 .gpio = UNIFIAC_GPIO_LED_BLUE,
65 static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = {
70 .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL,
71 .gpio = UNIFIAC_GPIO_BTN_RESET,
76 static void __init ubnt_unifiac_setup(void)
78 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
80 ath79_register_m25p80(&ubnt_unifiac_flash_data);
83 ath79_init_mac(ath79_eth0_data.mac_addr,
84 eeprom + UNIFIAC_MAC0_OFFSET, 0);
86 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
87 ath79_eth0_data.phy_mask = BIT(4);
88 ath79_eth0_pll_data.pll_10 = 0x00001313;
90 ath79_register_mdio(0, ~BIT(4));
91 ath79_register_eth(0);
94 ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL);
97 ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL);
100 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
101 ubnt_unifiac_leds_gpio);
103 ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL,
104 ARRAY_SIZE(ubnt_unifiac_gpio_keys),
105 ubnt_unifiac_gpio_keys);
108 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC",