Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2010-2011 Calxeda, Inc. |
| 3 | * Based on platsmp.c, Copyright (C) 2002 ARM Ltd. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/smp.h> |
| 19 | #include <linux/io.h> |
| 20 | |
| 21 | #include <asm/smp_scu.h> |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 22 | |
| 23 | #include "core.h" |
| 24 | |
| 25 | extern void secondary_startup(void); |
| 26 | |
Marc Zyngier | 7ad71b6 | 2012-09-05 14:36:18 +0000 | [diff] [blame] | 27 | static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 28 | { |
Rob Herring | 0b3455a | 2012-12-30 10:15:05 -0600 | [diff] [blame] | 29 | highbank_set_cpu_jump(cpu, secondary_startup); |
Rob Herring | b1cffeb | 2012-11-26 15:05:48 -0600 | [diff] [blame] | 30 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | /* |
| 35 | * Initialise the CPU possible map early - this describes the CPUs |
| 36 | * which may be present or become present in the system. |
| 37 | */ |
Marc Zyngier | 7ad71b6 | 2012-09-05 14:36:18 +0000 | [diff] [blame] | 38 | static void __init highbank_smp_init_cpus(void) |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 39 | { |
Rob Herring | 7a2848d | 2012-10-25 12:13:47 -0500 | [diff] [blame] | 40 | unsigned int i, ncores = 4; |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 41 | |
| 42 | /* sanity check */ |
| 43 | if (ncores > NR_CPUS) { |
| 44 | printk(KERN_WARNING |
| 45 | "highbank: no. of cores (%d) greater than configured " |
| 46 | "maximum of %d - clipping\n", |
| 47 | ncores, NR_CPUS); |
| 48 | ncores = NR_CPUS; |
| 49 | } |
| 50 | |
| 51 | for (i = 0; i < ncores; i++) |
| 52 | set_cpu_possible(i, true); |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 53 | } |
| 54 | |
Marc Zyngier | 7ad71b6 | 2012-09-05 14:36:18 +0000 | [diff] [blame] | 55 | static void __init highbank_smp_prepare_cpus(unsigned int max_cpus) |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 56 | { |
Rob Herring | 7a2848d | 2012-10-25 12:13:47 -0500 | [diff] [blame] | 57 | if (scu_base_addr) |
| 58 | scu_enable(scu_base_addr); |
Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame] | 59 | } |
Marc Zyngier | 7ad71b6 | 2012-09-05 14:36:18 +0000 | [diff] [blame] | 60 | |
| 61 | struct smp_operations highbank_smp_ops __initdata = { |
| 62 | .smp_init_cpus = highbank_smp_init_cpus, |
| 63 | .smp_prepare_cpus = highbank_smp_prepare_cpus, |
Marc Zyngier | 7ad71b6 | 2012-09-05 14:36:18 +0000 | [diff] [blame] | 64 | .smp_boot_secondary = highbank_boot_secondary, |
| 65 | #ifdef CONFIG_HOTPLUG_CPU |
| 66 | .cpu_die = highbank_cpu_die, |
| 67 | #endif |
| 68 | }; |