blob: 353af55fe94d9d691be108d9037a289f86e0a2bf [file] [log] [blame]
Gabor Juhos7e0dde12011-06-20 19:26:13 +02001/*
2 * Atheros AP121 board support
3 *
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5 *
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 */
10
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
17#define AP121_GPIO_LED_WLAN 0
18#define AP121_GPIO_LED_USB 1
19
20#define AP121_GPIO_BTN_JUMPSTART 11
21#define AP121_GPIO_BTN_RESET 12
22
23#define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
24#define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
25
26#define AP121_CAL_DATA_ADDR 0x1fff1000
27
28static struct gpio_led ap121_leds_gpio[] __initdata = {
29 {
30 .name = "ap121:green:usb",
31 .gpio = AP121_GPIO_LED_USB,
32 .active_low = 0,
33 },
34 {
35 .name = "ap121:green:wlan",
36 .gpio = AP121_GPIO_LED_WLAN,
37 .active_low = 0,
38 },
39};
40
41static struct gpio_keys_button ap121_gpio_keys[] __initdata = {
42 {
43 .desc = "jumpstart button",
44 .type = EV_KEY,
45 .code = KEY_WPS_BUTTON,
46 .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
47 .gpio = AP121_GPIO_BTN_JUMPSTART,
48 .active_low = 1,
49 },
50 {
51 .desc = "reset button",
52 .type = EV_KEY,
53 .code = KEY_RESTART,
54 .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
55 .gpio = AP121_GPIO_BTN_RESET,
56 .active_low = 1,
57 }
58};
59
60static struct spi_board_info ap121_spi_info[] = {
61 {
62 .bus_num = 0,
63 .chip_select = 0,
64 .max_speed_hz = 25000000,
65 .modalias = "mx25l1606e",
66 }
67};
68
69static struct ath79_spi_platform_data ap121_spi_data = {
70 .bus_num = 0,
71 .num_chipselect = 1,
72};
73
74static void __init ap121_setup(void)
75{
76 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
77 ap121_leds_gpio);
78 ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
79 ARRAY_SIZE(ap121_gpio_keys),
80 ap121_gpio_keys);
81
82 ath79_register_spi(&ap121_spi_data, ap121_spi_info,
83 ARRAY_SIZE(ap121_spi_info));
84 ath79_register_usb();
85}
86
87MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
88 ap121_setup);