Skip to contentSkip to conversation

ARM: highbank: adapt to use ARM PSCI calls

PATCH New Rob Herring 1 participant 1 message Apr 1, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: highbank: adapt to use ARM PSCI calls

From: Rob Herring <[email protected]>

This adapts highbank to use the psci_smp_ops. Additionally, 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.

---
v2: Rebase to use Stefano's psci_smp_ops patch:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-March/159187.html

 arch/arm/mach-highbank/Kconfig    |    2 +-
 arch/arm/mach-highbank/Makefile   |    4 +-
 arch/arm/mach-highbank/core.h     |    7 ----
 arch/arm/mach-highbank/highbank.c |   50 ++++---------------------
 arch/arm/mach-highbank/hotplug.c  |   40 --------------------
 arch/arm/mach-highbank/platsmp.c  |   75 -------------------------------------
 arch/arm/mach-highbank/pm.c       |   25 +++++--------
 arch/arm/mach-highbank/sysregs.h  |   67 ++++++---------------------------
 arch/arm/mach-highbank/system.c   |   32 ----------------
 9 files changed, 30 insertions(+), 272 deletions(-)
 delete mode 100644 arch/arm/mach-highbank/hotplug.c
 delete mode 100644 arch/arm/mach-highbank/platsmp.c
 delete mode 100644 arch/arm/mach-highbank/system.c
arch/arm/mach-highbank/Kconfig +1 -1
index 44b12f9..9dc0c9e 100644
@@ -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
arch/arm/mach-highbank/Makefile +1 -3
index 8a1ef57..aeabc32 100644
@@ -1,8 +1,6 @@
-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)
 
-obj-$(CONFIG_SMP)			+= platsmp.o
-obj-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
 obj-$(CONFIG_PM_SLEEP)			+= pm.o
arch/arm/mach-highbank/core.h +0 -7
index 3f65206..52b713a 100644
@@ -1,10 +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);
 #else
@@ -12,8 +8,5 @@ static inline void highbank_pm_init(void) {}
 #endif
 
 extern void highbank_smc1(int fn, int arg);
-extern void highbank_cpu_die(unsigned int cpu);
-
-extern struct smp_operations highbank_smp_ops;
 
 #endif
arch/arm/mach-highbank/highbank.c +8 -42

84 lines not on this page · raw message

arch/arm/mach-highbank/hotplug.c deleted +0 -40
deleted file mode 100644
index f30c528..0000000
@@ -1,40 +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/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();
-
-	/* We should never return from idle */
-	panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu);
-}
arch/arm/mach-highbank/platsmp.c deleted +0 -75

75 lines not on this page · raw message

arch/arm/mach-highbank/pm.c +9 -16
index 04eddb4..d1f511b 100644
@@ -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);
 }
arch/arm/mach-highbank/sysregs.h +11 -56

82 lines not on this page · raw message

arch/arm/mach-highbank/system.c deleted +0 -32
deleted file mode 100644
index 37d8384..0000000
@@ -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();
-}
-
Signature · 1 line
1.7.10.4