Linux 3.12.28
[linux/fpc-iii.git] / arch / mips / ath79 / mach-ap121.c
blob1bf73f2a069d73d41030bae19249d16d9227d484
1 /*
2 * Atheros AP121 board support
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
11 #include "machtypes.h"
12 #include "dev-gpio-buttons.h"
13 #include "dev-leds-gpio.h"
14 #include "dev-spi.h"
15 #include "dev-usb.h"
16 #include "dev-wmac.h"
18 #define AP121_GPIO_LED_WLAN 0
19 #define AP121_GPIO_LED_USB 1
21 #define AP121_GPIO_BTN_JUMPSTART 11
22 #define AP121_GPIO_BTN_RESET 12
24 #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
25 #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
27 #define AP121_CAL_DATA_ADDR 0x1fff1000
29 static struct gpio_led ap121_leds_gpio[] __initdata = {
31 .name = "ap121:green:usb",
32 .gpio = AP121_GPIO_LED_USB,
33 .active_low = 0,
36 .name = "ap121:green:wlan",
37 .gpio = AP121_GPIO_LED_WLAN,
38 .active_low = 0,
42 static struct gpio_keys_button ap121_gpio_keys[] __initdata = {
44 .desc = "jumpstart button",
45 .type = EV_KEY,
46 .code = KEY_WPS_BUTTON,
47 .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
48 .gpio = AP121_GPIO_BTN_JUMPSTART,
49 .active_low = 1,
52 .desc = "reset button",
53 .type = EV_KEY,
54 .code = KEY_RESTART,
55 .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
56 .gpio = AP121_GPIO_BTN_RESET,
57 .active_low = 1,
61 static struct spi_board_info ap121_spi_info[] = {
63 .bus_num = 0,
64 .chip_select = 0,
65 .max_speed_hz = 25000000,
66 .modalias = "mx25l1606e",
70 static struct ath79_spi_platform_data ap121_spi_data = {
71 .bus_num = 0,
72 .num_chipselect = 1,
75 static void __init ap121_setup(void)
77 u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR);
79 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
80 ap121_leds_gpio);
81 ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
82 ARRAY_SIZE(ap121_gpio_keys),
83 ap121_gpio_keys);
85 ath79_register_spi(&ap121_spi_data, ap121_spi_info,
86 ARRAY_SIZE(ap121_spi_info));
87 ath79_register_usb();
88 ath79_register_wmac(cal_data);
91 MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
92 ap121_setup);