upgrade 3.12 targets to 3.12.5
[openwrt/openwrt.git] / target / linux / omap / patches-3.12 / 202-ARM-OMAP2-hwmod-Extract-no-idle-and-no-reset-info-from-DT.patch
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
5
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.
9
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>
13
14 ---
15 --- a/arch/arm/mach-omap2/omap_hwmod.c
16 +++ b/arch/arm/mach-omap2/omap_hwmod.c
17 @@ -2357,6 +2357,8 @@ static struct device_node *of_dev_hwmod_
18 /**
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
23 *
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 @@ -2365,11 +2367,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.
29 */
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)
33 {
34 struct omap_hwmod_addr_space *mem;
35 void __iomem *va_start = NULL;
36 - struct device_node *np;
37
38 if (!oh)
39 return -EINVAL;
40 @@ -2385,12 +2387,10 @@ static int __init _init_mpu_rt_base(stru
41 oh->name);
42
43 /* Extract the IO space from device tree blob */
44 - if (!of_have_populated_dt())
45 + if (!np)
46 return -ENXIO;
47
48 - np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
49 - if (np)
50 - va_start = of_iomap(np, oh->mpu_rt_idx);
51 + va_start = of_iomap(np, oh->mpu_rt_idx);
52 } else {
53 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
54 }
55 @@ -2423,12 +2423,16 @@ static int __init _init_mpu_rt_base(stru
56 static int __init _init(struct omap_hwmod *oh, void *data)
57 {
58 int r;
59 + struct device_node *np = NULL;
60
61 if (oh->_state != _HWMOD_STATE_REGISTERED)
62 return 0;
63
64 + if (of_have_populated_dt())
65 + np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
66 +
67 if (oh->class->sysc) {
68 - r = _init_mpu_rt_base(oh, NULL);
69 + r = _init_mpu_rt_base(oh, NULL, np);
70 if (r < 0) {
71 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
72 oh->name);
73 @@ -2442,6 +2446,12 @@ static int __init _init(struct omap_hwmo
74 return -EINVAL;
75 }
76
77 + if (np)
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;
82 +
83 oh->_state = _HWMOD_STATE_INITIALIZED;
84
85 return 0;