[PATCH v2] gpio: pl061: use all specified IRQs for chained handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
Cc: Krzysztof Adamski <krzysztof.adamski@xxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: Alexandre Courbot <gnurou@xxxxxxxxx>
Cc: linux-gpio@xxxxxxxxxxxxxxx
Cc: Sławomir Stępień <slawomir.stepien@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux