summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/timer-fttmr010.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-09-24 10:55:38 +0200
committerThomas Gleixner <tglx@linutronix.de>2018-09-24 10:55:38 +0200
commit864f893f31eecf4d944539ad5ec1d004aefc3f41 (patch)
treef8a9ac24e1cd00a9700a339fb76ec6a4d4a8202f /drivers/clocksource/timer-fttmr010.c
parent6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84 (diff)
parent4451d3f59f2a6f95e5d205c2d04ea072955d080d (diff)
downloadlinux-864f893f31eecf4d944539ad5ec1d004aefc3f41.tar.bz2
Merge branch 'clockevents/4.19-fixes' of https://git.linaro.org/people/daniel.lezcano/linux into timers/urgent
Pull clockevent fixed from Daniel Lezcano: - Add the CLOCK_SOURCE_SUSPEND_NONSTOP for non-am43 SoCs (Keerthy) - Fix set_next_event handler for the fttmr010 (Tao Ren)
Diffstat (limited to 'drivers/clocksource/timer-fttmr010.c')
-rw-r--r--drivers/clocksource/timer-fttmr010.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c
index c020038ebfab..cf93f6419b51 100644
--- a/drivers/clocksource/timer-fttmr010.c
+++ b/drivers/clocksource/timer-fttmr010.c
@@ -130,13 +130,17 @@ static int fttmr010_timer_set_next_event(unsigned long cycles,
cr &= ~fttmr010->t1_enable_val;
writel(cr, fttmr010->base + TIMER_CR);
- /* Setup the match register forward/backward in time */
- cr = readl(fttmr010->base + TIMER1_COUNT);
- if (fttmr010->count_down)
- cr -= cycles;
- else
- cr += cycles;
- writel(cr, fttmr010->base + TIMER1_MATCH1);
+ if (fttmr010->count_down) {
+ /*
+ * ASPEED Timer Controller will load TIMER1_LOAD register
+ * into TIMER1_COUNT register when the timer is re-enabled.
+ */
+ writel(cycles, fttmr010->base + TIMER1_LOAD);
+ } else {
+ /* Setup the match register forward in time */
+ cr = readl(fttmr010->base + TIMER1_COUNT);
+ writel(cr + cycles, fttmr010->base + TIMER1_MATCH1);
+ }
/* Start */
cr = readl(fttmr010->base + TIMER_CR);