All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] gpio: dwapb: mask/unmask IRQ when disable/enable it
@ 2020-11-30  9:36 Luo Jiaxing
  2020-11-30 11:22 ` Andy Shevchenko
  2020-12-05 21:58 ` Linus Walleij
  0 siblings, 2 replies; 16+ messages in thread
From: Luo Jiaxing @ 2020-11-30  9:36 UTC (permalink / raw)
  To: bgolaszewski, linus.walleij, Sergey.Semin, andy.shevchenko,
	andriy.shevchenko
  Cc: linux-gpio, linux-kernel, linuxarm

The mask and unmask registers are not configured in dwapb_irq_enable() and
dwapb_irq_disable(). In the following situations, the IRQ will be masked by
default after the IRQ is enabled:

mask IRQ -> disable IRQ -> enable IRQ

In this case, the IRQ status of GPIO controller is inconsistent with it's
irq_data too. For example, in __irq_enable(), IRQD_IRQ_DISABLED and
IRQD_IRQ_MASKED are both clear, but GPIO controller do not perform unmask.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 drivers/gpio/gpio-dwapb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 2a9046c..ca654eb 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -270,6 +270,8 @@ static void dwapb_irq_enable(struct irq_data *d)
 	u32 val;
 
 	spin_lock_irqsave(&gc->bgpio_lock, flags);
+	val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(irqd_to_hwirq(d));
+	dwapb_write(gpio, GPIO_INTMASK, val);
 	val = dwapb_read(gpio, GPIO_INTEN);
 	val |= BIT(irqd_to_hwirq(d));
 	dwapb_write(gpio, GPIO_INTEN, val);
@@ -284,6 +286,8 @@ static void dwapb_irq_disable(struct irq_data *d)
 	u32 val;
 
 	spin_lock_irqsave(&gc->bgpio_lock, flags);
+	val = dwapb_read(gpio, GPIO_INTMASK) | BIT(irqd_to_hwirq(d));
+	dwapb_write(gpio, GPIO_INTMASK, val);
 	val = dwapb_read(gpio, GPIO_INTEN);
 	val &= ~BIT(irqd_to_hwirq(d));
 	dwapb_write(gpio, GPIO_INTEN, val);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-12-15 12:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30  9:36 [PATCH v1] gpio: dwapb: mask/unmask IRQ when disable/enable it Luo Jiaxing
2020-11-30 11:22 ` Andy Shevchenko
2020-12-01  8:59   ` luojiaxing
2020-12-05 22:15     ` Serge Semin
2020-12-06 15:02       ` Linus Walleij
2020-12-06 18:50         ` Marc Zyngier
2020-12-07 13:10           ` luojiaxing
2021-01-06 10:24             ` Bartosz Golaszewski
     [not found]               ` <CAHp75VcFo2hc1kjP9jLxmCdN79rD2R4vCw2P8UssbWe2v4zwcw@mail.gmail.com>
2021-01-07 12:20                 ` Serge Semin
2020-12-07 13:04         ` luojiaxing
2020-12-07 12:44       ` luojiaxing
2020-12-05 21:58 ` Linus Walleij
2023-12-15  8:09   ` Thomas Gleixner
2023-12-15 10:24     ` Serge Semin
2023-12-15 10:56       ` Thomas Gleixner
2023-12-15 12:57         ` Serge Semin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.