aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/time.c')
-rw-r--r--arch/arm64/kernel/time.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 3b4b7258f492..b0ef18d14c3b 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -31,8 +31,9 @@
31#include <linux/syscore_ops.h> 31#include <linux/syscore_ops.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/delay.h>
34 35
35#include <clocksource/arm_generic.h> 36#include <clocksource/arm_arch_timer.h>
36 37
37#include <asm/thread_info.h> 38#include <asm/thread_info.h>
38#include <asm/stacktrace.h> 39#include <asm/stacktrace.h>
@@ -59,7 +60,31 @@ unsigned long profile_pc(struct pt_regs *regs)
59EXPORT_SYMBOL(profile_pc); 60EXPORT_SYMBOL(profile_pc);
60#endif 61#endif
61 62
63static u64 sched_clock_mult __read_mostly;
64
65unsigned long long notrace sched_clock(void)
66{
67 return arch_timer_read_counter() * sched_clock_mult;
68}
69
70int read_current_timer(unsigned long *timer_value)
71{
72 *timer_value = arch_timer_read_counter();
73 return 0;
74}
75
62void __init time_init(void) 76void __init time_init(void)
63{ 77{
64 arm_generic_timer_init(); 78 u32 arch_timer_rate;
79
80 if (arch_timer_init())
81 panic("Unable to initialise architected timer.\n");
82
83 arch_timer_rate = arch_timer_get_rate();
84
85 /* Cache the sched_clock multiplier to save a divide in the hot path. */
86 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
87
88 /* Calibrate the delay loop directly */
89 lpj_fine = arch_timer_rate / HZ;
65} 90}