aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2013-10-09 03:26:55 -0400
committerPaul Walmsley <paul@pwsan.com>2013-10-09 04:54:32 -0400
commitf92d9597f781f6a5a39c73dc71604bd8a21c5299 (patch)
treef9c9508fdd09583f78a03eefb380f456e73a629f
parentb2eb000265115ecb4802ba2ffb35d197ab251390 (diff)
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: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: updated to apply] Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 3d5db8c83b3c..1c217e89deb9 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2357,6 +2357,8 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
2357/** 2357/**
2358 * _init_mpu_rt_base - populate the virtual address for a hwmod 2358 * _init_mpu_rt_base - populate the virtual address for a hwmod
2359 * @oh: struct omap_hwmod * to locate the virtual address 2359 * @oh: struct omap_hwmod * to locate the virtual address
2360 * @data: (unused, caller should pass NULL)
2361 * @np: struct device_node * of the IP block's device node in the DT data
2360 * 2362 *
2361 * Cache the virtual address used by the MPU to access this IP block's 2363 * Cache the virtual address used by the MPU to access this IP block's
2362 * registers. This address is needed early so the OCP registers that 2364 * 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 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and 2367 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2366 * -ENXIO on absent or invalid register target address space. 2368 * -ENXIO on absent or invalid register target address space.
2367 */ 2369 */
2368static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) 2370static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
2371 struct device_node *np)
2369{ 2372{
2370 struct omap_hwmod_addr_space *mem; 2373 struct omap_hwmod_addr_space *mem;
2371 void __iomem *va_start = NULL; 2374 void __iomem *va_start = NULL;
2372 struct device_node *np;
2373 2375
2374 if (!oh) 2376 if (!oh)
2375 return -EINVAL; 2377 return -EINVAL;
@@ -2385,12 +2387,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
2385 oh->name); 2387 oh->name);
2386 2388
2387 /* Extract the IO space from device tree blob */ 2389 /* Extract the IO space from device tree blob */
2388 if (!of_have_populated_dt()) 2390 if (!np)
2389 return -ENXIO; 2391 return -ENXIO;
2390 2392
2391 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); 2393 va_start = of_iomap(np, oh->mpu_rt_idx);
2392 if (np)
2393 va_start = of_iomap(np, oh->mpu_rt_idx);
2394 } else { 2394 } else {
2395 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); 2395 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
2396 } 2396 }
@@ -2423,12 +2423,16 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
2423static int __init _init(struct omap_hwmod *oh, void *data) 2423static int __init _init(struct omap_hwmod *oh, void *data)
2424{ 2424{
2425 int r; 2425 int r;
2426 struct device_node *np = NULL;
2426 2427
2427 if (oh->_state != _HWMOD_STATE_REGISTERED) 2428 if (oh->_state != _HWMOD_STATE_REGISTERED)
2428 return 0; 2429 return 0;
2429 2430
2431 if (of_have_populated_dt())
2432 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
2433
2430 if (oh->class->sysc) { 2434 if (oh->class->sysc) {
2431 r = _init_mpu_rt_base(oh, NULL); 2435 r = _init_mpu_rt_base(oh, NULL, np);
2432 if (r < 0) { 2436 if (r < 0) {
2433 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", 2437 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2434 oh->name); 2438 oh->name);
@@ -2442,6 +2446,12 @@ static int __init _init(struct omap_hwmod *oh, void *data)
2442 return -EINVAL; 2446 return -EINVAL;
2443 } 2447 }
2444 2448
2449 if (np)
2450 if (of_find_property(np, "ti,no-reset-on-init", NULL))
2451 oh->flags |= HWMOD_INIT_NO_RESET;
2452 if (of_find_property(np, "ti,no-idle-on-init", NULL))
2453 oh->flags |= HWMOD_INIT_NO_IDLE;
2454
2445 oh->_state = _HWMOD_STATE_INITIALIZED; 2455 oh->_state = _HWMOD_STATE_INITIALIZED;
2446 2456
2447 return 0; 2457 return 0;