linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls
       [not found] <1380248694-13388-1-git-send-email-robherring2@gmail.com>
@ 2013-09-27  2:24 ` Rob Herring
  2013-09-27  8:44   ` Daniel Lezcano
  2013-09-27  2:24 ` [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls Rob Herring
  2013-09-27  2:24 ` [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2013-09-27  2:24 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Rafael J. Wysocki, Daniel Lezcano, Rob Herring, linux-pm

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/Kconfig.arm       |  2 +-
 drivers/cpuidle/cpuidle-calxeda.c | 40 ++++++---------------------------------
 2 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index 8e36603..d6f57d5 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 3460584..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 __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,
 				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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls
       [not found] <1380248694-13388-1-git-send-email-robherring2@gmail.com>
  2013-09-27  2:24 ` [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls Rob Herring
@ 2013-09-27  2:24 ` Rob Herring
  2013-09-27  8:45   ` Daniel Lezcano
  2013-09-27  2:24 ` [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2013-09-27  2:24 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Rob Herring, Rafael J. Wysocki, Daniel Lezcano, linux-pm

From: Rob Herring <rob.herring@calxeda.com>

Wnen powergating the core, we need to call cpu pm notifiers to save VFP
state (!SMP only) and resetting the breakpoint h/w.

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 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index 01cfecf3..b04767a 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -21,6 +21,7 @@
  */
 
 #include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <asm/cpuidle.h>
@@ -39,7 +40,10 @@ static int calxeda_pwrdown_idle(struct cpuidle_device *dev,
 				struct cpuidle_driver *drv,
 				int index)
 {
+	cpu_pm_enter();
 	cpu_suspend(0, calxeda_idle_finish);
+	cpu_pm_exit();
+
 	return index;
 }
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support
       [not found] <1380248694-13388-1-git-send-email-robherring2@gmail.com>
  2013-09-27  2:24 ` [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls Rob Herring
  2013-09-27  2:24 ` [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls Rob Herring
@ 2013-09-27  2:24 ` Rob Herring
  2013-09-27  8:47   ` Daniel Lezcano
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2013-09-27  2:24 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Rob Herring, Rafael J. Wysocki, Daniel Lezcano, linux-pm

From: Rob Herring <rob.herring@calxeda.com>

Add cpuidle support for Calxeda ecx-2000 SoC.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index b04767a..c6e9d80 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -66,7 +66,9 @@ static struct cpuidle_driver calxeda_idle_driver = {
 
 static int __init calxeda_cpuidle_init(void)
 {
-	if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend)
+	if (!of_machine_is_compatible("calxeda,highbank") ||
+	    !of_machine_is_compatible("calxeda,ecx-2000") ||
+	    !psci_ops.cpu_suspend)
 		return -ENODEV;
 
 	return cpuidle_register(&calxeda_idle_driver, NULL);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls
  2013-09-27  2:24 ` [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls Rob Herring
@ 2013-09-27  8:44   ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2013-09-27  8:44 UTC (permalink / raw)
  To: Rob Herring, linux-kernel, linux-arm-kernel
  Cc: Rob Herring, Rafael J. Wysocki, linux-pm

On 09/27/2013 04:24 AM, Rob Herring wrote:
> 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

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls
  2013-09-27  2:24 ` [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls Rob Herring
@ 2013-09-27  8:45   ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2013-09-27  8:45 UTC (permalink / raw)
  To: Rob Herring, linux-kernel, linux-arm-kernel
  Cc: Rob Herring, Rafael J. Wysocki, linux-pm

On 09/27/2013 04:24 AM, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Wnen powergating the core, we need to call cpu pm notifiers to save VFP
> state (!SMP only) and resetting the breakpoint h/w.
>
> 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

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Shouldn't this patch be the first in the series ?

> ---
>   drivers/cpuidle/cpuidle-calxeda.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
> index 01cfecf3..b04767a 100644
> --- a/drivers/cpuidle/cpuidle-calxeda.c
> +++ b/drivers/cpuidle/cpuidle-calxeda.c
> @@ -21,6 +21,7 @@
>    */
>
>   #include <linux/cpuidle.h>
> +#include <linux/cpu_pm.h>
>   #include <linux/init.h>
>   #include <linux/of.h>
>   #include <asm/cpuidle.h>
> @@ -39,7 +40,10 @@ static int calxeda_pwrdown_idle(struct cpuidle_device *dev,
>   				struct cpuidle_driver *drv,
>   				int index)
>   {
> +	cpu_pm_enter();
>   	cpu_suspend(0, calxeda_idle_finish);
> +	cpu_pm_exit();
> +
>   	return index;
>   }
>
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support
  2013-09-27  2:24 ` [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support Rob Herring
@ 2013-09-27  8:47   ` Daniel Lezcano
  2013-09-27 12:14     ` Rob Herring
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2013-09-27  8:47 UTC (permalink / raw)
  To: Rob Herring, linux-kernel, linux-arm-kernel
  Cc: Rob Herring, Rafael J. Wysocki, linux-pm

On 09/27/2013 04:24 AM, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Add cpuidle support for Calxeda ecx-2000 SoC.
>
> 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

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Shall I pick these three patches in my tree ?

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support
  2013-09-27  8:47   ` Daniel Lezcano
@ 2013-09-27 12:14     ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2013-09-27 12:14 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Rob Herring,
	Rafael J. Wysocki, linux-pm@vger.kernel.org

On Fri, Sep 27, 2013 at 3:47 AM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> On 09/27/2013 04:24 AM, Rob Herring wrote:
>>
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Add cpuidle support for Calxeda ecx-2000 SoC.
>>
>> 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
>
>
> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Thanks.

> Shall I pick these three patches in my tree ?

No, the highbank changes are dependent on this to go in first.

Rob

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-27 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1380248694-13388-1-git-send-email-robherring2@gmail.com>
2013-09-27  2:24 ` [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls Rob Herring
2013-09-27  8:44   ` Daniel Lezcano
2013-09-27  2:24 ` [PATCH 2/6] cpuidle: calxeda: add cpu_pm_enter/exit calls Rob Herring
2013-09-27  8:45   ` Daniel Lezcano
2013-09-27  2:24 ` [PATCH 3/6] cpuidle: calxeda: add ecx-2000 support Rob Herring
2013-09-27  8:47   ` Daniel Lezcano
2013-09-27 12:14     ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).