From 49ab2fd3f9c1ae551916899c9d3299e97836683e Mon Sep 17 00:00:00 2001 From: Haojian Zhuang Date: Fri, 14 Oct 2011 16:44:07 +0800 Subject: [PATCH] --- yaml --- r: 281781 b: refs/heads/master c: 478e223cc39ee98f9f9f0c87cb971a2fe0ce8d12 h: refs/heads/master i: 281779: 8271f01ac1f70ea98a50b490d60a784de8962ac8 v: v3 --- [refs] | 2 +- trunk/drivers/gpio/gpio-pxa.c | 41 ++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 8ab7a71ad3e5..d2803b3d80a3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4929f5a8a99f64378659c5658621e45c90c2aaa9 +refs/heads/master: 478e223cc39ee98f9f9f0c87cb971a2fe0ce8d12 diff --git a/trunk/drivers/gpio/gpio-pxa.c b/trunk/drivers/gpio/gpio-pxa.c index 3e76c588f080..aebc4e8b7fd1 100644 --- a/trunk/drivers/gpio/gpio-pxa.c +++ b/trunk/drivers/gpio/gpio-pxa.c @@ -347,12 +347,51 @@ static struct irq_chip pxa_muxed_gpio_chip = { .irq_set_type = pxa_gpio_irq_type, }; +static int pxa_gpio_nums(void) +{ + int count = 0; + +#ifdef CONFIG_ARCH_PXA + if (cpu_is_pxa25x()) { +#ifdef CONFIG_CPU_PXA26x + count = 89; + gpio_type = PXA26X_GPIO; +#elif defined(CONFIG_PXA25x) + count = 84; + gpio_type = PXA26X_GPIO; +#endif /* CONFIG_CPU_PXA26x */ + } else if (cpu_is_pxa27x()) { + count = 120; + gpio_type = PXA27X_GPIO; + } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) { + count = 191; + gpio_type = PXA93X_GPIO; + } else if (cpu_is_pxa3xx()) { + count = 127; + gpio_type = PXA3XX_GPIO; + } +#endif /* CONFIG_ARCH_PXA */ + +#ifdef CONFIG_ARCH_MMP + if (cpu_is_pxa168() || cpu_is_pxa910()) { + count = 127; + gpio_type = MMP_GPIO; + } else if (cpu_is_mmp2()) { + count = 191; + gpio_type = MMP2_GPIO; + } +#endif /* CONFIG_ARCH_MMP */ + return count; +} + void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) { struct pxa_gpio_chip *c; int gpio, irq; - pxa_last_gpio = end; + pxa_last_gpio = pxa_gpio_nums(); + if (!pxa_last_gpio) + return; /* Initialize GPIO chips */ pxa_init_gpio_chip(end);