Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rabin Vincent and committed by
Jesper Nilsson
d3dad475 edfb6d5f

+12
+1
arch/cris/Kconfig
··· 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
+9
arch/cris/arch-v32/kernel/time.c
··· 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> ··· 243 242 .dev_id = &crisv32_clockevent, 244 243 }; 245 244 245 + static u64 notrace crisv32_timer_sched_clock(void) 246 + { 247 + return REG_RD(timer, timer_base, r_time); 248 + } 249 + 246 250 static void __init crisv32_timer_init(void) 247 251 { 248 252 reg_timer_rw_intr_mask timer_intr_mask; ··· 280 274 timer_base = (void __iomem *) regi_timer0; 281 275 282 276 crisv32_timer_init(); 277 + 278 + sched_clock_register(crisv32_timer_sched_clock, 32, 279 + CRISV32_TIMER_FREQ); 283 280 284 281 clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time, 285 282 "crisv32-timer", CRISV32_TIMER_FREQ,
+2
arch/cris/kernel/time.c
··· 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)