Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339896
b: refs/heads/master
c: 9883f7c
h: refs/heads/master
v: v3
  • Loading branch information
Jon Hunter committed Nov 2, 2012
1 parent d4be2ec commit aa9f3a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9725f4451a9ccd159b1d13f63e05896cd9bce07d
refs/heads/master: 9883f7c8dd21acb90697582ca331f3f8a66ac054
28 changes: 27 additions & 1 deletion trunk/arch/arm/mach-omap2/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ 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
Expand Down Expand Up @@ -377,10 +382,25 @@ static u32 notrace dmtimer_read_sched_clock(void)
static int __init omap2_sync32k_clocksource_init(void)
{
int ret;
struct device_node *np = NULL;
struct omap_hwmod *oh;
void __iomem *vbase;
const char *oh_name = "counter_32k";

/*
* If device-tree is present, then search the DT blob
* to see if the 32kHz counter is supported.
*/
if (of_have_populated_dt()) {
np = omap_get_timer_dt(omap_counter_match, NULL);
if (!np)
return -ENODEV;

of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
if (!oh_name)
return -ENODEV;
}

/*
* First check hwmod data is available for sync32k counter
*/
Expand All @@ -390,7 +410,13 @@ static int __init omap2_sync32k_clocksource_init(void)

omap_hwmod_setup_one(oh_name);

vbase = omap_hwmod_get_mpu_rt_va(oh);
if (np) {
vbase = of_iomap(np, 0);
of_node_put(np);
} else {
vbase = omap_hwmod_get_mpu_rt_va(oh);
}

if (!vbase) {
pr_warn("%s: failed to get counter_32k resource\n", __func__);
return -ENXIO;
Expand Down

0 comments on commit aa9f3a9

Please sign in to comment.