All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Convert highbank to use PSCI calls
@ 2013-02-27  3:42 Rob Herring
  2013-02-27  3:42 ` [PATCH 1/4] ARM: highbank: clean-up some unused includes Rob Herring
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Rob Herring @ 2013-02-27  3:42 UTC (permalink / raw)
  To: linux-arm-kernel

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

This series converts highbank to use PSCI calls for secondary core boot,
hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
A15 differences (some of which are not yet in place).

Will, I'm using the id field to specify system level events which are
highbank specific. I worry that the id field will be abused for things
that could be standardized. Having standard PSCI calls for reset and
poweroff would avoid this for highbank.

Rob

Rob Herring (4):
  ARM: highbank: clean-up some unused includes
  dts: calxeda: add ARM PSCI binding
  cpuidle: calxeda: add support to use PSCI calls
  ARM: highbank: adapt to use ARM PSCI calls

 arch/arm/boot/dts/ecx-common.dtsi |    8 +++++
 arch/arm/mach-highbank/Kconfig    |    2 +-
 arch/arm/mach-highbank/Makefile   |    2 +-
 arch/arm/mach-highbank/core.h     |    3 --
 arch/arm/mach-highbank/highbank.c |   53 +++++------------------------
 arch/arm/mach-highbank/hotplug.c  |   12 +------
 arch/arm/mach-highbank/platsmp.c  |   42 ++++-------------------
 arch/arm/mach-highbank/pm.c       |   25 +++++---------
 arch/arm/mach-highbank/sysregs.h  |   67 ++++++-------------------------------
 arch/arm/mach-highbank/system.c   |   32 ------------------
 drivers/cpuidle/cpuidle-calxeda.c |   54 ++++--------------------------
 drivers/mailbox/pl320-ipc.c       |    2 +-
 12 files changed, 53 insertions(+), 249 deletions(-)
 delete mode 100644 arch/arm/mach-highbank/system.c

-- 
1.7.10.4

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

* [PATCH 1/4] ARM: highbank: clean-up some unused includes
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
@ 2013-02-27  3:42 ` Rob Herring
  2013-02-27  3:42 ` [PATCH 2/4] dts: calxeda: add ARM PSCI binding Rob Herring
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2013-02-27  3:42 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/mach-highbank/highbank.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index a4f9f50..3a5e62c 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -17,14 +17,11 @@
 #include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
-#include <linux/irq.h>
 #include <linux/irqchip.h>
-#include <linux/irqdomain.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
-#include <linux/smp.h>
 #include <linux/amba/bus.h>
 #include <linux/clk-provider.h>
 
@@ -38,7 +35,6 @@
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
-#include <asm/mach/time.h>
 
 #include "core.h"
 #include "sysregs.h"
-- 
1.7.10.4

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

* [PATCH 2/4] dts: calxeda: add ARM PSCI binding
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
  2013-02-27  3:42 ` [PATCH 1/4] ARM: highbank: clean-up some unused includes Rob Herring
@ 2013-02-27  3:42 ` Rob Herring
  2013-02-27  3:42 ` [PATCH 3/4] cpuidle: calxeda: add support to use PSCI calls Rob Herring
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2013-02-27  3:42 UTC (permalink / raw)
  To: linux-arm-kernel

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

Add the PSCI binding for Calxeda SOCs.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/ecx-common.dtsi |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ecx-common.dtsi b/arch/arm/boot/dts/ecx-common.dtsi
index d61b535..2c7b31e 100644
--- a/arch/arm/boot/dts/ecx-common.dtsi
+++ b/arch/arm/boot/dts/ecx-common.dtsi
@@ -19,6 +19,14 @@
 		bootargs = "console=ttyAMA0";
 	};
 
