diff options
| author | Rabin Vincent <rabin@rab.in> | 2015-03-09 13:51:31 -0400 |
|---|---|---|
| committer | Jesper Nilsson <jespern@axis.com> | 2015-03-25 06:03:41 -0400 |
| commit | d3dad475b2839b9964ef54211e135eb6fb9952f9 (patch) | |
| tree | fcb7df761ed78f5899df8a74dd1726c0fdb43030 /arch/cris | |
| parent | edfb6d5f1a05627204d1640ba527312dc8ea745a (diff) | |
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>
Diffstat (limited to 'arch/cris')
| -rw-r--r-- | arch/cris/Kconfig | 1 | ||||
| -rw-r--r-- | arch/cris/arch-v32/kernel/time.c | 9 | ||||
| -rw-r--r-- | arch/cris/kernel/time.c | 2 |
3 files changed, 12 insertions, 0 deletions
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index bd920ccbef6f..0314e325a669 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
| @@ -57,6 +57,7 @@ config CRIS | |||
| 57 | select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 | 57 | select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 |
| 58 | select CLKSRC_MMIO if ETRAX_ARCH_V32 | 58 | select CLKSRC_MMIO if ETRAX_ARCH_V32 |
| 59 | select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 | 59 | select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 |
| 60 | select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32 | ||
| 60 | 61 | ||
| 61 | config HZ | 62 | config HZ |
| 62 | int | 63 | int |
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c index 7c802121c0c3..4fce9f1f7cc0 100644 --- a/arch/cris/arch-v32/kernel/time.c +++ b/arch/cris/arch-v32/kernel/time.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/threads.h> | 16 | #include <linux/threads.h> |
| 17 | #include <linux/cpufreq.h> | 17 | #include <linux/cpufreq.h> |
| 18 | #include <linux/sched_clock.h> | ||
| 18 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
| 19 | #include <asm/types.h> | 20 | #include <asm/types.h> |
| 20 | #include <asm/signal.h> | 21 | #include <asm/signal.h> |
| @@ -242,6 +243,11 @@ static struct irqaction irq_timer = { | |||
| 242 | .dev_id = &crisv32_clockevent, | 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 | static void __init crisv32_timer_init(void) | 251 | static void __init crisv32_timer_init(void) |
| 246 | { | 252 | { |
| 247 | reg_timer_rw_intr_mask timer_intr_mask; | 253 | reg_timer_rw_intr_mask timer_intr_mask; |
| @@ -275,6 +281,9 @@ void __init time_init(void) | |||
| 275 | 281 | ||
| 276 | crisv32_timer_init(); | 282 | crisv32_timer_init(); |
| 277 | 283 | ||
| 284 | sched_clock_register(crisv32_timer_sched_clock, 32, | ||
| 285 | CRISV32_TIMER_FREQ); | ||
| 286 | |||
| 278 | clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time, | 287 | clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time, |
| 279 | "crisv32-timer", CRISV32_TIMER_FREQ, | 288 | "crisv32-timer", CRISV32_TIMER_FREQ, |
| 280 | 300, 32, clocksource_mmio_readl_up); | 289 | 300, 32, clocksource_mmio_readl_up); |
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index fe6acdabbc8d..7780d379522f 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c | |||
| @@ -79,11 +79,13 @@ cris_do_profile(struct pt_regs* regs) | |||
| 79 | #endif | 79 | #endif |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | #ifndef CONFIG_GENERIC_SCHED_CLOCK | ||
| 82 | unsigned long long sched_clock(void) | 83 | unsigned long long sched_clock(void) |
| 83 | { | 84 | { |
| 84 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + | 85 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + |
| 85 | get_ns_in_jiffie(); | 86 | get_ns_in_jiffie(); |
| 86 | } | 87 | } |
| 88 | #endif | ||
| 87 | 89 | ||
| 88 | static int | 90 | static int |
| 89 | __init init_udelay(void) | 91 | __init init_udelay(void) |
