summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2012-01-20 10:47:00 +0000
committerMarc Zyngier <marc.zyngier@arm.com>2012-04-20 14:55:10 +0100
commit7d0946693794c6a5e91b7d597eba50efbd10fdac (patch)
tree6fa3e82d60b71747050dc61fdbe3cbbc8e3dbfe3
parent526f1deb0c5fc4e1251a514b7d895928d12d2a41 (diff)
ARM: architected timers: add support for UP timer
If CONFIG_LOCAL_TIMERS is not defined, let the architected timer driver register a single clock_event_device that is used as a global timer. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/kernel/arch_timer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index e2c1f86cd69a..8062805deb4e 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -245,6 +245,8 @@ static struct local_timer_ops arch_timer_ops __cpuinitdata = {
.stop = arch_timer_stop,
};
+static struct clock_event_device arch_timer_global_evt;
+
static int __init arch_timer_common_register(void)
{
int err;
@@ -279,6 +281,17 @@ static int __init arch_timer_common_register(void)
}
err = local_timer_register(&arch_timer_ops);
+ if (err) {
+ /*
+ * We couldn't register as a local timer (could be
+ * because we're on a UP platform, or because some
+ * other local timer is already present...). Try as a
+ * global timer instead.
+ */
+ arch_timer_global_evt.cpumask = cpumask_of(0);
+ err = arch_timer_setup(&arch_timer_global_evt);
+ }
+
if (err)
goto out_free_irq;