diff options
author | Rob Herring <rob.herring@calxeda.com> | 2013-02-26 16:05:46 -0600 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-10-01 16:30:56 -0500 |
commit | a410146c3ea5cf82a52f00814c0a4142ea9768ba (patch) | |
tree | bf7fdb253aa478f472fba2b43489e8fbb40209e9 | |
parent | 60a66e370007e8535b7a561353b07b37deaf35ba (diff) | |
download | linux-a410146c3ea5cf82a52f00814c0a4142ea9768ba.tar.bz2 |
cpuidle: calxeda: add support to use PSCI calls
This updates the Calxeda cpuidle driver to use PSCI calls to powergate
cores. This also enables cpuidle for the ECX-2000.
This could possibly become a generic PSCI driver, but there are no other
PSCI users in the kernel other than mach-virt.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org
-rw-r--r-- | arch/arm/mach-highbank/highbank.c | 2 | ||||
-rw-r--r-- | drivers/cpuidle/Kconfig.arm | 2 | ||||
-rw-r--r-- | drivers/cpuidle/cpuidle-calxeda.c | 39 |
3 files changed, 8 insertions, 35 deletions
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index a78ed62d6542..53d05bc904f9 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -168,7 +168,7 @@ static void __init highbank_init(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - if (of_machine_is_compatible("calxeda,highbank")) + if (psci_ops.cpu_suspend) platform_device_register(&highbank_cpuidle_device); } diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 8e3660322308..d6f57d5d9631 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -4,7 +4,7 @@ config ARM_HIGHBANK_CPUIDLE bool "CPU Idle Driver for Calxeda processors" - depends on ARCH_HIGHBANK + depends on ARM_PSCI select ARM_CPU_SUSPEND help Select this to enable cpuidle on Calxeda processors. diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c index 6d49527d4a0c..36795639df0d 100644 --- a/drivers/cpuidle/cpuidle-calxeda.c +++ b/drivers/cpuidle/cpuidle-calxeda.c @@ -23,44 +23,18 @@ #include <linux/cpuidle.h> #include <linux/cpu_pm.h> #include <linux/init.h> -#include <linux/io.h> -#include <linux/time.h> -#include <linux/delay.h> -#include <linux/suspend.h> +#include <linux/mm.h> #include <linux/platform_device.h> #include <asm/cpuidle.h> -#include <asm/proc-fns.h> -#include <asm/smp_scu.h> #include <asm/suspend.h> -#include <asm/cacheflush.h> -#include <asm/cp15.h> - -extern void highbank_set_cpu_jump(int cpu, void *jump_addr); -extern void __iomem *scu_base_addr; - -static noinline void calxeda_idle_restore(void) -{ - set_cr(get_cr() | CR_C); - set_auxcr(get_auxcr() | 0x40); - scu_power_mode(scu_base_addr, SCU_PM_NORMAL); -} +#include <asm/psci.h> static int calxeda_idle_finish(unsigned long val) { - /* Already flushed cache, but do it again as the outer cache functions - * dirty the cache with spinlocks */ - flush_cache_all(); - - set_auxcr(get_auxcr() & ~0x40); - set_cr(get_cr() & ~CR_C); - - scu_power_mode(scu_base_addr, SCU_PM_DORMANT); - - cpu_do_idle(); - - /* Restore things if we didn't enter power-gating */ - calxeda_idle_restore(); - return 1; + const struct psci_power_state ps = { + .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, + }; + return psci_ops.cpu_suspend(ps, __pa(cpu_resume)); } static int calxeda_pwrdown_idle(struct cpuidle_device *dev, @@ -68,7 +42,6 @@ static int calxeda_pwrdown_idle(struct cpuidle_device *dev, int index) { cpu_pm_enter(); - highbank_set_cpu_jump(smp_processor_id(), cpu_resume); cpu_suspend(0, calxeda_idle_finish); cpu_pm_exit(); |