Root/target/linux/ar71xx/patches-3.2/018-Initial-support-for-the-Ubiquiti-Networks-XM-board-r.patch

1From e6a1210bef8b48a946f1afb6d951f4b2448219ac Mon Sep 17 00:00:00 2001
2From: Rene Bolldorf <xsecute@googlemail.com>
3Date: Fri, 18 Nov 2011 00:17:42 +0000
4Subject: [PATCH 18/27] Initial support for the Ubiquiti Networks XM board (rev 1.0).
5
6Signed-off-by: Rene Bolldorf <xsecute@googlemail.com>
7Cc: linux-mips@linux-mips.org
8Cc: linux-kernel@vger.kernel.org
9Patchwork: https://patchwork.linux-mips.org/patch/3020/
10Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
11---
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
18
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.
24 
25+config ATH79_MACH_UBNT_XM
26+ bool "Ubiquiti Networks XM (rev 1.0) board"
27+ select SOC_AR724X
28+ select ATH79_DEV_GPIO_BUTTONS
29+ select ATH79_DEV_LEDS_GPIO
30+ select ATH79_DEV_SPI
31+ help
32+ Say 'Y' here if you want your kernel to support the
33+ Ubiquiti Networks XM (rev 1.0) board.
34+
35 endmenu
36 
37 config SOC_AR71XX
38@@ -46,6 +56,7 @@ config SOC_AR71XX
39 config SOC_AR724X
40     select USB_ARCH_HAS_EHCI
41     select USB_ARCH_HAS_OHCI
42+ select HW_HAS_PCI
43     def_bool n
44 
45 config SOC_AR913X
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
53--- /dev/null
54+++ b/arch/mips/ath79/mach-ubnt-xm.c
55@@ -0,0 +1,119 @@
56+/*
57+ * Ubiquiti Networks XM (rev 1.0) board support
58+ *
59+ * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
60+ *
61+ * Derived from: mach-pb44.c
62+ *
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.
66+ */
67+
68+#include <linux/init.h>
69+#include <linux/pci.h>
70+
71+#ifdef CONFIG_PCI
72+#include <linux/ath9k_platform.h>
73+#include <asm/mach-ath79/pci-ath724x.h>
74+#endif /* CONFIG_PCI */
75+
76+#include "machtypes.h"
77+#include "dev-gpio-buttons.h"
78+#include "dev-leds-gpio.h"
79+#include "dev-spi.h"
80+
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
85+
86+#define UBNT_XM_GPIO_BTN_RESET 12
87+
88+#define UBNT_XM_KEYS_POLL_INTERVAL 20
89+#define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
90+
91+#define UBNT_XM_PCI_IRQ 48
92+#define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000)
93+
94+static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
95+ {
96+ .name = "ubnt-xm:red:link1",
97+ .gpio = UBNT_XM_GPIO_LED_L1,
98+ .active_low = 0,
99+ }, {
100+ .name = "ubnt-xm:orange:link2",
101+ .gpio = UBNT_XM_GPIO_LED_L2,
102+ .active_low = 0,
103+ }, {
104+ .name = "ubnt-xm:green:link3",
105+ .gpio = UBNT_XM_GPIO_LED_L3,
106+ .active_low = 0,
107+ }, {
108+ .name = "ubnt-xm:green:link4",
109+ .gpio = UBNT_XM_GPIO_LED_L4,
110+ .active_low = 0,
111+ },
112+};
113+
114+static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = {
115+ {
116+ .desc = "reset",
117+ .type = EV_KEY,
118+ .code = KEY_RESTART,
119+ .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
120+ .gpio = UBNT_XM_GPIO_BTN_RESET,
121+ .active_low = 1,
122+ }
123+};
124+
125+static struct spi_board_info ubnt_xm_spi_info[] = {
126+ {
127+ .bus_num = 0,
128+ .chip_select = 0,
129+ .max_speed_hz = 25000000,
130+ .modalias = "mx25l6405d",
131+ }
132+};
133+
134+static struct ath79_spi_platform_data ubnt_xm_spi_data = {
135+ .bus_num = 0,
136+ .num_chipselect = 1,
137+};
138+
139+#ifdef CONFIG_PCI
140+static struct ath9k_platform_data ubnt_xm_eeprom_data;
141+
142+static struct ath724x_pci_data ubnt_xm_pci_data[] = {
143+ {
144+ .irq = UBNT_XM_PCI_IRQ,
145+ .pdata = &ubnt_xm_eeprom_data,
146+ },
147+};
148+#endif /* CONFIG_PCI */
149+
150+static void __init ubnt_xm_init(void)
151+{
152+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
153+ ubnt_xm_leds_gpio);
154+
155+ ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
156+ ARRAY_SIZE(ubnt_xm_gpio_keys),
157+ ubnt_xm_gpio_keys);
158+
159+ ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info,
160+ ARRAY_SIZE(ubnt_xm_spi_info));
161+
162+#ifdef CONFIG_PCI
163+ memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR,
164+ sizeof(ubnt_xm_eeprom_data.eeprom_data));
165+
166+ ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
167+#endif /* CONFIG_PCI */
168+
169+}
170+
171+MIPS_MACHINE(ATH79_MACH_UBNT_XM,
172+ "UBNT-XM",
173+ "Ubiquiti Networks XM (rev 1.0) board",
174+ ubnt_xm_init);
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 */
182 };
183 
184 #endif /* _ATH79_MACHTYPE_H */
185

Archive Download this file



interactive