1 From a034da3e4d4960266a94d15c811d5f4529fdff44 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Sun, 24 Jun 2012 13:52:23 +0200
4 Subject: [PATCH 27/34] MIPS: ath79: add support for the Qualcomm Atheros AP136 board
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
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
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.
21 +config ATH79_MACH_AP136
22 + bool "Atheros AP136 reference board"
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
30 + Say 'Y' here if you want your kernel to support the
31 + Atheros AP136 reference board.
33 config ATH79_MACH_AP81
34 bool "Atheros AP81 reference board"
36 --- a/arch/mips/ath79/Makefile
37 +++ b/arch/mips/ath79/Makefile
38 @@ -27,6 +27,7 @@ obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wma
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
47 +++ b/arch/mips/ath79/mach-ap136.c
50 + * Qualcomm Atheros AP136 reference board support
52 + * Copyright (c) 2012 Qualcomm Atheros
53 + * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
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.
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.
69 +#include <linux/pci.h>
70 +#include <linux/ath9k_platform.h>
72 +#include "machtypes.h"
73 +#include "dev-gpio-buttons.h"
74 +#include "dev-leds-gpio.h"
77 +#include "dev-wmac.h"
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
88 +#define AP136_GPIO_BTN_WPS 16
89 +#define AP136_GPIO_BTN_RFKILL 21
91 +#define AP136_KEYS_POLL_INTERVAL 20 /* msecs */
92 +#define AP136_KEYS_DEBOUNCE_INTERVAL (3 * AP136_KEYS_POLL_INTERVAL)
94 +#define AP136_WMAC_CALDATA_OFFSET 0x1000
95 +#define AP136_PCIE_CALDATA_OFFSET 0x5000
97 +static struct gpio_led ap136_leds_gpio[] __initdata = {
99 + .name = "ap136:green:status",
100 + .gpio = AP136_GPIO_LED_STATUS_GREEN,
104 + .name = "ap136:red:status",
105 + .gpio = AP136_GPIO_LED_STATUS_RED,
109 + .name = "ap136:green:wps",
110 + .gpio = AP136_GPIO_LED_WPS_GREEN,
114 + .name = "ap136:red:wps",
115 + .gpio = AP136_GPIO_LED_WPS_RED,
119 + .name = "ap136:red:wlan-2g",
120 + .gpio = AP136_GPIO_LED_WLAN_2G,
124 + .name = "ap136:red:usb",
125 + .gpio = AP136_GPIO_LED_USB,
130 +static struct gpio_keys_button ap136_gpio_keys[] __initdata = {
132 + .desc = "WPS button",
134 + .code = KEY_WPS_BUTTON,
135 + .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL,
136 + .gpio = AP136_GPIO_BTN_WPS,
140 + .desc = "RFKILL button",
142 + .code = KEY_RFKILL,
143 + .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL,
144 + .gpio = AP136_GPIO_BTN_RFKILL,
149 +static struct spi_board_info ap136_spi_info[] = {
153 + .max_speed_hz = 25000000,
154 + .modalias = "mx25l6405d",
158 +static struct ath79_spi_platform_data ap136_spi_data = {
160 + .num_chipselect = 1,
164 +static struct ath9k_platform_data ap136_ath9k_data;
166 +static int ap136_pci_plat_dev_init(struct pci_dev *dev)
168 + if (dev->bus->number == 1 && (PCI_SLOT(dev->devfn)) == 0)
169 + dev->dev.platform_data = &ap136_ath9k_data;
174 +static void __init ap136_pci_init(u8 *eeprom)
176 + memcpy(ap136_ath9k_data.eeprom_data, eeprom,
177 + sizeof(ap136_ath9k_data.eeprom_data));
179 + ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init);
180 + ath79_register_pci();
183 +static inline void ap136_pci_init(void) {}
184 +#endif /* CONFIG_PCI */
186 +static void __init ap136_setup(void)
188 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
190 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio),
192 + ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL,
193 + ARRAY_SIZE(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);
202 +MIPS_MACHINE(ATH79_MACH_AP136, "AP136", "Atheros AP136 reference board",
204 --- a/arch/mips/ath79/machtypes.h
205 +++ b/arch/mips/ath79/machtypes.h
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 */