diff options
Diffstat (limited to 'arch/arm/mach-s3c2410/sleep.S')
-rw-r--r-- | arch/arm/mach-s3c2410/sleep.S | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/arch/arm/mach-s3c2410/sleep.S b/arch/arm/mach-s3c2410/sleep.S index a7561a79fc82..2018c2e1dcc5 100644 --- a/arch/arm/mach-s3c2410/sleep.S +++ b/arch/arm/mach-s3c2410/sleep.S | |||
@@ -41,15 +41,25 @@ | |||
41 | 41 | ||
42 | .text | 42 | .text |
43 | 43 | ||
44 | /* s3c2410_cpu_suspend | 44 | /* s3c2410_cpu_save |
45 | * | 45 | * |
46 | * put the cpu into sleep mode | 46 | * save enough of the CPU state to allow us to re-start |
47 | * pm.c code. as we store items like the sp/lr, we will | ||
48 | * end up returning from this function when the cpu resumes | ||
49 | * so the return value is set to mark this. | ||
50 | * | ||
51 | * This arangement means we avoid having to flush the cache | ||
52 | * from this code. | ||
47 | * | 53 | * |
48 | * entry: | 54 | * entry: |
49 | * r0 = sleep save block | 55 | * r0 = pointer to save block |
56 | * | ||
57 | * exit: | ||
58 | * r0 = 0 => we stored everything | ||
59 | * 1 => resumed from sleep | ||
50 | */ | 60 | */ |
51 | 61 | ||
52 | ENTRY(s3c2410_cpu_suspend) | 62 | ENTRY(s3c2410_cpu_save) |
53 | stmfd sp!, { r4 - r12, lr } | 63 | stmfd sp!, { r4 - r12, lr } |
54 | 64 | ||
55 | @@ store co-processor registers | 65 | @@ store co-processor registers |
@@ -62,44 +72,14 @@ ENTRY(s3c2410_cpu_suspend) | |||
62 | 72 | ||
63 | stmia r0, { r4 - r13 } | 73 | stmia r0, { r4 - r13 } |
64 | 74 | ||
65 | @@ flush the caches to ensure everything is back out to | 75 | mov r0, #0 |
66 | @@ SDRAM before the core powers down | 76 | ldmfd sp, { r4 - r12, pc } |
67 | |||
68 | #ifndef CONFIG_CPU_DCACHE_WRITETHROUGH | ||
69 | bl arm920_flush_kern_cache_all | ||
70 | #endif | ||
71 | |||
72 | @@ prepare cpu to sleep | ||
73 | |||
74 | ldr r4, =S3C2410_REFRESH | ||
75 | ldr r5, =S3C24XX_MISCCR | ||
76 | ldr r6, =S3C2410_CLKCON | ||
77 | ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB) | ||
78 | ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB) | ||
79 | ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB) | ||
80 | |||
81 | orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command | ||
82 | orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals | ||
83 | orr r9, r9, #S3C2410_CLKCON_POWER @ power down command | ||
84 | |||
85 | teq pc, #0 @ first as a trial-run to load cache | ||
86 | bl s3c2410_do_sleep | ||
87 | teq r0, r0 @ now do it for real | ||
88 | b s3c2410_do_sleep @ | ||
89 | |||
90 | @@ align next bit of code to cache line | ||
91 | .align 8 | ||
92 | s3c2410_do_sleep: | ||
93 | streq r7, [ r4 ] @ SDRAM sleep command | ||
94 | streq r8, [ r5 ] @ SDRAM power-down config | ||
95 | streq r9, [ r6 ] @ CPU sleep | ||
96 | 1: beq 1b | ||
97 | mov pc, r14 | ||
98 | 77 | ||
99 | @@ return to the caller, after having the MMU | 78 | @@ return to the caller, after having the MMU |
100 | @@ turned on, this restores the last bits from the | 79 | @@ turned on, this restores the last bits from the |
101 | @@ stack | 80 | @@ stack |
102 | resume_with_mmu: | 81 | resume_with_mmu: |
82 | mov r0, #1 | ||
103 | ldmfd sp!, { r4 - r12, pc } | 83 | ldmfd sp!, { r4 - r12, pc } |
104 | 84 | ||
105 | .ltorg | 85 | .ltorg |