[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251222-axiado-ax3000-cadence-gpio-support-v1-2-c9ef8e0d0bce@axiado.com>
Date: Mon, 22 Dec 2025 23:28:58 -0800
From: Swark Yang <syang@...ado.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...nel.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Swark Yang <syang@...ado.com>, Tzu-Hao Wei <twei@...ado.com>,
Prasad Bolisetty <pbolisetty@...ado.com>
Subject: [PATCH 2/2] gpio: cadence: Add support for edge-triggered
interrupts
From: Tzu-Hao Wei <twei@...ado.com>
The Cadence GPIO controller (CDNS IP6508) supports edge-triggered
interrupts (rising, falling, and both) via IRQ_TYPE, IRQ_VALUE,
and IRQ_ANY_EDGE registers. This commit enables support for these
modes in cdns_gpio_irq_set_type().
Although the interrupt status register is cleared on read and lacks
per-pin acknowledgment, the driver already handles this safely by
reading the ISR once and dispatching all pending interrupts immediately.
This allows edge IRQs to be used reliably in controlled environments.
Signed-off-by: Tzu-Hao Wei <twei@...ado.com>
Signed-off-by: Swark Yang <syang@...ado.com>
Signed-off-by: Prasad Bolisetty <pbolisetty@...ado.com>
---
drivers/gpio/gpio-cadence.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c
index b9f39566b0f9..e34a160088fb 100644
--- a/drivers/gpio/gpio-cadence.c
+++ b/drivers/gpio/gpio-cadence.c
@@ -93,6 +93,7 @@ static int cdns_gpio_irq_set_type(struct irq_data *d, unsigned int type)
struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip);
u32 int_value;
u32 int_type;
+ u32 int_any;
u32 mask = BIT(d->hwirq);
int ret = 0;
@@ -100,24 +101,26 @@ static int cdns_gpio_irq_set_type(struct irq_data *d, unsigned int type)
int_value = ioread32(cgpio->regs + CDNS_GPIO_IRQ_VALUE) & ~mask;
int_type = ioread32(cgpio->regs + CDNS_GPIO_IRQ_TYPE) & ~mask;
-
- /*
- * The GPIO controller doesn't have an ACK register.
- * All interrupt statuses are cleared on a status register read.
- * Don't support edge interrupts for now.
- */
+ int_any = ioread32(cgpio->regs + CDNS_GPIO_IRQ_ANY_EDGE) & ~mask;
if (type == IRQ_TYPE_LEVEL_HIGH) {
int_type |= mask;
int_value |= mask;
} else if (type == IRQ_TYPE_LEVEL_LOW) {
int_type |= mask;
+ } else if (type == IRQ_TYPE_EDGE_RISING) {
+ int_value |= mask;
+ } else if (type == IRQ_TYPE_EDGE_FALLING) {
+ /* edge trigger, int_value remains cleared for falling */
+ } else if (type == IRQ_TYPE_EDGE_BOTH) {
+ int_any |= mask;
} else {
return -EINVAL;
}
iowrite32(int_value, cgpio->regs + CDNS_GPIO_IRQ_VALUE);
iowrite32(int_type, cgpio->regs + CDNS_GPIO_IRQ_TYPE);
+ iowrite32(int_any, cgpio->regs + CDNS_GPIO_IRQ_ANY_EDGE);
return ret;
}
--
2.25.1
Powered by blists - more mailing lists