Skip to content

Commit ce95706

Browse files
mtk23002dlezcano
authored andcommitted
clocksource/drivers/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: e3af677("clocksource/drivers/timer-mediatek: Add support for system timer") Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.com> Tested-by: Hsin-Yi Wang <hsinyi@chromium.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/1617960162-1988-2-git-send-email-Fengquan.Chen@mediatek.com
1 parent 3b87265 commit ce95706

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/clocksource/timer-mediatek.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
* SYST_CON_EN: Clock enable. Shall be set to
6161
* - Start timer countdown.
6262
* - Allow timeout ticks being updated.
63-
* - Allow changing interrupt functions.
63+
* - Allow changing interrupt status,like clear irq pending.
6464
*
65-
* SYST_CON_IRQ_EN: Set to allow interrupt.
65+
* SYST_CON_IRQ_EN: Set to enable interrupt.
6666
*
6767
* SYST_CON_IRQ_CLR: Set to clear interrupt.
6868
*/
@@ -75,6 +75,7 @@ static void __iomem *gpt_sched_reg __read_mostly;
7575
static void mtk_syst_ack_irq(struct timer_of *to)
7676
{
7777
/* Clear and disable interrupt */
78+
writel(SYST_CON_EN, SYST_CON_REG(to));
7879
writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to));
7980
}
8081

@@ -111,6 +112,9 @@ static int mtk_syst_clkevt_next_event(unsigned long ticks,
111112

112113
static int mtk_syst_clkevt_shutdown(struct clock_event_device *clkevt)
113114
{
115+
/* Clear any irq */
116+
mtk_syst_ack_irq(to_timer_of(clkevt));
117+
114118
/* Disable timer */
115119
writel(0, SYST_CON_REG(to_timer_of(clkevt)));
116120

0 commit comments

Comments
 (0)