aboutsummaryrefslogtreecommitdiff
path: root/target/linux/bcm27xx/patches-6.1/961-5-pinctrl-rp1-Clear-events-when-setting-IRQ-type.patch
blob: afb3d965bd6a5ae731cbd8c4dc74d4e5280db64d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;