Skip to contentSkip to conversation

clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown

PATCH Superseded Fengquan Chen 1 participant 2 messages Apr 9, 2021

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown

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")

Fengquan Chen (1):
[v3, 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(-)
Signature · 1 line
1.8.1.1.dirty
#1 lore raw

PATCH v3 1/1 clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown

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")

Change-Id: I1cd408cef4af4c5d7965eab27eda305ee4356315

---
 drivers/clocksource/timer-mediatek.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clocksource/timer-mediatek.c +6 -2
index 9318edc..6461fd3 100644
@@ -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)));
 
Signature · 1 line
1.8.1.1.dirty