diff options
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 776 |
1 files changed, 294 insertions, 482 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 26b3f3ee82a3..9a0fb385622b 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -2,10 +2,12 @@ | |||
2 | * OMAP powerdomain control | 2 | * OMAP powerdomain control |
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. |
5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2009 Nokia Corporation |
6 | * | 6 | * |
7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
8 | * | 8 | * |
9 | * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> | ||
10 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
@@ -26,12 +28,15 @@ | |||
26 | 28 | ||
27 | #include "cm.h" | 29 | #include "cm.h" |
28 | #include "cm-regbits-34xx.h" | 30 | #include "cm-regbits-34xx.h" |
31 | #include "cm-regbits-44xx.h" | ||
29 | #include "prm.h" | 32 | #include "prm.h" |
30 | #include "prm-regbits-34xx.h" | 33 | #include "prm-regbits-34xx.h" |
34 | #include "prm-regbits-44xx.h" | ||
31 | 35 | ||
32 | #include <plat/cpu.h> | 36 | #include <plat/cpu.h> |
33 | #include <plat/powerdomain.h> | 37 | #include <plat/powerdomain.h> |
34 | #include <plat/clockdomain.h> | 38 | #include <plat/clockdomain.h> |
39 | #include <plat/prcm.h> | ||
35 | 40 | ||
36 | #include "pm.h" | 41 | #include "pm.h" |
37 | 42 | ||
@@ -40,28 +45,42 @@ enum { | |||
40 | PWRDM_STATE_PREV, | 45 | PWRDM_STATE_PREV, |
41 | }; | 46 | }; |
42 | 47 | ||
43 | /* pwrdm_list contains all registered struct powerdomains */ | 48 | /* Variable holding value of the CPU dependent PWRSTCTRL Register Offset */ |
44 | static LIST_HEAD(pwrdm_list); | 49 | static u16 pwrstctrl_reg_offs; |
45 | 50 | ||
46 | /* | 51 | /* Variable holding value of the CPU dependent PWRSTST Register Offset */ |
47 | * pwrdm_rwlock protects pwrdm_list add and del ops - also reused to | 52 | static u16 pwrstst_reg_offs; |
48 | * protect pwrdm_clkdms[] during clkdm add/del ops | ||
49 | */ | ||
50 | static DEFINE_RWLOCK(pwrdm_rwlock); | ||
51 | 53 | ||
54 | /* OMAP3 and OMAP4 specific register bit initialisations | ||
55 | * Notice that the names here are not according to each power | ||
56 | * domain but the bit mapping used applies to all of them | ||
57 | */ | ||
52 | 58 | ||
53 | /* Private functions */ | 59 | /* OMAP3 and OMAP4 Memory Onstate Masks (common across all power domains) */ |
54 | 60 | #define OMAP_MEM0_ONSTATE_MASK OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK | |
55 | static u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) | 61 | #define OMAP_MEM1_ONSTATE_MASK OMAP3430_L1FLATMEMONSTATE_MASK |
56 | { | 62 | #define OMAP_MEM2_ONSTATE_MASK OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK |
57 | u32 v; | 63 | #define OMAP_MEM3_ONSTATE_MASK OMAP3430_L2FLATMEMONSTATE_MASK |
64 | #define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK | ||
65 | |||
66 | /* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */ | ||
67 | #define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE | ||
68 | #define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE | ||
69 | #define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE | ||
70 | #define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE | ||
71 | #define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK | ||
72 | |||
73 | /* OMAP3 and OMAP4 Memory Status bits */ | ||
74 | #define OMAP_MEM0_STATEST_MASK OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK | ||
75 | #define OMAP_MEM1_STATEST_MASK OMAP3430_L1FLATMEMSTATEST_MASK | ||
76 | #define OMAP_MEM2_STATEST_MASK OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK | ||
77 | #define OMAP_MEM3_STATEST_MASK OMAP3430_L2FLATMEMSTATEST_MASK | ||
78 | #define OMAP_MEM4_STATEST_MASK OMAP4430_OCP_NRET_BANK_STATEST_MASK | ||
58 | 79 | ||
59 | v = prm_read_mod_reg(domain, idx); | 80 | /* pwrdm_list contains all registered struct powerdomains */ |
60 | v &= mask; | 81 | static LIST_HEAD(pwrdm_list); |
61 | v >>= __ffs(mask); | ||
62 | 82 | ||
63 | return v; | 83 | /* Private functions */ |
64 | } | ||
65 | 84 | ||
66 | static struct powerdomain *_pwrdm_lookup(const char *name) | 85 | static struct powerdomain *_pwrdm_lookup(const char *name) |
67 | { | 86 | { |
@@ -79,32 +98,63 @@ static struct powerdomain *_pwrdm_lookup(const char *name) | |||
79 | return pwrdm; | 98 | return pwrdm; |
80 | } | 99 | } |
81 | 100 | ||
82 | /* _pwrdm_deps_lookup - look up the specified powerdomain in a pwrdm list */ | 101 | /** |
83 | static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm, | 102 | * _pwrdm_register - register a powerdomain |
84 | struct pwrdm_dep *deps) | 103 | * @pwrdm: struct powerdomain * to register |
104 | * | ||
105 | * Adds a powerdomain to the internal powerdomain list. Returns | ||
106 | * -EINVAL if given a null pointer, -EEXIST if a powerdomain is | ||
107 | * already registered by the provided name, or 0 upon success. | ||
108 | */ | ||
109 | static int _pwrdm_register(struct powerdomain *pwrdm) | ||
85 | { | 110 | { |
86 | struct pwrdm_dep *pd; | 111 | int i; |
112 | |||
113 | if (!pwrdm) | ||
114 | return -EINVAL; | ||
115 | |||
116 | if (!omap_chip_is(pwrdm->omap_chip)) | ||
117 | return -EINVAL; | ||
87 | 118 | ||
88 | if (!pwrdm || !deps || !omap_chip_is(pwrdm->omap_chip)) | 119 | if (_pwrdm_lookup(pwrdm->name)) |
89 | return ERR_PTR(-EINVAL); | 120 | return -EEXIST; |
90 | 121 | ||
91 | for (pd = deps; pd->pwrdm_name; pd++) { | 122 | list_add(&pwrdm->node, &pwrdm_list); |
92 | 123 | ||
93 | if (!omap_chip_is(pd->omap_chip)) | 124 | /* Initialize the powerdomain's state counter */ |
94 | continue; | 125 | for (i = 0; i < PWRDM_MAX_PWRSTS; i++) |
126 | pwrdm->state_counter[i] = 0; | ||
95 | 127 | ||
96 | if (!pd->pwrdm && pd->pwrdm_name) | 128 | pwrdm->ret_logic_off_counter = 0; |
97 | pd->pwrdm = pwrdm_lookup(pd->pwrdm_name); | 129 | for (i = 0; i < pwrdm->banks; i++) |
130 | pwrdm->ret_mem_off_counter[i] = 0; | ||
98 | 131 | ||
99 | if (pd->pwrdm == pwrdm) | 132 | pwrdm_wait_transition(pwrdm); |
100 | break; | 133 | pwrdm->state = pwrdm_read_pwrst(pwrdm); |
134 | pwrdm->state_counter[pwrdm->state] = 1; | ||
101 | 135 | ||
102 | } | 136 | pr_debug("powerdomain: registered %s\n", pwrdm->name); |
103 | 137 | ||
104 | if (!pd->pwrdm_name) | 138 | return 0; |
105 | return ERR_PTR(-ENOENT); | 139 | } |
106 | 140 | ||
107 | return pd->pwrdm; | 141 | static void _update_logic_membank_counters(struct powerdomain *pwrdm) |
142 | { | ||
143 | int i; | ||
144 | u8 prev_logic_pwrst, prev_mem_pwrst; | ||
145 | |||
146 | prev_logic_pwrst = pwrdm_read_prev_logic_pwrst(pwrdm); | ||
147 | if ((pwrdm->pwrsts_logic_ret == PWRSTS_OFF_RET) && | ||
148 | (prev_logic_pwrst == PWRDM_POWER_OFF)) | ||
149 | pwrdm->ret_logic_off_counter++; | ||
150 | |||
151 | for (i = 0; i < pwrdm->banks; i++) { | ||
152 | prev_mem_pwrst = pwrdm_read_prev_mem_pwrst(pwrdm, i); | ||
153 | |||
154 | if ((pwrdm->pwrsts_mem_ret[i] == PWRSTS_OFF_RET) && | ||
155 | (prev_mem_pwrst == PWRDM_POWER_OFF)) | ||
156 | pwrdm->ret_mem_off_counter[i]++; | ||
157 | } | ||
108 | } | 158 | } |
109 | 159 | ||
110 | static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) | 160 | static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) |
@@ -126,6 +176,8 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) | |||
126 | prev = pwrdm_read_prev_pwrst(pwrdm); | 176 | prev = pwrdm_read_prev_pwrst(pwrdm); |
127 | if (pwrdm->state != prev) | 177 | if (pwrdm->state != prev) |
128 | pwrdm->state_counter[prev]++; | 178 | pwrdm->state_counter[prev]++; |
179 | if (prev == PWRDM_POWER_RET) | ||
180 | _update_logic_membank_counters(pwrdm); | ||
129 | break; | 181 | break; |
130 | default: | 182 | default: |
131 | return -EINVAL; | 183 | return -EINVAL; |
@@ -154,134 +206,71 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused) | |||
154 | return 0; | 206 | return 0; |
155 | } | 207 | } |
156 | 208 | ||
157 | static __init void _pwrdm_setup(struct powerdomain *pwrdm) | ||
158 | { | ||
159 | int i; | ||
160 | |||
161 | for (i = 0; i < PWRDM_MAX_PWRSTS; i++) | ||
162 | pwrdm->state_counter[i] = 0; | ||
163 | |||
164 | pwrdm_wait_transition(pwrdm); | ||
165 | pwrdm->state = pwrdm_read_pwrst(pwrdm); | ||
166 | pwrdm->state_counter[pwrdm->state] = 1; | ||
167 | |||
168 | } | ||
169 | |||
170 | /* Public functions */ | 209 | /* Public functions */ |
171 | 210 | ||
172 | /** | 211 | /** |
173 | * pwrdm_init - set up the powerdomain layer | 212 | * pwrdm_init - set up the powerdomain layer |
213 | * @pwrdm_list: array of struct powerdomain pointers to register | ||
174 | * | 214 | * |
175 | * Loop through the list of powerdomains, registering all that are | 215 | * Loop through the array of powerdomains @pwrdm_list, registering all |
176 | * available on the current CPU. If pwrdm_list is supplied and not | 216 | * that are available on the current CPU. If pwrdm_list is supplied |
177 | * null, all of the referenced powerdomains will be registered. No | 217 | * and not null, all of the referenced powerdomains will be |
178 | * return value. | 218 | * registered. No return value. XXX pwrdm_list is not really a |
219 | * "list"; it is an array. Rename appropriately. | ||
179 | */ | 220 | */ |
180 | void pwrdm_init(struct powerdomain **pwrdm_list) | 221 | void pwrdm_init(struct powerdomain **pwrdm_list) |
181 | { | 222 | { |
182 | struct powerdomain **p = NULL; | 223 | struct powerdomain **p = NULL; |
183 | 224 | ||
184 | if (pwrdm_list) { | 225 | if (cpu_is_omap24xx() | cpu_is_omap34xx()) { |
185 | for (p = pwrdm_list; *p; p++) { | 226 | pwrstctrl_reg_offs = OMAP2_PM_PWSTCTRL; |
186 | pwrdm_register(*p); | 227 | pwrstst_reg_offs = OMAP2_PM_PWSTST; |
187 | _pwrdm_setup(*p); | 228 | } else if (cpu_is_omap44xx()) { |
188 | } | 229 | pwrstctrl_reg_offs = OMAP4_PM_PWSTCTRL; |
230 | pwrstst_reg_offs = OMAP4_PM_PWSTST; | ||
231 | } else { | ||
232 | printk(KERN_ERR "Power Domain struct not supported for " \ | ||
233 | "this CPU\n"); | ||
234 | return; | ||
189 | } | 235 | } |
190 | } | ||
191 | |||
192 | /** | ||
193 | * pwrdm_register - register a powerdomain | ||
194 | * @pwrdm: struct powerdomain * to register | ||
195 | * | ||
196 | * Adds a powerdomain to the internal powerdomain list. Returns | ||
197 | * -EINVAL if given a null pointer, -EEXIST if a powerdomain is | ||
198 | * already registered by the provided name, or 0 upon success. | ||
199 | */ | ||
200 | int pwrdm_register(struct powerdomain *pwrdm) | ||
201 | { | ||
202 | unsigned long flags; | ||
203 | int ret = -EINVAL; | ||
204 | |||
205 | if (!pwrdm) | ||
206 | return -EINVAL; | ||
207 | 236 | ||
208 | if (!omap_chip_is(pwrdm->omap_chip)) | 237 | if (pwrdm_list) { |
209 | return -EINVAL; | 238 | for (p = pwrdm_list; *p; p++) |
210 | 239 | _pwrdm_register(*p); | |
211 | write_lock_irqsave(&pwrdm_rwlock, flags); | ||
212 | if (_pwrdm_lookup(pwrdm->name)) { | ||
213 | ret = -EEXIST; | ||
214 | goto pr_unlock; | ||
215 | } | 240 | } |
216 | |||
217 | list_add(&pwrdm->node, &pwrdm_list); | ||
218 | |||
219 | pr_debug("powerdomain: registered %s\n", pwrdm->name); | ||
220 | ret = 0; | ||
221 | |||
222 | pr_unlock: | ||
223 | write_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
224 | |||
225 | return ret; | ||
226 | } | ||
227 | |||
228 | /** | ||
229 | * pwrdm_unregister - unregister a powerdomain | ||
230 | * @pwrdm: struct powerdomain * to unregister | ||
231 | * | ||
232 | * Removes a powerdomain from the internal powerdomain list. Returns | ||
233 | * -EINVAL if pwrdm argument is NULL. | ||
234 | */ | ||
235 | int pwrdm_unregister(struct powerdomain *pwrdm) | ||
236 | { | ||
237 | unsigned long flags; | ||
238 | |||
239 | if (!pwrdm) | ||
240 | return -EINVAL; | ||
241 | |||
242 | write_lock_irqsave(&pwrdm_rwlock, flags); | ||
243 | list_del(&pwrdm->node); | ||
244 | write_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
245 | |||
246 | pr_debug("powerdomain: unregistered %s\n", pwrdm->name); | ||
247 | |||
248 | return 0; | ||
249 | } | 241 | } |
250 | 242 | ||
251 | /** | 243 | /** |
252 | * pwrdm_lookup - look up a powerdomain by name, return a pointer | 244 | * pwrdm_lookup - look up a powerdomain by name, return a pointer |
253 | * @name: name of powerdomain | 245 | * @name: name of powerdomain |
254 | * | 246 | * |
255 | * Find a registered powerdomain by its name. Returns a pointer to the | 247 | * Find a registered powerdomain by its name @name. Returns a pointer |
256 | * struct powerdomain if found, or NULL otherwise. | 248 | * to the struct powerdomain if found, or NULL otherwise. |
257 | */ | 249 | */ |
258 | struct powerdomain *pwrdm_lookup(const char *name) | 250 | struct powerdomain *pwrdm_lookup(const char *name) |
259 | { | 251 | { |
260 | struct powerdomain *pwrdm; | 252 | struct powerdomain *pwrdm; |
261 | unsigned long flags; | ||
262 | 253 | ||
263 | if (!name) | 254 | if (!name) |
264 | return NULL; | 255 | return NULL; |
265 | 256 | ||
266 | read_lock_irqsave(&pwrdm_rwlock, flags); | ||
267 | pwrdm = _pwrdm_lookup(name); | 257 | pwrdm = _pwrdm_lookup(name); |
268 | read_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
269 | 258 | ||
270 | return pwrdm; | 259 | return pwrdm; |
271 | } | 260 | } |
272 | 261 | ||
273 | /** | 262 | /** |
274 | * pwrdm_for_each_nolock - call function on each registered clockdomain | 263 | * pwrdm_for_each - call function on each registered clockdomain |
275 | * @fn: callback function * | 264 | * @fn: callback function * |
276 | * | 265 | * |
277 | * Call the supplied function for each registered powerdomain. The | 266 | * Call the supplied function @fn for each registered powerdomain. |
278 | * callback function can return anything but 0 to bail out early from | 267 | * The callback function @fn can return anything but 0 to bail out |
279 | * the iterator. Returns the last return value of the callback function, which | 268 | * early from the iterator. Returns the last return value of the |
280 | * should be 0 for success or anything else to indicate failure; or -EINVAL if | 269 | * callback function, which should be 0 for success or anything else |
281 | * the function pointer is null. | 270 | * to indicate failure; or -EINVAL if the function pointer is null. |
282 | */ | 271 | */ |
283 | int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user), | 272 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), |
284 | void *user) | 273 | void *user) |
285 | { | 274 | { |
286 | struct powerdomain *temp_pwrdm; | 275 | struct powerdomain *temp_pwrdm; |
287 | int ret = 0; | 276 | int ret = 0; |
@@ -299,40 +288,17 @@ int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user), | |||
299 | } | 288 | } |
300 | 289 | ||
301 | /** | 290 | /** |
302 | * pwrdm_for_each - call function on each registered clockdomain | ||
303 | * @fn: callback function * | ||
304 | * | ||
305 | * This function is the same as 'pwrdm_for_each_nolock()', but keeps the | ||
306 | * &pwrdm_rwlock locked for reading, so no powerdomain structure manipulation | ||
307 | * functions should be called from the callback, although hardware powerdomain | ||
308 | * control functions are fine. | ||
309 | */ | ||
310 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), | ||
311 | void *user) | ||
312 | { | ||
313 | unsigned long flags; | ||
314 | int ret; | ||
315 | |||
316 | read_lock_irqsave(&pwrdm_rwlock, flags); | ||
317 | ret = pwrdm_for_each_nolock(fn, user); | ||
318 | read_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
319 | |||
320 | return ret; | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * pwrdm_add_clkdm - add a clockdomain to a powerdomain | 291 | * pwrdm_add_clkdm - add a clockdomain to a powerdomain |
325 | * @pwrdm: struct powerdomain * to add the clockdomain to | 292 | * @pwrdm: struct powerdomain * to add the clockdomain to |
326 | * @clkdm: struct clockdomain * to associate with a powerdomain | 293 | * @clkdm: struct clockdomain * to associate with a powerdomain |
327 | * | 294 | * |
328 | * Associate the clockdomain 'clkdm' with a powerdomain 'pwrdm'. This | 295 | * Associate the clockdomain @clkdm with a powerdomain @pwrdm. This |
329 | * enables the use of pwrdm_for_each_clkdm(). Returns -EINVAL if | 296 | * enables the use of pwrdm_for_each_clkdm(). Returns -EINVAL if |
330 | * presented with invalid pointers; -ENOMEM if memory could not be allocated; | 297 | * presented with invalid pointers; -ENOMEM if memory could not be allocated; |
331 | * or 0 upon success. | 298 | * or 0 upon success. |
332 | */ | 299 | */ |
333 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | 300 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) |
334 | { | 301 | { |
335 | unsigned long flags; | ||
336 | int i; | 302 | int i; |
337 | int ret = -EINVAL; | 303 | int ret = -EINVAL; |
338 | 304 | ||
@@ -342,8 +308,6 @@ int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | |||
342 | pr_debug("powerdomain: associating clockdomain %s with powerdomain " | 308 | pr_debug("powerdomain: associating clockdomain %s with powerdomain " |
343 | "%s\n", clkdm->name, pwrdm->name); | 309 | "%s\n", clkdm->name, pwrdm->name); |
344 | 310 | ||
345 | write_lock_irqsave(&pwrdm_rwlock, flags); | ||
346 | |||
347 | for (i = 0; i < PWRDM_MAX_CLKDMS; i++) { | 311 | for (i = 0; i < PWRDM_MAX_CLKDMS; i++) { |
348 | if (!pwrdm->pwrdm_clkdms[i]) | 312 | if (!pwrdm->pwrdm_clkdms[i]) |
349 | break; | 313 | break; |
@@ -368,8 +332,6 @@ int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | |||
368 | ret = 0; | 332 | ret = 0; |
369 | 333 | ||
370 | pac_exit: | 334 | pac_exit: |
371 | write_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
372 | |||
373 | return ret; | 335 | return ret; |
374 | } | 336 | } |
375 | 337 | ||
@@ -378,14 +340,13 @@ pac_exit: | |||
378 | * @pwrdm: struct powerdomain * to add the clockdomain to | 340 | * @pwrdm: struct powerdomain * to add the clockdomain to |
379 | * @clkdm: struct clockdomain * to associate with a powerdomain | 341 | * @clkdm: struct clockdomain * to associate with a powerdomain |
380 | * | 342 | * |
381 | * Dissociate the clockdomain 'clkdm' from the powerdomain | 343 | * Dissociate the clockdomain @clkdm from the powerdomain |
382 | * 'pwrdm'. Returns -EINVAL if presented with invalid pointers; | 344 | * @pwrdm. Returns -EINVAL if presented with invalid pointers; -ENOENT |
383 | * -ENOENT if the clkdm was not associated with the powerdomain, or 0 | 345 | * if @clkdm was not associated with the powerdomain, or 0 upon |
384 | * upon success. | 346 | * success. |
385 | */ | 347 | */ |
386 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | 348 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) |
387 | { | 349 | { |
388 | unsigned long flags; | ||
389 | int ret = -EINVAL; | 350 | int ret = -EINVAL; |
390 | int i; | 351 | int i; |
391 | 352 | ||
@@ -395,8 +356,6 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | |||
395 | pr_debug("powerdomain: dissociating clockdomain %s from powerdomain " | 356 | pr_debug("powerdomain: dissociating clockdomain %s from powerdomain " |
396 | "%s\n", clkdm->name, pwrdm->name); | 357 | "%s\n", clkdm->name, pwrdm->name); |
397 | 358 | ||
398 | write_lock_irqsave(&pwrdm_rwlock, flags); | ||
399 | |||
400 | for (i = 0; i < PWRDM_MAX_CLKDMS; i++) | 359 | for (i = 0; i < PWRDM_MAX_CLKDMS; i++) |
401 | if (pwrdm->pwrdm_clkdms[i] == clkdm) | 360 | if (pwrdm->pwrdm_clkdms[i] == clkdm) |
402 | break; | 361 | break; |
@@ -413,8 +372,6 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) | |||
413 | ret = 0; | 372 | ret = 0; |
414 | 373 | ||
415 | pdc_exit: | 374 | pdc_exit: |
416 | write_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
417 | |||
418 | return ret; | 375 | return ret; |
419 | } | 376 | } |
420 | 377 | ||
@@ -423,259 +380,34 @@ pdc_exit: | |||
423 | * @pwrdm: struct powerdomain * to iterate over | 380 | * @pwrdm: struct powerdomain * to iterate over |
424 | * @fn: callback function * | 381 | * @fn: callback function * |
425 | * | 382 | * |
426 | * Call the supplied function for each clockdomain in the powerdomain | 383 | * Call the supplied function @fn for each clockdomain in the powerdomain |
427 | * 'pwrdm'. The callback function can return anything but 0 to bail | 384 | * @pwrdm. The callback function can return anything but 0 to bail |
428 | * out early from the iterator. The callback function is called with | 385 | * out early from the iterator. Returns -EINVAL if presented with |
429 | * the pwrdm_rwlock held for reading, so no powerdomain structure | 386 | * invalid pointers; or passes along the last return value of the |
430 | * manipulation functions should be called from the callback, although | 387 | * callback function, which should be 0 for success or anything else |
431 | * hardware powerdomain control functions are fine. Returns -EINVAL | 388 | * to indicate failure. |
432 | * if presented with invalid pointers; or passes along the last return | ||
433 | * value of the callback function, which should be 0 for success or | ||
434 | * anything else to indicate failure. | ||
435 | */ | 389 | */ |
436 | int pwrdm_for_each_clkdm(struct powerdomain *pwrdm, | 390 | int pwrdm_for_each_clkdm(struct powerdomain *pwrdm, |
437 | int (*fn)(struct powerdomain *pwrdm, | 391 | int (*fn)(struct powerdomain *pwrdm, |
438 | struct clockdomain *clkdm)) | 392 | struct clockdomain *clkdm)) |
439 | { | 393 | { |
440 | unsigned long flags; | ||
441 | int ret = 0; | 394 | int ret = 0; |
442 | int i; | 395 | int i; |
443 | 396 | ||
444 | if (!fn) | 397 | if (!fn) |
445 | return -EINVAL; | 398 | return -EINVAL; |
446 | 399 | ||
447 | read_lock_irqsave(&pwrdm_rwlock, flags); | ||
448 | |||
449 | for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++) | 400 | for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++) |
450 | ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]); | 401 | ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]); |
451 | 402 | ||
452 | read_unlock_irqrestore(&pwrdm_rwlock, flags); | ||
453 | |||
454 | return ret; | 403 | return ret; |
455 | } | 404 | } |
456 | 405 | ||
457 | |||
458 | /** | ||
459 | * pwrdm_add_wkdep - add a wakeup dependency from pwrdm2 to pwrdm1 | ||
460 | * @pwrdm1: wake this struct powerdomain * up (dependent) | ||
461 | * @pwrdm2: when this struct powerdomain * wakes up (source) | ||
462 | * | ||
463 | * When the powerdomain represented by pwrdm2 wakes up (due to an | ||
464 | * interrupt), wake up pwrdm1. Implemented in hardware on the OMAP, | ||
465 | * this feature is designed to reduce wakeup latency of the dependent | ||
466 | * powerdomain. Returns -EINVAL if presented with invalid powerdomain | ||
467 | * pointers, -ENOENT if pwrdm2 cannot wake up pwrdm1 in hardware, or | ||
468 | * 0 upon success. | ||
469 | */ | ||
470 | int pwrdm_add_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
471 | { | ||
472 | struct powerdomain *p; | ||
473 | |||
474 | if (!pwrdm1) | ||
475 | return -EINVAL; | ||
476 | |||
477 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs); | ||
478 | if (IS_ERR(p)) { | ||
479 | pr_debug("powerdomain: hardware cannot set/clear wake up of " | ||
480 | "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); | ||
481 | return PTR_ERR(p); | ||
482 | } | ||
483 | |||
484 | pr_debug("powerdomain: hardware will wake up %s when %s wakes up\n", | ||
485 | pwrdm1->name, pwrdm2->name); | ||
486 | |||
487 | prm_set_mod_reg_bits((1 << pwrdm2->dep_bit), | ||
488 | pwrdm1->prcm_offs, PM_WKDEP); | ||
489 | |||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * pwrdm_del_wkdep - remove a wakeup dependency from pwrdm2 to pwrdm1 | ||
495 | * @pwrdm1: wake this struct powerdomain * up (dependent) | ||
496 | * @pwrdm2: when this struct powerdomain * wakes up (source) | ||
497 | * | ||
498 | * Remove a wakeup dependency that causes pwrdm1 to wake up when pwrdm2 | ||
499 | * wakes up. Returns -EINVAL if presented with invalid powerdomain | ||
500 | * pointers, -ENOENT if pwrdm2 cannot wake up pwrdm1 in hardware, or | ||
501 | * 0 upon success. | ||
502 | */ | ||
503 | int pwrdm_del_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
504 | { | ||
505 | struct powerdomain *p; | ||
506 | |||
507 | if (!pwrdm1) | ||
508 | return -EINVAL; | ||
509 | |||
510 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs); | ||
511 | if (IS_ERR(p)) { | ||
512 | pr_debug("powerdomain: hardware cannot set/clear wake up of " | ||
513 | "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); | ||
514 | return PTR_ERR(p); | ||
515 | } | ||
516 | |||
517 | pr_debug("powerdomain: hardware will no longer wake up %s after %s " | ||
518 | "wakes up\n", pwrdm1->name, pwrdm2->name); | ||
519 | |||
520 | prm_clear_mod_reg_bits((1 << pwrdm2->dep_bit), | ||
521 | pwrdm1->prcm_offs, PM_WKDEP); | ||
522 | |||
523 | return 0; | ||
524 | } | ||
525 | |||
526 | /** | ||
527 | * pwrdm_read_wkdep - read wakeup dependency state from pwrdm2 to pwrdm1 | ||
528 | * @pwrdm1: wake this struct powerdomain * up (dependent) | ||
529 | * @pwrdm2: when this struct powerdomain * wakes up (source) | ||
530 | * | ||
531 | * Return 1 if a hardware wakeup dependency exists wherein pwrdm1 will be | ||
532 | * awoken when pwrdm2 wakes up; 0 if dependency is not set; -EINVAL | ||
533 | * if either powerdomain pointer is invalid; or -ENOENT if the hardware | ||
534 | * is incapable. | ||
535 | * | ||
536 | * REVISIT: Currently this function only represents software-controllable | ||
537 | * wakeup dependencies. Wakeup dependencies fixed in hardware are not | ||
538 | * yet handled here. | ||
539 | */ | ||
540 | int pwrdm_read_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
541 | { | ||
542 | struct powerdomain *p; | ||
543 | |||
544 | if (!pwrdm1) | ||
545 | return -EINVAL; | ||
546 | |||
547 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs); | ||
548 | if (IS_ERR(p)) { | ||
549 | pr_debug("powerdomain: hardware cannot set/clear wake up of " | ||
550 | "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); | ||
551 | return PTR_ERR(p); | ||
552 | } | ||
553 | |||
554 | return prm_read_mod_bits_shift(pwrdm1->prcm_offs, PM_WKDEP, | ||
555 | (1 << pwrdm2->dep_bit)); | ||
556 | } | ||
557 | |||
558 | /** | ||
559 | * pwrdm_add_sleepdep - add a sleep dependency from pwrdm2 to pwrdm1 | ||
560 | * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent) | ||
561 | * @pwrdm2: when this struct powerdomain * is active (source) | ||
562 | * | ||
563 | * Prevent pwrdm1 from automatically going inactive (and then to | ||
564 | * retention or off) if pwrdm2 is still active. Returns -EINVAL if | ||
565 | * presented with invalid powerdomain pointers or called on a machine | ||
566 | * that does not support software-configurable hardware sleep dependencies, | ||
567 | * -ENOENT if the specified dependency cannot be set in hardware, or | ||
568 | * 0 upon success. | ||
569 | */ | ||
570 | int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
571 | { | ||
572 | struct powerdomain *p; | ||
573 | |||
574 | if (!cpu_is_omap34xx()) | ||
575 | return -EINVAL; | ||
576 | |||
577 | if (!pwrdm1) | ||
578 | return -EINVAL; | ||
579 | |||
580 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); | ||
581 | if (IS_ERR(p)) { | ||
582 | pr_debug("powerdomain: hardware cannot set/clear sleep " | ||
583 | "dependency affecting %s from %s\n", pwrdm1->name, | ||
584 | pwrdm2->name); | ||
585 | return PTR_ERR(p); | ||
586 | } | ||
587 | |||
588 | pr_debug("powerdomain: will prevent %s from sleeping if %s is active\n", | ||
589 | pwrdm1->name, pwrdm2->name); | ||
590 | |||
591 | cm_set_mod_reg_bits((1 << pwrdm2->dep_bit), | ||
592 | pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | /** | ||
598 | * pwrdm_del_sleepdep - remove a sleep dependency from pwrdm2 to pwrdm1 | ||
599 | * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent) | ||
600 | * @pwrdm2: when this struct powerdomain * is active (source) | ||
601 | * | ||
602 | * Allow pwrdm1 to automatically go inactive (and then to retention or | ||
603 | * off), independent of the activity state of pwrdm2. Returns -EINVAL | ||
604 | * if presented with invalid powerdomain pointers or called on a machine | ||
605 | * that does not support software-configurable hardware sleep dependencies, | ||
606 | * -ENOENT if the specified dependency cannot be cleared in hardware, or | ||
607 | * 0 upon success. | ||
608 | */ | ||
609 | int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
610 | { | ||
611 | struct powerdomain *p; | ||
612 | |||
613 | if (!cpu_is_omap34xx()) | ||
614 | return -EINVAL; | ||
615 | |||
616 | if (!pwrdm1) | ||
617 | return -EINVAL; | ||
618 | |||
619 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); | ||
620 | if (IS_ERR(p)) { | ||
621 | pr_debug("powerdomain: hardware cannot set/clear sleep " | ||
622 | "dependency affecting %s from %s\n", pwrdm1->name, | ||
623 | pwrdm2->name); | ||
624 | return PTR_ERR(p); | ||
625 | } | ||
626 | |||
627 | pr_debug("powerdomain: will no longer prevent %s from sleeping if " | ||
628 | "%s is active\n", pwrdm1->name, pwrdm2->name); | ||
629 | |||
630 | cm_clear_mod_reg_bits((1 << pwrdm2->dep_bit), | ||
631 | pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP); | ||
632 | |||
633 | return 0; | ||
634 | } | ||
635 | |||
636 | /** | ||
637 | * pwrdm_read_sleepdep - read sleep dependency state from pwrdm2 to pwrdm1 | ||
638 | * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent) | ||
639 | * @pwrdm2: when this struct powerdomain * is active (source) | ||
640 | * | ||
641 | * Return 1 if a hardware sleep dependency exists wherein pwrdm1 will | ||
642 | * not be allowed to automatically go inactive if pwrdm2 is active; | ||
643 | * 0 if pwrdm1's automatic power state inactivity transition is independent | ||
644 | * of pwrdm2's; -EINVAL if either powerdomain pointer is invalid or called | ||
645 | * on a machine that does not support software-configurable hardware sleep | ||
646 | * dependencies; or -ENOENT if the hardware is incapable. | ||
647 | * | ||
648 | * REVISIT: Currently this function only represents software-controllable | ||
649 | * sleep dependencies. Sleep dependencies fixed in hardware are not | ||
650 | * yet handled here. | ||
651 | */ | ||
652 | int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) | ||
653 | { | ||
654 | struct powerdomain *p; | ||
655 | |||
656 | if (!cpu_is_omap34xx()) | ||
657 | return -EINVAL; | ||
658 | |||
659 | if (!pwrdm1) | ||
660 | return -EINVAL; | ||
661 | |||
662 | p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); | ||
663 | if (IS_ERR(p)) { | ||
664 | pr_debug("powerdomain: hardware cannot set/clear sleep " | ||
665 | "dependency affecting %s from %s\n", pwrdm1->name, | ||
666 | pwrdm2->name); | ||
667 | return PTR_ERR(p); | ||
668 | } | ||
669 | |||
670 | return prm_read_mod_bits_shift(pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP, | ||
671 | (1 << pwrdm2->dep_bit)); | ||
672 | } | ||
673 | |||
674 | /** | 406 | /** |
675 | * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain | 407 | * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain |
676 | * @pwrdm: struct powerdomain * | 408 | * @pwrdm: struct powerdomain * |
677 | * | 409 | * |
678 | * Return the number of controllable memory banks in powerdomain pwrdm, | 410 | * Return the number of controllable memory banks in powerdomain @pwrdm, |
679 | * starting with 1. Returns -EINVAL if the powerdomain pointer is null. | 411 | * starting with 1. Returns -EINVAL if the powerdomain pointer is null. |
680 | */ | 412 | */ |
681 | int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) | 413 | int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) |
@@ -691,7 +423,7 @@ int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) | |||
691 | * @pwrdm: struct powerdomain * to set | 423 | * @pwrdm: struct powerdomain * to set |
692 | * @pwrst: one of the PWRDM_POWER_* macros | 424 | * @pwrst: one of the PWRDM_POWER_* macros |
693 | * | 425 | * |
694 | * Set the powerdomain pwrdm's next power state to pwrst. The powerdomain | 426 | * Set the powerdomain @pwrdm's next power state to @pwrst. The powerdomain |
695 | * may not enter this state immediately if the preconditions for this state | 427 | * may not enter this state immediately if the preconditions for this state |
696 | * have not been satisfied. Returns -EINVAL if the powerdomain pointer is | 428 | * have not been satisfied. Returns -EINVAL if the powerdomain pointer is |
697 | * null or if the power state is invalid for the powerdomin, or returns 0 | 429 | * null or if the power state is invalid for the powerdomin, or returns 0 |
@@ -710,7 +442,7 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | |||
710 | 442 | ||
711 | prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, | 443 | prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, |
712 | (pwrst << OMAP_POWERSTATE_SHIFT), | 444 | (pwrst << OMAP_POWERSTATE_SHIFT), |
713 | pwrdm->prcm_offs, PM_PWSTCTRL); | 445 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
714 | 446 | ||
715 | return 0; | 447 | return 0; |
716 | } | 448 | } |
@@ -719,7 +451,7 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | |||
719 | * pwrdm_read_next_pwrst - get next powerdomain power state | 451 | * pwrdm_read_next_pwrst - get next powerdomain power state |
720 | * @pwrdm: struct powerdomain * to get power state | 452 | * @pwrdm: struct powerdomain * to get power state |
721 | * | 453 | * |
722 | * Return the powerdomain pwrdm's next power state. Returns -EINVAL | 454 | * Return the powerdomain @pwrdm's next power state. Returns -EINVAL |
723 | * if the powerdomain pointer is null or returns the next power state | 455 | * if the powerdomain pointer is null or returns the next power state |
724 | * upon success. | 456 | * upon success. |
725 | */ | 457 | */ |
@@ -728,15 +460,15 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | |||
728 | if (!pwrdm) | 460 | if (!pwrdm) |
729 | return -EINVAL; | 461 | return -EINVAL; |
730 | 462 | ||
731 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTCTRL, | 463 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, |
732 | OMAP_POWERSTATE_MASK); | 464 | pwrstctrl_reg_offs, OMAP_POWERSTATE_MASK); |
733 | } | 465 | } |
734 | 466 | ||
735 | /** | 467 | /** |
736 | * pwrdm_read_pwrst - get current powerdomain power state | 468 | * pwrdm_read_pwrst - get current powerdomain power state |
737 | * @pwrdm: struct powerdomain * to get power state | 469 | * @pwrdm: struct powerdomain * to get power state |
738 | * | 470 | * |
739 | * Return the powerdomain pwrdm's current power state. Returns -EINVAL | 471 | * Return the powerdomain @pwrdm's current power state. Returns -EINVAL |
740 | * if the powerdomain pointer is null or returns the current power state | 472 | * if the powerdomain pointer is null or returns the current power state |
741 | * upon success. | 473 | * upon success. |
742 | */ | 474 | */ |
@@ -745,15 +477,15 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm) | |||
745 | if (!pwrdm) | 477 | if (!pwrdm) |
746 | return -EINVAL; | 478 | return -EINVAL; |
747 | 479 | ||
748 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, | 480 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, |
749 | OMAP_POWERSTATEST_MASK); | 481 | pwrstst_reg_offs, OMAP_POWERSTATEST_MASK); |
750 | } | 482 | } |
751 | 483 | ||
752 | /** | 484 | /** |
753 | * pwrdm_read_prev_pwrst - get previous powerdomain power state | 485 | * pwrdm_read_prev_pwrst - get previous powerdomain power state |
754 | * @pwrdm: struct powerdomain * to get previous power state | 486 | * @pwrdm: struct powerdomain * to get previous power state |
755 | * | 487 | * |
756 | * Return the powerdomain pwrdm's previous power state. Returns -EINVAL | 488 | * Return the powerdomain @pwrdm's previous power state. Returns -EINVAL |
757 | * if the powerdomain pointer is null or returns the previous power state | 489 | * if the powerdomain pointer is null or returns the previous power state |
758 | * upon success. | 490 | * upon success. |
759 | */ | 491 | */ |
@@ -771,11 +503,11 @@ int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | |||
771 | * @pwrdm: struct powerdomain * to set | 503 | * @pwrdm: struct powerdomain * to set |
772 | * @pwrst: one of the PWRDM_POWER_* macros | 504 | * @pwrst: one of the PWRDM_POWER_* macros |
773 | * | 505 | * |
774 | * Set the next power state that the logic portion of the powerdomain | 506 | * Set the next power state @pwrst that the logic portion of the |
775 | * pwrdm will enter when the powerdomain enters retention. This will | 507 | * powerdomain @pwrdm will enter when the powerdomain enters retention. |
776 | * be either RETENTION or OFF, if supported. Returns -EINVAL if the | 508 | * This will be either RETENTION or OFF, if supported. Returns |
777 | * powerdomain pointer is null or the target power state is not not | 509 | * -EINVAL if the powerdomain pointer is null or the target power |
778 | * supported, or returns 0 upon success. | 510 | * state is not not supported, or returns 0 upon success. |
779 | */ | 511 | */ |
780 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | 512 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) |
781 | { | 513 | { |
@@ -796,7 +528,7 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | |||
796 | */ | 528 | */ |
797 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE, | 529 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE, |
798 | (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)), | 530 | (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)), |
799 | pwrdm->prcm_offs, PM_PWSTCTRL); | 531 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
800 | 532 | ||
801 | return 0; | 533 | return 0; |
802 | } | 534 | } |
@@ -807,13 +539,14 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | |||
807 | * @bank: memory bank number to set (0-3) | 539 | * @bank: memory bank number to set (0-3) |
808 | * @pwrst: one of the PWRDM_POWER_* macros | 540 | * @pwrst: one of the PWRDM_POWER_* macros |
809 | * | 541 | * |
810 | * Set the next power state that memory bank x of the powerdomain | 542 | * Set the next power state @pwrst that memory bank @bank of the |
811 | * pwrdm will enter when the powerdomain enters the ON state. Bank | 543 | * powerdomain @pwrdm will enter when the powerdomain enters the ON |
812 | * will be a number from 0 to 3, and represents different types of | 544 | * state. @bank will be a number from 0 to 3, and represents different |
813 | * memory, depending on the powerdomain. Returns -EINVAL if the | 545 | * types of memory, depending on the powerdomain. Returns -EINVAL if |
814 | * powerdomain pointer is null or the target power state is not not | 546 | * the powerdomain pointer is null or the target power state is not |
815 | * supported for this memory bank, -EEXIST if the target memory bank | 547 | * not supported for this memory bank, -EEXIST if the target memory |
816 | * does not exist or is not controllable, or returns 0 upon success. | 548 | * bank does not exist or is not controllable, or returns 0 upon |
549 | * success. | ||
817 | */ | 550 | */ |
818 | int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | 551 | int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) |
819 | { | 552 | { |
@@ -839,16 +572,19 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
839 | */ | 572 | */ |
840 | switch (bank) { | 573 | switch (bank) { |
841 | case 0: | 574 | case 0: |
842 | m = OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK; | 575 | m = OMAP_MEM0_ONSTATE_MASK; |
843 | break; | 576 | break; |
844 | case 1: | 577 | case 1: |
845 | m = OMAP3430_L1FLATMEMONSTATE_MASK; | 578 | m = OMAP_MEM1_ONSTATE_MASK; |
846 | break; | 579 | break; |
847 | case 2: | 580 | case 2: |
848 | m = OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK; | 581 | m = OMAP_MEM2_ONSTATE_MASK; |
849 | break; | 582 | break; |
850 | case 3: | 583 | case 3: |
851 | m = OMAP3430_L2FLATMEMONSTATE_MASK; | 584 | m = OMAP_MEM3_ONSTATE_MASK; |
585 | break; | ||
586 | case 4: | ||
587 | m = OMAP_MEM4_ONSTATE_MASK; | ||
852 | break; | 588 | break; |
853 | default: | 589 | default: |
854 | WARN_ON(1); /* should never happen */ | 590 | WARN_ON(1); /* should never happen */ |
@@ -856,7 +592,7 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
856 | } | 592 | } |
857 | 593 | ||
858 | prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), | 594 | prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), |
859 | pwrdm->prcm_offs, PM_PWSTCTRL); | 595 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
860 | 596 | ||
861 | return 0; | 597 | return 0; |
862 | } | 598 | } |
@@ -867,14 +603,15 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
867 | * @bank: memory bank number to set (0-3) | 603 | * @bank: memory bank number to set (0-3) |
868 | * @pwrst: one of the PWRDM_POWER_* macros | 604 | * @pwrst: one of the PWRDM_POWER_* macros |
869 | * | 605 | * |
870 | * Set the next power state that memory bank x of the powerdomain | 606 | * Set the next power state @pwrst that memory bank @bank of the |
871 | * pwrdm will enter when the powerdomain enters the RETENTION state. | 607 | * powerdomain @pwrdm will enter when the powerdomain enters the |
872 | * Bank will be a number from 0 to 3, and represents different types | 608 | * RETENTION state. Bank will be a number from 0 to 3, and represents |
873 | * of memory, depending on the powerdomain. pwrst will be either | 609 | * different types of memory, depending on the powerdomain. @pwrst |
874 | * RETENTION or OFF, if supported. Returns -EINVAL if the powerdomain | 610 | * will be either RETENTION or OFF, if supported. Returns -EINVAL if |
875 | * pointer is null or the target power state is not not supported for | 611 | * the powerdomain pointer is null or the target power state is not |
876 | * this memory bank, -EEXIST if the target memory bank does not exist | 612 | * not supported for this memory bank, -EEXIST if the target memory |
877 | * or is not controllable, or returns 0 upon success. | 613 | * bank does not exist or is not controllable, or returns 0 upon |
614 | * success. | ||
878 | */ | 615 | */ |
879 | int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | 616 | int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) |
880 | { | 617 | { |
@@ -900,16 +637,19 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
900 | */ | 637 | */ |
901 | switch (bank) { | 638 | switch (bank) { |
902 | case 0: | 639 | case 0: |
903 | m = OMAP3430_SHAREDL1CACHEFLATRETSTATE; | 640 | m = OMAP_MEM0_RETSTATE_MASK; |
904 | break; | 641 | break; |
905 | case 1: | 642 | case 1: |
906 | m = OMAP3430_L1FLATMEMRETSTATE; | 643 | m = OMAP_MEM1_RETSTATE_MASK; |
907 | break; | 644 | break; |
908 | case 2: | 645 | case 2: |
909 | m = OMAP3430_SHAREDL2CACHEFLATRETSTATE; | 646 | m = OMAP_MEM2_RETSTATE_MASK; |
910 | break; | 647 | break; |
911 | case 3: | 648 | case 3: |
912 | m = OMAP3430_L2FLATMEMRETSTATE; | 649 | m = OMAP_MEM3_RETSTATE_MASK; |
650 | break; | ||
651 | case 4: | ||
652 | m = OMAP_MEM4_RETSTATE_MASK; | ||
913 | break; | 653 | break; |
914 | default: | 654 | default: |
915 | WARN_ON(1); /* should never happen */ | 655 | WARN_ON(1); /* should never happen */ |
@@ -917,7 +657,7 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
917 | } | 657 | } |
918 | 658 | ||
919 | prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, | 659 | prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, |
920 | PM_PWSTCTRL); | 660 | pwrstctrl_reg_offs); |
921 | 661 | ||
922 | return 0; | 662 | return 0; |
923 | } | 663 | } |
@@ -926,27 +666,27 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
926 | * pwrdm_read_logic_pwrst - get current powerdomain logic retention power state | 666 | * pwrdm_read_logic_pwrst - get current powerdomain logic retention power state |
927 | * @pwrdm: struct powerdomain * to get current logic retention power state | 667 | * @pwrdm: struct powerdomain * to get current logic retention power state |
928 | * | 668 | * |
929 | * Return the current power state that the logic portion of | 669 | * Return the power state that the logic portion of powerdomain @pwrdm |
930 | * powerdomain pwrdm will enter | 670 | * will enter when the powerdomain enters retention. Returns -EINVAL |
931 | * Returns -EINVAL if the powerdomain pointer is null or returns the | 671 | * if the powerdomain pointer is null or returns the logic retention |
932 | * current logic retention power state upon success. | 672 | * power state upon success. |
933 | */ | 673 | */ |
934 | int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | 674 | int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) |
935 | { | 675 | { |
936 | if (!pwrdm) | 676 | if (!pwrdm) |
937 | return -EINVAL; | 677 | return -EINVAL; |
938 | 678 | ||
939 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, | 679 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, |
940 | OMAP3430_LOGICSTATEST); | 680 | pwrstst_reg_offs, OMAP3430_LOGICSTATEST); |
941 | } | 681 | } |
942 | 682 | ||
943 | /** | 683 | /** |
944 | * pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state | 684 | * pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state |
945 | * @pwrdm: struct powerdomain * to get previous logic power state | 685 | * @pwrdm: struct powerdomain * to get previous logic power state |
946 | * | 686 | * |
947 | * Return the powerdomain pwrdm's logic power state. Returns -EINVAL | 687 | * Return the powerdomain @pwrdm's previous logic power state. Returns |
948 | * if the powerdomain pointer is null or returns the previous logic | 688 | * -EINVAL if the powerdomain pointer is null or returns the previous |
949 | * power state upon success. | 689 | * logic power state upon success. |
950 | */ | 690 | */ |
951 | int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | 691 | int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) |
952 | { | 692 | { |
@@ -964,12 +704,35 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | |||
964 | } | 704 | } |
965 | 705 | ||
966 | /** | 706 | /** |
707 | * pwrdm_read_logic_retst - get next powerdomain logic power state | ||
708 | * @pwrdm: struct powerdomain * to get next logic power state | ||
709 | * | ||
710 | * Return the powerdomain pwrdm's logic power state. Returns -EINVAL | ||
711 | * if the powerdomain pointer is null or returns the next logic | ||
712 | * power state upon success. | ||
713 | */ | ||
714 | int pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
715 | { | ||
716 | if (!pwrdm) | ||
717 | return -EINVAL; | ||
718 | |||
719 | /* | ||
720 | * The register bit names below may not correspond to the | ||
721 | * actual names of the bits in each powerdomain's register, | ||
722 | * but the type of value returned is the same for each | ||
723 | * powerdomain. | ||
724 | */ | ||
725 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs, | ||
726 | OMAP3430_LOGICSTATEST); | ||
727 | } | ||
728 | |||
729 | /** | ||
967 | * pwrdm_read_mem_pwrst - get current memory bank power state | 730 | * pwrdm_read_mem_pwrst - get current memory bank power state |
968 | * @pwrdm: struct powerdomain * to get current memory bank power state | 731 | * @pwrdm: struct powerdomain * to get current memory bank power state |
969 | * @bank: memory bank number (0-3) | 732 | * @bank: memory bank number (0-3) |
970 | * | 733 | * |
971 | * Return the powerdomain pwrdm's current memory power state for bank | 734 | * Return the powerdomain @pwrdm's current memory power state for bank |
972 | * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if | 735 | * @bank. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if |
973 | * the target memory bank does not exist or is not controllable, or | 736 | * the target memory bank does not exist or is not controllable, or |
974 | * returns the current memory power state upon success. | 737 | * returns the current memory power state upon success. |
975 | */ | 738 | */ |
@@ -994,23 +757,27 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | |||
994 | */ | 757 | */ |
995 | switch (bank) { | 758 | switch (bank) { |
996 | case 0: | 759 | case 0: |
997 | m = OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK; | 760 | m = OMAP_MEM0_STATEST_MASK; |
998 | break; | 761 | break; |
999 | case 1: | 762 | case 1: |
1000 | m = OMAP3430_L1FLATMEMSTATEST_MASK; | 763 | m = OMAP_MEM1_STATEST_MASK; |
1001 | break; | 764 | break; |
1002 | case 2: | 765 | case 2: |
1003 | m = OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK; | 766 | m = OMAP_MEM2_STATEST_MASK; |
1004 | break; | 767 | break; |
1005 | case 3: | 768 | case 3: |
1006 | m = OMAP3430_L2FLATMEMSTATEST_MASK; | 769 | m = OMAP_MEM3_STATEST_MASK; |
770 | break; | ||
771 | case 4: | ||
772 | m = OMAP_MEM4_STATEST_MASK; | ||
1007 | break; | 773 | break; |
1008 | default: | 774 | default: |
1009 | WARN_ON(1); /* should never happen */ | 775 | WARN_ON(1); /* should never happen */ |
1010 | return -EEXIST; | 776 | return -EEXIST; |
1011 | } | 777 | } |
1012 | 778 | ||
1013 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, m); | 779 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, |
780 | pwrstst_reg_offs, m); | ||
1014 | } | 781 | } |
1015 | 782 | ||
1016 | /** | 783 | /** |
@@ -1018,10 +785,11 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | |||
1018 | * @pwrdm: struct powerdomain * to get previous memory bank power state | 785 | * @pwrdm: struct powerdomain * to get previous memory bank power state |
1019 | * @bank: memory bank number (0-3) | 786 | * @bank: memory bank number (0-3) |
1020 | * | 787 | * |
1021 | * Return the powerdomain pwrdm's previous memory power state for bank | 788 | * Return the powerdomain @pwrdm's previous memory power state for |
1022 | * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if | 789 | * bank @bank. Returns -EINVAL if the powerdomain pointer is null, |
1023 | * the target memory bank does not exist or is not controllable, or | 790 | * -EEXIST if the target memory bank does not exist or is not |
1024 | * returns the previous memory power state upon success. | 791 | * controllable, or returns the previous memory power state upon |
792 | * success. | ||
1025 | */ | 793 | */ |
1026 | int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | 794 | int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) |
1027 | { | 795 | { |
@@ -1065,13 +833,63 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | |||
1065 | } | 833 | } |
1066 | 834 | ||
1067 | /** | 835 | /** |
836 | * pwrdm_read_mem_retst - get next memory bank power state | ||
837 | * @pwrdm: struct powerdomain * to get mext memory bank power state | ||
838 | * @bank: memory bank number (0-3) | ||
839 | * | ||
840 | * Return the powerdomain pwrdm's next memory power state for bank | ||
841 | * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if | ||
842 | * the target memory bank does not exist or is not controllable, or | ||
843 | * returns the next memory power state upon success. | ||
844 | */ | ||
845 | int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
846 | { | ||
847 | u32 m; | ||
848 | |||
849 | if (!pwrdm) | ||
850 | return -EINVAL; | ||
851 | |||
852 | if (pwrdm->banks < (bank + 1)) | ||
853 | return -EEXIST; | ||
854 | |||
855 | /* | ||
856 | * The register bit names below may not correspond to the | ||
857 | * actual names of the bits in each powerdomain's register, | ||
858 | * but the type of value returned is the same for each | ||
859 | * powerdomain. | ||
860 | */ | ||
861 | switch (bank) { | ||
862 | case 0: | ||
863 | m = OMAP_MEM0_RETSTATE_MASK; | ||
864 | break; | ||
865 | case 1: | ||
866 | m = OMAP_MEM1_RETSTATE_MASK; | ||
867 | break; | ||
868 | case 2: | ||
869 | m = OMAP_MEM2_RETSTATE_MASK; | ||
870 | break; | ||
871 | case 3: | ||
872 | m = OMAP_MEM3_RETSTATE_MASK; | ||
873 | break; | ||
874 | case 4: | ||
875 | m = OMAP_MEM4_RETSTATE_MASK; | ||
876 | default: | ||
877 | WARN_ON(1); /* should never happen */ | ||
878 | return -EEXIST; | ||
879 | } | ||
880 | |||
881 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
882 | pwrstctrl_reg_offs, m); | ||
883 | } | ||
884 | |||
885 | /** | ||
1068 | * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm | 886 | * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm |
1069 | * @pwrdm: struct powerdomain * to clear | 887 | * @pwrdm: struct powerdomain * to clear |
1070 | * | 888 | * |
1071 | * Clear the powerdomain's previous power state register. Clears the | 889 | * Clear the powerdomain's previous power state register @pwrdm. |
1072 | * entire register, including logic and memory bank previous power states. | 890 | * Clears the entire register, including logic and memory bank |
1073 | * Returns -EINVAL if the powerdomain pointer is null, or returns 0 upon | 891 | * previous power states. Returns -EINVAL if the powerdomain pointer |
1074 | * success. | 892 | * is null, or returns 0 upon success. |
1075 | */ | 893 | */ |
1076 | int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | 894 | int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) |
1077 | { | 895 | { |
@@ -1096,11 +914,11 @@ int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | |||
1096 | * @pwrdm: struct powerdomain * | 914 | * @pwrdm: struct powerdomain * |
1097 | * | 915 | * |
1098 | * Enable automatic context save-and-restore upon power state change | 916 | * Enable automatic context save-and-restore upon power state change |
1099 | * for some devices in a powerdomain. Warning: this only affects a | 917 | * for some devices in the powerdomain @pwrdm. Warning: this only |
1100 | * subset of devices in a powerdomain; check the TRM closely. Returns | 918 | * affects a subset of devices in a powerdomain; check the TRM |
1101 | * -EINVAL if the powerdomain pointer is null or if the powerdomain | 919 | * closely. Returns -EINVAL if the powerdomain pointer is null or if |
1102 | * does not support automatic save-and-restore, or returns 0 upon | 920 | * the powerdomain does not support automatic save-and-restore, or |
1103 | * success. | 921 | * returns 0 upon success. |
1104 | */ | 922 | */ |
1105 | int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) | 923 | int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) |
1106 | { | 924 | { |
@@ -1114,7 +932,7 @@ int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) | |||
1114 | pwrdm->name); | 932 | pwrdm->name); |
1115 | 933 | ||
1116 | prm_rmw_mod_reg_bits(0, 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, | 934 | prm_rmw_mod_reg_bits(0, 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, |
1117 | pwrdm->prcm_offs, PM_PWSTCTRL); | 935 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
1118 | 936 | ||
1119 | return 0; | 937 | return 0; |
1120 | } | 938 | } |
@@ -1124,11 +942,11 @@ int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) | |||
1124 | * @pwrdm: struct powerdomain * | 942 | * @pwrdm: struct powerdomain * |
1125 | * | 943 | * |
1126 | * Disable automatic context save-and-restore upon power state change | 944 | * Disable automatic context save-and-restore upon power state change |
1127 | * for some devices in a powerdomain. Warning: this only affects a | 945 | * for some devices in the powerdomain @pwrdm. Warning: this only |
1128 | * subset of devices in a powerdomain; check the TRM closely. Returns | 946 | * affects a subset of devices in a powerdomain; check the TRM |
1129 | * -EINVAL if the powerdomain pointer is null or if the powerdomain | 947 | * closely. Returns -EINVAL if the powerdomain pointer is null or if |
1130 | * does not support automatic save-and-restore, or returns 0 upon | 948 | * the powerdomain does not support automatic save-and-restore, or |
1131 | * success. | 949 | * returns 0 upon success. |
1132 | */ | 950 | */ |
1133 | int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) | 951 | int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) |
1134 | { | 952 | { |
@@ -1142,7 +960,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) | |||
1142 | pwrdm->name); | 960 | pwrdm->name); |
1143 | 961 | ||
1144 | prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, 0, | 962 | prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, 0, |
1145 | pwrdm->prcm_offs, PM_PWSTCTRL); | 963 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
1146 | 964 | ||
1147 | return 0; | 965 | return 0; |
1148 | } | 966 | } |
@@ -1151,7 +969,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) | |||
1151 | * pwrdm_has_hdwr_sar - test whether powerdomain supports hardware SAR | 969 | * pwrdm_has_hdwr_sar - test whether powerdomain supports hardware SAR |
1152 | * @pwrdm: struct powerdomain * | 970 | * @pwrdm: struct powerdomain * |
1153 | * | 971 | * |
1154 | * Returns 1 if powerdomain 'pwrdm' supports hardware save-and-restore | 972 | * Returns 1 if powerdomain @pwrdm supports hardware save-and-restore |
1155 | * for some devices, or 0 if it does not. | 973 | * for some devices, or 0 if it does not. |
1156 | */ | 974 | */ |
1157 | bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm) | 975 | bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm) |
@@ -1163,7 +981,7 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm) | |||
1163 | * pwrdm_wait_transition - wait for powerdomain power transition to finish | 981 | * pwrdm_wait_transition - wait for powerdomain power transition to finish |
1164 | * @pwrdm: struct powerdomain * to wait for | 982 | * @pwrdm: struct powerdomain * to wait for |
1165 | * | 983 | * |
1166 | * If the powerdomain pwrdm is in the process of a state transition, | 984 | * If the powerdomain @pwrdm is in the process of a state transition, |
1167 | * spin until it completes the power transition, or until an iteration | 985 | * spin until it completes the power transition, or until an iteration |
1168 | * bailout value is reached. Returns -EINVAL if the powerdomain | 986 | * bailout value is reached. Returns -EINVAL if the powerdomain |
1169 | * pointer is null, -EAGAIN if the bailout value was reached, or | 987 | * pointer is null, -EAGAIN if the bailout value was reached, or |
@@ -1183,10 +1001,10 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm) | |||
1183 | */ | 1001 | */ |
1184 | 1002 | ||
1185 | /* XXX Is this udelay() value meaningful? */ | 1003 | /* XXX Is this udelay() value meaningful? */ |
1186 | while ((prm_read_mod_reg(pwrdm->prcm_offs, PM_PWSTST) & | 1004 | while ((prm_read_mod_reg(pwrdm->prcm_offs, pwrstst_reg_offs) & |
1187 | OMAP_INTRANSITION) && | 1005 | OMAP_INTRANSITION) && |
1188 | (c++ < PWRDM_TRANSITION_BAILOUT)) | 1006 | (c++ < PWRDM_TRANSITION_BAILOUT)) |
1189 | udelay(1); | 1007 | udelay(1); |
1190 | 1008 | ||
1191 | if (c > PWRDM_TRANSITION_BAILOUT) { | 1009 | if (c > PWRDM_TRANSITION_BAILOUT) { |
1192 | printk(KERN_ERR "powerdomain: waited too long for " | 1010 | printk(KERN_ERR "powerdomain: waited too long for " |
@@ -1213,12 +1031,6 @@ int pwrdm_clkdm_state_switch(struct clockdomain *clkdm) | |||
1213 | 1031 | ||
1214 | return -EINVAL; | 1032 | return -EINVAL; |
1215 | } | 1033 | } |
1216 | int pwrdm_clk_state_switch(struct clk *clk) | ||
1217 | { | ||
1218 | if (clk != NULL && clk->clkdm != NULL) | ||
1219 | return pwrdm_clkdm_state_switch(clk->clkdm); | ||
1220 | return -EINVAL; | ||
1221 | } | ||
1222 | 1034 | ||
1223 | int pwrdm_pre_transition(void) | 1035 | int pwrdm_pre_transition(void) |
1224 | { | 1036 | { |