ARM: arch_timer: Distinguish between CP15 and memory mapped interface
If a timer uses the CP15 interface, it will not have a
memory mapped base address as part of its device tree
node. If an address is present, use this information and
ignore the CP15 interface.
Change-Id: Ibdba849e3195f1b46e590cf4b5a4204fbc45de3a
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 88cf368..87bb7d3 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -374,8 +374,10 @@
{
int err;
- if (!local_timer_is_architected())
+ if (timer_base)
arch_specific_timer = &arch_timer_ops_mem;
+ else if (!local_timer_is_architected())
+ return -ENXIO;
err = arch_timer_available();
if (err)
@@ -490,10 +492,12 @@
return -ENODEV;
}
- timer_base = of_iomap(np, 0);
- if (!timer_base) {
- pr_err("arch_timer: cant map timer base\n");
- return -ENOMEM;
+ if (of_get_address(np, 0, NULL, NULL)) {
+ timer_base = of_iomap(np, 0);
+ if (!timer_base) {
+ pr_err("arch_timer: cant map timer base\n");
+ return -ENOMEM;
+ }
}
if (of_get_property(np, "irq-is-not-percpu", NULL))