Skip to contentSkip to conversation

DaVinci: GPIO: fixes

PATCH In review Prabhakar Lad 5 participants 10 messages Nov 8, 2013 – Nov 20, 2013 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover DaVinci: GPIO: fixes

From: "Lad, Prabhakar" <[email protected]>

This patch series fixes gpio driver regestration
and offset check for unbanked gpio.

Lad, Prabhakar (2):
gpio: davinci: Fix a check for unbanked gpio
ARM: davinci: Fix number of resources passed to
davinci_gpio_register() call

 arch/arm/mach-davinci/dm355.c  |    2 +-
 arch/arm/mach-davinci/dm365.c  |    2 +-
 arch/arm/mach-davinci/dm644x.c |    2 +-
 arch/arm/mach-davinci/dm646x.c |    2 +-
 drivers/gpio/gpio-davinci.c    |    4 +++-
 5 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 gpio: davinci: Fix a check for unbanked gpio

From: "Lad, Prabhakar" <[email protected]>

This patch fixes a check for offset in gpio_to_irq_unbanked() and also assigns gpio_irq, gpio_unbanked of chips[0] to appropriate values which is used in gpio_to_irq_unbanked() function.

---
 drivers/gpio/gpio-davinci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-davinci.c +3 -1
index 8847adf..84be701 100644
@@ -327,7 +327,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
 	 * NOTE:  we assume for now that only irqs in the first gpio_chip
 	 * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
 	 */
-	if (offset < d->irq_base)
+	if (offset < d->gpio_unbanked)
 		return d->gpio_irq + offset;
 	else
 		return -ENODEV;
@@ -419,6 +419,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
 
 		/* pass "bank 0" GPIO IRQs to AINTC */
 		chips[0].chip.to_irq = gpio_to_irq_unbanked;
+		chips[0].gpio_irq = bank_irq;
+		chips[0].gpio_unbanked = pdata->gpio_unbanked;
 		binten = BIT(0);
 
 		/* AINTC handles mask/unmask; GPIO handles triggering */
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/2 ARM: davinci: Fix number of resources passed to davinci_gpio_register() call

In reply to Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

The davinci_gpio_register() function expects the number of resources as the second parameter, but size of resources was passed to it due to which it was causing unexpected behaviour. This patch fixes the same by passing the ARRAY_SIZE of resources.

---
 arch/arm/mach-davinci/dm355.c  |    2 +-
 arch/arm/mach-davinci/dm365.c  |    2 +-
 arch/arm/mach-davinci/dm644x.c |    2 +-
 arch/arm/mach-davinci/dm646x.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-davinci/dm355.c +1 -1
