aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2012-05-16 02:45:34 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-17 18:14:02 -0400
commit088efd9273b5076a0aead479aa31f1066d182b3e (patch)
tree17f7972d2134719a36d9527cfeea154fca409b24 /arch/arm/mach-shmobile
parentbd5a875d90c878be4d23f54ea565253734ae2377 (diff)
mach-shmobile: Emma Mobile EV2 GPIO support V3
Tie in the Emma Mobile GPIO driver "em-gio" to support the GPIOs on Emma Mobile EV2. A static IRQ range is used to allow boards to hook up their platform devices to the GPIOs. DT support is still on the TODO for the GPIO driver, so only platform device support is included here. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/Kconfig1
-rw-r--r--arch/arm/mach-shmobile/include/mach/emev2.h3
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c203
3 files changed, 207 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 34c0343db118..8d3c2b18524c 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -45,6 +45,7 @@ config ARCH_EMEV2
45 bool "Emma Mobile EV2" 45 bool "Emma Mobile EV2"
46 select CPU_V7 46 select CPU_V7
47 select ARM_GIC 47 select ARM_GIC
48 select ARCH_WANT_OPTIONAL_GPIOLIB
48 49
49comment "SH-Mobile Board Type" 50comment "SH-Mobile Board Type"
50 51
diff --git a/arch/arm/mach-shmobile/include/mach/emev2.h b/arch/arm/mach-shmobile/include/mach/emev2.h
index 3fc718419854..e6b0c1bf4b7e 100644
--- a/arch/arm/mach-shmobile/include/mach/emev2.h
+++ b/arch/arm/mach-shmobile/include/mach/emev2.h
@@ -13,4 +13,7 @@ extern void emev2_secondary_init(unsigned int cpu);
13extern int emev2_boot_secondary(unsigned int cpu); 13extern int emev2_boot_secondary(unsigned int cpu);
14extern void emev2_smp_prepare_cpus(void); 14extern void emev2_smp_prepare_cpus(void);
15 15
16#define EMEV2_GPIO_BASE 200
17#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
18
16#endif /* __ASM_EMEV2_H__ */ 19#endif /* __ASM_EMEV2_H__ */
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 2a03a78abddd..d40fede8c9b3 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -21,6 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/platform_data/gpio-em.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/input.h> 26#include <linux/input.h>
26#include <linux/io.h> 27#include <linux/io.h>
@@ -156,6 +157,203 @@ static struct platform_device sti_device = {
156 .num_resources = ARRAY_SIZE(sti_resources), 157 .num_resources = ARRAY_SIZE(sti_resources),
157}; 158};
158 159
160
161/* GIO */
162static struct gpio_em_config gio0_config = {
163 .gpio_base = 0,
164 .irq_base = EMEV2_GPIO_IRQ(0),
165 .number_of_pins = 32,
166};
167
168static struct resource gio0_resources[] = {
169 [0] = {
170 .name = "GIO_000",
171 .start = 0xe0050000,
172 .end = 0xe005002b,
173 .flags = IORESOURCE_MEM,
174 },
175 [1] = {
176 .name = "GIO_000",
177 .start = 0xe0050040,
178 .end = 0xe005005f,
179 .flags = IORESOURCE_MEM,
180 },
181 [2] = {
182 .start = 99,
183 .flags = IORESOURCE_IRQ,
184 },
185 [3] = {
186 .start = 100,
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191static struct platform_device gio0_device = {
192 .name = "em_gio",
193 .id = 0,
194 .resource = gio0_resources,
195 .num_resources = ARRAY_SIZE(gio0_resources),
196 .dev = {
197 .platform_data = &gio0_config,
198 },
199};
200
201static struct gpio_em_config gio1_config = {
202 .gpio_base = 32,
203 .irq_base = EMEV2_GPIO_IRQ(32),
204 .number_of_pins = 32,
205};
206
207static struct resource gio1_resources[] = {
208 [0] = {
209 .name = "GIO_032",
210 .start = 0xe0050080,
211 .end = 0xe00500ab,
212 .flags = IORESOURCE_MEM,
213 },
214 [1] = {
215 .name = "GIO_032",
216 .start = 0xe00500c0,
217 .end = 0xe00500df,
218 .flags = IORESOURCE_MEM,
219 },
220 [2] = {
221 .start = 101,
222 .flags = IORESOURCE_IRQ,
223 },
224 [3] = {
225 .start = 102,
226 .flags = IORESOURCE_IRQ,
227 },
228};
229
230static struct platform_device gio1_device = {
231 .name = "em_gio",
232 .id = 1,
233 .resource = gio1_resources,
234 .num_resources = ARRAY_SIZE(gio1_resources),
235 .dev = {
236 .platform_data = &gio1_config,
237 },
238};
239
240static struct gpio_em_config gio2_config = {
241 .gpio_base = 64,
242 .irq_base = EMEV2_GPIO_IRQ(64),
243 .number_of_pins = 32,
244};
245
246static struct resource gio2_resources[] = {
247 [0] = {
248 .name = "GIO_064",
249 .start = 0xe0050100,
250 .end = 0xe005012b,
251 .flags = IORESOURCE_MEM,
252 },
253 [1] = {
254 .name = "GIO_064",
255 .start = 0xe0050140,
256 .end = 0xe005015f,
257 .flags = IORESOURCE_MEM,
258 },
259 [2] = {
260 .start = 103,
261 .flags = IORESOURCE_IRQ,
262 },
263 [3] = {
264 .start = 104,
265 .flags = IORESOURCE_IRQ,
266 },
267};
268
269static struct platform_device gio2_device = {
270 .name = "em_gio",
271 .id = 2,
272 .resource = gio2_resources,
273 .num_resources = ARRAY_SIZE(gio2_resources),
274 .dev = {
275 .platform_data = &gio2_config,
276 },
277};
278
279static struct gpio_em_config gio3_config = {
280 .gpio_base = 96,
281 .irq_base = EMEV2_GPIO_IRQ(96),
282 .number_of_pins = 32,
283};
284
285static struct resource gio3_resources[] = {
286 [0] = {
287 .name = "GIO_096",
288 .start = 0xe0050100,
289 .end = 0xe005012b,
290 .flags = IORESOURCE_MEM,
291 },
292 [1] = {
293 .name = "GIO_096",
294 .start = 0xe0050140,
295 .end = 0xe005015f,
296 .flags = IORESOURCE_MEM,
297 },
298 [2] = {
299 .start = 105,
300 .flags = IORESOURCE_IRQ,
301 },
302 [3] = {
303 .start = 106,
304 .flags = IORESOURCE_IRQ,
305 },
306};
307
308static struct platform_device gio3_device = {
309 .name = "em_gio",
310 .id = 3,
311 .resource = gio3_resources,
312 .num_resources = ARRAY_SIZE(gio3_resources),
313 .dev = {
314 .platform_data = &gio3_config,
315 },
316};
317
318static struct gpio_em_config gio4_config = {
319 .gpio_base = 128,
320 .irq_base = EMEV2_GPIO_IRQ(128),
321 .number_of_pins = 31,
322};
323
324static struct resource gio4_resources[] = {
325 [0] = {
326 .name = "GIO_128",
327 .start = 0xe0050200,
328 .end = 0xe005022b,
329 .flags = IORESOURCE_MEM,
330 },
331 [1] = {
332 .name = "GIO_128",
333 .start = 0xe0050240,
334 .end = 0xe005025f,
335 .flags = IORESOURCE_MEM,
336 },
337 [2] = {
338 .start = 107,
339 .flags = IORESOURCE_IRQ,
340 },
341 [3] = {
342 .start = 108,
343 .flags = IORESOURCE_IRQ,
344 },
345};
346
347static struct platform_device gio4_device = {
348 .name = "em_gio",
349 .id = 4,
350 .resource = gio4_resources,
351 .num_resources = ARRAY_SIZE(gio4_resources),
352 .dev = {
353 .platform_data = &gio4_config,
354 },
355};
356
159static struct platform_device *emev2_early_devices[] __initdata = { 357static struct platform_device *emev2_early_devices[] __initdata = {
160 &uart0_device, 358 &uart0_device,
161 &uart1_device, 359 &uart1_device,
@@ -165,6 +363,11 @@ static struct platform_device *emev2_early_devices[] __initdata = {
165 363
166static struct platform_device *emev2_late_devices[] __initdata = { 364static struct platform_device *emev2_late_devices[] __initdata = {
167 &sti_device, 365 &sti_device,
366 &gio0_device,
367 &gio1_device,
368 &gio2_device,
369 &gio3_device,
370 &gio4_device,
168}; 371};
169 372
170void __init emev2_add_standard_devices(void) 373void __init emev2_add_standard_devices(void)