aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/powerdomain.c
diff options
context:
space:
mode:
authorThara Gopinath <thara@ti.com>2010-02-24 14:05:49 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:05:49 -0500
commit1e3d0d2ba9ce1f975ca59d9a1048175f1e9c01ac (patch)
tree673c08a001a1fb0256244c6815451fff0cb34001 /arch/arm/mach-omap2/powerdomain.c
parentb024b542c3697dceb7b625773358310ee34382a6 (diff)
OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state
This patch adds APIs pwrdm_read_logic_retst and pwrdm_read_mem_retst for reading the next programmed logic and memory state a powerdomain is to hit in event of the next power domain state being retention. These are needed for OSWR support. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r--arch/arm/mach-omap2/powerdomain.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index dc03289d5dea..e9eeaa4fbd47 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -679,6 +679,29 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
679} 679}
680 680
681/** 681/**
682 * pwrdm_read_logic_retst - get next powerdomain logic power state
683 * @pwrdm: struct powerdomain * to get next logic power state
684 *
685 * Return the powerdomain pwrdm's logic power state. Returns -EINVAL
686 * if the powerdomain pointer is null or returns the next logic
687 * power state upon success.
688 */
689int pwrdm_read_logic_retst(struct powerdomain *pwrdm)
690{
691 if (!pwrdm)
692 return -EINVAL;
693
694 /*
695 * The register bit names below may not correspond to the
696 * actual names of the bits in each powerdomain's register,
697 * but the type of value returned is the same for each
698 * powerdomain.
699 */
700 return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs,
701 OMAP3430_LOGICSTATEST);
702}
703
704/**
682 * pwrdm_read_mem_pwrst - get current memory bank power state 705 * pwrdm_read_mem_pwrst - get current memory bank power state
683 * @pwrdm: struct powerdomain * to get current memory bank power state 706 * @pwrdm: struct powerdomain * to get current memory bank power state
684 * @bank: memory bank number (0-3) 707 * @bank: memory bank number (0-3)
@@ -785,6 +808,56 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
785} 808}
786 809
787/** 810/**
811 * pwrdm_read_mem_retst - get next memory bank power state
812 * @pwrdm: struct powerdomain * to get mext memory bank power state
813 * @bank: memory bank number (0-3)
814 *
815 * Return the powerdomain pwrdm's next memory power state for bank
816 * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
817 * the target memory bank does not exist or is not controllable, or
818 * returns the next memory power state upon success.
819 */
820int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
821{
822 u32 m;
823
824 if (!pwrdm)
825 return -EINVAL;
826
827 if (pwrdm->banks < (bank + 1))
828 return -EEXIST;
829
830 /*
831 * The register bit names below may not correspond to the
832 * actual names of the bits in each powerdomain's register,
833 * but the type of value returned is the same for each
834 * powerdomain.
835 */
836 switch (bank) {
837 case 0:
838 m = OMAP_MEM0_RETSTATE_MASK;
839 break;
840 case 1:
841 m = OMAP_MEM1_RETSTATE_MASK;
842 break;
843 case 2:
844 m = OMAP_MEM2_RETSTATE_MASK;
845 break;
846 case 3:
847 m = OMAP_MEM3_RETSTATE_MASK;
848 break;
849 case 4:
850 m = OMAP_MEM4_RETSTATE_MASK;
851 default:
852 WARN_ON(1); /* should never happen */
853 return -EEXIST;
854 }
855
856 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
857 pwrstctrl_reg_offs, m);
858}
859
860/**
788 * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm 861 * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm
789 * @pwrdm: struct powerdomain * to clear 862 * @pwrdm: struct powerdomain * to clear
790 * 863 *