Root/target/linux/ar71xx/patches-3.3/171-MIPS-ath79-add-support-for-the-Qualcomm-Atheros-AP13.patch

1From a034da3e4d4960266a94d15c811d5f4529fdff44 Mon Sep 17 00:00:00 2001
2From: Gabor Juhos <juhosg@openwrt.org>
3Date: Sun, 24 Jun 2012 13:52:23 +0200
4Subject: [PATCH 27/34] MIPS: ath79: add support for the Qualcomm Atheros AP136 board
5
6Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7---
8 arch/mips/ath79/Kconfig | 12 +++
9 arch/mips/ath79/Makefile | 1 +
10 arch/mips/ath79/mach-ap136.c | 155 ++++++++++++++++++++++++++++++++++++++++++
11 arch/mips/ath79/machtypes.h | 1 +
12 4 files changed, 169 insertions(+), 0 deletions(-)
13 create mode 100644 arch/mips/ath79/mach-ap136.c
14
15--- a/arch/mips/ath79/Kconfig
16+++ b/arch/mips/ath79/Kconfig
17@@ -14,6 +14,18 @@ config ATH79_MACH_AP121
18       Say 'Y' here if you want your kernel to support the
19       Atheros AP121 reference board.
20 
21+config ATH79_MACH_AP136
22+ bool "Atheros AP136 reference board"
23+ select SOC_QCA955X
24+ select ATH79_DEV_GPIO_BUTTONS
25+ select ATH79_DEV_LEDS_GPIO
26+ select ATH79_DEV_SPI
27+ select ATH79_DEV_USB
28+ select ATH79_DEV_WMAC
29+ help
30+ Say 'Y' here if you want your kernel to support the
31+ Atheros AP136 reference board.
32+
33 config ATH79_MACH_AP81
34     bool "Atheros AP81 reference board"
35     select SOC_AR913X
36--- a/arch/mips/ath79/Makefile
37+++ b/arch/mips/ath79/Makefile
38@@ -27,6 +27,7 @@ obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wma
39 # Machines
40 #
41 obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
42+obj-$(CONFIG_ATH79_MACH_AP136) += mach-ap136.o
43 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
44 obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
45 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
46--- /dev/null
47+++ b/arch/mips/ath79/mach-ap136.c
48@@ -0,0 +1,155 @@
49+/*
50+ * Qualcomm Atheros AP136 reference board support
51+ *
52+ * Copyright (c) 2012 Qualcomm Atheros
53+ * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
54+ *
55+ * Permission to use, copy, modify, and/or distribute this software for any
56+ * purpose with or without fee is hereby granted, provided that the above
57+ * copyright notice and this permission notice appear in all copies.
58+ *
59+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
60+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
61+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
62+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
63+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
64+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
65+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
66+ *
67+ */
68+
69+#include <linux/pci.h>
70+#include <linux/ath9k_platform.h>
71+
72+#include "machtypes.h"
73+#include "dev-gpio-buttons.h"
74+#include "dev-leds-gpio.h"
75+#include "dev-spi.h"
76+#include "dev-usb.h"
77+#include "dev-wmac.h"
78+#include "pci.h"
79+
80+#define AP136_GPIO_LED_STATUS_RED 14
81+#define AP136_GPIO_LED_STATUS_GREEN 19
82+#define AP136_GPIO_LED_USB 4
83+#define AP136_GPIO_LED_WLAN_2G 13
84+#define AP136_GPIO_LED_WLAN_5G 12
85+#define AP136_GPIO_LED_WPS_RED 15
86+#define AP136_GPIO_LED_WPS_GREEN 20
87+
88+#define AP136_GPIO_BTN_WPS 16
89+#define AP136_GPIO_BTN_RFKILL 21
90+
91+#define AP136_KEYS_POLL_INTERVAL 20 /* msecs */
92+#define AP136_KEYS_DEBOUNCE_INTERVAL (3 * AP136_KEYS_POLL_INTERVAL)
93+
94+#define AP136_WMAC_CALDATA_OFFSET 0x1000
95+#define AP136_PCIE_CALDATA_OFFSET 0x5000
96+
97+static struct gpio_led ap136_leds_gpio[] __initdata = {
98+ {
99+ .name = "ap136:green:status",
100+ .gpio = AP136_GPIO_LED_STATUS_GREEN,
101+ .active_low = 1,
102+ },
103+ {
104+ .name = "ap136:red:status",
105+ .gpio = AP136_GPIO_LED_STATUS_RED,
106+ .active_low = 1,
107+ },
108+ {
109+ .name = "ap136:green:wps",
110+ .gpio = AP136_GPIO_LED_WPS_GREEN,
111+ .active_low = 1,
112+ },
113+ {
114+ .name = "ap136:red:wps",
115+ .gpio = AP136_GPIO_LED_WPS_RED,
116+ .active_low = 1,
117+ },
118+ {
119+ .name = "ap136:red:wlan-2g",
120+ .gpio = AP136_GPIO_LED_WLAN_2G,
121+ .active_low = 1,
122+ },
123+ {
124+ .name = "ap136:red:usb",
125+ .gpio = AP136_GPIO_LED_USB,
126+ .active_low = 1,
127+ }
128+};
129+
130+static struct gpio_keys_button ap136_gpio_keys[] __initdata = {
131+ {
132+ .desc = "WPS button",
133+ .type = EV_KEY,
134+ .code = KEY_WPS_BUTTON,
135+ .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL,
136+ .gpio = AP136_GPIO_BTN_WPS,
137+ .active_low = 1,
138+ },
139+ {
140+ .desc = "RFKILL button",
141+ .type = EV_KEY,
142+ .code = KEY_RFKILL,
143+ .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL,
144+ .gpio = AP136_GPIO_BTN_RFKILL,
145+ .active_low = 1,
146+ },
147+};
148+
149+static struct spi_board_info ap136_spi_info[] = {
150+ {
151+ .bus_num = 0,
152+ .chip_select = 0,
153+ .max_speed_hz = 25000000,
154+ .modalias = "mx25l6405d",
155+ }
156+};
157+
158+static struct ath79_spi_platform_data ap136_spi_data = {
159+ .bus_num = 0,
160+ .num_chipselect = 1,
161+};
162+
163+#ifdef CONFIG_PCI
164+static struct ath9k_platform_data ap136_ath9k_data;
165+
166+static int ap136_pci_plat_dev_init(struct pci_dev *dev)
167+{
168+ if (dev->bus->number == 1 && (PCI_SLOT(dev->devfn)) == 0)
169+ dev->dev.platform_data = &ap136_ath9k_data;
170+
171+ return 0;
172+}
173+
174+static void __init ap136_pci_init(u8 *eeprom)
175+{
176+ memcpy(ap136_ath9k_data.eeprom_data, eeprom,
177+ sizeof(ap136_ath9k_data.eeprom_data));
178+
179+ ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init);
180+ ath79_register_pci();
181+}
182+#else
183+static inline void ap136_pci_init(void) {}
184+#endif /* CONFIG_PCI */
185+
186+static void __init ap136_setup(void)
187+{
188+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
189+
190+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio),
191+ ap136_leds_gpio);
192+ ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL,
193+ ARRAY_SIZE(ap136_gpio_keys),
194+ ap136_gpio_keys);
195+ ath79_register_spi(&ap136_spi_data, ap136_spi_info,
196+ ARRAY_SIZE(ap136_spi_info));
197+ ath79_register_usb();
198+ ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET);
199+ ap136_pci_init(art + AP136_PCIE_CALDATA_OFFSET);
200+}
201+
202+MIPS_MACHINE(ATH79_MACH_AP136, "AP136", "Atheros AP136 reference board",
203+ ap136_setup);
204--- a/arch/mips/ath79/machtypes.h
205+++ b/arch/mips/ath79/machtypes.h
206@@ -17,6 +17,7 @@
207 enum ath79_mach_type {
208     ATH79_MACH_GENERIC = 0,
209     ATH79_MACH_AP121, /* Atheros AP121 reference board */
210+ ATH79_MACH_AP136, /* Atheros AP136 reference board */
211     ATH79_MACH_AP81, /* Atheros AP81 reference board */
212     ATH79_MACH_DB120, /* Atheros DB120 reference board */
213     ATH79_MACH_PB44, /* Atheros PB44 reference board */
214

Archive Download this file



interactive