From d177f4e51d81f29699f6041909c26ae43a27bd76 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 25 Jul 2011 14:55:25 -0700 Subject: ARM: tegra: power: Split CPU context save and coherency exit Separate the CPU context save and CPU coherency exit into separate functions. Change-Id: I7c5376677e293342b02b5bebdef6be2610522936 Signed-off-by: Scott Williams Signed-off-by: Dan Willemsen Rebase-Id: R17eb40d551e797448410cf6220dfba122faa702d --- arch/arm/mach-tegra/sleep-t2.S | 4 ++-- arch/arm/mach-tegra/sleep-t3.S | 19 ++++--------------- arch/arm/mach-tegra/sleep.S | 32 +++++++++++++++++++++----------- 3 files changed, 27 insertions(+), 28 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-tegra/sleep-t2.S b/arch/arm/mach-tegra/sleep-t2.S index 9daf61a76ea4..071932713871 100644 --- a/arch/arm/mach-tegra/sleep-t2.S +++ b/arch/arm/mach-tegra/sleep-t2.S @@ -183,7 +183,7 @@ ENDPROC(tegra2_cpu_is_resettable_soon) ENTRY(tegra2_sleep_core) mov r3, lr @ set resume address to lr bl tegra_cpu_save - + bl tegra_cpu_exit_coherency mov32 r1, tegra2_tear_down_core mov32 r2, tegra2_iram_start sub r1, r1, r2 @@ -199,7 +199,7 @@ ENTRY(tegra2_sleep_wfi) mov r3, lr @ set resume address to lr mrc p15, 0, r2, c1, c0, 1 @ save actlr before exiting coherency bl tegra_cpu_save - + bl tegra_cpu_exit_coherency mov r11, r2 mov32 r3, TEGRA_PMC_VIRT diff --git a/arch/arm/mach-tegra/sleep-t3.S b/arch/arm/mach-tegra/sleep-t3.S index b234ab3a671f..9a089a605378 100644 --- a/arch/arm/mach-tegra/sleep-t3.S +++ b/arch/arm/mach-tegra/sleep-t3.S @@ -49,25 +49,13 @@ * Should never return. */ ENTRY(tegra3_hotplug_shutdown) - cpu_id r0 - - /* Exit coherency. */ - mrc p15, 0, r3, c1, c0, 1 @ ACTLR - bic r3, r3, #(1<<6) @ exit coherency SCTLR.SMP - mcr p15, 0, r3, c1, c0, 1 @ ACTLR - isb - - /* Invalidate the SCU tags for this CPU. */ - mov32 r3, TEGRA_ARM_PERIF_VIRT + 0xC @ SCUIAR - mov r2, r0, lsl #2 - mov r1, #0xf - mov r1, r1, lsl r2 @ 0xF << (cpu * 4) - str r1, [r3] @ invalidate SCU tags for CPU + mov r6, lr + bl tegra_cpu_exit_coherency /* Powergate this CPU. */ mov r0, #TEGRA_POWER_HOTPLUG_SHUTDOWN bl tegra3_cpu_reset - mov pc, lr @ should never get here + mov pc, r6 @ should never get here ENDPROC(tegra3_hotplug_shutdown) #endif @@ -140,6 +128,7 @@ ENDPROC(tegra3_cpu_reset) ENTRY(tegra3_sleep_cpu) mov r3, lr @ set resume address to lr bl tegra_cpu_save + bl tegra_cpu_exit_coherency mov32 r1, tegra3_tear_down_cpu add r1, r1, r0 diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S index 0c15989a4cd8..77ea6b3ba363 100644 --- a/arch/arm/mach-tegra/sleep.S +++ b/arch/arm/mach-tegra/sleep.S @@ -132,6 +132,26 @@ ENTRY(tegra_cpu_wfi) ENDPROC(tegra_cpu_wfi) #ifdef CONFIG_PM_SLEEP +/* + * tegra_cpu_exit_coherency + * + * Exits SMP coherency. + * corrupts r4-r5 + */ +ENTRY(tegra_cpu_exit_coherency) + mrc p15, 0, r4, c1, c0, 1 @ ACTLR + bic r4, r4, #(1<<6) @ exit coherency: clear ACTLR.SMP + mcr p15, 0, r4, c1, c0, 1 @ ACTLR + isb + cpu_id r4 + mov r4, r4, lsl #2 + mov r5, #0xf + mov r5, r5, lsl r4 + mov32 r4, TEGRA_ARM_PERIF_VIRT + 0xC + str r5, [r4] @ invalidate SCU tags for CPU + mov pc, lr +ENDPROC(tegra_cpu_exit_coherency) + /* * tegra_cpu_save * @@ -161,17 +181,6 @@ ENTRY(tegra_cpu_save) mov r0, r5 mov r2, r6 mov sp, r7 - - mov r4, #0 - mcr p15, 0, r4, c1, c0, 1 @ exit coherency - isb - cpu_id r4 - mov32 r5, TEGRA_ARM_PERIF_VIRT + 0xC - mov r4, r4, lsl #2 - mov r6, #0xf - mov r6, r6, lsl r4 - str r6, [r5] @ invalidate SCU tags for CPU - mov pc, lr ENDPROC(tegra_cpu_save) @@ -184,6 +193,7 @@ ENDPROC(tegra_cpu_save) ENTRY(tegra_sleep_cpu) mov r3, lr @ set resume address to lr bl tegra_cpu_save + bl tegra_cpu_exit_coherency #ifdef CONFIG_ARCH_TEGRA_2x_SOC mov32 r1, tegra2_tear_down_cpu -- cgit v1.2.3