]> git.karo-electronics.de Git - linux-beck.git/commitdiff
arm/imx: fix irq_base for gpio
authorShawn Guo <shawn.guo@linaro.org>
Thu, 1 Dec 2011 06:49:29 +0000 (14:49 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Thu, 1 Dec 2011 08:15:15 +0000 (16:15 +0800)
When gpio core dynamically allocate gpio number for a port, it starts
from the end of the total range, 0 ~ ARCH_NR_GPIOS.  That said, the
earlier a port gets probed, the bigger gpio number it gets assigned.
To match this, the irq_base for gpio should be assigned from
'MXC_GPIO_IRQ_START + ARCH_NR_GPIOS' decreasingly.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-mx5/imx51-dt.c
arch/arm/mach-mx5/imx53-dt.c

index eb7531bdfed70309cfa3cfd6321d842d584d894e..22aa54aa9b2af90b38098997fd276289fa3d92e0 100644 (file)
@@ -39,11 +39,10 @@ static void __init imx6q_map_io(void)
 static int __init imx6q_gpio_add_irq_domain(struct device_node *np,
                                struct device_node *interrupt_parent)
 {
-       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS -
-                                  32 * 7; /* imx6q gets 7 gpio ports */
+       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
 
+       gpio_irq_base -= 32;
        irq_domain_add_simple(np, gpio_irq_base);
-       gpio_irq_base += 32;
 
        return 0;
 }
index 3451a463a79af4673fb7fb7a24a89fe594f60d04..596edd967dbfef9a21b009b327f42cdda3ad60b0 100644 (file)
@@ -54,11 +54,10 @@ static int __init imx51_tzic_add_irq_domain(struct device_node *np,
 static int __init imx51_gpio_add_irq_domain(struct device_node *np,
                                struct device_node *interrupt_parent)
 {
-       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS -
-                                  32 * 4; /* imx51 gets 4 gpio ports */
+       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
 
+       gpio_irq_base -= 32;
        irq_domain_add_simple(np, gpio_irq_base);
-       gpio_irq_base += 32;
 
        return 0;
 }
index 022bc0364b5fd5a42dd255c6d373a654f516751b..85bfd5ff21b0bb925583679260321fbc7e25731b 100644 (file)
@@ -58,11 +58,10 @@ static int __init imx53_tzic_add_irq_domain(struct device_node *np,
 static int __init imx53_gpio_add_irq_domain(struct device_node *np,
                                struct device_node *interrupt_parent)
 {
-       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS -
-                                  32 * 7; /* imx53 gets 7 gpio ports */
+       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
 
+       gpio_irq_base -= 32;
        irq_domain_add_simple(np, gpio_irq_base);
-       gpio_irq_base += 32;
 
        return 0;
 }