129f895fd1f11bb9dcfda6e40a8e9ad6b96762ee
[openwrt.git] / target / linux / omap / patches-3.12 / 202-ARM-OMAP2-hwmod-Extract-no-idle-and-no-reset-info-from-DT.patch
1 Now that we have DT bindings to specify which devices should not
2 be reset and idled during init, make hwmod extract the information
3 (and store them in internal flags) from Device tree.
4
5 Signed-off-by: Rajendra Nayak <rnayak@ti.com>
6
7 ---
8 arch/arm/mach-omap2/omap_hwmod.c |   23 ++++++++++++++++-------
9  1 file changed, 16 insertions(+), 7 deletions(-)
10
11 diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
12 index d9ee0ff..b55923a 100644
13 --- a/arch/arm/mach-omap2/omap_hwmod.c
14 +++ b/arch/arm/mach-omap2/omap_hwmod.c
15 @@ -2363,11 +2363,11 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
16   * are part of the device's address space can be ioremapped properly.
17   * No return value.
18   */
19 -static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
20 +static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
21 +                                    struct device_node *np)
22  {
23         struct omap_hwmod_addr_space *mem;
24         void __iomem *va_start = NULL;
25 -       struct device_node *np;
26  
27         if (!oh)
28                 return;
29 @@ -2383,12 +2383,10 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
30                          oh->name);
31  
32                 /* Extract the IO space from device tree blob */
33 -               if (!of_have_populated_dt())
34 +               if (!np)
35                         return;
36  
37 -               np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
38 -               if (np)
39 -                       va_start = of_iomap(np, oh->mpu_rt_idx);
40 +               va_start = of_iomap(np, oh->mpu_rt_idx);
41         } else {
42                 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
43         }
44 @@ -2420,12 +2418,16 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
45  static int __init _init(struct omap_hwmod *oh, void *data)
46  {
47         int r;
48 +       struct device_node *np = NULL;
49  
50         if (oh->_state != _HWMOD_STATE_REGISTERED)
51                 return 0;
52  
53 +       if (of_have_populated_dt())
54 +               np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
55 +
56         if (oh->class->sysc)
57 -               _init_mpu_rt_base(oh, NULL);
58 +               _init_mpu_rt_base(oh, NULL, np);
59  
60         r = _init_clocks(oh, NULL);
61         if (r < 0) {
62 @@ -2433,6 +2435,13 @@ static int __init _init(struct omap_hwmod *oh, void *data)
63                 return -EINVAL;
64         }
65  
66 +       if (np) {
67 +               if (of_find_property(np, "ti,no-reset-on-init", NULL))
68 +                       oh->flags |= HWMOD_INIT_NO_RESET;
69 +               if (of_find_property(np, "ti,no-idle-on-init", NULL))
70 +                       oh->flags |= HWMOD_INIT_NO_IDLE;
71 +       }
72 +
73         oh->_state = _HWMOD_STATE_INITIALIZED;
74  
75         return 0;