453ebd6cfe79dd15103ff6e2678179360287a6b4
[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 --- a/arch/arm/mach-omap2/omap_hwmod.c
12 +++ b/arch/arm/mach-omap2/omap_hwmod.c
13 @@ -2363,11 +2363,11 @@ static struct device_node *of_dev_hwmod_
14   * are part of the device's address space can be ioremapped properly.
15   * No return value.
16   */
17 -static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
18 +static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
19 +                                    struct device_node *np)
20  {
21         struct omap_hwmod_addr_space *mem;
22         void __iomem *va_start = NULL;
23 -       struct device_node *np;
24  
25         if (!oh)
26                 return;
27 @@ -2383,12 +2383,10 @@ static void __init _init_mpu_rt_base(str
28                          oh->name);
29  
30                 /* Extract the IO space from device tree blob */
31 -               if (!of_have_populated_dt())
32 +               if (!np)
33                         return;
34  
35 -               np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
36 -               if (np)
37 -                       va_start = of_iomap(np, oh->mpu_rt_idx);
38 +               va_start = of_iomap(np, oh->mpu_rt_idx);
39         } else {
40                 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
41         }
42 @@ -2420,12 +2418,16 @@ static void __init _init_mpu_rt_base(str
43  static int __init _init(struct omap_hwmod *oh, void *data)
44  {
45         int r;
46 +       struct device_node *np = NULL;
47  
48         if (oh->_state != _HWMOD_STATE_REGISTERED)
49                 return 0;
50  
51 +       if (of_have_populated_dt())
52 +               np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
53 +
54         if (oh->class->sysc)
55 -               _init_mpu_rt_base(oh, NULL);
56 +               _init_mpu_rt_base(oh, NULL, np);
57  
58         r = _init_clocks(oh, NULL);
59         if (r < 0) {
60 @@ -2433,6 +2435,13 @@ static int __init _init(struct omap_hwmo
61                 return -EINVAL;
62         }
63  
64 +       if (np) {
65 +               if (of_find_property(np, "ti,no-reset-on-init", NULL))
66 +                       oh->flags |= HWMOD_INIT_NO_RESET;
67 +               if (of_find_property(np, "ti,no-idle-on-init", NULL))
68 +                       oh->flags |= HWMOD_INIT_NO_IDLE;
69 +       }
70 +
71         oh->_state = _HWMOD_STATE_INITIALIZED;
72  
73         return 0;