aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-pxa.c
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2011-10-14 04:44:07 -0400
committerHaojian Zhuang <haojian.zhuang@marvell.com>2011-11-14 08:07:59 -0500
commit478e223cc39ee98f9f9f0c87cb971a2fe0ce8d12 (patch)
tree1c0dde3d14ddb0997f5cbaf387d46ae879d94887 /drivers/gpio/gpio-pxa.c
parent4929f5a8a99f64378659c5658621e45c90c2aaa9 (diff)
ARM: pxa: recognize gpio number and type
Use cpuid to recognize the gpio number and type. CPU_PXA26x is the special case since we can't identify it by cpuid. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Diffstat (limited to 'drivers/gpio/gpio-pxa.c')
-rw-r--r--drivers/gpio/gpio-pxa.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 3e76c588f080..aebc4e8b7fd1 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -347,12 +347,51 @@ static struct irq_chip pxa_muxed_gpio_chip = {
347 .irq_set_type = pxa_gpio_irq_type, 347 .irq_set_type = pxa_gpio_irq_type,
348}; 348};
349 349
350static int pxa_gpio_nums(void)
351{
352 int count = 0;
353
354#ifdef CONFIG_ARCH_PXA
355 if (cpu_is_pxa25x()) {
356#ifdef CONFIG_CPU_PXA26x
357 count = 89;
358 gpio_type = PXA26X_GPIO;
359#elif defined(CONFIG_PXA25x)
360 count = 84;
361 gpio_type = PXA26X_GPIO;
362#endif /* CONFIG_CPU_PXA26x */
363 } else if (cpu_is_pxa27x()) {
364 count = 120;
365 gpio_type = PXA27X_GPIO;
366 } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) {
367 count = 191;
368 gpio_type = PXA93X_GPIO;
369 } else if (cpu_is_pxa3xx()) {
370 count = 127;
371 gpio_type = PXA3XX_GPIO;
372 }
373#endif /* CONFIG_ARCH_PXA */
374
375#ifdef CONFIG_ARCH_MMP
376 if (cpu_is_pxa168() || cpu_is_pxa910()) {
377 count = 127;
378 gpio_type = MMP_GPIO;
379 } else if (cpu_is_mmp2()) {
380 count = 191;
381 gpio_type = MMP2_GPIO;
382 }
383#endif /* CONFIG_ARCH_MMP */
384 return count;
385}
386
350void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) 387void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
351{ 388{
352 struct pxa_gpio_chip *c; 389 struct pxa_gpio_chip *c;
353 int gpio, irq; 390 int gpio, irq;
354 391
355 pxa_last_gpio = end; 392 pxa_last_gpio = pxa_gpio_nums();
393 if (!pxa_last_gpio)
394 return;
356 395
357 /* Initialize GPIO chips */ 396 /* Initialize GPIO chips */
358 pxa_init_gpio_chip(end); 397 pxa_init_gpio_chip(end);