Commit d9d5cd4e authored by Tuukka Tikkanen's avatar Tuukka Tikkanen Committed by Tony Lindgren

ARM: OMAP: PM update

Sync with linux-omap tree. PM updates to make deep sleep work.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent e88be4f3
This diff is collapsed.
...@@ -66,7 +66,7 @@ ENTRY(omap1510_idle_loop_suspend) ...@@ -66,7 +66,7 @@ ENTRY(omap1510_idle_loop_suspend)
@ get ARM_IDLECT2 into r2 @ get ARM_IDLECT2 into r2
ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff
orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00 orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00
strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
@ request ARM idle @ request ARM idle
...@@ -76,7 +76,7 @@ ENTRY(omap1510_idle_loop_suspend) ...@@ -76,7 +76,7 @@ ENTRY(omap1510_idle_loop_suspend)
strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
mov r5, #IDLE_WAIT_CYCLES & 0xff mov r5, #IDLE_WAIT_CYCLES & 0xff
orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
l_1510: subs r5, r5, #1 l_1510: subs r5, r5, #1
bne l_1510 bne l_1510
/* /*
...@@ -96,7 +96,7 @@ l_1510: subs r5, r5, #1 ...@@ -96,7 +96,7 @@ l_1510: subs r5, r5, #1
strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
ldmfd sp!, {r0 - r12, pc} @ restore regs and return ldmfd sp!, {r0 - r12, pc} @ restore regs and return
ENTRY(omap1510_idle_loop_suspend_sz) ENTRY(omap1510_idle_loop_suspend_sz)
.word . - omap1510_idle_loop_suspend .word . - omap1510_idle_loop_suspend
...@@ -115,8 +115,8 @@ ENTRY(omap1610_idle_loop_suspend) ...@@ -115,8 +115,8 @@ ENTRY(omap1610_idle_loop_suspend)
@ turn off clock domains @ turn off clock domains
@ get ARM_IDLECT2 into r2 @ get ARM_IDLECT2 into r2
ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
mov r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff mov r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff
orr r5,r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff00 orr r5,r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff00
strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
@ request ARM idle @ request ARM idle
...@@ -126,7 +126,7 @@ ENTRY(omap1610_idle_loop_suspend) ...@@ -126,7 +126,7 @@ ENTRY(omap1610_idle_loop_suspend)
strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
mov r5, #IDLE_WAIT_CYCLES & 0xff mov r5, #IDLE_WAIT_CYCLES & 0xff
orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
l_1610: subs r5, r5, #1 l_1610: subs r5, r5, #1
bne l_1610 bne l_1610
/* /*
...@@ -146,7 +146,7 @@ l_1610: subs r5, r5, #1 ...@@ -146,7 +146,7 @@ l_1610: subs r5, r5, #1
strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
ldmfd sp!, {r0 - r12, pc} @ restore regs and return ldmfd sp!, {r0 - r12, pc} @ restore regs and return
ENTRY(omap1610_idle_loop_suspend_sz) ENTRY(omap1610_idle_loop_suspend_sz)
.word . - omap1610_idle_loop_suspend .word . - omap1610_idle_loop_suspend
...@@ -208,7 +208,7 @@ ENTRY(omap1510_cpu_suspend) ...@@ -208,7 +208,7 @@ ENTRY(omap1510_cpu_suspend)
@ turn off clock domains @ turn off clock domains
mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff
orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00 orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00
strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
@ request ARM idle @ request ARM idle
...@@ -217,7 +217,7 @@ ENTRY(omap1510_cpu_suspend) ...@@ -217,7 +217,7 @@ ENTRY(omap1510_cpu_suspend)
strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
mov r5, #IDLE_WAIT_CYCLES & 0xff mov r5, #IDLE_WAIT_CYCLES & 0xff
orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
l_1510_2: l_1510_2:
subs r5, r5, #1 subs r5, r5, #1
bne l_1510_2 bne l_1510_2
...@@ -237,7 +237,7 @@ l_1510_2: ...@@ -237,7 +237,7 @@ l_1510_2:
strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
@ restore regs and return @ restore regs and return
ldmfd sp!, {r0 - r12, pc} ldmfd sp!, {r0 - r12, pc}
ENTRY(omap1510_cpu_suspend_sz) ENTRY(omap1510_cpu_suspend_sz)
.word . - omap1510_cpu_suspend .word . - omap1510_cpu_suspend
...@@ -249,21 +249,26 @@ ENTRY(omap1610_cpu_suspend) ...@@ -249,21 +249,26 @@ ENTRY(omap1610_cpu_suspend)
@ save registers on stack @ save registers on stack
stmfd sp!, {r0 - r12, lr} stmfd sp!, {r0 - r12, lr}
@ Drain write cache
mov r4, #0
mcr p15, 0, r0, c7, c10, 4
nop
@ load base address of Traffic Controller @ load base address of Traffic Controller
mov r4, #TCMIF_ASM_BASE & 0xff000000 mov r6, #TCMIF_ASM_BASE & 0xff000000
orr r4, r4, #TCMIF_ASM_BASE & 0x00ff0000 orr r6, r6, #TCMIF_ASM_BASE & 0x00ff0000
orr r4, r4, #TCMIF_ASM_BASE & 0x0000ff00 orr r6, r6, #TCMIF_ASM_BASE & 0x0000ff00
@ prepare to put SDRAM into self-refresh manually @ prepare to put SDRAM into self-refresh manually
ldr r5, [r4, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff] ldr r7, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
orr r5, r5, #SELF_REFRESH_MODE & 0xff000000 orr r9, r7, #SELF_REFRESH_MODE & 0xff000000
orr r5, r5, #SELF_REFRESH_MODE & 0x000000ff orr r9, r9, #SELF_REFRESH_MODE & 0x000000ff
str r5, [r4, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff] str r9, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
@ prepare to put EMIFS to Sleep @ prepare to put EMIFS to Sleep
ldr r5, [r4, #EMIFS_CONFIG_ASM_OFFSET & 0xff] ldr r8, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
orr r5, r5, #IDLE_EMIFS_REQUEST & 0xff orr r9, r8, #IDLE_EMIFS_REQUEST & 0xff
str r5, [r4, #EMIFS_CONFIG_ASM_OFFSET & 0xff] str r9, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
@ load base address of ARM_IDLECT1 and ARM_IDLECT2 @ load base address of ARM_IDLECT1 and ARM_IDLECT2
mov r4, #CLKGEN_REG_ASM_BASE & 0xff000000 mov r4, #CLKGEN_REG_ASM_BASE & 0xff000000
...@@ -271,26 +276,22 @@ ENTRY(omap1610_cpu_suspend) ...@@ -271,26 +276,22 @@ ENTRY(omap1610_cpu_suspend)
orr r4, r4, #CLKGEN_REG_ASM_BASE & 0x0000ff00 orr r4, r4, #CLKGEN_REG_ASM_BASE & 0x0000ff00
@ turn off clock domains @ turn off clock domains
mov r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff @ do not disable PERCK (0x04)
orr r5,r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff00 mov r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff
strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] orr r5,r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff00
@ work around errata of OMAP1610/5912. Enable (!) peripheral
@ clock to let the chip go into deep sleep
ldrh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
orr r5,r5, #EN_PERCK_BIT & 0xff
strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
@ request ARM idle @ request ARM idle
mov r3, #OMAP1610_DEEP_SLEEP_REQUEST & 0xff mov r3, #OMAP1610_IDLECT1_SLEEP_VAL & 0xff
orr r3, r3, #OMAP1610_DEEP_SLEEP_REQUEST & 0xff00 orr r3, r3, #OMAP1610_IDLECT1_SLEEP_VAL & 0xff00
strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
mov r5, #IDLE_WAIT_CYCLES & 0xff @ disable instruction cache
orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 mrc p15, 0, r9, c1, c0, 0
l_1610_2: bic r2, r9, #0x1000
subs r5, r5, #1 mcr p15, 0, r2, c1, c0, 0
bne l_1610_2 nop
/* /*
* Let's wait for the next wake up event to wake us up. r0 can't be * Let's wait for the next wake up event to wake us up. r0 can't be
* used here because r0 holds ARM_IDLECT1 * used here because r0 holds ARM_IDLECT1
...@@ -301,11 +302,19 @@ l_1610_2: ...@@ -301,11 +302,19 @@ l_1610_2:
* omap1610_cpu_suspend()'s resume point. * omap1610_cpu_suspend()'s resume point.
* *
* It will just start executing here, so we'll restore stuff from the * It will just start executing here, so we'll restore stuff from the
* stack, reset the ARM_IDLECT1 and ARM_IDLECT2. * stack.
*/ */
@ re-enable Icache
mcr p15, 0, r9, c1, c0, 0
@ reset the ARM_IDLECT1 and ARM_IDLECT2.
strh r1, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] strh r1, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
@ Restore EMIFF controls
str r7, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
str r8, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
@ restore regs and return @ restore regs and return
ldmfd sp!, {r0 - r12, pc} ldmfd sp!, {r0 - r12, pc}
......
...@@ -61,7 +61,10 @@ ...@@ -61,7 +61,10 @@
#define PER_EN 0x1 #define PER_EN 0x1
#define CPU_SUSPEND_SIZE 200 #define CPU_SUSPEND_SIZE 200
#define ULPD_LOW_POWER_EN 0x0001 #define ULPD_LOW_PWR_EN 0x0001
#define ULPD_DEEP_SLEEP_TRANSITION_EN 0x0010
#define ULPD_SETUP_ANALOG_CELL_3_VAL 0
#define ULPD_POWER_CTRL_REG_VAL 0x0219
#define DSP_IDLE_DELAY 10 #define DSP_IDLE_DELAY 10
#define DSP_IDLE 0x0040 #define DSP_IDLE 0x0040
...@@ -86,13 +89,14 @@ ...@@ -86,13 +89,14 @@
#define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5 #define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5
#define OMAP1510_IDLE_LOOP_REQUEST 0x0c00 #define OMAP1510_IDLE_LOOP_REQUEST 0x0c00
#define OMAP1510_IDLE_CLOCK_DOMAINS 0x2 #define OMAP1510_IDLE_CLOCK_DOMAINS 0x2
#define OMAP1510_ULPD_LOW_POWER_REQ 0x0001
#define OMAP1610_DEEP_SLEEP_REQUEST 0x17c7 /* Both big sleep and deep sleep use same values. Difference is in ULPD. */
#define OMAP1610_BIG_SLEEP_REQUEST TBD #define OMAP1610_IDLECT1_SLEEP_VAL 0x13c7
#define OMAP1610_IDLECT2_SLEEP_VAL 0x09c7
#define OMAP1610_IDLECT3_VAL 0x3f
#define OMAP1610_IDLECT3_SLEEP_ORMASK 0x2c
#define OMAP1610_IDLECT3 0xfffece24
#define OMAP1610_IDLE_LOOP_REQUEST 0x0400 #define OMAP1610_IDLE_LOOP_REQUEST 0x0400
#define OMAP1610_IDLE_CLOCK_DOMAINS 0x09c7
#define OMAP1610_ULPD_LOW_POWER_REQ 0x3
#ifndef OMAP1510_SRAM_IDLE_SUSPEND #ifndef OMAP1510_SRAM_IDLE_SUSPEND
#define OMAP1510_SRAM_IDLE_SUSPEND 0 #define OMAP1510_SRAM_IDLE_SUSPEND 0
...@@ -161,6 +165,7 @@ enum arm_save_state { ...@@ -161,6 +165,7 @@ enum arm_save_state {
ARM_SLEEP_SAVE_ARM_CKCTL, ARM_SLEEP_SAVE_ARM_CKCTL,
ARM_SLEEP_SAVE_ARM_IDLECT1, ARM_SLEEP_SAVE_ARM_IDLECT1,
ARM_SLEEP_SAVE_ARM_IDLECT2, ARM_SLEEP_SAVE_ARM_IDLECT2,
ARM_SLEEP_SAVE_ARM_IDLECT3,
ARM_SLEEP_SAVE_ARM_EWUPCT, ARM_SLEEP_SAVE_ARM_EWUPCT,
ARM_SLEEP_SAVE_ARM_RSTCT1, ARM_SLEEP_SAVE_ARM_RSTCT1,
ARM_SLEEP_SAVE_ARM_RSTCT2, ARM_SLEEP_SAVE_ARM_RSTCT2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment