1 From e6a1210bef8b48a946f1afb6d951f4b2448219ac Mon Sep 17 00:00:00 2001
2 From: Rene Bolldorf <xsecute@googlemail.com>
3 Date: Fri, 18 Nov 2011 00:17:42 +0000
4 Subject: [PATCH 18/27] Initial support for the Ubiquiti Networks XM board (rev 1.0).
6 Signed-off-by: Rene Bolldorf <xsecute@googlemail.com>
7 Cc: linux-mips@linux-mips.org
8 Cc: linux-kernel@vger.kernel.org
9 Patchwork: https://patchwork.linux-mips.org/patch/3020/
10 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
12 arch/mips/ath79/Kconfig | 11 ++++
13 arch/mips/ath79/Makefile | 1 +
14 arch/mips/ath79/mach-ubnt-xm.c | 119 ++++++++++++++++++++++++++++++++++++++++
15 arch/mips/ath79/machtypes.h | 1 +
16 4 files changed, 132 insertions(+), 0 deletions(-)
17 create mode 100644 arch/mips/ath79/mach-ubnt-xm.c
19 --- a/arch/mips/ath79/Kconfig
20 +++ b/arch/mips/ath79/Kconfig
21 @@ -36,6 +36,16 @@ config ATH79_MACH_PB44
22 Say 'Y' here if you want your kernel to support the
23 Atheros PB44 reference board.
25 +config ATH79_MACH_UBNT_XM
26 + bool "Ubiquiti Networks XM (rev 1.0) board"
28 + select ATH79_DEV_GPIO_BUTTONS
29 + select ATH79_DEV_LEDS_GPIO
30 + select ATH79_DEV_SPI
32 + Say 'Y' here if you want your kernel to support the
33 + Ubiquiti Networks XM (rev 1.0) board.
38 @@ -46,6 +56,7 @@ config SOC_AR71XX
40 select USB_ARCH_HAS_EHCI
41 select USB_ARCH_HAS_OHCI
46 --- a/arch/mips/ath79/Makefile
47 +++ b/arch/mips/ath79/Makefile
48 @@ -28,3 +28,4 @@ obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.
49 obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
50 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
51 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
52 +obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
54 +++ b/arch/mips/ath79/mach-ubnt-xm.c
57 + * Ubiquiti Networks XM (rev 1.0) board support
59 + * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
61 + * Derived from: mach-pb44.c
63 + * This program is free software; you can redistribute it and/or modify it
64 + * under the terms of the GNU General Public License version 2 as published
65 + * by the Free Software Foundation.
68 +#include <linux/init.h>
69 +#include <linux/pci.h>
72 +#include <linux/ath9k_platform.h>
73 +#include <asm/mach-ath79/pci-ath724x.h>
74 +#endif /* CONFIG_PCI */
76 +#include "machtypes.h"
77 +#include "dev-gpio-buttons.h"
78 +#include "dev-leds-gpio.h"
81 +#define UBNT_XM_GPIO_LED_L1 0
82 +#define UBNT_XM_GPIO_LED_L2 1
83 +#define UBNT_XM_GPIO_LED_L3 11
84 +#define UBNT_XM_GPIO_LED_L4 7
86 +#define UBNT_XM_GPIO_BTN_RESET 12
88 +#define UBNT_XM_KEYS_POLL_INTERVAL 20
89 +#define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
91 +#define UBNT_XM_PCI_IRQ 48
92 +#define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000)
94 +static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
96 + .name = "ubnt-xm:red:link1",
97 + .gpio = UBNT_XM_GPIO_LED_L1,
100 + .name = "ubnt-xm:orange:link2",
101 + .gpio = UBNT_XM_GPIO_LED_L2,
104 + .name = "ubnt-xm:green:link3",
105 + .gpio = UBNT_XM_GPIO_LED_L3,
108 + .name = "ubnt-xm:green:link4",
109 + .gpio = UBNT_XM_GPIO_LED_L4,
114 +static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = {
118 + .code = KEY_RESTART,
119 + .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
120 + .gpio = UBNT_XM_GPIO_BTN_RESET,
125 +static struct spi_board_info ubnt_xm_spi_info[] = {
129 + .max_speed_hz = 25000000,
130 + .modalias = "mx25l6405d",
134 +static struct ath79_spi_platform_data ubnt_xm_spi_data = {
136 + .num_chipselect = 1,
140 +static struct ath9k_platform_data ubnt_xm_eeprom_data;
142 +static struct ath724x_pci_data ubnt_xm_pci_data[] = {
144 + .irq = UBNT_XM_PCI_IRQ,
145 + .pdata = &ubnt_xm_eeprom_data,
148 +#endif /* CONFIG_PCI */
150 +static void __init ubnt_xm_init(void)
152 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
153 + ubnt_xm_leds_gpio);
155 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
156 + ARRAY_SIZE(ubnt_xm_gpio_keys),
157 + ubnt_xm_gpio_keys);
159 + ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info,
160 + ARRAY_SIZE(ubnt_xm_spi_info));
163 + memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR,
164 + sizeof(ubnt_xm_eeprom_data.eeprom_data));
166 + ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
167 +#endif /* CONFIG_PCI */
171 +MIPS_MACHINE(ATH79_MACH_UBNT_XM,
173 + "Ubiquiti Networks XM (rev 1.0) board",
175 --- a/arch/mips/ath79/machtypes.h
176 +++ b/arch/mips/ath79/machtypes.h
177 @@ -19,6 +19,7 @@ enum ath79_mach_type {
178 ATH79_MACH_AP121, /* Atheros AP121 reference board */
179 ATH79_MACH_AP81, /* Atheros AP81 reference board */
180 ATH79_MACH_PB44, /* Atheros PB44 reference board */
181 + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
184 #endif /* _ATH79_MACHTYPE_H */