Commit bf4c9449 authored by Felipe Balbi's avatar Felipe Balbi

arm: omap2: timer: limit hwmod usage to non-DT boots

now that we have a working 32k clocksource driver,
we can limit HWMOD usage to non-DT boots and rely
on clocksource_of_init() every time we boot
with DT.

While at that, also make sure that we don't disable
the 32-counter device so it gets probed by its driver.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 429ac200
...@@ -183,6 +183,7 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id * ...@@ -183,6 +183,7 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id *
of_get_property(np, "ti,timer-secure", NULL))) of_get_property(np, "ti,timer-secure", NULL)))
continue; continue;
if (!of_device_is_compatible(np, "ti,omap-counter32k"))
of_add_property(np, &device_disabled); of_add_property(np, &device_disabled);
return np; return np;
} }
...@@ -394,7 +395,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) ...@@ -394,7 +395,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
int ret; int ret;
struct device_node *np = NULL; struct device_node *np = NULL;
struct omap_hwmod *oh; struct omap_hwmod *oh;
void __iomem *vbase;
const char *oh_name = "counter_32k"; const char *oh_name = "counter_32k";
/* /*
...@@ -420,18 +420,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) ...@@ -420,18 +420,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
omap_hwmod_setup_one(oh_name); omap_hwmod_setup_one(oh_name);
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;
}
ret = omap_hwmod_enable(oh); ret = omap_hwmod_enable(oh);
if (ret) { if (ret) {
pr_warn("%s: failed to enable counter_32k module (%d)\n", pr_warn("%s: failed to enable counter_32k module (%d)\n",
...@@ -439,13 +427,18 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) ...@@ -439,13 +427,18 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
return ret; return ret;
} }
if (!of_have_populated_dt()) {
void __iomem *vbase;
vbase = omap_hwmod_get_mpu_rt_va(oh);
ret = omap_init_clocksource_32k(vbase); ret = omap_init_clocksource_32k(vbase);
if (ret) { if (ret) {
pr_warn("%s: failed to initialize counter_32k as a clocksource (%d)\n", pr_warn("%s: failed to initialize counter_32k as a clocksource (%d)\n",
__func__, ret); __func__, ret);
omap_hwmod_idle(oh); omap_hwmod_idle(oh);
} }
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment