diff options
author | Rob Herring <rob.herring@calxeda.com> | 2013-04-10 19:27:51 -0400 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-04-11 16:11:15 -0400 |
commit | 0583fe478a7d93be2c814b7e50d6e81c287edfe8 (patch) | |
tree | 1fedae32e915a0caf60fa20be32824a67262cf99 /drivers/clocksource | |
parent | f414f13f2fd0d8bb12a87268a55827cda771d42b (diff) |
ARM: convert arm/arm64 arch timer to use CLKSRC_OF init
This converts arm and arm64 to use CLKSRC_OF DT based initialization for
the arch timer. A new function arch_timer_arch_init is added to allow for
arch specific setup.
This has a side effect of enabling sched_clock on omap5 and exynos5. There
should not be any reason not to use the arch timers for sched_clock.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/Kconfig | 1 | ||||
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 23 |
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 | ||
63 | config ARM_ARCH_TIMER | 63 | config ARM_ARCH_TIMER |
64 | bool | 64 | bool |
65 | select CLKSRC_OF if OF | ||
65 | 66 | ||
66 | config CLKSRC_METAG_GENERIC | 67 | config 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 | ||
340 | static const struct of_device_id arch_timer_of_match[] __initconst = { | 340 | static void __init arch_timer_init(struct device_node *np) |
341 | { .compatible = "arm,armv7-timer", }, | ||
342 | { .compatible = "arm,armv8-timer", }, | ||
343 | {}, | ||
344 | }; | ||
345 | |||
346 | int __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 | } |
385 | CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init); | ||
386 | CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init); | ||