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.c23
2 files changed, 10 insertions, 14 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index e507ab7df60b..d98e7e1ee594 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -62,6 +62,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK
62 62
63config ARM_ARCH_TIMER 63config ARM_ARCH_TIMER
64 bool 64 bool
65 select CLKSRC_OF if OF
65 66
66config CLKSRC_METAG_GENERIC 67config CLKSRC_METAG_GENERIC
67 def_bool y if METAG 68 def_bool y if METAG
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index d7ad425ab9b3..122ff05628b5 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -337,22 +337,14 @@ out:
337 return err; 337 return err;
338} 338}
339 339
340static const struct of_device_id arch_timer_of_match[] __initconst = { 340static 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{ 341{
348 struct device_node *np;
349 u32 freq; 342 u32 freq;
350 int i; 343 int i;
351 344
352 np = of_find_matching_node(NULL, arch_timer_of_match); 345 if (arch_timer_get_rate()) {
353 if (!np) { 346 pr_warn("arch_timer: multiple nodes in dt, skipping\n");
354 pr_err("arch_timer: can't find DT node\n"); 347 return;
355 return -ENODEV;
356 } 348 }
357 349
358 /* Try to determine the frequency from the device tree or CNTFRQ */ 350 /* Try to determine the frequency from the device tree or CNTFRQ */
@@ -378,7 +370,7 @@ int __init arch_timer_init(void)
378 if (!arch_timer_ppi[PHYS_SECURE_PPI] || 370 if (!arch_timer_ppi[PHYS_SECURE_PPI] ||
379 !arch_timer_ppi[PHYS_NONSECURE_PPI]) { 371 !arch_timer_ppi[PHYS_NONSECURE_PPI]) {
380 pr_warn("arch_timer: No interrupt available, giving up\n"); 372 pr_warn("arch_timer: No interrupt available, giving up\n");
381 return -EINVAL; 373 return;
382 } 374 }
383 } 375 }
384 376
@@ -387,5 +379,8 @@ int __init arch_timer_init(void)
387 else 379 else
388 arch_timer_read_counter = arch_counter_get_cntpct; 380 arch_timer_read_counter = arch_counter_get_cntpct;
389 381
390 return arch_timer_register(); 382 arch_timer_register();
383 arch_timer_arch_init();
391} 384}
385CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init);
386CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init);