From: Rob Herring <robherring2@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Rob Herring <rob.herring@calxeda.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-pm@vger.kernel.org
Subject: [PATCH 4/7] cpuidle: calxeda: add support to use PSCI calls
Date: Sun, 28 Jul 2013 16:56:35 -0500 [thread overview]
Message-ID: <1375048598-15637-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1375048598-15637-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
This updates the Calxeda cpuidle driver to use PSCI calls to powergate
cores. This is needed to enable 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>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org
---
drivers/cpuidle/cpuidle-calxeda.c | 40 ++++++---------------------------------
1 file changed, 6 insertions(+), 34 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index 0e6e408..01cfecf3 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -22,51 +22,23 @@
#include <linux/cpuidle.h>
#include <linux/init.h>
-#include <linux/io.h>
#include <linux/of.h>
-#include <linux/time.h>
-#include <linux/delay.h>
-#include <linux/suspend.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 *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,
struct cpuidle_driver *drv,
int index)
{
- highbank_set_cpu_jump(smp_processor_id(), cpu_resume);
cpu_suspend(0, calxeda_idle_finish);
return index;
}
@@ -90,7 +62,7 @@ static struct cpuidle_driver calxeda_idle_driver = {
static int __init calxeda_cpuidle_init(void)
{
- if (!of_machine_is_compatible("calxeda,highbank"))
+ if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend)
return -ENODEV;
return cpuidle_register(&calxeda_idle_driver, NULL);
--
1.8.1.2
WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] cpuidle: calxeda: add support to use PSCI calls
Date: Sun, 28 Jul 2013 16:56:35 -0500 [thread overview]
Message-ID: <1375048598-15637-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1375048598-15637-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
This updates the Calxeda cpuidle driver to use PSCI calls to powergate
cores. This is needed to enable 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>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm at vger.kernel.org
---
drivers/cpuidle/cpuidle-calxeda.c | 40 ++++++---------------------------------
1 file changed, 6 insertions(+), 34 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index 0e6e408..01cfecf3 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -22,51 +22,23 @@
#include <linux/cpuidle.h>
#include <linux/init.h>
-#include <linux/io.h>
#include <linux/of.h>
-#include <linux/time.h>
-#include <linux/delay.h>
-#include <linux/suspend.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 *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,
struct cpuidle_driver *drv,
int index)
{
- highbank_set_cpu_jump(smp_processor_id(), cpu_resume);
cpu_suspend(0, calxeda_idle_finish);
return index;
}
@@ -90,7 +62,7 @@ static struct cpuidle_driver calxeda_idle_driver = {
static int __init calxeda_cpuidle_init(void)
{
- if (!of_machine_is_compatible("calxeda,highbank"))
+ if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend)
return -ENODEV;
return cpuidle_register(&calxeda_idle_driver, NULL);
--
1.8.1.2
next prev parent reply other threads:[~2013-07-28 21:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-28 21:56 [PATCH v3 0/7] PSCI support for highbank Rob Herring
2013-07-28 21:56 ` [PATCH 1/7] dt: update PSCI binding documentation for v0.2 Rob Herring
2013-07-29 10:13 ` Mark Rutland
2013-07-29 20:18 ` Rob Herring
2013-07-30 9:49 ` Mark Rutland
2013-07-30 12:42 ` Rob Herring
2013-07-30 12:56 ` Mark Rutland
2013-07-30 13:44 ` Mark Rutland
2013-07-30 14:33 ` Stefano Stabellini
2013-07-30 14:42 ` Ian Campbell
2013-07-30 17:48 ` Matt Sealey
2013-07-31 8:55 ` Ian Campbell
2013-07-31 13:49 ` Mark Rutland
2013-07-31 17:24 ` Matt Sealey
2013-07-31 17:49 ` Rob Herring
2013-08-01 17:51 ` Dave Martin
2013-08-01 19:02 ` Rob Herring
2013-08-01 21:04 ` Matt Sealey
2013-07-31 13:07 ` Mark Rutland
2013-07-30 19:34 ` Rob Herring
2013-07-31 8:57 ` Ian Campbell
2013-07-31 13:05 ` Mark Rutland
2013-07-30 10:01 ` Dave Martin
2013-07-28 21:56 ` [PATCH 2/7] ARM: PSCI: remove unnecessary include of arm-gic.h Rob Herring
2013-07-28 21:56 ` [PATCH 3/7] ARM: PSCI: add ops for system restart and power off Rob Herring
2013-07-28 21:56 ` Rob Herring [this message]
2013-07-28 21:56 ` [PATCH 4/7] cpuidle: calxeda: add support to use PSCI calls Rob Herring
2013-07-29 14:14 ` Daniel Lezcano
2013-07-29 14:14 ` Daniel Lezcano
2013-07-29 14:39 ` Rob Herring
2013-07-29 14:39 ` Rob Herring
2013-07-29 14:46 ` Daniel Lezcano
2013-07-29 14:46 ` Daniel Lezcano
2013-07-28 21:56 ` [PATCH 5/7] ARM: highbank: clean-up some unused includes Rob Herring
2013-07-28 21:56 ` [PATCH 6/7] ARM: highbank: adapt to use ARM PSCI calls Rob Herring
2013-07-28 21:56 ` [PATCH 7/7] dts: calxeda: add ARM PSCI binding Rob Herring
2013-07-29 10:24 ` Mark Rutland
2013-07-29 13:13 ` Rob Herring
2013-07-29 14:30 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375048598-15637-5-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=rob.herring@calxeda.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.