aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/arch_timer.h9
-rw-r--r--arch/arm64/include/asm/arch_timer.h10
-rw-r--r--drivers/clocksource/arm_arch_timer.c23
-rw-r--r--include/clocksource/arm_arch_timer.h2
4 files changed, 6 insertions, 38 deletions
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 7c1bfc0aea0c..accefe099182 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -80,15 +80,6 @@ static inline u32 arch_timer_get_cntfrq(void)
80 return val; 80 return val;
81} 81}
82 82
83static inline u64 arch_counter_get_cntpct(void)
84{
85 u64 cval;
86
87 isb();
88 asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
89 return cval;
90}
91
92static inline u64 arch_counter_get_cntvct(void) 83static inline u64 arch_counter_get_cntvct(void)
93{ 84{
94 u64 cval; 85 u64 cval;
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index bf6ab242f047..d56ed11ba9a3 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -110,16 +110,6 @@ static inline void __cpuinit arch_counter_set_user_access(void)
110 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 110 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
111} 111}
112 112
113static inline u64 arch_counter_get_cntpct(void)
114{
115 u64 cval;
116
117 isb();
118 asm volatile("mrs %0, cntpct_el0" : "=r" (cval));
119
120 return cval;
121}
122
123static inline u64 arch_counter_get_cntvct(void) 113static inline u64 arch_counter_get_cntvct(void)
124{ 114{
125 u64 cval; 115 u64 cval;
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index a2b254189782..053d846ab5b1 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -186,27 +186,19 @@ u32 arch_timer_get_rate(void)
186 return arch_timer_rate; 186 return arch_timer_rate;
187} 187}
188 188
189/* 189u64 arch_timer_read_counter(void)
190 * Some external users of arch_timer_read_counter (e.g. sched_clock) may try to
191 * call it before it has been initialised. Rather than incur a performance
192 * penalty checking for initialisation, provide a default implementation that
193 * won't lead to time appearing to jump backwards.
194 */
195static u64 arch_timer_read_zero(void)
196{ 190{
197 return 0; 191 return arch_counter_get_cntvct();
198} 192}
199 193
200u64 (*arch_timer_read_counter)(void) = arch_timer_read_zero;
201
202static cycle_t arch_counter_read(struct clocksource *cs) 194static cycle_t arch_counter_read(struct clocksource *cs)
203{ 195{
204 return arch_timer_read_counter(); 196 return arch_counter_get_cntvct();
205} 197}
206 198
207static cycle_t arch_counter_read_cc(const struct cyclecounter *cc) 199static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
208{ 200{
209 return arch_timer_read_counter(); 201 return arch_counter_get_cntvct();
210} 202}
211 203
212static struct clocksource clocksource_counter = { 204static struct clocksource clocksource_counter = {
@@ -287,7 +279,7 @@ static int __init arch_timer_register(void)
287 cyclecounter.mult = clocksource_counter.mult; 279 cyclecounter.mult = clocksource_counter.mult;
288 cyclecounter.shift = clocksource_counter.shift; 280 cyclecounter.shift = clocksource_counter.shift;
289 timecounter_init(&timecounter, &cyclecounter, 281 timecounter_init(&timecounter, &cyclecounter,
290 arch_counter_get_cntpct()); 282 arch_counter_get_cntvct());
291 283
292 if (arch_timer_use_virtual) { 284 if (arch_timer_use_virtual) {
293 ppi = arch_timer_ppi[VIRT_PPI]; 285 ppi = arch_timer_ppi[VIRT_PPI];
@@ -376,11 +368,6 @@ static void __init arch_timer_init(struct device_node *np)
376 } 368 }
377 } 369 }
378 370
379 if (arch_timer_use_virtual)
380 arch_timer_read_counter = arch_counter_get_cntvct;
381 else
382 arch_timer_read_counter = arch_counter_get_cntpct;
383
384 arch_timer_register(); 371 arch_timer_register();
385 arch_timer_arch_init(); 372 arch_timer_arch_init();
386} 373}
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index e6c9c4cc9b23..c463ce990c48 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -32,7 +32,7 @@
32#ifdef CONFIG_ARM_ARCH_TIMER 32#ifdef CONFIG_ARM_ARCH_TIMER
33 33
34extern u32 arch_timer_get_rate(void); 34extern u32 arch_timer_get_rate(void);
35extern u64 (*arch_timer_read_counter)(void); 35extern u64 arch_timer_read_counter(void);
36extern struct timecounter *arch_timer_get_timecounter(void); 36extern struct timecounter *arch_timer_get_timecounter(void);
37 37
38#else 38#else