summaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-03-13 15:31:12 -0500
committerRob Herring <rob.herring@calxeda.com>2013-04-11 15:11:21 -0500
commit870e2928cf3368ca9b06bc925d0027b0a56bcd8e (patch)
tree77ab94078703065c13f0b3bf9b36f2d439883c9c /arch/arm/common
parent818270d573674188cfe731992e66455e2e183e64 (diff)
downloadlinux-870e2928cf3368ca9b06bc925d0027b0a56bcd8e.tar.gz
linux-870e2928cf3368ca9b06bc925d0027b0a56bcd8e.tar.bz2
linux-870e2928cf3368ca9b06bc925d0027b0a56bcd8e.zip
ARM: integrator-cp: convert use CLKSRC_OF for timer init
Move the integrator-cp timer init to timer-sp.c and use CLKSRC_OF. There is no reason to use the aliases, so drop them from the init code. The integrator-cp timers are mistakenly called sp804 timers in the dts, but in fact they are not sp804 dual timers, but single timers with the same programming model. Fix the dts to reflect this. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/timer-sp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index ded926f7c4e8..ddc740769601 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -31,6 +31,7 @@
#include <asm/sched_clock.h>
#include <asm/hardware/arm_timer.h>
+#include <asm/hardware/timer-sp.h>
static long __init sp804_get_clock_rate(struct clk *clk)
{
@@ -262,3 +263,37 @@ err:
iounmap(base);
}
CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_of_init);
+
+static void __init integrator_cp_of_init(struct device_node *np)
+{
+ static int init_count = 0;
+ void __iomem *base;
+ int irq;
+ const char *name = of_get_property(np, "compatible", NULL);
+
+ base = of_iomap(np, 0);
+ if (WARN_ON(!base))
+ return;
+
+ /* Ensure timer is disabled */
+ writel(0, base + TIMER_CTRL);
+
+ if (init_count == 2 || !of_device_is_available(np))
+ goto err;
+
+ if (!init_count)
+ sp804_clocksource_init(base, name);
+ else {
+ irq = irq_of_parse_and_map(np, 0);
+ if (irq <= 0)
+ goto err;
+
+ sp804_clockevents_init(base, irq, name);
+ }
+
+ init_count++;
+ return;
+err:
+ iounmap(base);
+}
+CLOCKSOURCE_OF_DECLARE(intcp, "arm,integrator-cp-timer", integrator_cp_of_init);