From eebc91326681f02111bd463ef40d8f9286ee24bf Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Wed, 3 Aug 2011 19:07:51 -0700 Subject: ARM: tegra: power: Consolidate CPU context save and SMP exit Every call to tegra_cpu_save is always followed by a call to tegra_cpu_exit_coherency. Simplify the callers of tegra_cpu_save by folding the CPU context save functionality of cpu_suspend and the coherency exit functionality into a single function called tegra_cpu_suspend. Change-Id: Ia71a663b2971685712d5b8a2b7e8b44fe1526f40 Signed-off-by: Scott Williams Rebase-Id: R36c0c5f44608d0c099d928e19e36af2e7ba061d8 --- arch/arm/mach-tegra/hotplug.c | 5 +---- arch/arm/mach-tegra/sleep-t2.S | 2 -- arch/arm/mach-tegra/sleep-t3.S | 1 - arch/arm/mach-tegra/sleep.S | 25 ++++++++++++++++++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index 36fcf591bfe7..6fb618e7841b 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -73,10 +73,7 @@ void platform_cpu_die(unsigned int cpu) tegra3_hotplug_shutdown(); #endif - /* - * tegra_cpu_suspend can return through tegra_cpu_resume, but that - * should never happen for a hotplugged cpu - */ + /* Should never return here. */ BUG(); } diff --git a/arch/arm/mach-tegra/sleep-t2.S b/arch/arm/mach-tegra/sleep-t2.S index 6b6de9b8d91e..a0547084dd27 100644 --- a/arch/arm/mach-tegra/sleep-t2.S +++ b/arch/arm/mach-tegra/sleep-t2.S @@ -172,7 +172,6 @@ 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 @@ -188,7 +187,6 @@ 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 4b84a15fba5a..482005b84020 100644 --- a/arch/arm/mach-tegra/sleep-t3.S +++ b/arch/arm/mach-tegra/sleep-t3.S @@ -127,7 +127,6 @@ ENDPROC(tegra3_cpu_reset) ENTRY(tegra3_sleep_cpu_secondary) mov r3, lr @ set resume address to lr bl tegra_cpu_save - bl tegra_cpu_exit_coherency /* Powergate this CPU. */ mov r0, #0 @ power mode flags (!hotplug) diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S index 9b436c9512a2..b25f01ce5a47 100644 --- a/arch/arm/mach-tegra/sleep.S +++ b/arch/arm/mach-tegra/sleep.S @@ -142,6 +142,26 @@ ENTRY(tegra_cpu_exit_coherency) mov pc, lr ENDPROC(tegra_cpu_exit_coherency) +/* + * tegra_cpu_suspend + * + * Save CPU suspend state + * + * Input: + * r1 = v:p offset + * r3 = virtual return function + * Output: + * sp is decremented to allocate space for CPU state on stack + * r0-r3,r8-r10,lr corrupted + */ + +ENTRY(tegra_cpu_suspend) + mov r8, lr + bl cpu_suspend + exit_smp r0, r2 + mov pc, r8 +ENDPROC(tegra_cpu_suspend) + /* * tegra_cpu_save * @@ -151,7 +171,7 @@ ENDPROC(tegra_cpu_exit_coherency) * Output: * r0 = v:p offset * r7 = SP after saving the registers but before cpu_suspend, suitable - * for restoring an aborted suspend that does not call cpu_resume + * for restoring an aborted suspend * sp = SP after cpu_suspend (the 'real' SP) * Saves r4-r11 on the stack * Corrupts r1, r3-r10 @@ -172,7 +192,7 @@ ENTRY(tegra_cpu_save) mov r5, r0 mov r6, r2 mov r1, r0 - bl cpu_suspend + bl tegra_cpu_suspend mov lr, r4 mov r0, r5 mov r2, r6 @@ -188,7 +208,6 @@ 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