openwrt/target/linux/bcm27xx/patches-6.1/961-5-pinctrl-rp1-Clear-eve...

32 lines
1.1 KiB
Diff

From ba9f37cecf19e4d2b5cc7186d054735e3cc7a4a2 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 4 Apr 2024 11:52:33 +0100
Subject: [PATCH 5/5] pinctrl: rp1: Clear events when setting IRQ type
When setting the interrupt type, it is unlikely that any latched events
are of interest, so clear them.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/pinctrl/pinctrl-rp1.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/pinctrl/pinctrl-rp1.c
+++ b/drivers/pinctrl/pinctrl-rp1.c
@@ -848,10 +848,13 @@ static int rp1_irq_set_type(struct rp1_p
return -EINVAL;
}
- /* Clear them all */
+ /* Clear the event enables */
writel(RP1_INT_MASK << RP1_GPIO_EVENTS_SHIFT_RAW,
pin->gpio + RP1_CLR_OFFSET + RP1_GPIO_CTRL);
- /* Set those that are needed */
+ /* Clear any latched events */
+ writel(RP1_GPIO_CTRL_IRQRESET,
+ pin->gpio + RP1_SET_OFFSET + RP1_GPIO_CTRL);
+ /* Enable the events that are needed */
writel(irq_flags << RP1_GPIO_EVENTS_SHIFT_RAW,
pin->gpio + RP1_SET_OFFSET + RP1_GPIO_CTRL);
pin->irq_type = type;