aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/timer.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-11-21 09:46:19 -0800
committerTony Lindgren <tony@atomide.com>2012-11-21 09:46:19 -0800
commit48b0023607c4e524e893a7a378a1dd42234c41a7 (patch)
treedec8ce3b8dab55ecbc65f71f716236fdab95acd3 /arch/arm/mach-omap2/timer.c
parentMerge branch 'fixes-timer' of github.com:jonhunter/linux into omap-for-v3.8/timer (diff)
parentARM: OMAP2+: Fix compiler warning for 32k timer (diff)
downloadlinux-dev-48b0023607c4e524e893a7a378a1dd42234c41a7.tar.xz
linux-dev-48b0023607c4e524e893a7a378a1dd42234c41a7.zip
Merge branch 'cleanup-timer' of git://github.com/jonhunter/linux into omap-for-v3.8/timer
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 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/dmtimer-omap.h>
#include <asm/mach/time.h>
#include <asm/smp_twd.h>
@@ -160,11 +162,6 @@ static struct of_device_id omap_timer_match[] __initdata = {
{ }
};
-static struct of_device_id omap_counter_match[] __initdata = {
- { .compatible = "ti,omap-counter32k", },
- { }
-};
-
/**
* omap_get_timer_dt - get a timer using device-tree
* @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,
const char *oh_name;
struct device_node *np;
struct omap_hwmod *oh;
- struct resource irq_rsrc, mem_rsrc;
- size_t size;
- int res = 0;
- int r;
+ struct resource irq, mem;
+ int r = 0;
if (of_have_populated_dt()) {
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,
if (!of_have_populated_dt()) {
r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
- &irq_rsrc);
+ &irq);
if (r)
return -ENXIO;
- timer->irq = irq_rsrc.start;
+ timer->irq = irq.start;
r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
- &mem_rsrc);
+ &mem);
if (r)
return -ENXIO;
- timer->phys_base = mem_rsrc.start;
- size = mem_rsrc.end - mem_rsrc.start;
/* Static mapping, never released */
- timer->io_base = ioremap(timer->phys_base, size);
+ timer->io_base = ioremap(mem.start, mem.end - mem.start);
}
if (!timer->io_base)
@@ -310,10 +303,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
src = clk_get(NULL, fck_source);
if (IS_ERR(src)) {
- res = -EINVAL;
+ r = -EINVAL;
} else {
- res = clk_set_parent(timer->fclk, src);
- if (IS_ERR_VALUE(res))
+ r = clk_set_parent(timer->fclk, src);
+ if (IS_ERR_VALUE(r))
pr_warn("%s: %s cannot set source\n",
__func__, oh->name);
clk_put(src);
@@ -334,7 +327,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
timer->rate = clk_get_rate(timer->fclk);
timer->reserved = 1;
- return res;
+ return r;
}
static void __init omap2_gp_clockevent_init(int gptimer_id,
@@ -408,6 +401,11 @@ static u32 notrace dmtimer_read_sched_clock(void)
}
#ifdef CONFIG_OMAP_32K_TIMER
+static struct of_device_id omap_counter_match[] __initdata = {
+ { .compatible = "ti,omap-counter32k", },
+ { }
+};
+
/* Setup free-running counter for clocksource */
static int __init omap2_sync32k_clocksource_init(void)
{