diff options
Diffstat (limited to 'arch/arm/plat-s3c24xx/sleep.S')
-rw-r--r-- | arch/arm/plat-s3c24xx/sleep.S | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/arch/arm/plat-s3c24xx/sleep.S b/arch/arm/plat-s3c24xx/sleep.S index 76594b212802..e73e3b6e88d2 100644 --- a/arch/arm/plat-s3c24xx/sleep.S +++ b/arch/arm/plat-s3c24xx/sleep.S | |||
@@ -41,25 +41,13 @@ | |||
41 | 41 | ||
42 | .text | 42 | .text |
43 | 43 | ||
44 | /* s3c2410_cpu_save | 44 | /* s3c_cpu_save |
45 | * | ||
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. | ||
53 | * | 45 | * |
54 | * entry: | 46 | * entry: |
55 | * r0 = pointer to save block | 47 | * r0 = save address (virtual addr of s3c_sleep_save_phys) |
56 | * | ||
57 | * exit: | ||
58 | * r0 = 0 => we stored everything | ||
59 | * 1 => resumed from sleep | ||
60 | */ | 48 | */ |
61 | 49 | ||
62 | ENTRY(s3c2410_cpu_save) | 50 | ENTRY(s3c_cpu_save) |
63 | stmfd sp!, { r4 - r12, lr } | 51 | stmfd sp!, { r4 - r12, lr } |
64 | 52 | ||
65 | @@ store co-processor registers | 53 | @@ store co-processor registers |
@@ -71,20 +59,25 @@ ENTRY(s3c2410_cpu_save) | |||
71 | 59 | ||
72 | stmia r0, { r4 - r13 } | 60 | stmia r0, { r4 - r13 } |
73 | 61 | ||
74 | mov r0, #0 | 62 | @@ write our state back to RAM |
75 | ldmfd sp, { r4 - r12, pc } | 63 | bl s3c_pm_cb_flushcache |
76 | 64 | ||
65 | @@ jump to final code to send system to sleep | ||
66 | ldr r0, =pm_cpu_sleep | ||
67 | @@ldr pc, [ r0 ] | ||
68 | ldr r0, [ r0 ] | ||
69 | mov pc, r0 | ||
70 | |||
77 | @@ return to the caller, after having the MMU | 71 | @@ return to the caller, after having the MMU |
78 | @@ turned on, this restores the last bits from the | 72 | @@ turned on, this restores the last bits from the |
79 | @@ stack | 73 | @@ stack |
80 | resume_with_mmu: | 74 | resume_with_mmu: |
81 | mov r0, #1 | ||
82 | ldmfd sp!, { r4 - r12, pc } | 75 | ldmfd sp!, { r4 - r12, pc } |
83 | 76 | ||
84 | .ltorg | 77 | .ltorg |
85 | 78 | ||
86 | @@ the next bits sit in the .data segment, even though they | 79 | @@ the next bits sit in the .data segment, even though they |
87 | @@ happen to be code... the s3c2410_sleep_save_phys needs to be | 80 | @@ happen to be code... the s3c_sleep_save_phys needs to be |
88 | @@ accessed by the resume code before it can restore the MMU. | 81 | @@ accessed by the resume code before it can restore the MMU. |
89 | @@ This means that the variable has to be close enough for the | 82 | @@ This means that the variable has to be close enough for the |
90 | @@ code to read it... since the .text segment needs to be RO, | 83 | @@ code to read it... since the .text segment needs to be RO, |
@@ -92,19 +85,19 @@ resume_with_mmu: | |||
92 | 85 | ||
93 | .data | 86 | .data |
94 | 87 | ||
95 | .global s3c2410_sleep_save_phys | 88 | .global s3c_sleep_save_phys |
96 | s3c2410_sleep_save_phys: | 89 | s3c_sleep_save_phys: |
97 | .word 0 | 90 | .word 0 |
98 | 91 | ||
99 | 92 | ||
100 | /* sleep magic, to allow the bootloader to check for an valid | 93 | /* sleep magic, to allow the bootloader to check for an valid |
101 | * image to resume to. Must be the first word before the | 94 | * image to resume to. Must be the first word before the |
102 | * s3c2410_cpu_resume entry. | 95 | * s3c_cpu_resume entry. |
103 | */ | 96 | */ |
104 | 97 | ||
105 | .word 0x2bedf00d | 98 | .word 0x2bedf00d |
106 | 99 | ||
107 | /* s3c2410_cpu_resume | 100 | /* s3c_cpu_resume |
108 | * | 101 | * |
109 | * resume code entry for bootloader to call | 102 | * resume code entry for bootloader to call |
110 | * | 103 | * |
@@ -113,7 +106,7 @@ s3c2410_sleep_save_phys: | |||
113 | * must not write to the code segment (code is read-only) | 106 | * must not write to the code segment (code is read-only) |
114 | */ | 107 | */ |
115 | 108 | ||
116 | ENTRY(s3c2410_cpu_resume) | 109 | ENTRY(s3c_cpu_resume) |
117 | mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE | 110 | mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE |
118 | msr cpsr_c, r0 | 111 | msr cpsr_c, r0 |
119 | 112 | ||
@@ -145,7 +138,7 @@ ENTRY(s3c2410_cpu_resume) | |||
145 | mcr p15, 0, r1, c8, c7, 0 @@ invalidate I & D TLBs | 138 | mcr p15, 0, r1, c8, c7, 0 @@ invalidate I & D TLBs |
146 | mcr p15, 0, r1, c7, c7, 0 @@ invalidate I & D caches | 139 | mcr p15, 0, r1, c7, c7, 0 @@ invalidate I & D caches |
147 | 140 | ||
148 | ldr r0, s3c2410_sleep_save_phys @ address of restore block | 141 | ldr r0, s3c_sleep_save_phys @ address of restore block |
149 | ldmia r0, { r4 - r13 } | 142 | ldmia r0, { r4 - r13 } |
150 | 143 | ||
151 | mcr p15, 0, r4, c13, c0, 0 @ PID | 144 | mcr p15, 0, r4, c13, c0, 0 @ PID |