]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: architected timers: add support for UP timer
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 20 Jan 2012 10:47:00 +0000 (10:47 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Fri, 27 Apr 2012 12:35:34 +0000 (13:35 +0100)
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>
arch/arm/kernel/arch_timer.c

index 1a34eeebc26ef7aafe8dd80cafef0c93740ffa07..154f0a1756b1665e290901822e15546ea7979ca8 100644 (file)
@@ -246,6 +246,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;
@@ -280,6 +282,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;