Commit d3dad475b2839b9964ef54211e135eb6fb9952f9
Committed by
Jesper Nilsson
1 parent
edfb6d5f1a
CRISv32: use GENERIC_SCHED_CLOCK
Provide a fast sched clock using the free-running timer and the generic sched_clock infrastructure. Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Jesper Nilsson <jespern@axis.com>
Showing 3 changed files with 12 additions and 0 deletions Side-by-side Diff
arch/cris/Kconfig
arch/cris/arch-v32/kernel/time.c
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #include <linux/init.h> |
16 | 16 | #include <linux/threads.h> |
17 | 17 | #include <linux/cpufreq.h> |
18 | +#include <linux/sched_clock.h> | |
18 | 19 | #include <linux/mm.h> |
19 | 20 | #include <asm/types.h> |
20 | 21 | #include <asm/signal.h> |
... | ... | @@ -242,6 +243,11 @@ |
242 | 243 | .dev_id = &crisv32_clockevent, |
243 | 244 | }; |
244 | 245 | |
246 | +static u64 notrace crisv32_timer_sched_clock(void) | |
247 | +{ | |
248 | + return REG_RD(timer, timer_base, r_time); | |
249 | +} | |
250 | + | |
245 | 251 | static void __init crisv32_timer_init(void) |
246 | 252 | { |
247 | 253 | reg_timer_rw_intr_mask timer_intr_mask; |
... | ... | @@ -274,6 +280,9 @@ |
274 | 280 | timer_base = (void __iomem *) regi_timer0; |
275 | 281 | |
276 | 282 | crisv32_timer_init(); |
283 | + | |
284 | + sched_clock_register(crisv32_timer_sched_clock, 32, | |
285 | + CRISV32_TIMER_FREQ); | |
277 | 286 | |
278 | 287 | clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time, |
279 | 288 | "crisv32-timer", CRISV32_TIMER_FREQ, |
arch/cris/kernel/time.c
... | ... | @@ -79,11 +79,13 @@ |
79 | 79 | #endif |
80 | 80 | } |
81 | 81 | |
82 | +#ifndef CONFIG_GENERIC_SCHED_CLOCK | |
82 | 83 | unsigned long long sched_clock(void) |
83 | 84 | { |
84 | 85 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + |
85 | 86 | get_ns_in_jiffie(); |
86 | 87 | } |
88 | +#endif | |
87 | 89 | |
88 | 90 | static int |
89 | 91 | __init init_udelay(void) |