index ef9ff1f..536ce52 100644
@@ -906,7 +906,7 @@ static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
 int __init dm355_gpio_register(void)
 {
 	return davinci_gpio_register(dm355_gpio_resources,
-				     sizeof(dm355_gpio_resources),
+				     ARRAY_SIZE(dm355_gpio_resources),
 				     &dm355_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
arch/arm/mach-davinci/dm365.c +1 -1
index 1511a06..9c96520 100644
@@ -720,7 +720,7 @@ static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
 int __init dm365_gpio_register(void)
 {
 	return davinci_gpio_register(dm365_gpio_resources,
-				     sizeof(dm365_gpio_resources),
+				     ARRAY_SIZE(dm365_gpio_resources),
 				     &dm365_gpio_platform_data);
 }
 
arch/arm/mach-davinci/dm644x.c +1 -1
index 143a321..72a3aa7 100644
@@ -792,7 +792,7 @@ static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
 int __init dm644x_gpio_register(void)
 {
 	return davinci_gpio_register(dm644_gpio_resources,
-				     sizeof(dm644_gpio_resources),
+				     ARRAY_SIZE(dm644_gpio_resources),
 				     &dm644_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
arch/arm/mach-davinci/dm646x.c +1 -1
index 2a73f29..d1b646c 100644
@@ -769,7 +769,7 @@ static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
 int __init dm646x_gpio_register(void)
 {
 	return davinci_gpio_register(dm646x_gpio_resources,
-				     sizeof(dm646x_gpio_resources),
+				     ARRAY_SIZE(dm646x_gpio_resources),
 				     &dm646x_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
Signature · 1 line
1.7.9.5
#6 lore raw
In reply to Prabhakar Lad

Hi Sekhar, Prabhakar Lad

On 11/08/2013 08:45 AM, Prabhakar Lad wrote:> From: "Lad, Prabhakar" <[email protected]>

Quoted 8 lines

This patch series fixes gpio driver regestration
and offset check for unbanked gpio.

Lad, Prabhakar (2):
gpio: davinci: Fix a check for unbanked gpio
ARM: davinci: Fix number of resources passed to
davinci_gpio_register() call

I've verified both patches - looks ok.
Patch 1 - restores unbanked GPIO IRQs functionality
Patch 2 - allows to register GPIO Platform devices and boot without issues.

Could we move forward with these patches?

Quoted 8 lines
  arch/arm/mach-davinci/dm355.c  |    2 +-
  arch/arm/mach-davinci/dm365.c  |    2 +-
  arch/arm/mach-davinci/dm644x.c |    2 +-
  arch/arm/mach-davinci/dm646x.c |    2 +-
  drivers/gpio/gpio-davinci.c    |    4 +++-
  5 files changed, 7 insertions(+), 5 deletions(-)
#8 lore raw
In reply to a message not in the archive

Hi Grygorii,

Quoted 4 lines · Grygorii Strashko

Hi Sekhar, Prabhakar Lad

On 11/08/2013 08:45 AM, Prabhakar Lad wrote:> From: "Lad, Prabhakar" <

[email protected]>

Quoted 4 lines
Quoted 4 lines

This patch series fixes gpio driver regestration
and offset check for unbanked gpio.

Quoted 8 lines
Quoted 4 lines

Lad, Prabhakar (2):
gpio: davinci: Fix a check for unbanked gpio
ARM: davinci: Fix number of resources passed to
davinci_gpio_register() call

I've verified both patches - looks ok.
Patch 1 - restores unbanked GPIO IRQs functionality Patch 2 - allows to register GPIO Platform devices and boot without

issues.

Quoted 3 lines

Could we move forward with these patches?

Can you ACk the patches ?

Regards,
--Prabhakar

#2 lore raw

Re: [PATCH 1/2] gpio: davinci: Fix a check for unbanked gpio

In reply to Prabhakar Lad
Quoted 9 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes a check for offset in gpio_to_irq_unbanked() and also assigns gpio_irq, gpio_unbanked of chips[0] to appropriate values which is used in gpio_to_irq_unbanked() function.

You should note explicitly that this patch fixes broken unbanked IRQ support. You mostly just described what you are doing.

I will fixup while committing.

Thanks,
Sekhar

Quoted 27 lines
---
 drivers/gpio/gpio-davinci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-davinci.c +3 -1
index 8847adf..84be701 100644
@@ -327,7 +327,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
 	 * NOTE:  we assume for now that only irqs in the first gpio_chip
 	 * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
 	 */
-	if (offset < d->irq_base)
+	if (offset < d->gpio_unbanked)
 		return d->gpio_irq + offset;
 	else
 		return -ENODEV;
@@ -419,6 +419,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
 
 		/* pass "bank 0" GPIO IRQs to AINTC */
 		chips[0].chip.to_irq = gpio_to_irq_unbanked;
+		chips[0].gpio_irq = bank_irq;
+		chips[0].gpio_unbanked = pdata->gpio_unbanked;
 		binten = BIT(0);
 
 		/* AINTC handles mask/unmask; GPIO handles triggering */
#9 lore raw
In reply to Grygorii Strashko
Quoted 12 lines · Grygorii Strashko

Hi Sekhar, Prabhakar Lad

On 11/08/2013 08:45 AM, Prabhakar Lad wrote:> From: "Lad, Prabhakar" <[email protected]>

Quoted 8 lines

This patch series fixes gpio driver regestration
and offset check for unbanked gpio.

Lad, Prabhakar (2):
gpio: davinci: Fix a check for unbanked gpio
ARM: davinci: Fix number of resources passed to
davinci_gpio_register() call

Quoted 5 lines

I've verified both patches - looks ok.
Patch 1 - restores unbanked GPIO IRQs functionality
Patch 2 - allows to register GPIO Platform devices and boot without issues.

Could we move forward with these patches?

Prabhakar, both patches look good to me. Thanks for the fixes.

Also Grygorii, have you actually verified that the unbanked IRQ support works? Only DM365 uses it.

What do I add for you? Tested-by: or Acked-by:

Thanks,
Sekhar

#10 lore raw

Hi Sekhar,

Quoted 17 lines · Sekhar Nori
Quoted 16 lines · Grygorii Strashko

Hi Sekhar, Prabhakar Lad

On 11/08/2013 08:45 AM, Prabhakar Lad wrote:> From: "Lad, Prabhakar" <[email protected]>

Quoted 8 lines

This patch series fixes gpio driver regestration
and offset check for unbanked gpio.

Lad, Prabhakar (2):
gpio: davinci: Fix a check for unbanked gpio
ARM: davinci: Fix number of resources passed to
davinci_gpio_register() call

I've verified both patches - looks ok.
Patch 1 - restores unbanked GPIO IRQs functionality
Patch 2 - allows to register GPIO Platform devices and boot without issues.

Quoted 6 lines
Quoted 1 line

Could we move forward with these patches?

Prabhakar, both patches look good to me. Thanks for the fixes.

Also Grygorii, have you actually verified that the unbanked IRQ support works? Only DM365 uses it.

Yes, I've verified it, but on Keystone which has similar GPIO IP which supports only unbanked IRQs.

Quoted 2 lines

What do I add for you? Tested-by: or Acked-by:

Reported-and-Reviewed-and-Tested-by Grygorii Strashko <[email protected]> :P

^Up to you :), but if I understand things right "Acked-by:" included all above

Regards,
- grygorii

Acked-by
#3 lore raw

Re: [PATCH 1/2] gpio: davinci: Fix a check for unbanked gpio

In reply to Sekhar Nori
Quoted 8 lines · Sekhar Nori
Quoted 7 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes a check for offset in gpio_to_irq_unbanked() and also assigns gpio_irq, gpio_unbanked of chips[0] to appropriate values which is used in gpio_to_irq_unbanked() function.

Quoted 7 lines
Quoted 2 lines

You should note explicitly that this patch fixes broken unbanked IRQ support. You mostly just described what you are doing.

I will fixup while committing.

So you're carrying this patch Sekhar?

Thanks:

Yours,
Linus Walleij

#4 lore raw

Re: [PATCH 1/2] gpio: davinci: Fix a check for unbanked gpio

Quoted 12 lines · Linus Walleij
Quoted 11 lines · Sekhar Nori
Quoted 9 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes a check for offset in gpio_to_irq_unbanked() and also assigns gpio_irq, gpio_unbanked of chips[0] to appropriate values which is used in gpio_to_irq_unbanked() function.

Quoted 6 lines
Quoted 4 lines

You should note explicitly that this patch fixes broken unbanked IRQ support. You mostly just described what you are doing.

I will fixup while committing.

So you're carrying this patch Sekhar?

Yes, and I would have sent this for upstream already if not for I going under the weather a bit past couple of days.

Thanks,
Sekhar