LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [v5, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown
@ 2021-08-24  9:23 Fengquan Chen
  2021-08-24  9:23 ` [PATCH] " Fengquan Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Fengquan Chen @ 2021-08-24  9:23 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger, Stanley Chu,
	linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: fengquan.chen

From: "fengquan.chen" <fengquan.chen@mediatek.com>

mtk_syst_clkevt_shutdown is called after irq disabled in suspend flow,
clear any pending systimer irq when shutdown to avoid suspend aborted
due to timer irq pending

Also as for systimer in mediatek socs, there must be firstly enable
timer before clear systimer irq

fengquan.chen (1):
  [v5, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq   
     clear flow on shutdown

 drivers/clocksource/timer-mediatek.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
1.8.1.1.dirty


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

* [PATCH] [v5, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown
  2021-08-24  9:23 [v5, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown Fengquan Chen
@ 2021-08-24  9:23 ` Fengquan Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Fengquan Chen @ 2021-08-24  9:23 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger, Stanley Chu,
	linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: fengquan.chen

From: "fengquan.chen" <fengquan.chen@mediatek.com>

mtk_syst_clkevt_shutdown is called after irq disabled in suspend flow,
clear any pending systimer irq when shutdown to avoid suspend aborted
due to timer irq pending

Also as for systimer in mediatek socs, there must be firstly enable
timer before clear systimer irq

Fixes: e3af677607d9("clocksource/drivers/timer-mediatek: Add support for system timer")
Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.com>
---
 drivers/clocksource/timer-mediatek.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 9318edc..6461fd3 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -60,9 +60,9 @@
  * SYST_CON_EN: Clock enable. Shall be set to
  *   - Start timer countdown.
  *   - Allow timeout ticks being updated.
- *   - Allow changing interrupt functions.
+ *   - Allow changing interrupt status,like clear irq pending.
  *
- * SYST_CON_IRQ_EN: Set to allow interrupt.
+ * SYST_CON_IRQ_EN: Set to enable interrupt.
  *
  * SYST_CON_IRQ_CLR: Set to clear interrupt.
  */
@@ -75,6 +75,7 @@
 static void mtk_syst_ack_irq(struct timer_of *to)
 {
 	/* Clear and disable interrupt */
+	writel(SYST_CON_EN, SYST_CON_REG(to));
 	writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to));
 }
 
@@ -111,6 +112,9 @@ static int mtk_syst_clkevt_next_event(unsigned long ticks,
 
 static int mtk_syst_clkevt_shutdown(struct clock_event_device *clkevt)
 {
+	/* Clear any irq */
+	mtk_syst_ack_irq(to_timer_of(clkevt));
+
 	/* Disable timer */
 	writel(0, SYST_CON_REG(to_timer_of(clkevt)));
 
-- 
1.8.1.1.dirty


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

end of thread, other threads:[~2021-08-24  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  9:23 [v5, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown Fengquan Chen
2021-08-24  9:23 ` [PATCH] " Fengquan Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).