+	psci {
+		compatible	= "arm,psci";
+		method		= "smc";
+		cpu_suspend	= <0x95c10000>;
+		cpu_off		= <0x95c10001>;
+		cpu_on		= <0x95c10002>;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.7.10.4

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

* [PATCH 3/4] cpuidle: calxeda: add support to use PSCI calls
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
  2013-02-27  3:42 ` [PATCH 1/4] ARM: highbank: clean-up some unused includes Rob Herring
  2013-02-27  3:42 ` [PATCH 2/4] dts: calxeda: add ARM PSCI binding Rob Herring
@ 2013-02-27  3:42 ` Rob Herring
  2013-02-27  3:42 ` [PATCH 4/4] ARM: highbank: adapt to use ARM " Rob Herring
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2013-02-27  3:42 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/cpuidle/cpuidle-calxeda.c |   54 +++++--------------------------------
 1 file changed, 6 insertions(+), 48 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index e1aab38..eee8074 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -20,67 +20,25 @@
 
 #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;
+#include <asm/psci.h>
 
 static struct cpuidle_device __percpu *calxeda_idle_cpuidle_devices;
 
-static inline unsigned int get_auxcr(void)
-{
-	unsigned int val;
-	asm("mrc p15, 0, %0, c1, c0, 1	@ get AUXCR" : "=r" (val) : : "cc");
-	return val;
-}
-
-static inline void set_auxcr(unsigned int val)
-{
-	asm volatile("mcr p15, 0, %0, c1, c0, 1	@ set AUXCR"
-	  : : "r" (val) : "cc");
-	isb();
-}
-
-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);
-}
-
 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;
 }
@@ -123,7 +81,7 @@ static int __init calxeda_cpuidle_init(void)
 	struct cpuidle_device *dev;
 	struct cpuidle_driver *drv = &calxeda_idle_driver;
 
-	if (!of_machine_is_compatible("calxeda,highbank"))
+	if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend)
 		return -ENODEV;
 
 	ret = cpuidle_register_driver(drv);
-- 
1.7.10.4

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

* [PATCH 4/4] ARM: highbank: adapt to use ARM PSCI calls
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
                   ` (2 preceding siblings ...)
  2013-02-27  3:42 ` [PATCH 3/4] cpuidle: calxeda: add support to use PSCI calls Rob Herring
