Skip to content

Commit

Permalink
pinctrl: rp1: Clear events when setting IRQ type
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pelwell committed Apr 5, 2024
1 parent e4d1481 commit f656acc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/pinctrl/pinctrl-rp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,13 @@ static int rp1_irq_set_type(struct rp1_pin_info *pin, unsigned int type)
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;
Expand Down

0 comments on commit f656acc

Please sign in to comment.