ARM: mach-shmobile: sh7372 Core Standby Suspend-to-RAM
Magnus Damm
maintainerPATCH 1/1 ARM: mach-shmobile: sh7372 Core Standby Suspend-to-RAM
From: Magnus Damm <[email protected]>
Add sh7372 Core Standby sleep mode support and tie it in with the shared SH-Mobile ARM suspend code.
The Core Standby mode is the lightest sh7372-specific sleep mode, cutting power to the ARM core excluding the L2 cache. Any interrupt source can be used for wakeups.
The low level portion of this code is based on the TI OMAP sleep code in sleep34xx.S, thanks to them.
---
arch/arm/mach-shmobile/Makefile | 1 arch/arm/mach-shmobile/board-ap4evb.c | 1 arch/arm/mach-shmobile/board-mackerel.c | 1 arch/arm/mach-shmobile/include/mach/common.h | 3 arch/arm/mach-shmobile/pm-sh7372.c | 79 +++++++ arch/arm/mach-shmobile/sleep-sh7372.S | 260 ++++++++++++++++++++++++++ 6 files changed, 345 insertions(+)
arch/arm/mach-shmobile/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o # PM objects obj-$(CONFIG_SUSPEND) += suspend.o +obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o # Board objects obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o
arch/arm/mach-shmobile/board-ap4evb.c +1 -0
@@ -1343,6 +1343,7 @@ static void __init ap4evb_init(void)hdmi_init_pm_clock ();fsi_init_pm_clock (); +sh7372_pm_init (); }static void __init ap4evb_timer_init (void )
arch/arm/mach-shmobile/board-mackerel.c +1 -0
@@ -1216,6 +1216,7 @@ static void __init mackerel_init(void)platform_add_devices (mackerel_devices,ARRAY_SIZE (mackerel_devices));hdmi_init_pm_clock (); +sh7372_pm_init (); }static void __init mackerel_timer_init (void )
arch/arm/mach-shmobile/include/mach/common.h +3 -0
@@ -31,6 +31,9 @@ extern void sh7372_add_early_devices(voiextern void sh7372_add_standard_devices (void );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 struct clk sh7372_extal1_clk;extern struct clk sh7372_extal2_clk;
arch/arm/mach-shmobile/pm-sh7372.c new file +79 -0
79 lines not on this page · raw message
arch/arm/mach-shmobile/sleep-sh7372.S new file +254 -0
254 lines not on this page · raw message
Magnus Damm
maintainerPATCH 1/1 ARM: mach-shmobile: sh7372 Core Standby CPUIdle
From: Magnus Damm <[email protected]>
This patch ties in the previously added sh7372 sleep mode known as Core Standby together with the shared SH-Mobile ARM CPUIdle implementation.
---
arch/arm/mach-shmobile/pm-sh7372.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/pm-sh7372.c +31 -2
@@ -10,6 +10,7 @@#include <linux/pm.h> #include <linux/suspend.h> +#include <linux/cpuidle.h> #include <linux/module.h> #include <linux/list.h> #include <linux/err.h>
@@ -24,8 +25,7 @@#define SBAR 0xe6180020#define APARMBAREA 0xe6f10020 -#ifdef CONFIG_SUSPEND -static void sh7372_enter_core_standby (void ) +void sh7372_enter_core_standby (void ) {void __iomem *smfram = (void __iomem *)SMFRAM ;
@@ -51,6 +51,34 @@ static void sh7372_enter_core_standby(vo__raw_writel (0 ,SBAR );/* disable reset vector translation */ } +#ifdef CONFIG_CPU_IDLE +static void sh7372_cpuidle_setup (struct cpuidle_device *dev) +{ +struct cpuidle_state *state; +int i = dev->state_count; + + state = &dev->states[i]; +snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); +strncpy (state->desc,"Core Standby Mode" ,CPUIDLE_DESC_LEN ); + state->exit_latency =10 ; + state->target_residency =20 +10 ; + state->power_usage =1 ;/* perhaps not */ + state->flags =0 ; + state->flags |=CPUIDLE_FLAG_TIME_VALID ; + shmobile_cpuidle_modes[i] = sh7372_enter_core_standby; + + dev->state_count = i +1 ; +} + +static void sh7372_cpuidle_init (void ) +{ + shmobile_cpuidle_setup = sh7372_cpuidle_setup; +} +#else +static void sh7372_cpuidle_init (void ) {} +#endif + +#ifdef CONFIG_SUSPEND static int sh7372_enter_suspend (suspend_state_t suspend_state) {sh7372_enter_core_standby ();
@@ -76,4 +104,5 @@ void __init sh7372_pm_init(void)__raw_writel (0x00000000 ,DBGREG1 );sh7372_suspend_init (); +sh7372_cpuidle_init (); }