aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-spear
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-04-21 03:45:37 -0400
committerArnd Bergmann <arnd@arndb.de>2012-05-12 15:03:26 -0400
commit30551c0108e0d2fed48778a6bbd52843088bcb7b (patch)
treeb26eba9ad07964e76465bddb42474e25c4690597 /arch/arm/plat-spear
parentfa599c333d3d66846545026b41bcf36d1350fe30 (diff)
SPEAr: Add DT bindings for SPEAr's timer
All SPEAr SoC's use ST's Timer module. This patch adds device tree probing capability for that. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/plat-spear')
-rw-r--r--arch/arm/plat-spear/time.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index a3164d1647fd..9a378987bbb1 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -18,6 +18,8 @@
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/of_irq.h>
22#include <linux/of_address.h>
21#include <linux/time.h> 23#include <linux/time.h>
22#include <linux/irq.h> 24#include <linux/irq.h>
23#include <asm/mach/time.h> 25#include <asm/mach/time.h>
@@ -197,19 +199,32 @@ static void __init spear_clockevent_init(int irq)
197 setup_irq(irq, &spear_timer_irq); 199 setup_irq(irq, &spear_timer_irq);
198} 200}
199 201
200void __init spear_setup_timer(resource_size_t base, int irq) 202const static struct of_device_id timer_of_match[] __initconst = {
203 { .compatible = "st,spear-timer", },
204 { },
205};
206
207void __init spear_setup_of_timer(void)
201{ 208{
202 int ret; 209 struct device_node *np;
210 int irq, ret;
211
212 np = of_find_matching_node(NULL, timer_of_match);
213 if (!np) {
214 pr_err("%s: No timer passed via DT\n", __func__);
215 return;
216 }
203 217
204 if (!request_mem_region(base, SZ_1K, "gpt0")) { 218 irq = irq_of_parse_and_map(np, 0);
205 pr_err("%s:cannot get IO addr\n", __func__); 219 if (!irq) {
220 pr_err("%s: No irq passed for timer via DT\n", __func__);
206 return; 221 return;
207 } 222 }
208 223
209 gpt_base = ioremap(base, SZ_1K); 224 gpt_base = of_iomap(np, 0);
210 if (!gpt_base) { 225 if (!gpt_base) {
211 pr_err("%s:ioremap failed for gpt\n", __func__); 226 pr_err("%s: of iomap failed\n", __func__);
212 goto err_mem; 227 return;
213 } 228 }
214 229
215 gpt_clk = clk_get_sys("gpt0", NULL); 230 gpt_clk = clk_get_sys("gpt0", NULL);
@@ -233,6 +248,4 @@ err_clk:
233 clk_put(gpt_clk); 248 clk_put(gpt_clk);
234err_iomap: 249err_iomap:
235 iounmap(gpt_base); 250 iounmap(gpt_base);
236err_mem:
237 release_mem_region(base, SZ_1K);
238} 251}