ARM: mach-shmobile: sh7372 generic suspend/resume support
Magnus Damm
maintainerPATCH 1/3 ARM: mach-shmobile: sh7372 generic suspend/resume support
From: Magnus Damm <[email protected]>
Convert the sh7372 Core Standby code to make use
of the new generic ARM cpu suspend/resume code.
Signed-off-by Magnus Damm <[email protected]>
---
arch/arm/mach-shmobile/include/mach/common.h | 3 arch/arm/mach-shmobile/pm-sh7372.c | 38 +--- arch/arm/mach-shmobile/sleep-sh7372.S | 230 -------------------------- 3 files changed, 24 insertions(+), 247 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +1 -2
@@ -35,8 +35,7 @@ extern void sh7372_add_standard_devices(extern void sh7372_clock_init (void );extern void sh7372_pinmux_init (void );extern void sh7372_pm_init (void ); -extern void sh7372_cpu_suspend (void ); -extern void sh7372_cpu_resume (void ); +extern void sh7372_resume_core_standby (void );extern struct clk sh7372_extal1_clk;extern struct clk sh7372_extal2_clk;
arch/arm/mach-shmobile/pm-sh7372.c +17 -21
@@ -18,6 +18,7 @@#include <asm/system.h> #include <asm/io.h> #include <asm/tlbflush.h> +#include <asm/suspend.h> #include <mach/common.h> #define SMFRAM 0xe6a70000
@@ -25,30 +26,25 @@#define SBAR 0xe6180020#define APARMBAREA 0xe6f10020 -static void sh7372_enter_core_standby (void ) +static int sh7372_do_idle_core_standby (unsigned long unused) { -void __iomem *smfram = (void __iomem *)SMFRAM ; - -__raw_writel (0 ,APARMBAREA );/* translate 4k */ -__raw_writel (__pa (sh7372_cpu_resume),SBAR );/* set reset vector */ -__raw_writel (0x10 ,SYSTBCR );/* enable core standby */ - -__raw_writel (0 , smfram +0x3c );/* clear page table address */ - -sh7372_cpu_suspend (); -cpu_init (); - -/* if page table address is non-NULL then we have been powered down */ -if (__raw_readl (smfram +0x3c )) { -__raw_writel (__raw_readl (smfram +0x40 ), -__va (__raw_readl (smfram +0x3c ))); +cpu_do_idle ();/* WFI when SYSTBCR = 0x10 -> Core Standby */ +return 0 ; +} -flush_tlb_all (); -set_cr (__raw_readl (smfram +0x38 )); - } +static void sh7372_enter_core_standby (void ) +{ +/* set reset vector, translate 4k */ +__raw_writel (__pa (sh7372_resume_core_standby),SBAR ); +__raw_writel (0 ,APARMBAREA ); + +/* enter sleep mode with SYSTBCR to 0x10 */ +__raw_writel (0x10 ,SYSTBCR ); +cpu_suspend (0 , sh7372_do_idle_core_standby); +__raw_writel (0 ,SYSTBCR ); -__raw_writel (0 ,SYSTBCR );/* disable core standby */ -__raw_writel (0 ,SBAR );/* disable reset vector translation */ +/* disable reset vector translation */ +__raw_writel (0 ,SBAR ); }#ifdef CONFIG_CPU_IDLE
arch/arm/mach-shmobile/sleep-sh7372.S +6 -218
231 lines not on this page · raw message