@ 2013-02-27  3:42 ` Rob Herring
  2013-02-27  8:58 ` [PATCH 0/4] Convert highbank to use " Arnd Bergmann
  2013-02-27 17:18 ` Will Deacon
  5 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2013-02-27  3:42 UTC (permalink / raw)
  To: linux-arm-kernel

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

This adapts highbank to use the ARM PSCI calls for cpu power control.
Secondary core boot, cpu hotplug, suspend/resume, reset and poweroff are
all converted to use PSCI calls. Doing this removes direct access to the
SCU and factors out the A9 vs. A15 differences.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/mach-highbank/Kconfig    |    2 +-
 arch/arm/mach-highbank/Makefile   |    2 +-
 arch/arm/mach-highbank/core.h     |    3 --
 arch/arm/mach-highbank/highbank.c |   49 +++++----------------------
 arch/arm/mach-highbank/hotplug.c  |   12 +------
 arch/arm/mach-highbank/platsmp.c  |   42 ++++-------------------
 arch/arm/mach-highbank/pm.c       |   25 +++++---------
 arch/arm/mach-highbank/sysregs.h  |   67 ++++++-------------------------------
 arch/arm/mach-highbank/system.c   |   32 ------------------
 drivers/mailbox/pl320-ipc.c       |    2 +-
 10 files changed, 39 insertions(+), 197 deletions(-)
 delete mode 100644 arch/arm/mach-highbank/system.c

diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 44b12f9..9dc0c9e 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -5,13 +5,13 @@ config ARCH_HIGHBANK
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select ARM_AMBA
 	select ARM_GIC
+	select ARM_PSCI
 	select ARM_TIMER_SP804
 	select CACHE_L2X0
 	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select CPU_V7
 	select GENERIC_CLOCKEVENTS
-	select HAVE_ARM_SCU
 	select HAVE_SMP
 	select MAILBOX
 	select PL320_MBOX
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index 8a1ef57..c1dde52 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -1,4 +1,4 @@
-obj-y					:= highbank.o system.o smc.o
+obj-y					:= highbank.o smc.o
 
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_smc.o				:=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index 3f65206..b8bcde7 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -1,9 +1,6 @@
 #ifndef __HIGHBANK_CORE_H
 #define __HIGHBANK_CORE_H
 
-extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
-extern void highbank_restart(char, const char *);
-extern void __iomem *scu_base_addr;
 
 #ifdef CONFIG_PM_SLEEP
 extern void highbank_pm_init(void);
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 3a5e62c..e8c9382 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -26,9 +26,6 @@
 #include <linux/clk-provider.h>
 
 #include <asm/arch_timer.h>
-#include <asm/cacheflush.h>
-#include <asm/cputype.h>
-#include <asm/smp_plat.h>
 #include <asm/smp_twd.h>
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/timer-sp.h>
@@ -40,50 +37,15 @@
 #include "sysregs.h"
 
 void __iomem *sregs_base;
-void __iomem *scu_base_addr;
-
-static void __init highbank_scu_map_io(void)
-{
-	unsigned long base;
-
-	/* Get SCU base */
-	asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
-
-	scu_base_addr = ioremap(base, SZ_4K);
-}
-
-#define HB_JUMP_TABLE_PHYS(cpu)		(0x40 + (0x10 * (cpu)))
-#define HB_JUMP_TABLE_VIRT(cpu)		phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))
-
-void highbank_set_cpu_jump(int cpu, void *jump_addr)
-{
-	cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
-	writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu));
-	__cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
-	outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
-			  HB_JUMP_TABLE_PHYS(cpu) + 15);
-}
-
-#ifdef CONFIG_CACHE_L2X0
-static void highbank_l2x0_disable(void)
-{
-	/* Disable PL310 L2 Cache controller */
-	highbank_smc1(0x102, 0x0);
-}
-#endif
 
 static void __init highbank_init_irq(void)
 {
 	irqchip_init();
 
-	if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
-		highbank_scu_map_io();
-
 #ifdef CONFIG_CACHE_L2X0
 	/* Enable PL310 L2 Cache controller */
 	highbank_smc1(0x102, 0x1);
 	l2x0_of_init(0, ~0UL);
-	outer_cache.disable = highbank_l2x0_disable;
 #endif
 }
 
@@ -123,10 +85,15 @@ static void __init highbank_timer_init(void)
 
 static void highbank_power_off(void)
 {
-	highbank_set_pwr_shutdown();
+	highbank_cpu_off(HB_PWR_SHUTDOWN, 1);
+}
 
-	while (1)
-		cpu_do_idle();
+static void highbank_restart(char mode, const char *cmd)
+{
+	if (mode == 'h')
+		highbank_cpu_off(HB_PWR_HARD_RESET, 1);
+	else
+		highbank_cpu_off(HB_PWR_SOFT_RESET, 1);
 }
 
 static int highbank_platform_notifier(struct notifier_block *nb,
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index f30c528..dc65b0f 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -15,25 +15,15 @@
  */
 #include <linux/kernel.h>
 
-#include <asm/cacheflush.h>
-
-#include "core.h"
 #include "sysregs.h"
 
-extern void secondary_startup(void);
-
 /*
  * platform-specific code to shutdown a CPU
  *
  */
 void __ref highbank_cpu_die(unsigned int cpu)
 {
-	flush_cache_all();
-
-	highbank_set_cpu_jump(cpu, phys_to_virt(0));
-	highbank_set_core_pwr();
-
-	cpu_do_idle();
+	highbank_cpu_off(0, 0);
 
 	/* We should never return from idle */
 	panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index 8797a70..33ae6ca 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -16,10 +16,10 @@
  */
 #include <linux/init.h>
 #include <linux/smp.h>
-#include <linux/io.h>
 #include <linux/irqchip/arm-gic.h>
-
-#include <asm/smp_scu.h>
+#include <asm/smp_plat.h>
+#include <asm/psci.h>
+#include <asm/page.h>
 
 #include "core.h"
 
@@ -32,41 +32,13 @@ static void __cpuinit highbank_secondary_init(unsigned int cpu)
 
 static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
-	highbank_set_cpu_jump(cpu, secondary_startup);
-	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
-	return 0;
-}
-
-/*
- * Initialise the CPU possible map early - this describes the CPUs
- * which may be present or become present in the system.
- */
-static void __init highbank_smp_init_cpus(void)
-{
-	unsigned int i, ncores = 4;
-
-	/* sanity check */
-	if (ncores > NR_CPUS) {
-		printk(KERN_WARNING
-		       "highbank: no. of cores (%d) greater than configured "
-		       "maximum of %d - clipping\n",
-		       ncores, NR_CPUS);
-		ncores = NR_CPUS;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-}
-
-static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
-{
-	if (scu_base_addr)
-		scu_enable(scu_base_addr);
+	if (psci_ops.cpu_on)
+		return psci_ops.cpu_on(cpu_logical_map(cpu),
+				       __pa(secondary_startup));
+	return -ENODEV;
 }
 
 struct smp_operations highbank_smp_ops __initdata = {
-	.smp_init_cpus		= highbank_smp_init_cpus,
-	.smp_prepare_cpus	= highbank_smp_prepare_cpus,
 	.smp_secondary_init	= highbank_secondary_init,
 	.smp_boot_secondary	= highbank_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c
index 04eddb4..d1f511b 100644
--- a/arch/arm/mach-highbank/pm.c
+++ b/arch/arm/mach-highbank/pm.c
@@ -16,27 +16,21 @@
 
 #include <linux/cpu_pm.h>
 #include <linux/init.h>
-#include <linux/io.h>
 #include <linux/suspend.h>
 
-#include <asm/cacheflush.h>
-#include <asm/proc-fns.h>
 #include <asm/suspend.h>
 
-#include "core.h"
 #include "sysregs.h"
 
 static int highbank_suspend_finish(unsigned long val)
 {
-	outer_flush_all();
-	outer_disable();
+	const struct psci_power_state ps = {
+		.id = HB_PWR_SUSPEND,
+		.type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
+		.affinity_level = 1,
+	};
 
-	highbank_set_pwr_suspend();
-
-	cpu_do_idle();
-
-	highbank_clear_pwr_request();
-	return 0;
+	return psci_ops.cpu_suspend(ps, __pa(cpu_resume));
 }
 
 static int highbank_pm_enter(suspend_state_t state)
@@ -44,15 +38,11 @@ static int highbank_pm_enter(suspend_state_t state)
 	cpu_pm_enter();
 	cpu_cluster_pm_enter();
 
-	highbank_set_cpu_jump(0, cpu_resume);
 	cpu_suspend(0, highbank_suspend_finish);
 
 	cpu_cluster_pm_exit();
 	cpu_pm_exit();
 
-	highbank_smc1(0x102, 0x1);
-	if (scu_base_addr)
-		scu_enable(scu_base_addr);
 	return 0;
 }
 
@@ -63,5 +53,8 @@ static const struct platform_suspend_ops highbank_pm_ops = {
 
 void __init highbank_pm_init(void)
 {
+	if (!psci_ops.cpu_suspend)
+		return;
+
 	suspend_set_ops(&highbank_pm_ops);
 }
diff --git a/arch/arm/mach-highbank/sysregs.h b/arch/arm/mach-highbank/sysregs.h
index 5995df7..38818f3 100644
--- a/arch/arm/mach-highbank/sysregs.h
+++ b/arch/arm/mach-highbank/sysregs.h
@@ -16,71 +16,26 @@
 #ifndef _MACH_HIGHBANK__SYSREGS_H_
 #define _MACH_HIGHBANK__SYSREGS_H_
 
-#include <linux/io.h>
-#include <linux/smp.h>
-#include <asm/smp_plat.h>
-#include <asm/smp_scu.h>
-#include "core.h"
-
-extern void __iomem *sregs_base;
-
-#define HB_SREG_A9_PWR_REQ		0xf00
-#define HB_SREG_A9_BOOT_STAT		0xf04
-#define HB_SREG_A9_BOOT_DATA		0xf08
+#include <linux/err.h>
+#include <asm/psci.h>
 
 #define HB_PWR_SUSPEND			0
 #define HB_PWR_SOFT_RESET		1
 #define HB_PWR_HARD_RESET		2
 #define HB_PWR_SHUTDOWN			3
 
-#define SREG_CPU_PWR_CTRL(c)		(0x200 + ((c) * 4))
-
-static inline void highbank_set_core_pwr(void)
-{
-	int cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(smp_processor_id()), 0);
-	if (scu_base_addr)
-		scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
-	else
-		writel_relaxed(1, sregs_base + SREG_CPU_PWR_CTRL(cpu));
-}
-
-static inline void highbank_clear_core_pwr(void)
+static inline int highbank_cpu_off(int id, int affinity_level)
 {
-	int cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(smp_processor_id()), 0);
-	if (scu_base_addr)
-		scu_power_mode(scu_base_addr, SCU_PM_NORMAL);
-	else
-		writel_relaxed(0, sregs_base + SREG_CPU_PWR_CTRL(cpu));
-}
+	struct psci_power_state ps = {
+		.id = id,
+		.type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
+		.affinity_level = affinity_level,
+	};
 
-static inline void highbank_set_pwr_suspend(void)
-{
-	writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ);
-	highbank_set_core_pwr();
-}
+	if (psci_ops.cpu_off)
+		return psci_ops.cpu_off(ps);
 
-static inline void highbank_set_pwr_shutdown(void)
-{
-	writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ);
-	highbank_set_core_pwr();
-}
-
-static inline void highbank_set_pwr_soft_reset(void)
-{
-	writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
-	highbank_set_core_pwr();
-}
-
-static inline void highbank_set_pwr_hard_reset(void)
-{
-	writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
-	highbank_set_core_pwr();
-}
-
-static inline void highbank_clear_pwr_request(void)
-{
-	writel(~0UL, sregs_base + HB_SREG_A9_PWR_REQ);
-	highbank_clear_core_pwr();
+	return -ENODEV;
 }
 
 #endif
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
deleted file mode 100644
index 37d8384..0000000
--- a/arch/arm/mach-highbank/system.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011 Calxeda, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#include <linux/io.h>
-#include <asm/proc-fns.h>
-
-#include "core.h"
-#include "sysregs.h"
-
-void highbank_restart(char mode, const char *cmd)
-{
-	if (mode == 'h')
-		highbank_set_pwr_hard_reset();
-	else
-		highbank_set_pwr_soft_reset();
-
-	while (1)
-		cpu_do_idle();
-}
-
diff --git a/drivers/mailbox/pl320-ipc.c b/drivers/mailbox/pl320-ipc.c
index c45b3ae..4127e2e 100644
--- a/drivers/mailbox/pl320-ipc.c
+++ b/drivers/mailbox/pl320-ipc.c
@@ -196,4 +196,4 @@ static int __init ipc_init(void)
 {
 	return amba_driver_register(&pl320_driver);
 }
-module_init(ipc_init);
+arch_initcall(ipc_init);
-- 
1.7.10.4

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
                   ` (3 preceding siblings ...)
  2013-02-27  3:42 ` [PATCH 4/4] ARM: highbank: adapt to use ARM " Rob Herring
@ 2013-02-27  8:58 ` Arnd Bergmann
  2013-02-27 13:51   ` Rob Herring
  2013-02-27 17:18 ` Will Deacon
  5 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-02-27  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> This series converts highbank to use PSCI calls for secondary core boot,
> hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
> about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
> A15 differences (some of which are not yet in place).

Hi Rob,

This looks pretty cool. Can you or Will comment on what is still left
for the SMP ops that is actually required as platform specific code?

Specifically, I'm wondering if we could have a set of default smp_ops
based on this that we could use with the default machine descriptor [1]
and any platform that has SMP enabled but a NULL smp_ops pointer.

	Arnd

[1] https://patchwork.kernel.org/patch/2074871/

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27  8:58 ` [PATCH 0/4] Convert highbank to use " Arnd Bergmann
@ 2013-02-27 13:51   ` Rob Herring
  2013-02-27 17:14     ` Will Deacon
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2013-02-27 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/27/2013 02:58 AM, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> This series converts highbank to use PSCI calls for secondary core boot,
>> hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
>> about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
>> A15 differences (some of which are not yet in place).
> 
> Hi Rob,
> 
> This looks pretty cool. Can you or Will comment on what is still left
> for the SMP ops that is actually required as platform specific code?
> 
> Specifically, I'm wondering if we could have a set of default smp_ops
> based on this that we could use with the default machine descriptor [1]
> and any platform that has SMP enabled but a NULL smp_ops pointer.

My smp code is exactly the same as mach-virt with this, but adds cpu_die
for hotplug. smp_secondary_init will go away with Catalin's series to
use notifiers for the gic secondary init. This leaves smp_boot_secondary.

We could move these remaining smp_ops to psci.c and create psci_smp_ops.
That probably needs to be after the gic notifier changes.

Your patch, psci smp ops, and converting the arch timers to use
OF_CLKSRC_DECLARE will eliminate mach-virt unless Will has more things
planned for it.

Rob

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27 13:51   ` Rob Herring
@ 2013-02-27 17:14     ` Will Deacon
  2013-02-27 20:25       ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Will Deacon @ 2013-02-27 17:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 01:51:53PM +0000, Rob Herring wrote:
> On 02/27/2013 02:58 AM, Arnd Bergmann wrote:
> >> This series converts highbank to use PSCI calls for secondary core boot,
> >> hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
> >> about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
> >> A15 differences (some of which are not yet in place).
> > 
> > This looks pretty cool. Can you or Will comment on what is still left
> > for the SMP ops that is actually required as platform specific code?
> > 
> > Specifically, I'm wondering if we could have a set of default smp_ops
> > based on this that we could use with the default machine descriptor [1]
> > and any platform that has SMP enabled but a NULL smp_ops pointer.
> 
> My smp code is exactly the same as mach-virt with this, but adds cpu_die
> for hotplug. smp_secondary_init will go away with Catalin's series to
> use notifiers for the gic secondary init. This leaves smp_boot_secondary.
> 
> We could move these remaining smp_ops to psci.c and create psci_smp_ops.
> That probably needs to be after the gic notifier changes.
> 
> Your patch, psci smp ops, and converting the arch timers to use
> OF_CLKSRC_DECLARE will eliminate mach-virt unless Will has more things
> planned for it.

As long as we remain compatible with "linux,dummy-virt" then I'm not fussed
what happens to the support code. I don't envisage adding anything else to
it that can't live under drivers/ (e.g. new virtio devices).

Will

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
                   ` (4 preceding siblings ...)
  2013-02-27  8:58 ` [PATCH 0/4] Convert highbank to use " Arnd Bergmann
@ 2013-02-27 17:18 ` Will Deacon
  2013-02-27 17:25   ` Rob Herring
  5 siblings, 1 reply; 13+ messages in thread
From: Will Deacon @ 2013-02-27 17:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rob,

On Wed, Feb 27, 2013 at 03:42:04AM +0000, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> This series converts highbank to use PSCI calls for secondary core boot,
> hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
> about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
> A15 differences (some of which are not yet in place).

This is great, nice work!

> Will, I'm using the id field to specify system level events which are
> highbank specific. I worry that the id field will be abused for things
> that could be standardized. Having standard PSCI calls for reset and
> poweroff would avoid this for highbank.

I don't like using the ID field for this because it places some of the
number space in the device tree binding and other parts in the platform
code. It might be better to use the bottom 16 bits of the power_state
argument to CPU_OFF (which are designated as platform specific anyway) to
indicate that you actually want a system-wide operation to take place.

Since this document is currently undergoing a fairly major update (which
will hopefully be released soon), I'll go and check with the authors to see
if they have already considered this.

Cheers,

Will

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27 17:18 ` Will Deacon
@ 2013-02-27 17:25   ` Rob Herring
  2013-02-28 16:14     ` Will Deacon
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2013-02-27 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/27/2013 11:18 AM, Will Deacon wrote:
> Hi Rob,
> 
> On Wed, Feb 27, 2013 at 03:42:04AM +0000, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> This series converts highbank to use PSCI calls for secondary core boot,
>> hotplug, cpuidle, suspend/resume, reset, and poweroff. Doing this removes
>> about 200 lines of platform code (1/3 of it) and abstracts out the A9 and
>> A15 differences (some of which are not yet in place).
> 
> This is great, nice work!
> 
>> Will, I'm using the id field to specify system level events which are
>> highbank specific. I worry that the id field will be abused for things
>> that could be standardized. Having standard PSCI calls for reset and
>> poweroff would avoid this for highbank.
> 
> I don't like using the ID field for this because it places some of the
> number space in the device tree binding and other parts in the platform
> code. It might be better to use the bottom 16 bits of the power_state
> argument to CPU_OFF (which are designated as platform specific anyway) to
> indicate that you actually want a system-wide operation to take place.

