aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/Kconfig1
-rw-r--r--drivers/clocksource/arm_arch_timer.c33
-rw-r--r--drivers/clocksource/exynos_mct.c1
3 files changed, 16 insertions, 19 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 7bc6e51757ee..c20de4a85cbd 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -65,6 +65,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK
65 65
66config ARM_ARCH_TIMER 66config ARM_ARCH_TIMER
67 bool 67 bool
68 select CLKSRC_OF if OF
68 69
69config CLKSRC_METAG_GENERIC 70config CLKSRC_METAG_GENERIC
70 def_bool y if METAG 71 def_bool y if METAG
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index d7ad425ab9b3..a2b254189782 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -248,14 +248,16 @@ static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
248static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, 248static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
249 unsigned long action, void *hcpu) 249 unsigned long action, void *hcpu)
250{ 250{
251 struct clock_event_device *evt = this_cpu_ptr(arch_timer_evt); 251 /*
252 252 * Grab cpu pointer in each case to avoid spurious
253 * preemptible warnings
254 */
253 switch (action & ~CPU_TASKS_FROZEN) { 255 switch (action & ~CPU_TASKS_FROZEN) {
254 case CPU_STARTING: 256 case CPU_STARTING:
255 arch_timer_setup(evt); 257 arch_timer_setup(this_cpu_ptr(arch_timer_evt));
256 break; 258 break;
257 case CPU_DYING: 259 case CPU_DYING:
258 arch_timer_stop(evt); 260 arch_timer_stop(this_cpu_ptr(arch_timer_evt));
259 break; 261 break;
260 } 262 }
261 263
@@ -337,22 +339,14 @@ out:
337 return err; 339 return err;
338} 340}
339 341
340static const struct of_device_id arch_timer_of_match[] __initconst = { 342static void __init arch_timer_init(struct device_node *np)
341 { .compatible = "arm,armv7-timer", },
342 { .compatible = "arm,armv8-timer", },
343 {},
344};
345
346int __init arch_timer_init(void)
347{ 343{
348 struct device_node *np;
349 u32 freq; 344 u32 freq;
350 int i; 345 int i;
351 346
352 np = of_find_matching_node(NULL, arch_timer_of_match); 347 if (arch_timer_get_rate()) {
353 if (!np) { 348 pr_warn("arch_timer: multiple nodes in dt, skipping\n");
354 pr_err("arch_timer: can't find DT node\n"); 349 return;
355 return -ENODEV;
356 } 350 }
357 351
358 /* Try to determine the frequency from the device tree or CNTFRQ */ 352 /* Try to determine the frequency from the device tree or CNTFRQ */
@@ -378,7 +372,7 @@ int __init arch_timer_init(void)
378 if (!arch_timer_ppi[PHYS_SECURE_PPI] || 372 if (!arch_timer_ppi[PHYS_SECURE_PPI] ||
379 !arch_timer_ppi[PHYS_NONSECURE_PPI]) { 373 !arch_timer_ppi[PHYS_NONSECURE_PPI]) {
380 pr_warn("arch_timer: No interrupt available, giving up\n"); 374 pr_warn("arch_timer: No interrupt available, giving up\n");
381 return -EINVAL; 375 return;
382 } 376 }
383 } 377 }
384 378
@@ -387,5 +381,8 @@ int __init arch_timer_init(void)
387 else 381 else
388 arch_timer_read_counter = arch_counter_get_cntpct; 382 arch_timer_read_counter = arch_counter_get_cntpct;
389 383
390 return arch_timer_register(); 384 arch_timer_register();
385 arch_timer_arch_init();
391} 386}
387CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init);
388CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init);
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 661026834b23..13a9e4923a03 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -24,7 +24,6 @@
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25#include <linux/clocksource.h> 25#include <linux/clocksource.h>
26 26
27#include <asm/arch_timer.h>
28#include <asm/localtimer.h> 27#include <asm/localtimer.h>
29 28
30#include <plat/cpu.h> 29#include <plat/cpu.h>