From ba9f37cecf19e4d2b5cc7186d054735e3cc7a4a2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 4 Apr 2024 11:52:33 +0100 Subject: [PATCH 1009/1085] 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 --- 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;