summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/platsmp.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-12-14 16:56:55 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-12-14 18:15:44 +0900
commit1c51ed4fb9f11fa1e0873aa2d5b28f42a85ac299 (patch)
tree258c5de6db68146a86fc27ae1dc2b8fed2dc40e3 /arch/arm/mach-shmobile/platsmp.c
parent09dd7ded60019d6a4fd2ae20a08c4ad2bc3ed3e9 (diff)
ARM: mach-shmobile: SMP base support
Add SMP base support for R-Mobile / SH-Mobile processors. This patch contains all base code to support CONFIG_SMP regardless of ARCH_SHMOBILE processor type. Both local timer and CPU hotplug are supported, but no processor specific code is included. At this point only the default behavior is in place, so a single core will always be used even though CONFIG_SMP is enabled on multicore systems. The SMP Kconfig entry for arch/arm/Kconfig is excluded from this patch to simplify merging. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/platsmp.c')
-rw-r--r--arch/arm/mach-shmobile/platsmp.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
new file mode 100644
index 000000000000..b41f5d0650e4
--- /dev/null
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -0,0 +1,73 @@
+/*
+ * SMP support for R-Mobile / SH-Mobile
+ *
+ * Copyright (C) 2010 Magnus Damm
+ *
+ * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <asm/localtimer.h>
+
+static unsigned int __init shmobile_smp_get_core_count(void)
+{
+ return 1;
+}
+
+static void __init shmobile_smp_prepare_cpus(void)
+{
+ /* do nothing for now */
+}
+
+
+void __cpuinit platform_secondary_init(unsigned int cpu)
+{
+ trace_hardirqs_off();
+}
+
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+ return -ENOSYS;
+}
+
+void __init smp_init_cpus(void)
+{
+ unsigned int ncores = shmobile_smp_get_core_count();
+ unsigned int i;
+
+ for (i = 0; i < ncores; i++)
+ set_cpu_possible(i, true);
+}
+
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
+ unsigned int ncores = shmobile_smp_get_core_count();
+ unsigned int cpu = smp_processor_id();
+ int i;
+
+ smp_store_cpu_info(cpu);
+
+ if (max_cpus > ncores)
+ max_cpus = ncores;
+
+ for (i = 0; i < max_cpus; i++)
+ set_cpu_present(i, true);
+
+ if (max_cpus > 1) {
+ shmobile_smp_prepare_cpus();
+
+ /*
+ * Enable the local timer or broadcast device for the
+ * boot CPU, but only if we have more than one CPU.
+ */
+ percpu_timer_setup();
+ }
+}