Commit d3dad475b2839b9964ef54211e135eb6fb9952f9

Authored by Rabin Vincent
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

... ... @@ -57,6 +57,7 @@
57 57 select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
58 58 select CLKSRC_MMIO if ETRAX_ARCH_V32
59 59 select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
  60 + select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32
60 61  
61 62 config HZ
62 63 int
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)