ramips: use gpio-keys-polled instead of gpio-buttons
[openwrt.git] / target / linux / ar71xx / patches-3.2 / 016-MIPS-ath79-Add-initial-support-for-the-Atheros-AP121.patch
1 From d7b27740e8376c1c147297b526f9a8e330c1fe17 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 20 Jun 2011 19:26:13 +0200
4 Subject: [PATCH 16/27] MIPS: ath79: Add initial support for the Atheros AP121 reference board
5
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 Cc: linux-mips@linux-mips.org
8 Cc: Kathy Giori <kgiori@qca.qualcomm.com>
9 Cc: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
10 Patchwork: https://patchwork.linux-mips.org/patch/2531/
11 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
12 ---
13 arch/mips/ath79/Kconfig | 11 +++++
14 arch/mips/ath79/Makefile | 1 +
15 arch/mips/ath79/mach-ap121.c | 88 ++++++++++++++++++++++++++++++++++++++++++
16 arch/mips/ath79/machtypes.h | 1 +
17 4 files changed, 101 insertions(+), 0 deletions(-)
18 create mode 100644 arch/mips/ath79/mach-ap121.c
19
20 --- a/arch/mips/ath79/Kconfig
21 +++ b/arch/mips/ath79/Kconfig
22 @@ -2,6 +2,17 @@ if ATH79
23
24 menu "Atheros AR71XX/AR724X/AR913X machine selection"
25
26 +config ATH79_MACH_AP121
27 + bool "Atheros AP121 reference board"
28 + select SOC_AR933X
29 + select ATH79_DEV_GPIO_BUTTONS
30 + select ATH79_DEV_LEDS_GPIO
31 + select ATH79_DEV_SPI
32 + select ATH79_DEV_USB
33 + help
34 + Say 'Y' here if you want your kernel to support the
35 + Atheros AP121 reference board.
36 +
37 config ATH79_MACH_AP81
38 bool "Atheros AP81 reference board"
39 select SOC_AR913X
40 --- a/arch/mips/ath79/Makefile
41 +++ b/arch/mips/ath79/Makefile
42 @@ -25,5 +25,6 @@ obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.
43 #
44 # Machines
45 #
46 +obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o
47 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
48 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
49 --- /dev/null
50 +++ b/arch/mips/ath79/mach-ap121.c
51 @@ -0,0 +1,88 @@
52 +/*
53 + * Atheros AP121 board support
54 + *
55 + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
56 + *
57 + * This program is free software; you can redistribute it and/or modify it
58 + * under the terms of the GNU General Public License version 2 as published
59 + * by the Free Software Foundation.
60 + */
61 +
62 +#include "machtypes.h"
63 +#include "dev-gpio-buttons.h"
64 +#include "dev-leds-gpio.h"
65 +#include "dev-spi.h"
66 +#include "dev-usb.h"
67 +
68 +#define AP121_GPIO_LED_WLAN 0
69 +#define AP121_GPIO_LED_USB 1
70 +
71 +#define AP121_GPIO_BTN_JUMPSTART 11
72 +#define AP121_GPIO_BTN_RESET 12
73 +
74 +#define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
75 +#define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
76 +
77 +#define AP121_CAL_DATA_ADDR 0x1fff1000
78 +
79 +static struct gpio_led ap121_leds_gpio[] __initdata = {
80 + {
81 + .name = "ap121:green:usb",
82 + .gpio = AP121_GPIO_LED_USB,
83 + .active_low = 0,
84 + },
85 + {
86 + .name = "ap121:green:wlan",
87 + .gpio = AP121_GPIO_LED_WLAN,
88 + .active_low = 0,
89 + },
90 +};
91 +
92 +static struct gpio_keys_button ap121_gpio_keys[] __initdata = {
93 + {
94 + .desc = "jumpstart button",
95 + .type = EV_KEY,
96 + .code = KEY_WPS_BUTTON,
97 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
98 + .gpio = AP121_GPIO_BTN_JUMPSTART,
99 + .active_low = 1,
100 + },
101 + {
102 + .desc = "reset button",
103 + .type = EV_KEY,
104 + .code = KEY_RESTART,
105 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
106 + .gpio = AP121_GPIO_BTN_RESET,
107 + .active_low = 1,
108 + }
109 +};
110 +
111 +static struct spi_board_info ap121_spi_info[] = {
112 + {
113 + .bus_num = 0,
114 + .chip_select = 0,
115 + .max_speed_hz = 25000000,
116 + .modalias = "mx25l1606e",
117 + }
118 +};
119 +
120 +static struct ath79_spi_platform_data ap121_spi_data = {
121 + .bus_num = 0,
122 + .num_chipselect = 1,
123 +};
124 +
125 +static void __init ap121_setup(void)
126 +{
127 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
128 + ap121_leds_gpio);
129 + ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
130 + ARRAY_SIZE(ap121_gpio_keys),
131 + ap121_gpio_keys);
132 +
133 + ath79_register_spi(&ap121_spi_data, ap121_spi_info,
134 + ARRAY_SIZE(ap121_spi_info));
135 + ath79_register_usb();
136 +}
137 +
138 +MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
139 + ap121_setup);
140 --- a/arch/mips/ath79/machtypes.h
141 +++ b/arch/mips/ath79/machtypes.h
142 @@ -16,6 +16,7 @@
143
144 enum ath79_mach_type {
145 ATH79_MACH_GENERIC = 0,
146 + ATH79_MACH_AP121, /* Atheros AP121 reference board */
147 ATH79_MACH_AP81, /* Atheros AP81 reference board */
148 ATH79_MACH_PB44, /* Atheros PB44 reference board */
149 };
This page took 0.049432 seconds and 5 git commands to generate.