summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch')
-rw-r--r--recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch231
1 files changed, 0 insertions, 231 deletions
diff --git a/recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch b/recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch
deleted file mode 100644
index 3d478516..00000000
--- a/recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0089-OMAP2-clockdomain-Add-2-APIs-to-control-clockdomain-.patch
+++ /dev/null
@@ -1,231 +0,0 @@
1From 4cf6b3a535c5e63c4808733c170a68990e45afa2 Mon Sep 17 00:00:00 2001
2From: Benoit Cousson <b-cousson@ti.com>
3Date: Sun, 10 Jul 2011 05:56:54 -0600
4Subject: [PATCH 089/149] OMAP2+: clockdomain: Add 2 APIs to control clockdomain from hwmod framework
5
6Duplicate the existing API for clockdomain enable from clock to enable
7a clock domain from hwmod framework.
8This will be needed when the hwmod framework will move from the current
9clock centric approach to the module based approach.
10
11These APIs are returning 0 for the moment for OMAP2 and OMAP3 until
12their hwmods are updated with the clksm attribute.
13
14Signed-off-by: Benoit Cousson <b-cousson@ti.com>
15Cc: Kevin Hilman <khilman@ti.com>
16Cc: Paul Walmsley <paul@pwsan.com>
17Cc: Rajendra Nayak <rnayak@ti.com>
18Signed-off-by: Paul Walmsley <paul@pwsan.com>
19---
20 arch/arm/mach-omap2/clockdomain.c | 142 +++++++++++++++++++++++++++---------
21 arch/arm/mach-omap2/clockdomain.h | 3 +
22 2 files changed, 109 insertions(+), 36 deletions(-)
23
24diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
25index 4fbbbfc..5a57de5 100644
26--- a/arch/arm/mach-omap2/clockdomain.c
27+++ b/arch/arm/mach-omap2/clockdomain.c
28@@ -796,7 +796,50 @@ void clkdm_deny_idle(struct clockdomain *clkdm)
29 }
30
31
32-/* Clockdomain-to-clock framework interface code */
33+/* Clockdomain-to-clock/hwmod framework interface code */
34+
35+static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
36+{
37+ if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_enable)
38+ return -EINVAL;
39+
40+ /*
41+ * For arch's with no autodeps, clkcm_clk_enable
42+ * should be called for every clock instance or hwmod that is
43+ * enabled, so the clkdm can be force woken up.
44+ */
45+ if ((atomic_inc_return(&clkdm->usecount) > 1) && autodeps)
46+ return 0;
47+
48+ arch_clkdm->clkdm_clk_enable(clkdm);
49+ pwrdm_wait_transition(clkdm->pwrdm.ptr);
50+ pwrdm_clkdm_state_switch(clkdm);
51+
52+ pr_debug("clockdomain: clkdm %s: enabled\n", clkdm->name);
53+
54+ return 0;
55+}
56+
57+static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
58+{
59+ if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
60+ return -EINVAL;
61+
62+ if (atomic_read(&clkdm->usecount) == 0) {
63+ WARN_ON(1); /* underflow */
64+ return -ERANGE;
65+ }
66+
67+ if (atomic_dec_return(&clkdm->usecount) > 0)
68+ return 0;
69+
70+ arch_clkdm->clkdm_clk_disable(clkdm);
71+ pwrdm_clkdm_state_switch(clkdm);
72+
73+ pr_debug("clockdomain: clkdm %s: disabled\n", clkdm->name);
74+
75+ return 0;
76+}
77
78 /**
79 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
80@@ -819,24 +862,10 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
81 * downstream clocks for debugging purposes?
82 */
83
84- if (!clkdm || !clk)
85+ if (!clk)
86 return -EINVAL;
87
88- if (!arch_clkdm || !arch_clkdm->clkdm_clk_enable)
89- return -EINVAL;
90-
91- if (atomic_inc_return(&clkdm->usecount) > 1)
92- return 0;
93-
94- /* Clockdomain now has one enabled downstream clock */
95-
96- pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
97- clk->name);
98-
99- arch_clkdm->clkdm_clk_enable(clkdm);
100- pwrdm_clkdm_state_switch(clkdm);
101-
102- return 0;
103+ return _clkdm_clk_hwmod_enable(clkdm);
104 }
105
106 /**
107@@ -849,9 +878,8 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
108 * clockdomain usecount goes to 0, put the clockdomain to sleep
109 * (software-supervised mode) or remove the clkdm autodependencies
110 * (hardware-supervised mode). Returns -EINVAL if passed null
111- * pointers; -ERANGE if the @clkdm usecount underflows and debugging
112- * is enabled; or returns 0 upon success or if the clockdomain is in
113- * hwsup idle mode.
114+ * pointers; -ERANGE if the @clkdm usecount underflows; or returns 0
115+ * upon success or if the clockdomain is in hwsup idle mode.
116 */
117 int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
118 {
119@@ -860,30 +888,72 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
120 * downstream clocks for debugging purposes?
121 */
122
123- if (!clkdm || !clk)
124+ if (!clk)
125 return -EINVAL;
126
127- if (!arch_clkdm || !arch_clkdm->clkdm_clk_disable)
128+ return _clkdm_clk_hwmod_disable(clkdm);
129+}
130+
131+/**
132+ * clkdm_hwmod_enable - add an enabled downstream hwmod to this clkdm
133+ * @clkdm: struct clockdomain *
134+ * @oh: struct omap_hwmod * of the enabled downstream hwmod
135+ *
136+ * Increment the usecount of the clockdomain @clkdm and ensure that it
137+ * is awake before @oh is enabled. Intended to be called by
138+ * module_enable() code.
139+ * If the clockdomain is in software-supervised idle mode, force the
140+ * clockdomain to wake. If the clockdomain is in hardware-supervised idle
141+ * mode, add clkdm-pwrdm autodependencies, to ensure that devices in the
142+ * clockdomain can be read from/written to by on-chip processors.
143+ * Returns -EINVAL if passed null pointers;
144+ * returns 0 upon success or if the clockdomain is in hwsup idle mode.
145+ */
146+int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
147+{
148+ /* The clkdm attribute does not exist yet prior OMAP4 */
149+ if (cpu_is_omap24xx() || cpu_is_omap34xx())
150+ return 0;
151+
152+ /*
153+ * XXX Rewrite this code to maintain a list of enabled
154+ * downstream hwmods for debugging purposes?
155+ */
156+
157+ if (!oh)
158 return -EINVAL;
159
160-#ifdef DEBUG
161- if (atomic_read(&clkdm->usecount) == 0) {
162- WARN_ON(1); /* underflow */
163- return -ERANGE;
164- }
165-#endif
166+ return _clkdm_clk_hwmod_enable(clkdm);
167+}
168
169- if (atomic_dec_return(&clkdm->usecount) > 0)
170+/**
171+ * clkdm_hwmod_disable - remove an enabled downstream hwmod from this clkdm
172+ * @clkdm: struct clockdomain *
173+ * @oh: struct omap_hwmod * of the disabled downstream hwmod
174+ *
175+ * Decrement the usecount of this clockdomain @clkdm when @oh is
176+ * disabled. Intended to be called by module_disable() code.
177+ * If the clockdomain usecount goes to 0, put the clockdomain to sleep
178+ * (software-supervised mode) or remove the clkdm autodependencies
179+ * (hardware-supervised mode).
180+ * Returns -EINVAL if passed null pointers; -ERANGE if the @clkdm usecount
181+ * underflows; or returns 0 upon success or if the clockdomain is in hwsup
182+ * idle mode.
183+ */
184+int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
185+{
186+ /* The clkdm attribute does not exist yet prior OMAP4 */
187+ if (cpu_is_omap24xx() || cpu_is_omap34xx())
188 return 0;
189
190- /* All downstream clocks of this clockdomain are now disabled */
191-
192- pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name,
193- clk->name);
194+ /*
195+ * XXX Rewrite this code to maintain a list of enabled
196+ * downstream hwmods for debugging purposes?
197+ */
198
199- arch_clkdm->clkdm_clk_disable(clkdm);
200- pwrdm_clkdm_state_switch(clkdm);
201+ if (!oh)
202+ return -EINVAL;
203
204- return 0;
205+ return _clkdm_clk_hwmod_disable(clkdm);
206 }
207
208diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
209index 5823584..8e0da64 100644
210--- a/arch/arm/mach-omap2/clockdomain.h
211+++ b/arch/arm/mach-omap2/clockdomain.h
212@@ -20,6 +20,7 @@
213
214 #include "powerdomain.h"
215 #include <plat/clock.h>
216+#include <plat/omap_hwmod.h>
217 #include <plat/cpu.h>
218
219 /*
220@@ -183,6 +184,8 @@ int clkdm_sleep(struct clockdomain *clkdm);
221
222 int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
223 int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
224+int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
225+int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
226
227 extern void __init omap2xxx_clockdomains_init(void);
228 extern void __init omap3xxx_clockdomains_init(void);
229--
2301.7.2.5
231