1 From a01e8727327cf0fb6382ca8700a3a3f73d93202a Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Fri, 9 Dec 2011 22:23:02 +0100
4 Subject: [PATCH 34/35] MIPS: ath79: add initial support for the Atheros DB120 board
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
9 arch/mips/ath79/Kconfig | 12 +++
10 arch/mips/ath79/Makefile | 1 +
11 arch/mips/ath79/mach-db120.c | 155 ++++++++++++++++++++++++++++++++++++++++++
12 arch/mips/ath79/machtypes.h | 1 +
13 4 files changed, 169 insertions(+), 0 deletions(-)
14 create mode 100644 arch/mips/ath79/mach-db120.c
16 --- a/arch/mips/ath79/Kconfig
17 +++ b/arch/mips/ath79/Kconfig
18 @@ -26,6 +26,18 @@ config ATH79_MACH_AP81
19 Say 'Y' here if you want your kernel to support the
20 Atheros AP81 reference board.
22 +config ATH79_MACH_DB120
23 + bool "Atheros DB120 reference board"
25 + select ATH79_DEV_GPIO_BUTTONS
26 + select ATH79_DEV_LEDS_GPIO
27 + select ATH79_DEV_SPI
28 + select ATH79_DEV_USB
29 + select ATH79_DEV_WMAC
31 + Say 'Y' here if you want your kernel to support the
32 + Atheros DB120 reference board.
34 config ATH79_MACH_PB44
35 bool "Atheros PB44 reference board"
37 --- a/arch/mips/ath79/Makefile
38 +++ b/arch/mips/ath79/Makefile
39 @@ -28,5 +28,6 @@ obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wma
41 obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
42 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
43 +obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
44 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
45 obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
47 +++ b/arch/mips/ath79/mach-db120.c
50 + * Atheros DB120 reference board support
52 + * Copyright (c) 2011 Qualcomm Atheros
53 + * Copyright (c) 2011 Gabor Juhos <juhosg@openwrt.org>
55 + * All rights reserved.
57 + * Redistribution and use in source and binary forms, with or without
58 + * modification, are permitted (subject to the limitations in the
59 + * disclaimer below) provided that the following conditions are met:
61 + * * Redistributions of source code must retain the above copyright
62 + * notice, this list of conditions and the following disclaimer.
64 + * * Redistributions in binary form must reproduce the above copyright
65 + * notice, this list of conditions and the following disclaimer in the
66 + * documentation and/or other materials provided with the
69 + * * Neither the name of Qualcomm Atheros nor the names of its
70 + * contributors may be used to endorse or promote products derived
71 + * from this software without specific prior written permission.
73 + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
74 + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
75 + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
76 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
77 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
78 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
79 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
80 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
81 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
82 + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
83 + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
84 + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
85 + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 +#include <linux/pci.h>
89 +#include <linux/ath9k_platform.h>
91 +#include "machtypes.h"
92 +#include "dev-gpio-buttons.h"
93 +#include "dev-leds-gpio.h"
96 +#include "dev-wmac.h"
99 +#define DB120_GPIO_LED_WLAN_5G 12
100 +#define DB120_GPIO_LED_WLAN_2G 13
101 +#define DB120_GPIO_LED_STATUS 14
102 +#define DB120_GPIO_LED_WPS 15
104 +#define DB120_GPIO_BTN_WPS 16
106 +#define DB120_KEYS_POLL_INTERVAL 20 /* msecs */
107 +#define DB120_KEYS_DEBOUNCE_INTERVAL (3 * DB120_KEYS_POLL_INTERVAL)
109 +#define DB120_WMAC_CALDATA_OFFSET 0x1000
110 +#define DB120_PCIE_CALDATA_OFFSET 0x5000
112 +static struct gpio_led db120_leds_gpio[] __initdata = {
114 + .name = "db120:green:status",
115 + .gpio = DB120_GPIO_LED_STATUS,
119 + .name = "db120:green:wps",
120 + .gpio = DB120_GPIO_LED_WPS,
124 + .name = "db120:green:wlan-5g",
125 + .gpio = DB120_GPIO_LED_WLAN_5G,
129 + .name = "db120:green:wlan-2g",
130 + .gpio = DB120_GPIO_LED_WLAN_2G,
135 +static struct gpio_keys_button db120_gpio_keys[] __initdata = {
137 + .desc = "WPS button",
139 + .code = KEY_WPS_BUTTON,
140 + .debounce_interval = DB120_KEYS_DEBOUNCE_INTERVAL,
141 + .gpio = DB120_GPIO_BTN_WPS,
146 +static struct spi_board_info db120_spi_info[] = {
150 + .max_speed_hz = 25000000,
151 + .modalias = "s25sl064a",
155 +static struct ath79_spi_platform_data db120_spi_data = {
157 + .num_chipselect = 1,
161 +static struct ath9k_platform_data db120_ath9k_data;
163 +static int db120_pci_plat_dev_init(struct pci_dev *dev)
165 + switch (PCI_SLOT(dev->devfn)) {
167 + dev->dev.platform_data = &db120_ath9k_data;
174 +static void __init db120_pci_init(u8 *eeprom)
176 + memcpy(db120_ath9k_data.eeprom_data, eeprom,
177 + sizeof(db120_ath9k_data.eeprom_data));
179 + ath79_pci_set_plat_dev_init(db120_pci_plat_dev_init);
180 + ath79_register_pci();
183 +static inline void db120_pci_init(void) {}
184 +#endif /* CONFIG_PCI */
186 +static void __init db120_setup(void)
188 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
190 + ath79_register_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio),
192 + ath79_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL,
193 + ARRAY_SIZE(db120_gpio_keys),
195 + ath79_register_spi(&db120_spi_data, db120_spi_info,
196 + ARRAY_SIZE(db120_spi_info));
197 + ath79_register_usb();
198 + ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET);
199 + db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET);
202 +MIPS_MACHINE(ATH79_MACH_DB120, "DB120", "Atheros DB120 reference board",
204 --- a/arch/mips/ath79/machtypes.h
205 +++ b/arch/mips/ath79/machtypes.h
206 @@ -18,6 +18,7 @@ enum ath79_mach_type {
207 ATH79_MACH_GENERIC = 0,
208 ATH79_MACH_AP121, /* Atheros AP121 reference board */
209 ATH79_MACH_AP81, /* Atheros AP81 reference board */
210 + ATH79_MACH_DB120, /* Atheros DB120 reference board */
211 ATH79_MACH_PB44, /* Atheros PB44 reference board */
212 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */