ARM: shmobile: r8a7790 Core Standby CPUIdle prototype
Magnus Damm
maintainerPATCH 5/6 ARM: shmobile: r8a7790 Core Standby CPUIdle prototype
From: Magnus Damm <[email protected]>
Prototype code to enable per-cpu power domain control via the r8a7790 Core Standby sleep mode. Needs more work.
Not-Yet-Signed-off-by Magnus Damm <[email protected]>
---
arch/arm/mach-shmobile/include/mach/common.h | 2 arch/arm/mach-shmobile/platsmp-apmu.c | 38 ++++++++++++++++-- arch/arm/mach-shmobile/pm-r8a7790.c | 53 +++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +2 -0
@@ -24,6 +24,8 @@ extern int shmobile_smp_scu_cpu_kill(unsextern void shmobile_smp_apmu_prepare_cpus (unsigned int max_cpus);extern int shmobile_smp_apmu_boot_secondary (unsigned int cpu,struct task_struct *idle); +extern void shmobile_smp_apmu_cpu_shutdown (unsigned int cpu); +extern void shmobile_smp_apmu_cpu_resume (void );extern void shmobile_smp_apmu_cpu_die (unsigned int cpu);extern int shmobile_smp_apmu_cpu_kill (unsigned int cpu);struct clk ;
arch/arm/mach-shmobile/platsmp-apmu.c +33 -5
@@ -143,7 +143,7 @@ int shmobile_smp_apmu_boot_secondary(uns }#endif -#ifdef CONFIG_HOTPLUG_CPU +#if defined(CONFIG_HOTPLUG_CPU ) || defined(CONFIG_CPU_IDLE )/* nicked from arch/arm/mach-exynos/hotplug.c */ static inline void cpu_enter_lowpower_a15 (void ) {
@@ -174,16 +174,44 @@ static inline void cpu_enter_lowpower_a1dsb (); } -void shmobile_smp_apmu_cpu_die (unsigned int cpu) +void shmobile_smp_apmu_cpu_shutdown (unsigned int cpu) { -/* For this particular CPU deregister boot vector */ -shmobile_smp_hook (cpu,0 ,0 ); -/* Select next sleep mode using the APMU */ apmu_wrap (cpu, apmu_power_off);/* Do ARM specific CPU shutdown */ cpu_enter_lowpower_a15 (); +} + +static inline void cpu_leave_lowpower (void ) +{ +unsigned int v; + + asmvolatile ("mrc p15, 0, %0, c1, c0, 0\n" +" orr %0, %0, %1\n" +" mcr p15, 0, %0, c1, c0, 0\n" +" mrc p15, 0, %0, c1, c0, 1\n" +" orr %0, %0, %2\n" +" mcr p15, 0, %0, c1, c0, 1\n" + :"=&r" (v) + :"Ir" (CR_C ),"Ir" (0x40 ) + :"cc" ); +} + +void shmobile_smp_apmu_cpu_resume (void ) +{ +cpu_leave_lowpower (); +} +#endif + +#if defined(CONFIG_HOTPLUG_CPU ) +void shmobile_smp_apmu_cpu_die (unsigned int cpu) +{ +/* For this particular CPU deregister boot vector */ +shmobile_smp_hook (cpu,0 ,0 ); + +/* Shutdown CPU core */ +shmobile_smp_apmu_cpu_shutdown (cpu);/* jump to shared mach-shmobile sleep / reset code */ shmobile_smp_sleep ();
arch/arm/mach-shmobile/pm-r8a7790.c +52 -1
73 lines not on this page · raw message