All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] gpio: pl061: use all specified IRQs for chained handler
@ 2017-02-22 12:30 Alexander Sverdlin
  2017-02-22 12:47 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Sverdlin @ 2017-02-22 12:30 UTC (permalink / raw)
  Cc: Alexander Sverdlin, Krzysztof Adamski, Linus Walleij,
	Alexandre Courbot, linux-gpio, Sławomir Stępień

There are several implementations of PL061 which lack GPIOINTR signal in
hardware and only have individual GPIOMIS[7:0] interrupts. It's possible
to support these variants with minimal changes to the driver just
requesting all these IRQs for the same chained handler. While the solution
seems to be suboptimal, this is just a quirk for some particular IPs.

Power Management (wakeup) is not expected to work with these IPs. Only the
basic GPIO functionality.

One in-tree example is arch/arm/boot/dts/axm55xx.dtsi, pl061 instances have
8 IRQs defined, but current driver supports only the first one, so only one
pin would work as IRQ trigger.

Reported-by: Sławomir Stępień <slawomir.stepien@nokia.com>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: Sławomir Stępień <slawomir.stepien@nokia.com>
---
Changes since v1:
- Added AMBA_NR_IRQS loop limit

 drivers/gpio/gpio-pl061.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 0a6bfd2b06e5..0e5205a9a924 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -343,8 +343,15 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 		dev_info(&adev->dev, "could not add irqchip\n");
 		return ret;
 	}
-	gpiochip_set_chained_irqchip(&pl061->gc, &pl061_irqchip,
-				     irq, pl061_irq_handler);
+
+	/*
+	 * There are some PL061 implementations which lack GPIOINTR in hardware
+	 * and only have individual GPIOMIS[7:0] signals. The loop below will
+	 * work for both cases, depending on the device tree.
+	 */
+	for (i = 0; adev->irq[i] && (i < AMBA_NR_IRQS); i++)
+		gpiochip_set_chained_irqchip(&pl061->gc, &pl061_irqchip,
+					     adev->irq[i], pl061_irq_handler);
 
 	amba_set_drvdata(adev, pl061);
 	dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n",
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-23 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 12:30 [PATCH v2] gpio: pl061: use all specified IRQs for chained handler Alexander Sverdlin
2017-02-22 12:47 ` Linus Walleij
2017-02-22 12:57   ` Alexander Sverdlin
2017-02-23  9:45     ` Linus Walleij
2017-02-23 12:58       ` Sławomir Stępień (Nokia - PL/Wroclaw)
2017-02-23 13:49         ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.