The platform specific ID in the power state field of CPU_OFF is what I'm
using. But there is no reason for this to be platform specific when
possibly all platforms need this.

> Since this document is currently undergoing a fairly major update (which
> will hopefully be released soon), I'll go and check with the authors to see
> if they have already considered this.

It would be nice to have some visibility to this as this is an ABI and
will break if things change.

Rob

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27 17:14     ` Will Deacon
@ 2013-02-27 20:25       ` Arnd Bergmann
  2013-02-28 16:10         ` Will Deacon
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-02-27 20:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Will Deacon wrote:
> As long as we remain compatible with "linux,dummy-virt" then I'm not fussed
> what happens to the support code. I don't envisage adding anything else to
> it that can't live under drivers/ (e.g. new virtio devices).

The idea with my patch is that you don't actually have to check anything
against "linux,dummy-virt" or another top-level "compatible value.

Basically any device tree would boot as long as all device you want to
use (including timer, irqchip, smp CPU setup method, ...) can be brought
up using the DT information. The SMP stuff is the only bit missing
right now, any other field of the machine_desc structure is already
optional with my patch, and if all fields are NULL, you can leave
out the entire structure. The best part of this is that an empty
machine_desc is exactly what we have on arm64, so any machine that
is supported on arm64 could also be supported on arch/arm without
any machine specific code.

	Arnd

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27 20:25       ` Arnd Bergmann
@ 2013-02-28 16:10         ` Will Deacon
  0 siblings, 0 replies; 13+ messages in thread
From: Will Deacon @ 2013-02-28 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 08:25:19PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Will Deacon wrote:
> > As long as we remain compatible with "linux,dummy-virt" then I'm not fussed
> > what happens to the support code. I don't envisage adding anything else to
> > it that can't live under drivers/ (e.g. new virtio devices).
> 
> The idea with my patch is that you don't actually have to check anything
> against "linux,dummy-virt" or another top-level "compatible value.

Great, I've got no problem killing of the short-lived mach-virt then!

> Basically any device tree would boot as long as all device you want to
> use (including timer, irqchip, smp CPU setup method, ...) can be brought
> up using the DT information. The SMP stuff is the only bit missing
> right now, any other field of the machine_desc structure is already
> optional with my patch, and if all fields are NULL, you can leave
> out the entire structure. The best part of this is that an empty
> machine_desc is exactly what we have on arm64, so any machine that
> is supported on arm64 could also be supported on arch/arm without
> any machine specific code.

Keeping on the same topic: using a PSCI implementation as the default SMP
ops would extend the arm/arm64 compatibility to SMP booting, as both are
PSCI-capable.

Will

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

* [PATCH 0/4] Convert highbank to use PSCI calls
  2013-02-27 17:25   ` Rob Herring
