diff options
Diffstat (limited to 'arch/sh/boards')
-rw-r--r-- | arch/sh/boards/mach-x3proto/setup.c | 107 |
1 files changed, 105 insertions, 2 deletions
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c index 8fd75109bdc6..d682e2b6a856 100644 --- a/arch/sh/boards/mach-x3proto/setup.c +++ b/arch/sh/boards/mach-x3proto/setup.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/boards/renesas/x3proto/setup.c | 2 | * arch/sh/boards/mach-x3proto/setup.c |
3 | * | 3 | * |
4 | * Renesas SH-X3 Prototype Board Support. | 4 | * Renesas SH-X3 Prototype Board Support. |
5 | * | 5 | * |
6 | * Copyright (C) 2007 - 2008 Paul Mundt | 6 | * Copyright (C) 2007 - 2010 Paul Mundt |
7 | * | 7 | * |
8 | * This file is subject to the terms and conditions of the GNU General Public | 8 | * This file is subject to the terms and conditions of the GNU General Public |
9 | * License. See the file "COPYING" in the main directory of this archive | 9 | * License. See the file "COPYING" in the main directory of this archive |
@@ -16,9 +16,13 @@ | |||
16 | #include <linux/smc91x.h> | 16 | #include <linux/smc91x.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/input.h> | ||
19 | #include <linux/usb/r8a66597.h> | 20 | #include <linux/usb/r8a66597.h> |
20 | #include <linux/usb/m66592.h> | 21 | #include <linux/usb/m66592.h> |
22 | #include <linux/gpio.h> | ||
23 | #include <linux/gpio_keys.h> | ||
21 | #include <mach/ilsel.h> | 24 | #include <mach/ilsel.h> |
25 | #include <mach/hardware.h> | ||
22 | #include <asm/smp-ops.h> | 26 | #include <asm/smp-ops.h> |
23 | 27 | ||
24 | static struct resource heartbeat_resources[] = { | 28 | static struct resource heartbeat_resources[] = { |
@@ -122,11 +126,95 @@ static struct platform_device m66592_usb_peripheral_device = { | |||
122 | .resource = m66592_usb_peripheral_resources, | 126 | .resource = m66592_usb_peripheral_resources, |
123 | }; | 127 | }; |
124 | 128 | ||
129 | static struct gpio_keys_button baseboard_buttons[NR_BASEBOARD_GPIOS] = { | ||
130 | { | ||
131 | .desc = "key44", | ||
132 | .code = KEY_POWER, | ||
133 | .active_low = 1, | ||
134 | .wakeup = 1, | ||
135 | }, { | ||
136 | .desc = "key43", | ||
137 | .code = KEY_SUSPEND, | ||
138 | .active_low = 1, | ||
139 | .wakeup = 1, | ||
140 | }, { | ||
141 | .desc = "key42", | ||
142 | .code = KEY_KATAKANAHIRAGANA, | ||
143 | .active_low = 1, | ||
144 | }, { | ||
145 | .desc = "key41", | ||
146 | .code = KEY_SWITCHVIDEOMODE, | ||
147 | .active_low = 1, | ||
148 | }, { | ||
149 | .desc = "key34", | ||
150 | .code = KEY_F12, | ||
151 | .active_low = 1, | ||
152 | }, { | ||
153 | .desc = "key33", | ||
154 | .code = KEY_F11, | ||
155 | .active_low = 1, | ||
156 | }, { | ||
157 | .desc = "key32", | ||
158 | .code = KEY_F10, | ||
159 | .active_low = 1, | ||
160 | }, { | ||
161 | .desc = "key31", | ||
162 | .code = KEY_F9, | ||
163 | .active_low = 1, | ||
164 | }, { | ||
165 | .desc = "key24", | ||
166 | .code = KEY_F8, | ||
167 | .active_low = 1, | ||
168 | }, { | ||
169 | .desc = "key23", | ||
170 | .code = KEY_F7, | ||
171 | .active_low = 1, | ||
172 | }, { | ||
173 | .desc = "key22", | ||
174 | .code = KEY_F6, | ||
175 | .active_low = 1, | ||
176 | }, { | ||
177 | .desc = "key21", | ||
178 | .code = KEY_F5, | ||
179 | .active_low = 1, | ||
180 | }, { | ||
181 | .desc = "key14", | ||
182 | .code = KEY_F4, | ||
183 | .active_low = 1, | ||
184 | }, { | ||
185 | .desc = "key13", | ||
186 | .code = KEY_F3, | ||
187 | .active_low = 1, | ||
188 | }, { | ||
189 | .desc = "key12", | ||
190 | .code = KEY_F2, | ||
191 | .active_low = 1, | ||
192 | }, { | ||
193 | .desc = "key11", | ||
194 | .code = KEY_F1, | ||
195 | .active_low = 1, | ||
196 | }, | ||
197 | }; | ||
198 | |||
199 | static struct gpio_keys_platform_data baseboard_buttons_data = { | ||
200 | .buttons = baseboard_buttons, | ||
201 | .nbuttons = ARRAY_SIZE(baseboard_buttons), | ||
202 | }; | ||
203 | |||
204 | static struct platform_device baseboard_buttons_device = { | ||
205 | .name = "gpio-keys", | ||
206 | .id = -1, | ||
207 | .dev = { | ||
208 | .platform_data = &baseboard_buttons_data, | ||
209 | }, | ||
210 | }; | ||
211 | |||
125 | static struct platform_device *x3proto_devices[] __initdata = { | 212 | static struct platform_device *x3proto_devices[] __initdata = { |
126 | &heartbeat_device, | 213 | &heartbeat_device, |
127 | &smc91x_device, | 214 | &smc91x_device, |
128 | &r8a66597_usb_host_device, | 215 | &r8a66597_usb_host_device, |
129 | &m66592_usb_peripheral_device, | 216 | &m66592_usb_peripheral_device, |
217 | &baseboard_buttons_device, | ||
130 | }; | 218 | }; |
131 | 219 | ||
132 | static void __init x3proto_init_irq(void) | 220 | static void __init x3proto_init_irq(void) |
@@ -139,12 +227,27 @@ static void __init x3proto_init_irq(void) | |||
139 | 227 | ||
140 | static int __init x3proto_devices_setup(void) | 228 | static int __init x3proto_devices_setup(void) |
141 | { | 229 | { |
230 | int ret, i; | ||
231 | |||
142 | /* | 232 | /* |
143 | * IRLs are only needed for ILSEL mappings, so flip over the INTC | 233 | * IRLs are only needed for ILSEL mappings, so flip over the INTC |
144 | * pins at a later point to enable the GPIOs to settle. | 234 | * pins at a later point to enable the GPIOs to settle. |
145 | */ | 235 | */ |
146 | x3proto_init_irq(); | 236 | x3proto_init_irq(); |
147 | 237 | ||
238 | /* | ||
239 | * Now that ILSELs are available, set up the baseboard GPIOs. | ||
240 | */ | ||
241 | ret = x3proto_gpio_setup(); | ||
242 | if (unlikely(ret)) | ||
243 | return ret; | ||
244 | |||
245 | /* | ||
246 | * Propagate dynamic GPIOs for the baseboard button device. | ||
247 | */ | ||
248 | for (i = 0; i < ARRAY_SIZE(baseboard_buttons); i++) | ||
249 | baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i; | ||
250 | |||
148 | r8a66597_usb_host_resources[1].start = | 251 | r8a66597_usb_host_resources[1].start = |
149 | r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); | 252 | r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); |
150 | 253 | ||