Commit f92d9597 authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Paul Walmsley

ARM: OMAP2+: hwmod: Extract no-idle and no-reset info from DT

Now that we have DT bindings to specify which devices should not
be reset and idled during init, make hwmod extract the information
(and store them in internal flags) from Device tree.
Signed-off-by: default avatarRajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: updated to apply]
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
parent b2eb0002
...@@ -2357,6 +2357,8 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np, ...@@ -2357,6 +2357,8 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
/** /**
* _init_mpu_rt_base - populate the virtual address for a hwmod * _init_mpu_rt_base - populate the virtual address for a hwmod
* @oh: struct omap_hwmod * to locate the virtual address * @oh: struct omap_hwmod * to locate the virtual address
* @data: (unused, caller should pass NULL)
* @np: struct device_node * of the IP block's device node in the DT data
* *
* Cache the virtual address used by the MPU to access this IP block's * Cache the virtual address used by the MPU to access this IP block's
* registers. This address is needed early so the OCP registers that * registers. This address is needed early so the OCP registers that
...@@ -2365,11 +2367,11 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np, ...@@ -2365,11 +2367,11 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
* Returns 0 on success, -EINVAL if an invalid hwmod is passed, and * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
* -ENXIO on absent or invalid register target address space. * -ENXIO on absent or invalid register target address space.
*/ */
static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
struct device_node *np)
{ {
struct omap_hwmod_addr_space *mem; struct omap_hwmod_addr_space *mem;
void __iomem *va_start = NULL; void __iomem *va_start = NULL;
struct device_node *np;
if (!oh) if (!oh)
return -EINVAL; return -EINVAL;
...@@ -2385,12 +2387,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) ...@@ -2385,12 +2387,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
oh->name); oh->name);
/* Extract the IO space from device tree blob */ /* Extract the IO space from device tree blob */
if (!of_have_populated_dt()) if (!np)
return -ENXIO; return -ENXIO;
np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); va_start = of_iomap(np, oh->mpu_rt_idx);
if (np)
va_start = of_iomap(np, oh->mpu_rt_idx);
} else { } else {
va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
} }
...@@ -2423,12 +2423,16 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) ...@@ -2423,12 +2423,16 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
static int __init _init(struct omap_hwmod *oh, void *data) static int __init _init(struct omap_hwmod *oh, void *data)
{ {
int r; int r;
struct device_node *np = NULL;
if (oh->_state != _HWMOD_STATE_REGISTERED) if (oh->_state != _HWMOD_STATE_REGISTERED)
return 0; return 0;
if (of_have_populated_dt())
np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
if (oh->class->sysc) { if (oh->class->sysc) {
r = _init_mpu_rt_base(oh, NULL); r = _init_mpu_rt_base(oh, NULL, np);
if (r < 0) { if (r < 0) {
WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
oh->name); oh->name);
...@@ -2442,6 +2446,12 @@ static int __init _init(struct omap_hwmod *oh, void *data) ...@@ -2442,6 +2446,12 @@ static int __init _init(struct omap_hwmod *oh, void *data)
return -EINVAL; return -EINVAL;
} }
if (np)
if (of_find_property(np, "ti,no-reset-on-init", NULL))
oh->flags |= HWMOD_INIT_NO_RESET;
if (of_find_property(np, "ti,no-idle-on-init", NULL))
oh->flags |= HWMOD_INIT_NO_IDLE;
oh->_state = _HWMOD_STATE_INITIALIZED; oh->_state = _HWMOD_STATE_INITIALIZED;
return 0; return 0;
......
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