@ 2013-02-28 16:14     ` Will Deacon
  0 siblings, 0 replies; 13+ messages in thread
From: Will Deacon @ 2013-02-28 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 05:25:59PM +0000, Rob Herring wrote:
> On 02/27/2013 11:18 AM, Will Deacon wrote:
> > On Wed, Feb 27, 2013 at 03:42:04AM +0000, Rob Herring wrote:
> >> Will, I'm using the id field to specify system level events which are
> >> highbank specific. I worry that the id field will be abused for things
> >> that could be standardized. Having standard PSCI calls for reset and
> >> poweroff would avoid this for highbank.
> > 
> > I don't like using the ID field for this because it places some of the
> > number space in the device tree binding and other parts in the platform
> > code. It might be better to use the bottom 16 bits of the power_state
> > argument to CPU_OFF (which are designated as platform specific anyway) to
> > indicate that you actually want a system-wide operation to take place.
> 
> The platform specific ID in the power state field of CPU_OFF is what I'm
> using. But there is no reason for this to be platform specific when
> possibly all platforms need this.

Yes, sorry, I misread your description above and assumed you were referring
to the *function* ID.

> > Since this document is currently undergoing a fairly major update (which
> > will hopefully be released soon), I'll go and check with the authors to see
> > if they have already considered this.
> 
> It would be nice to have some visibility to this as this is an ABI and
> will break if things change.

As long as things are versioned sensibly, we just don't pretend to be
compatible with versions of the ABI that we don't support; otherwise PSCI
would be unable to evolve as a specification. The main thing is to avoid
implementing features as platform-specific parts when an upcoming version of
the specification actually describes them in a different way.

We should talk more about this at Connect, where hopefully some other
platforms can be converted too.

Will

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

end of thread, other threads:[~2013-02-28 16:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27  3:42 [PATCH 0/4] Convert highbank to use PSCI calls Rob Herring
2013-02-27  3:42 ` [PATCH 1/4] ARM: highbank: clean-up some unused includes Rob Herring
2013-02-27  3:42 ` [PATCH 2/4] dts: calxeda: add ARM PSCI binding Rob Herring
2013-02-27  3:42 ` [PATCH 3/4] cpuidle: calxeda: add support to use PSCI calls Rob Herring
2013-02-27  3:42 ` [PATCH 4/4] ARM: highbank: adapt to use ARM " Rob Herring
2013-02-27  8:58 ` [PATCH 0/4] Convert highbank to use " Arnd Bergmann
2013-02-27 13:51   ` Rob Herring
2013-02-27 17:14     ` Will Deacon
2013-02-27 20:25       ` Arnd Bergmann
2013-02-28 16:10         ` Will Deacon
2013-02-27 17:18 ` Will Deacon
2013-02-27 17:25   ` Rob Herring
2013-02-28 16:14     ` Will Deacon

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.