aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-versatile
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2012-02-23 09:57:11 -0500
committerPawel Moll <pawel.moll@arm.com>2012-02-23 10:09:42 -0500
commite129440af63879808ee0a40613fd1cece935678e (patch)
treed5951428211d644d79d7920cdaff11c948d95003 /arch/arm/plat-versatile
parent98ed4ceb93ba22268f35ebcbb7de0cb1c7e70231 (diff)
ARM: versatile: Map local timers using Device Tree when possible
Try to map TWD registers basing on a "arm,*-twd-timer" Device Tree node. This overrides existing twd_base value. Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Diffstat (limited to 'arch/arm/plat-versatile')
-rw-r--r--arch/arm/plat-versatile/localtimer.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/plat-versatile/localtimer.c b/arch/arm/plat-versatile/localtimer.c
index 0fb3961999b5..e15668793159 100644
--- a/arch/arm/plat-versatile/localtimer.c
+++ b/arch/arm/plat-versatile/localtimer.c
@@ -11,16 +11,42 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/smp.h> 12#include <linux/smp.h>
13#include <linux/clockchips.h> 13#include <linux/clockchips.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
14 16
15#include <asm/smp_twd.h> 17#include <asm/smp_twd.h>
16#include <asm/localtimer.h> 18#include <asm/localtimer.h>
17#include <mach/irqs.h> 19#include <mach/irqs.h>
18 20
21const static struct of_device_id twd_of_match[] __initconst = {
22 { .compatible = "arm,cortex-a9-twd-timer", },
23 { .compatible = "arm,cortex-a5-twd-timer", },
24 { .compatible = "arm,arm11mp-twd-timer", },
25 { },
26};
27
19/* 28/*
20 * Setup the local clock events for a CPU. 29 * Setup the local clock events for a CPU.
21 */ 30 */
22int __cpuinit local_timer_setup(struct clock_event_device *evt) 31int __cpuinit local_timer_setup(struct clock_event_device *evt)
23{ 32{
33#if defined(CONFIG_OF)
34 static int dt_node_probed;
35
36 /* Look for TWD node only once */
37 if (!dt_node_probed) {
38 struct device_node *node = of_find_matching_node(NULL,
39 twd_of_match);
40
41 if (node)
42 twd_base = of_iomap(node, 0);
43
44 dt_node_probed = 1;
45 }
46#endif
47 if (!twd_base)
48 return -ENXIO;
49
24 evt->irq = IRQ_LOCALTIMER; 50 evt->irq = IRQ_LOCALTIMER;
25 twd_timer_setup(evt); 51 twd_timer_setup(evt);
26 return 0; 52 return 0;