aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/timer.c')
-rw-r--r--arch/arm/mach-omap2/timer.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 099e4060afe9..b7f43a28e41f 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -39,6 +39,8 @@
39#include <linux/of.h> 39#include <linux/of.h>
40#include <linux/of_address.h> 40#include <linux/of_address.h>
41#include <linux/of_irq.h> 41#include <linux/of_irq.h>
42#include <linux/platform_device.h>
43#include <linux/platform_data/dmtimer-omap.h>
42 44
43#include <asm/mach/time.h> 45#include <asm/mach/time.h>
44#include <asm/smp_twd.h> 46#include <asm/smp_twd.h>
@@ -160,11 +162,6 @@ static struct of_device_id omap_timer_match[] __initdata = {
160 { } 162 { }
161}; 163};
162 164
163static struct of_device_id omap_counter_match[] __initdata = {
164 { .compatible = "ti,omap-counter32k", },
165 { }
166};
167
168/** 165/**
169 * omap_get_timer_dt - get a timer using device-tree 166 * omap_get_timer_dt - get a timer using device-tree
170 * @match - device-tree match structure for matching a device type 167 * @match - device-tree match structure for matching a device type
@@ -245,10 +242,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
245 const char *oh_name; 242 const char *oh_name;
246 struct device_node *np; 243 struct device_node *np;
247 struct omap_hwmod *oh; 244 struct omap_hwmod *oh;
248 struct resource irq_rsrc, mem_rsrc; 245 struct resource irq, mem;
249 size_t size; 246 int r = 0;
250 int res = 0;
251 int r;
252 247
253 if (of_have_populated_dt()) { 248 if (of_have_populated_dt()) {
254 np = omap_get_timer_dt(omap_timer_match, NULL); 249 np = omap_get_timer_dt(omap_timer_match, NULL);
@@ -280,20 +275,18 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
280 275
281 if (!of_have_populated_dt()) { 276 if (!of_have_populated_dt()) {
282 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, 277 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
283 &irq_rsrc); 278 &irq);
284 if (r) 279 if (r)
285 return -ENXIO; 280 return -ENXIO;
286 timer->irq = irq_rsrc.start; 281 timer->irq = irq.start;
287 282
288 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL, 283 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
289 &mem_rsrc); 284 &mem);
290 if (r) 285 if (r)
291 return -ENXIO; 286 return -ENXIO;
292 timer->phys_base = mem_rsrc.start;
293 size = mem_rsrc.end - mem_rsrc.start;
294 287
295 /* Static mapping, never released */ 288 /* Static mapping, never released */
296 timer->io_base = ioremap(timer->phys_base, size); 289 timer->io_base = ioremap(mem.start, mem.end - mem.start);
297 } 290 }
298 291
299 if (!timer->io_base) 292 if (!timer->io_base)
@@ -310,10 +303,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
310 303
311 src = clk_get(NULL, fck_source); 304 src = clk_get(NULL, fck_source);
312 if (IS_ERR(src)) { 305 if (IS_ERR(src)) {
313 res = -EINVAL; 306 r = -EINVAL;
314 } else { 307 } else {
315 res = clk_set_parent(timer->fclk, src); 308 r = clk_set_parent(timer->fclk, src);
316 if (IS_ERR_VALUE(res)) 309 if (IS_ERR_VALUE(r))
317 pr_warn("%s: %s cannot set source\n", 310 pr_warn("%s: %s cannot set source\n",
318 __func__, oh->name); 311 __func__, oh->name);
319 clk_put(src); 312 clk_put(src);
@@ -334,7 +327,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
334 timer->rate = clk_get_rate(timer->fclk); 327 timer->rate = clk_get_rate(timer->fclk);
335 timer->reserved = 1; 328 timer->reserved = 1;
336 329
337 return res; 330 return r;
338} 331}
339 332
340static void __init omap2_gp_clockevent_init(int gptimer_id, 333static void __init omap2_gp_clockevent_init(int gptimer_id,
@@ -408,6 +401,11 @@ static u32 notrace dmtimer_read_sched_clock(void)
408} 401}
409 402
410#ifdef CONFIG_OMAP_32K_TIMER 403#ifdef CONFIG_OMAP_32K_TIMER
404static struct of_device_id omap_counter_match[] __initdata = {
405 { .compatible = "ti,omap-counter32k", },
406 { }
407};
408
411/* Setup free-running counter for clocksource */ 409/* Setup free-running counter for clocksource */
412static int __init omap2_sync32k_clocksource_init(void) 410static int __init omap2_sync32k_clocksource_init(void)
413{ 411{