diff options
author | Paul Walmsley <paul@pwsan.com> | 2013-01-26 02:58:14 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2013-01-29 16:59:57 -0500 |
commit | f653b29825817a929a606726f03a04fcd0b2b566 (patch) | |
tree | 0f70038dcebbc4a0fb1ac95fd247cf9a3617fa7b /arch/arm/mach-omap2/pm24xx.c | |
parent | 53e1cb469e6cf353aa581e6b0a36cca359ecee25 (diff) |
ARM: OMAP2xxx: PM: clean up some crufty powerstate programming code
Don't attempt to put clockdomains to sleep; this should be handled by the
clock framework. It should be enough to program the next-power-state,
and then let the code in omap_pm_clkdms_setup() deal with the rest.
Start out by programming the MPU and CORE powerdomains to stay ON.
Then control the MPU and CORE powerdomain states directly in
omap2_enter_full_retention() and omap2_enter_mpu_retention(). Not the
most optimal way to do it, but certainly is the most conservative until
OMAP2xxx PM is working again.
Get rid of the open-coded PM_PWSTCTRL_MPU writes in
omap2_enter_mpu_retention(); use the powerdomain code instead.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm24xx.c')
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index c333fa6dffa8..5d0f39b490b6 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -90,11 +90,7 @@ static int omap2_enter_full_retention(void) | |||
90 | omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2); | 90 | omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2); |
91 | omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); | 91 | omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); |
92 | 92 | ||
93 | /* | 93 | pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_RET); |
94 | * Set MPU powerdomain's next power state to RETENTION; | ||
95 | * preserve logic state during retention | ||
96 | */ | ||
97 | pwrdm_set_logic_retst(mpu_pwrdm, PWRDM_POWER_RET); | ||
98 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); | 94 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); |
99 | 95 | ||
100 | /* Workaround to kill USB */ | 96 | /* Workaround to kill USB */ |
@@ -137,6 +133,9 @@ no_sleep: | |||
137 | /* Mask future PRCM-to-MPU interrupts */ | 133 | /* Mask future PRCM-to-MPU interrupts */ |
138 | omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); | 134 | omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); |
139 | 135 | ||
136 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); | ||
137 | pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_ON); | ||
138 | |||
140 | return 0; | 139 | return 0; |
141 | } | 140 | } |
142 | 141 | ||
@@ -186,17 +185,16 @@ static void omap2_enter_mpu_retention(void) | |||
186 | omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); | 185 | omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); |
187 | 186 | ||
188 | /* Try to enter MPU retention */ | 187 | /* Try to enter MPU retention */ |
189 | omap2_prm_write_mod_reg((0x01 << OMAP_POWERSTATE_SHIFT) | | 188 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); |
190 | OMAP_LOGICRETSTATE_MASK, | 189 | |
191 | MPU_MOD, OMAP2_PM_PWSTCTRL); | ||
192 | } else { | 190 | } else { |
193 | /* Block MPU retention */ | 191 | /* Block MPU retention */ |
194 | 192 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); | |
195 | omap2_prm_write_mod_reg(OMAP_LOGICRETSTATE_MASK, MPU_MOD, | ||
196 | OMAP2_PM_PWSTCTRL); | ||
197 | } | 193 | } |
198 | 194 | ||
199 | omap2_sram_idle(); | 195 | omap2_sram_idle(); |
196 | |||
197 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); | ||
200 | } | 198 | } |
201 | 199 | ||
202 | static int omap2_can_sleep(void) | 200 | static int omap2_can_sleep(void) |
@@ -251,25 +249,17 @@ static void __init prcm_setup_regs(void) | |||
251 | for (i = 0; i < num_mem_banks; i++) | 249 | for (i = 0; i < num_mem_banks; i++) |
252 | pwrdm_set_mem_retst(core_pwrdm, i, PWRDM_POWER_RET); | 250 | pwrdm_set_mem_retst(core_pwrdm, i, PWRDM_POWER_RET); |
253 | 251 | ||
254 | /* Set CORE powerdomain's next power state to RETENTION */ | 252 | pwrdm_set_logic_retst(core_pwrdm, PWRDM_POWER_RET); |
255 | pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_RET); | ||
256 | 253 | ||
257 | /* | ||
258 | * Set MPU powerdomain's next power state to RETENTION; | ||
259 | * preserve logic state during retention | ||
260 | */ | ||
261 | pwrdm_set_logic_retst(mpu_pwrdm, PWRDM_POWER_RET); | 254 | pwrdm_set_logic_retst(mpu_pwrdm, PWRDM_POWER_RET); |
262 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); | ||
263 | 255 | ||
264 | /* Force-power down DSP, GFX powerdomains */ | 256 | /* Force-power down DSP, GFX powerdomains */ |
265 | 257 | ||
266 | pwrdm = clkdm_get_pwrdm(dsp_clkdm); | 258 | pwrdm = clkdm_get_pwrdm(dsp_clkdm); |
267 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); | 259 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); |
268 | clkdm_sleep(dsp_clkdm); | ||
269 | 260 | ||
270 | pwrdm = clkdm_get_pwrdm(gfx_clkdm); | 261 | pwrdm = clkdm_get_pwrdm(gfx_clkdm); |
271 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); | 262 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); |
272 | clkdm_sleep(gfx_clkdm); | ||
273 | 263 | ||
274 | /* Enable hardware-supervised idle for all clkdms */ | 264 | /* Enable hardware-supervised idle for all clkdms */ |
275 | clkdm_for_each(omap_pm_clkdms_setup, NULL); | 265 | clkdm_for_each(omap_pm_clkdms_setup, NULL); |