aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-12-21 23:05:15 -0500
committerPaul Walmsley <paul@pwsan.com>2010-12-21 23:05:15 -0500
commitb170fbe1f9f1aa38773b1bcf064ab65951ce739d (patch)
treecb372fdfaa4d640b7029cfaafa4b02daf9c1099c /arch
parenta64bb9cda8b12f599766c7dfe81770d2082a133a (diff)
OMAP2+: clockdomains: split the clkdm hwsup enable/disable function
Split _omap2_clkdm_set_hwsup() into _disable_hwsup() and _enable_hwsup(). While here, also document that the autodeps are deprecated and that they should be removed at the earliest opportunity. The documentation has been fixed for _{enable,disable}_hwsup(), thanks to Kevin Hilman <khilman@deeprootsystems.com> for pointing out that those functions still had placeholder documentation in an earlier patch revision. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-by: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c75
1 files changed, 55 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index da74f719d874..8e3276bfed25 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -140,6 +140,9 @@ static struct clkdm_dep *_clkdm_deps_lookup(struct clockdomain *clkdm,
140 * clockdomain is in hardware-supervised mode. Meant to be called 140 * clockdomain is in hardware-supervised mode. Meant to be called
141 * once at clockdomain layer initialization, since these should remain 141 * once at clockdomain layer initialization, since these should remain
142 * fixed for a particular architecture. No return value. 142 * fixed for a particular architecture. No return value.
143 *
144 * XXX autodeps are deprecated and should be removed at the earliest
145 * opportunity
143 */ 146 */
144static void _autodep_lookup(struct clkdm_autodep *autodep) 147static void _autodep_lookup(struct clkdm_autodep *autodep)
145{ 148{
@@ -167,6 +170,9 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
167 * Add the "autodep" sleep & wakeup dependencies to clockdomain 'clkdm' 170 * Add the "autodep" sleep & wakeup dependencies to clockdomain 'clkdm'
168 * in hardware-supervised mode. Meant to be called from clock framework 171 * in hardware-supervised mode. Meant to be called from clock framework
169 * when a clock inside clockdomain 'clkdm' is enabled. No return value. 172 * when a clock inside clockdomain 'clkdm' is enabled. No return value.
173 *
174 * XXX autodeps are deprecated and should be removed at the earliest
175 * opportunity
170 */ 176 */
171static void _clkdm_add_autodeps(struct clockdomain *clkdm) 177static void _clkdm_add_autodeps(struct clockdomain *clkdm)
172{ 178{
@@ -198,6 +204,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
198 * Remove the "autodep" sleep & wakeup dependencies from clockdomain 'clkdm' 204 * Remove the "autodep" sleep & wakeup dependencies from clockdomain 'clkdm'
199 * in hardware-supervised mode. Meant to be called from clock framework 205 * in hardware-supervised mode. Meant to be called from clock framework
200 * when a clock inside clockdomain 'clkdm' is disabled. No return value. 206 * when a clock inside clockdomain 'clkdm' is disabled. No return value.
207 *
208 * XXX autodeps are deprecated and should be removed at the earliest
209 * opportunity
201 */ 210 */
202static void _clkdm_del_autodeps(struct clockdomain *clkdm) 211static void _clkdm_del_autodeps(struct clockdomain *clkdm)
203{ 212{
@@ -222,28 +231,54 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
222 } 231 }
223} 232}
224 233
225/* 234/**
226 * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit 235 * _enable_hwsup - place a clockdomain into hardware-supervised idle
227 * @clkdm: struct clockdomain * 236 * @clkdm: struct clockdomain *
228 * @enable: int 0 to disable, 1 to enable
229 * 237 *
230 * Internal helper for actually switching the bit that controls hwsup 238 * Place the clockdomain into hardware-supervised idle mode. No return
231 * idle transitions for clkdm. 239 * value.
240 *
241 * XXX Should this return an error if the clockdomain does not support
242 * hardware-supervised idle mode?
243 */
244static void _enable_hwsup(struct clockdomain *clkdm)
245{
246 u32 bits, v;
247
248 if (cpu_is_omap24xx())
249 bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
250 else if (cpu_is_omap34xx() || cpu_is_omap44xx())
251 bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
252 else
253 BUG();
254
255 bits = bits << __ffs(clkdm->clktrctrl_mask);
256
257 v = __raw_readl(clkdm->clkstctrl_reg);
258 v &= ~(clkdm->clktrctrl_mask);
259 v |= bits;
260 __raw_writel(v, clkdm->clkstctrl_reg);
261
262}
263
264/**
265 * _disable_hwsup - place a clockdomain into software-supervised idle
266 * @clkdm: struct clockdomain *
267 *
268 * Place the clockdomain @clkdm into software-supervised idle mode.
269 * No return value.
270 *
271 * XXX Should this return an error if the clockdomain does not support
272 * software-supervised idle mode?
232 */ 273 */
233static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable) 274static void _disable_hwsup(struct clockdomain *clkdm)
234{ 275{
235 u32 bits, v; 276 u32 bits, v;
236 277
237 if (cpu_is_omap24xx()) { 278 if (cpu_is_omap24xx()) {
238 if (enable) 279 bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
239 bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
240 else
241 bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
242 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 280 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
243 if (enable) 281 bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
244 bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
245 else
246 bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
247 } else { 282 } else {
248 BUG(); 283 BUG();
249 } 284 }
@@ -828,7 +863,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
828 _clkdm_add_autodeps(clkdm); 863 _clkdm_add_autodeps(clkdm);
829 } 864 }
830 865
831 _omap2_clkdm_set_hwsup(clkdm, 1); 866 _enable_hwsup(clkdm);
832 867
833 pwrdm_clkdm_state_switch(clkdm); 868 pwrdm_clkdm_state_switch(clkdm);
834} 869}
@@ -856,7 +891,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
856 pr_debug("clockdomain: disabling automatic idle transitions for %s\n", 891 pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
857 clkdm->name); 892 clkdm->name);
858 893
859 _omap2_clkdm_set_hwsup(clkdm, 0); 894 _disable_hwsup(clkdm);
860 895
861 /* 896 /*
862 * XXX This should be removed once TI adds wakeup/sleep 897 * XXX This should be removed once TI adds wakeup/sleep
@@ -916,9 +951,9 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
916 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 951 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
917 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) { 952 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
918 /* Disable HW transitions when we are changing deps */ 953 /* Disable HW transitions when we are changing deps */
919 _omap2_clkdm_set_hwsup(clkdm, 0); 954 _disable_hwsup(clkdm);
920 _clkdm_add_autodeps(clkdm); 955 _clkdm_add_autodeps(clkdm);
921 _omap2_clkdm_set_hwsup(clkdm, 1); 956 _enable_hwsup(clkdm);
922 } else { 957 } else {
923 omap2_clkdm_wakeup(clkdm); 958 omap2_clkdm_wakeup(clkdm);
924 } 959 }
@@ -978,9 +1013,9 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
978 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 1013 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
979 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) { 1014 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
980 /* Disable HW transitions when we are changing deps */ 1015 /* Disable HW transitions when we are changing deps */
981 _omap2_clkdm_set_hwsup(clkdm, 0); 1016 _disable_hwsup(clkdm);
982 _clkdm_del_autodeps(clkdm); 1017 _clkdm_del_autodeps(clkdm);
983 _omap2_clkdm_set_hwsup(clkdm, 1); 1018 _enable_hwsup(clkdm);
984 } else { 1019 } else {
985 omap2_clkdm_sleep(clkdm); 1020 omap2_clkdm_sleep(clkdm);
986 } 1021 }