2 * OMAP powerdomain control
4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2008 Nokia Corporation
7 * Written by Paul Walmsley
9 * 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
11 * published by the Free Software Foundation.
13 #ifdef CONFIG_OMAP_DEBUG_POWERDOMAIN
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 #include <linux/types.h>
20 #include <linux/delay.h>
21 #include <linux/spinlock.h>
22 #include <linux/list.h>
23 #include <linux/errno.h>
24 #include <linux/err.h>
27 #include <asm/atomic.h>
30 #include "cm-regbits-34xx.h"
32 #include "prm-regbits-34xx.h"
35 #include <mach/powerdomain.h>
37 /* pwrdm_list contains all registered struct powerdomains */
38 static LIST_HEAD(pwrdm_list);
41 * pwrdm_rwlock protects pwrdm_list add and del ops - also reused to
42 * protect pwrdm_clkdms[] during clkdm add/del ops
44 static DEFINE_RWLOCK(pwrdm_rwlock);
47 /* Private functions */
49 static u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
53 v = prm_read_mod_reg(domain, idx);
60 static struct powerdomain *_pwrdm_lookup(const char *name)
62 struct powerdomain *pwrdm, *temp_pwrdm;
66 list_for_each_entry(temp_pwrdm, &pwrdm_list, node) {
67 if (!strcmp(name, temp_pwrdm->name)) {
76 /* _pwrdm_deps_lookup - look up the specified powerdomain in a pwrdm list */
77 static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm,
78 struct pwrdm_dep *deps)
82 if (!pwrdm || !deps || !omap_chip_is(pwrdm->omap_chip))
83 return ERR_PTR(-EINVAL);
85 for (pd = deps; pd; pd++) {
87 if (!omap_chip_is(pd->omap_chip))
90 if (!pd->pwrdm && pd->pwrdm_name)
91 pd->pwrdm = pwrdm_lookup(pd->pwrdm_name);
93 if (pd->pwrdm == pwrdm)
99 return ERR_PTR(-ENOENT);
105 /* Public functions */
108 * pwrdm_init - set up the powerdomain layer
110 * Loop through the list of powerdomains, registering all that are
111 * available on the current CPU. If pwrdm_list is supplied and not
112 * null, all of the referenced powerdomains will be registered. No
115 void pwrdm_init(struct powerdomain **pwrdm_list)
117 struct powerdomain **p = NULL;
120 for (p = pwrdm_list; *p; p++)
125 * pwrdm_register - register a powerdomain
126 * @pwrdm: struct powerdomain * to register
128 * Adds a powerdomain to the internal powerdomain list. Returns
129 * -EINVAL if given a null pointer, -EEXIST if a powerdomain is
130 * already registered by the provided name, or 0 upon success.
132 int pwrdm_register(struct powerdomain *pwrdm)
140 if (!omap_chip_is(pwrdm->omap_chip))
143 write_lock_irqsave(&pwrdm_rwlock, flags);
144 if (_pwrdm_lookup(pwrdm->name)) {
149 list_add(&pwrdm->node, &pwrdm_list);
151 pr_debug("powerdomain: registered %s\n", pwrdm->name);
155 write_unlock_irqrestore(&pwrdm_rwlock, flags);
161 * pwrdm_unregister - unregister a powerdomain
162 * @pwrdm: struct powerdomain * to unregister
164 * Removes a powerdomain from the internal powerdomain list. Returns
165 * -EINVAL if pwrdm argument is NULL.
167 int pwrdm_unregister(struct powerdomain *pwrdm)
174 write_lock_irqsave(&pwrdm_rwlock, flags);
175 list_del(&pwrdm->node);
176 write_unlock_irqrestore(&pwrdm_rwlock, flags);
178 pr_debug("powerdomain: unregistered %s\n", pwrdm->name);
184 * pwrdm_lookup - look up a powerdomain by name, return a pointer
185 * @name: name of powerdomain
187 * Find a registered powerdomain by its name. Returns a pointer to the
188 * struct powerdomain if found, or NULL otherwise.
190 struct powerdomain *pwrdm_lookup(const char *name)
192 struct powerdomain *pwrdm;
198 read_lock_irqsave(&pwrdm_rwlock, flags);
199 pwrdm = _pwrdm_lookup(name);
200 read_unlock_irqrestore(&pwrdm_rwlock, flags);
206 * pwrdm_for_each - call function on each registered clockdomain
207 * @fn: callback function *
209 * Call the supplied function for each registered powerdomain. The
210 * callback function can return anything but 0 to bail out early from
211 * the iterator. The callback function is called with the pwrdm_rwlock
212 * held for reading, so no powerdomain structure manipulation
213 * functions should be called from the callback, although hardware
214 * powerdomain control functions are fine. Returns the last return
215 * value of the callback function, which should be 0 for success or
216 * anything else to indicate failure; or -EINVAL if the function
219 int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm))
221 struct powerdomain *temp_pwrdm;
228 read_lock_irqsave(&pwrdm_rwlock, flags);
229 list_for_each_entry(temp_pwrdm, &pwrdm_list, node) {
230 ret = (*fn)(temp_pwrdm);
234 read_unlock_irqrestore(&pwrdm_rwlock, flags);
240 * pwrdm_add_wkdep - add a wakeup dependency from pwrdm2 to pwrdm1
241 * @pwrdm1: wake this struct powerdomain * up (dependent)
242 * @pwrdm2: when this struct powerdomain * wakes up (source)
244 * When the powerdomain represented by pwrdm2 wakes up (due to an
245 * interrupt), wake up pwrdm1. Implemented in hardware on the OMAP,
246 * this feature is designed to reduce wakeup latency of the dependent
247 * powerdomain. Returns -EINVAL if presented with invalid powerdomain
248 * pointers, -ENOENT if pwrdm2 cannot wake up pwrdm1 in hardware, or
251 int pwrdm_add_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
253 struct powerdomain *p;
258 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs);
260 pr_debug("powerdomain: hardware cannot set/clear wake up of "
261 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
265 pr_debug("powerdomain: hardware will wake up %s when %s wakes up\n",
266 pwrdm1->name, pwrdm2->name);
268 prm_set_mod_reg_bits((1 << pwrdm2->dep_bit),
269 pwrdm1->prcm_offs, PM_WKDEP);
275 * pwrdm_del_wkdep - remove a wakeup dependency from pwrdm2 to pwrdm1
276 * @pwrdm1: wake this struct powerdomain * up (dependent)
277 * @pwrdm2: when this struct powerdomain * wakes up (source)
279 * Remove a wakeup dependency that causes pwrdm1 to wake up when pwrdm2
280 * wakes up. Returns -EINVAL if presented with invalid powerdomain
281 * pointers, -ENOENT if pwrdm2 cannot wake up pwrdm1 in hardware, or
284 int pwrdm_del_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
286 struct powerdomain *p;
291 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs);
293 pr_debug("powerdomain: hardware cannot set/clear wake up of "
294 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
298 pr_debug("powerdomain: hardware will no longer wake up %s after %s "
299 "wakes up\n", pwrdm1->name, pwrdm2->name);
301 prm_clear_mod_reg_bits((1 << pwrdm2->dep_bit),
302 pwrdm1->prcm_offs, PM_WKDEP);
308 * pwrdm_read_wkdep - read wakeup dependency state from pwrdm2 to pwrdm1
309 * @pwrdm1: wake this struct powerdomain * up (dependent)
310 * @pwrdm2: when this struct powerdomain * wakes up (source)
312 * Return 1 if a hardware wakeup dependency exists wherein pwrdm1 will be
313 * awoken when pwrdm2 wakes up; 0 if dependency is not set; -EINVAL
314 * if either powerdomain pointer is invalid; or -ENOENT if the hardware
317 * REVISIT: Currently this function only represents software-controllable
318 * wakeup dependencies. Wakeup dependencies fixed in hardware are not
321 int pwrdm_read_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
323 struct powerdomain *p;
328 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->wkdep_srcs);
330 pr_debug("powerdomain: hardware cannot set/clear wake up of "
331 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
335 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, PM_WKDEP,
336 (1 << pwrdm2->dep_bit));
340 * pwrdm_add_sleepdep - add a sleep dependency from pwrdm2 to pwrdm1
341 * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent)
342 * @pwrdm2: when this struct powerdomain * is active (source)
344 * Prevent pwrdm1 from automatically going inactive (and then to
345 * retention or off) if pwrdm2 is still active. Returns -EINVAL if
346 * presented with invalid powerdomain pointers or called on a machine
347 * that does not support software-configurable hardware sleep dependencies,
348 * -ENOENT if the specified dependency cannot be set in hardware, or
351 int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
353 struct powerdomain *p;
358 if (!cpu_is_omap34xx())
361 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
363 pr_debug("powerdomain: hardware cannot set/clear sleep "
364 "dependency affecting %s from %s\n", pwrdm1->name,
369 pr_debug("powerdomain: will prevent %s from sleeping if %s is active\n",
370 pwrdm1->name, pwrdm2->name);
372 cm_set_mod_reg_bits((1 << pwrdm2->dep_bit),
373 pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP);
379 * pwrdm_del_sleepdep - remove a sleep dependency from pwrdm2 to pwrdm1
380 * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent)
381 * @pwrdm2: when this struct powerdomain * is active (source)
383 * Allow pwrdm1 to automatically go inactive (and then to retention or
384 * off), independent of the activity state of pwrdm2. Returns -EINVAL
385 * if presented with invalid powerdomain pointers or called on a machine
386 * that does not support software-configurable hardware sleep dependencies,
387 * -ENOENT if the specified dependency cannot be cleared in hardware, or
390 int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
392 struct powerdomain *p;
397 if (!cpu_is_omap34xx())
400 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
402 pr_debug("powerdomain: hardware cannot set/clear sleep "
403 "dependency affecting %s from %s\n", pwrdm1->name,
408 pr_debug("powerdomain: will no longer prevent %s from sleeping if "
409 "%s is active\n", pwrdm1->name, pwrdm2->name);
411 cm_clear_mod_reg_bits((1 << pwrdm2->dep_bit),
412 pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP);
418 * pwrdm_read_sleepdep - read sleep dependency state from pwrdm2 to pwrdm1
419 * @pwrdm1: prevent this struct powerdomain * from sleeping (dependent)
420 * @pwrdm2: when this struct powerdomain * is active (source)
422 * Return 1 if a hardware sleep dependency exists wherein pwrdm1 will
423 * not be allowed to automatically go inactive if pwrdm2 is active;
424 * 0 if pwrdm1's automatic power state inactivity transition is independent
425 * of pwrdm2's; -EINVAL if either powerdomain pointer is invalid or called
426 * on a machine that does not support software-configurable hardware sleep
427 * dependencies; or -ENOENT if the hardware is incapable.
429 * REVISIT: Currently this function only represents software-controllable
430 * sleep dependencies. Sleep dependencies fixed in hardware are not
433 int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
435 struct powerdomain *p;
440 if (!cpu_is_omap34xx())
443 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
445 pr_debug("powerdomain: hardware cannot set/clear sleep "
446 "dependency affecting %s from %s\n", pwrdm1->name,
451 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP,
452 (1 << pwrdm2->dep_bit));
456 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
457 * @pwrdm: struct powerdomain *
459 * Return the number of controllable memory banks in powerdomain pwrdm,
460 * starting with 1. Returns -EINVAL if the powerdomain pointer is null.
462 int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm)
471 * pwrdm_set_next_pwrst - set next powerdomain power state
472 * @pwrdm: struct powerdomain * to set
473 * @pwrst: one of the PWRDM_POWER_* macros
475 * Set the powerdomain pwrdm's next power state to pwrst. The powerdomain
476 * may not enter this state immediately if the preconditions for this state
477 * have not been satisfied. Returns -EINVAL if the powerdomain pointer is
478 * null or if the power state is invalid for the powerdomin, or returns 0
481 int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
486 if (!(pwrdm->pwrsts & (1 << pwrst)))
489 pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
492 prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
493 (pwrst << OMAP_POWERSTATE_SHIFT),
494 pwrdm->prcm_offs, PM_PWSTCTRL);
500 * pwrdm_read_next_pwrst - get next powerdomain power state
501 * @pwrdm: struct powerdomain * to get power state
503 * Return the powerdomain pwrdm's next power state. Returns -EINVAL
504 * if the powerdomain pointer is null or returns the next power state
507 int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
512 return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTCTRL,
513 OMAP_POWERSTATE_MASK);
517 * pwrdm_read_pwrst - get current powerdomain power state
518 * @pwrdm: struct powerdomain * to get power state
520 * Return the powerdomain pwrdm's current power state. Returns -EINVAL
521 * if the powerdomain pointer is null or returns the current power state
524 int pwrdm_read_pwrst(struct powerdomain *pwrdm)
529 return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST,
530 OMAP_POWERSTATEST_MASK);
534 * pwrdm_read_prev_pwrst - get previous powerdomain power state
535 * @pwrdm: struct powerdomain * to get previous power state
537 * Return the powerdomain pwrdm's previous power state. Returns -EINVAL
538 * if the powerdomain pointer is null or returns the previous power state
541 int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
546 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST,
547 OMAP3430_LASTPOWERSTATEENTERED_MASK);
551 * pwrdm_set_logic_retst - set powerdomain logic power state upon retention
552 * @pwrdm: struct powerdomain * to set
553 * @pwrst: one of the PWRDM_POWER_* macros
555 * Set the next power state that the logic portion of the powerdomain
556 * pwrdm will enter when the powerdomain enters retention. This will
557 * be either RETENTION or OFF, if supported. Returns -EINVAL if the
558 * powerdomain pointer is null or the target power state is not not
559 * supported, or returns 0 upon success.
561 int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
566 if (!(pwrdm->pwrsts_logic_ret & (1 << pwrst)))
569 pr_debug("powerdomain: setting next logic powerstate for %s to %0x\n",
573 * The register bit names below may not correspond to the
574 * actual names of the bits in each powerdomain's register,
575 * but the type of value returned is the same for each
578 prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE,
579 (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)),
580 pwrdm->prcm_offs, PM_PWSTCTRL);
586 * pwrdm_set_mem_onst - set memory power state while powerdomain ON
587 * @pwrdm: struct powerdomain * to set
588 * @bank: memory bank number to set (0-3)
589 * @pwrst: one of the PWRDM_POWER_* macros
591 * Set the next power state that memory bank x of the powerdomain
592 * pwrdm will enter when the powerdomain enters the ON state. Bank
593 * will be a number from 0 to 3, and represents different types of
594 * memory, depending on the powerdomain. Returns -EINVAL if the
595 * powerdomain pointer is null or the target power state is not not
596 * supported for this memory bank, -EEXIST if the target memory bank
597 * does not exist or is not controllable, or returns 0 upon success.
599 int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
606 if (pwrdm->banks < (bank + 1))
609 if (!(pwrdm->pwrsts_mem_on[bank] & (1 << pwrst)))
612 pr_debug("powerdomain: setting next memory powerstate for domain %s "
613 "bank %0x while pwrdm-ON to %0x\n", pwrdm->name, bank, pwrst);
616 * The register bit names below may not correspond to the
617 * actual names of the bits in each powerdomain's register,
618 * but the type of value returned is the same for each
623 m = OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK;
626 m = OMAP3430_L1FLATMEMONSTATE_MASK;
629 m = OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK;
632 m = OMAP3430_L2FLATMEMONSTATE_MASK;
635 WARN_ON(1); /* should never happen */
639 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)),
640 pwrdm->prcm_offs, PM_PWSTCTRL);
646 * pwrdm_set_mem_retst - set memory power state while powerdomain in RET
647 * @pwrdm: struct powerdomain * to set
648 * @bank: memory bank number to set (0-3)
649 * @pwrst: one of the PWRDM_POWER_* macros
651 * Set the next power state that memory bank x of the powerdomain
652 * pwrdm will enter when the powerdomain enters the RETENTION state.
653 * Bank will be a number from 0 to 3, and represents different types
654 * of memory, depending on the powerdomain. pwrst will be either
655 * RETENTION or OFF, if supported. Returns -EINVAL if the powerdomain
656 * pointer is null or the target power state is not not supported for
657 * this memory bank, -EEXIST if the target memory bank does not exist
658 * or is not controllable, or returns 0 upon success.
660 int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
667 if (pwrdm->banks < (bank + 1))
670 if (!(pwrdm->pwrsts_mem_ret[bank] & (1 << pwrst)))
673 pr_debug("powerdomain: setting next memory powerstate for domain %s "
674 "bank %0x while pwrdm-RET to %0x\n", pwrdm->name, bank, pwrst);
677 * The register bit names below may not correspond to the
678 * actual names of the bits in each powerdomain's register,
679 * but the type of value returned is the same for each
684 m = OMAP3430_SHAREDL1CACHEFLATRETSTATE;
687 m = OMAP3430_L1FLATMEMRETSTATE;
690 m = OMAP3430_SHAREDL2CACHEFLATRETSTATE;
693 m = OMAP3430_L2FLATMEMRETSTATE;
696 WARN_ON(1); /* should never happen */
700 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
707 * pwrdm_read_logic_pwrst - get current powerdomain logic retention power state
708 * @pwrdm: struct powerdomain * to get current logic retention power state
710 * Return the current power state that the logic portion of
711 * powerdomain pwrdm will enter
712 * Returns -EINVAL if the powerdomain pointer is null or returns the
713 * current logic retention power state upon success.
715 int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
720 return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST,
721 OMAP3430_LOGICSTATEST);
725 * pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state
726 * @pwrdm: struct powerdomain * to get previous logic power state
728 * Return the powerdomain pwrdm's logic power state. Returns -EINVAL
729 * if the powerdomain pointer is null or returns the previous logic
730 * power state upon success.
732 int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
738 * The register bit names below may not correspond to the
739 * actual names of the bits in each powerdomain's register,
740 * but the type of value returned is the same for each
743 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST,
744 OMAP3430_LASTLOGICSTATEENTERED);
748 * pwrdm_read_mem_pwrst - get current memory bank power state
749 * @pwrdm: struct powerdomain * to get current memory bank power state
750 * @bank: memory bank number (0-3)
752 * Return the powerdomain pwrdm's current memory power state for bank
753 * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
754 * the target memory bank does not exist or is not controllable, or
755 * returns the current memory power state upon success.
757 int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
764 if (pwrdm->banks < (bank + 1))
768 * The register bit names below may not correspond to the
769 * actual names of the bits in each powerdomain's register,
770 * but the type of value returned is the same for each
775 m = OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK;
778 m = OMAP3430_L1FLATMEMSTATEST_MASK;
781 m = OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK;
784 m = OMAP3430_L2FLATMEMSTATEST_MASK;
787 WARN_ON(1); /* should never happen */
791 return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, m);
795 * pwrdm_read_prev_mem_pwrst - get previous memory bank power state
796 * @pwrdm: struct powerdomain * to get previous memory bank power state
797 * @bank: memory bank number (0-3)
799 * Return the powerdomain pwrdm's previous memory power state for bank
800 * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
801 * the target memory bank does not exist or is not controllable, or
802 * returns the previous memory power state upon success.
804 int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
811 if (pwrdm->banks < (bank + 1))
815 * The register bit names below may not correspond to the
816 * actual names of the bits in each powerdomain's register,
817 * but the type of value returned is the same for each
822 m = OMAP3430_LASTMEM1STATEENTERED_MASK;
825 m = OMAP3430_LASTMEM2STATEENTERED_MASK;
828 m = OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
831 m = OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
834 WARN_ON(1); /* should never happen */
838 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
839 OMAP3430_PM_PREPWSTST, m);
843 * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm
844 * @pwrdm: struct powerdomain * to clear
846 * Clear the powerdomain's previous power state register. Clears the
847 * entire register, including logic and memory bank previous power states.
848 * Returns -EINVAL if the powerdomain pointer is null, or returns 0 upon
851 int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
857 * XXX should get the powerdomain's current state here;
858 * warn & fail if it is not ON.
861 pr_debug("powerdomain: clearing previous power state reg for %s\n",
864 prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
870 * pwrdm_wait_transition - wait for powerdomain power transition to finish
871 * @pwrdm: struct powerdomain * to wait for
873 * If the powerdomain pwrdm is in the process of a state transition,
874 * spin until it completes the power transition, or until an iteration
875 * bailout value is reached. Returns -EINVAL if the powerdomain
876 * pointer is null, -EAGAIN if the bailout value was reached, or
877 * returns 0 upon success.
879 int pwrdm_wait_transition(struct powerdomain *pwrdm)
887 * REVISIT: pwrdm_wait_transition() may be better implemented
888 * via a callback and a periodic timer check -- how long do we expect
889 * powerdomain transitions to take?
892 /* XXX Is this udelay() value meaningful? */
893 while ((prm_read_mod_reg(pwrdm->prcm_offs, PM_PWSTST) &
894 OMAP_INTRANSITION) &&
895 (c++ < PWRDM_TRANSITION_BAILOUT))
898 if (c >= PWRDM_TRANSITION_BAILOUT) {
899 printk(KERN_ERR "powerdomain: waited too long for "
900 "powerdomain %s to complete transition\n", pwrdm->name);
904 pr_debug("powerdomain: completed transition in %d loops\n", c);