1 From f92d9597f781f6a5a39c73dc71604bd8a21c5299 Mon Sep 17 00:00:00 2001
2 From: Rajendra Nayak <rnayak@ti.com>
3 Date: Wed, 09 Oct 2013 07:26:55 +0000
4 Subject: ARM: OMAP2+: hwmod: Extract no-idle and no-reset info from DT
6 Now that we have DT bindings to specify which devices should not
7 be reset and idled during init, make hwmod extract the information
8 (and store them in internal flags) from Device tree.
10 Signed-off-by: Rajendra Nayak <rnayak@ti.com>
11 [paul@pwsan.com: updated to apply]
12 Signed-off-by: Paul Walmsley <paul@pwsan.com>
15 --- a/arch/arm/mach-omap2/omap_hwmod.c
16 +++ b/arch/arm/mach-omap2/omap_hwmod.c
17 @@ -2393,6 +2393,8 @@ static struct device_node *of_dev_hwmod_
19 * _init_mpu_rt_base - populate the virtual address for a hwmod
20 * @oh: struct omap_hwmod * to locate the virtual address
21 + * @data: (unused, caller should pass NULL)
22 + * @np: struct device_node * of the IP block's device node in the DT data
24 * Cache the virtual address used by the MPU to access this IP block's
25 * registers. This address is needed early so the OCP registers that
26 @@ -2401,11 +2403,11 @@ static struct device_node *of_dev_hwmod_
27 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
28 * -ENXIO on absent or invalid register target address space.
30 -static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
31 +static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
32 + struct device_node *np)
34 struct omap_hwmod_addr_space *mem;
35 void __iomem *va_start = NULL;
36 - struct device_node *np;
40 @@ -2421,12 +2423,10 @@ static int __init _init_mpu_rt_base(stru
43 /* Extract the IO space from device tree blob */
44 - if (!of_have_populated_dt())
48 - np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
50 - va_start = of_iomap(np, oh->mpu_rt_idx);
51 + va_start = of_iomap(np, oh->mpu_rt_idx);
53 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
55 @@ -2459,12 +2459,16 @@ static int __init _init_mpu_rt_base(stru
56 static int __init _init(struct omap_hwmod *oh, void *data)
59 + struct device_node *np = NULL;
61 if (oh->_state != _HWMOD_STATE_REGISTERED)
64 + if (of_have_populated_dt())
65 + np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
67 if (oh->class->sysc) {
68 - r = _init_mpu_rt_base(oh, NULL);
69 + r = _init_mpu_rt_base(oh, NULL, np);
71 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
73 @@ -2478,6 +2482,12 @@ static int __init _init(struct omap_hwmo
78 + if (of_find_property(np, "ti,no-reset-on-init", NULL))
79 + oh->flags |= HWMOD_INIT_NO_RESET;
80 + if (of_find_property(np, "ti,no-idle-on-init", NULL))
81 + oh->flags |= HWMOD_INIT_NO_IDLE;
83 oh->_state = _HWMOD_STATE_INITIALIZED;