[linux-yocto] [PATCH 2/3] arch: arm: mach-owl: modify code to get the correct GPIO bank number

Jiang Lu lu.jiang at windriver.com
Thu Jun 1 03:10:40 PDT 2017


From: Limeng <Meng.Li at windriver.com>

In SDK kernel 3.10, it gets GPIO bank number via current GPIO irq minus
the fixing GPIOA irq, but in kernel 4.1.21 irq is not fixing number, it
is mapped during add GPIO device. So we need to use the mapped irq.

Signed-off-by: Meng Li <Meng.Li at windriver.com>
---
 arch/arm/mach-owl/gpio-owl.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-owl/gpio-owl.c b/arch/arm/mach-owl/gpio-owl.c
index 079fa2f..a54ac7a 100644
--- a/arch/arm/mach-owl/gpio-owl.c
+++ b/arch/arm/mach-owl/gpio-owl.c
@@ -297,6 +297,12 @@ static int owl_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type)
 	return 0;
 }
 
+struct owl_gpio_bank {
+	int irq;
+};
+
+static struct owl_gpio_bank owl_gpio_banks[OWL_GPIO_BANKS];
+
 /*
  * When the summary IRQ is raised, any number of GPIO lines may be high.
  * It is the job of the summary handler to find all those GPIO lines
@@ -312,7 +318,7 @@ static void owl_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 
 	gpioctl = act_readl(INTC_GPIOCTL);
 
-	bank = irq - OWL_IRQ_GPIOA;
+	bank = irq - owl_gpio_banks[0].irq;
 
 	if (bank >= 0 && bank < 5) {
 		if (gpioctl & (1 << ((bank * 5)))) {
@@ -340,13 +346,6 @@ static struct irq_chip owl_gpio_irq_chip = {
 	.irq_set_type   = owl_gpio_irq_set_type,
 };
 
-struct owl_gpio_bank {
-	int irq;
-};
-
-static struct owl_gpio_bank owl_gpio_banks[OWL_GPIO_BANKS];
-
-
 static struct of_device_id owl_gpio_of_match[] = {
 	{ .compatible = "actions,atm7039c-gpio"},
 	{ .compatible = "actions,atm7059a-gpio"},
-- 
2.7.4



More information about the linux-yocto mailing list