diff options
author | Stafford Horne <shorne@gmail.com> | 2017-07-06 23:06:30 +0200 |
---|---|---|
committer | Stafford Horne <shorne@gmail.com> | 2017-11-03 06:01:16 +0100 |
commit | 4553474d977d1ee8a81067cfbc588f1df84ce3e9 (patch) | |
tree | 4e74260eb9134fd94a7bc20fc3ab23e4ecb3a7e1 /arch/openrisc/kernel/time.c | |
parent | openrisc: enable LOCKDEP_SUPPORT and irqflags tracing (diff) | |
download | linux-4553474d977d1ee8a81067cfbc588f1df84ce3e9.tar.xz linux-4553474d977d1ee8a81067cfbc588f1df84ce3e9.zip |
openrisc: add tick timer multi-core sync logic
In case timers are not in sync when cpus start (i.e. hot plug / offset
resets) we need to synchronize the secondary cpus internal timer with
the main cpu. This is needed as in OpenRISC SMP there is only one
clocksource registered which reads from the same ttcr register on each
cpu.
This synchronization routine heavily borrows from mips implementation that
does something similar.
Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'arch/openrisc/kernel/time.c')
-rw-r--r-- | arch/openrisc/kernel/time.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/openrisc/kernel/time.c b/arch/openrisc/kernel/time.c index ab04eaedbf8d..6baecea27080 100644 --- a/arch/openrisc/kernel/time.c +++ b/arch/openrisc/kernel/time.c @@ -27,8 +27,14 @@ #include <asm/cpuinfo.h> -static int openrisc_timer_set_next_event(unsigned long delta, - struct clock_event_device *dev) +/* Test the timer ticks to count, used in sync routine */ +inline void openrisc_timer_set(unsigned long count) +{ + mtspr(SPR_TTCR, count); +} + +/* Set the timer to trigger in delta cycles */ +inline void openrisc_timer_set_next(unsigned long delta) { u32 c; @@ -44,7 +50,12 @@ static int openrisc_timer_set_next_event(unsigned long delta, * Keep timer in continuous mode always. */ mtspr(SPR_TTMR, SPR_TTMR_CR | SPR_TTMR_IE | c); +} +static int openrisc_timer_set_next_event(unsigned long delta, + struct clock_event_device *dev) +{ + openrisc_timer_set_next(delta); return 0; } |