Commit | Line | Data |
---|---|---|
7e0dde17 GJ |
1 | /* |
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" | |
009b9d52 | 16 | #include "dev-wmac.h" |
7e0dde17 GJ |
17 | |
18 | #define AP121_GPIO_LED_WLAN 0 | |
19 | #define AP121_GPIO_LED_USB 1 | |
20 | ||
21 | #define AP121_GPIO_BTN_JUMPSTART 11 | |
22 | #define AP121_GPIO_BTN_RESET 12 | |
23 | ||
24 | #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */ | |
25 | #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL) | |
26 | ||
27 | #define AP121_CAL_DATA_ADDR 0x1fff1000 | |
28 | ||
29 | static struct gpio_led ap121_leds_gpio[] __initdata = { | |
30 | { | |
31 | .name = "ap121:green:usb", | |
32 | .gpio = AP121_GPIO_LED_USB, | |
33 | .active_low = 0, | |
34 | }, | |
35 | { | |
36 | .name = "ap121:green:wlan", | |
37 | .gpio = AP121_GPIO_LED_WLAN, | |
38 | .active_low = 0, | |
39 | }, | |
40 | }; | |
41 | ||
42 | static struct gpio_keys_button ap121_gpio_keys[] __initdata = { | |
43 | { | |
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, | |
50 | }, | |
51 | { | |
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, | |
58 | } | |
59 | }; | |
60 | ||
61 | static struct spi_board_info ap121_spi_info[] = { | |
62 | { | |
63 | .bus_num = 0, | |
64 | .chip_select = 0, | |
65 | .max_speed_hz = 25000000, | |
66 | .modalias = "mx25l1606e", | |
67 | } | |
68 | }; | |
69 | ||
70 | static struct ath79_spi_platform_data ap121_spi_data = { | |
71 | .bus_num = 0, | |
72 | .num_chipselect = 1, | |
73 | }; | |
74 | ||
75 | static void __init ap121_setup(void) | |
76 | { | |
0b0db270 GJ |
77 | u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR); |
78 | ||
7e0dde17 GJ |
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); | |
84 | ||
85 | ath79_register_spi(&ap121_spi_data, ap121_spi_info, | |
86 | ARRAY_SIZE(ap121_spi_info)); | |
87 | ath79_register_usb(); | |
0b0db270 | 88 | ath79_register_wmac(cal_data); |
7e0dde17 GJ |
89 | } |
90 | ||
91 | MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", | |
92 | ap121_setup); |