aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-06-30 03:45:49 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-06-30 03:47:35 -0400
commitcbe263497def23befb6f475977661bae5d1f82e4 (patch)
tree61d94af049ab285f0067c4a8e8a92c5763f1bd6f /arch/arm
parent46e130d298a384b677426e19faec311749ff2677 (diff)
ARM: pm: omap3: move saving of the auxiliary control registers to C
Move the saving of the auxiliary control registers into C; there's no need for this to be in assembly code. This results in less assembly code to deal with in OMAP. Kevin tested full-chip retention and off on 3430/n900, 3530/Overo and 3630/Zoom3. Tested-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/pm.h2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c19
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S12
3 files changed, 21 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index a4ec213e30c0..04ee56646126 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -97,7 +97,7 @@ extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
97extern unsigned int omap24xx_cpu_suspend_sz; 97extern unsigned int omap24xx_cpu_suspend_sz;
98 98
99/* 3xxx */ 99/* 3xxx */
100extern void omap34xx_cpu_suspend(u32 *addr, int save_state); 100extern void omap34xx_cpu_suspend(int save_state);
101 101
102/* omap3_do_wfi function pointer and size, for copy to SRAM */ 102/* omap3_do_wfi function pointer and size, for copy to SRAM */
103extern void omap3_do_wfi(void); 103extern void omap3_do_wfi(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index e1c79bae7670..7238a63e24e2 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -306,9 +306,24 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
306 return IRQ_HANDLED; 306 return IRQ_HANDLED;
307} 307}
308 308
309static void omap34xx_save_context(u32 *save)
310{
311 u32 val;
312
313 /* Read Auxiliary Control Register */
314 asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (val));
315 *save++ = 1;
316 *save++ = val;
317
318 /* Read L2 AUX ctrl register */
319 asm("mrc p15, 1, %0, c9, c0, 2" : "=r" (val));
320 *save++ = 1;
321 *save++ = val;
322}
323
309static void omap34xx_do_sram_idle(unsigned long save_state) 324static void omap34xx_do_sram_idle(unsigned long save_state)
310{ 325{
311 omap34xx_cpu_suspend(omap3_arm_context, save_state); 326 omap34xx_cpu_suspend(save_state);
312} 327}
313 328
314void omap_sram_idle(void) 329void omap_sram_idle(void)
@@ -408,6 +423,8 @@ void omap_sram_idle(void)
408 * get saved. The rest is placed on the stack, and restored 423 * get saved. The rest is placed on the stack, and restored
409 * from there before resuming. 424 * from there before resuming.
410 */ 425 */
426 if (save_state)
427 omap34xx_save_context(omap3_arm_context);
411 if (save_state == 1 || save_state == 3) 428 if (save_state == 1 || save_state == 3)
412 cpu_suspend(save_state, omap34xx_do_sram_idle); 429 cpu_suspend(save_state, omap34xx_do_sram_idle);
413 else 430 else
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 17dbc5af6915..f2ea1bd1c691 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -152,8 +152,7 @@ ENTRY(omap34xx_cpu_suspend)
152 stmfd sp!, {r4 - r11, lr} @ save registers on stack 152 stmfd sp!, {r4 - r11, lr} @ save registers on stack
153 153
154 /* 154 /*
155 * r0 contains CPU context save/restore pointer in sdram 155 * r0 contains information about saving context:
156 * r1 contains information about saving context:
157 * 0 - No context lost 156 * 0 - No context lost
158 * 1 - Only L1 and logic lost 157 * 1 - Only L1 and logic lost
159 * 2 - Only L2 lost (Even L1 is retained we clean it along with L2) 158 * 2 - Only L2 lost (Even L1 is retained we clean it along with L2)
@@ -166,19 +165,12 @@ ENTRY(omap34xx_cpu_suspend)
166 */ 165 */
167 ldr r4, omap3_do_wfi_sram_addr 166 ldr r4, omap3_do_wfi_sram_addr
168 ldr r5, [r4] 167 ldr r5, [r4]
169 cmp r1, #0x0 @ If no context save required, 168 cmp r0, #0x0 @ If no context save required,
170 bxeq r5 @ jump to the WFI code in SRAM 169 bxeq r5 @ jump to the WFI code in SRAM
171 170
172 171
173 /* Otherwise fall through to the save context code */ 172 /* Otherwise fall through to the save context code */
174save_context_wfi: 173save_context_wfi:
175 mov r8, r0 @ Store SDRAM address in r8
176 mrc p15, 0, r5, c1, c0, 1 @ Read Auxiliary Control Register
177 mov r4, #0x1 @ Number of parameters for restore call
178 stmia r8!, {r4-r5} @ Push parameters for restore call
179 mrc p15, 1, r5, c9, c0, 2 @ Read L2 AUX ctrl register
180 stmia r8!, {r4-r5} @ Push parameters for restore call
181
182 /* 174 /*
183 * jump out to kernel flush routine 175 * jump out to kernel flush routine
184 * - reuse that code is better 176 * - reuse that code is better