blob: e8d3c5f0171fbe81d3d99ea77fa313f5051b58af [file] [log] [blame]
Rob Herring67388452011-05-17 21:02:49 -05001/*
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>
22#include <asm/hardware/gic.h>
23
24#include "core.h"
25
26extern void secondary_startup(void);
27
Marc Zyngier7ad71b62012-09-05 14:36:18 +000028static void __cpuinit highbank_secondary_init(unsigned int cpu)
Rob Herring67388452011-05-17 21:02:49 -050029{
30 gic_secondary_init(0);
31}
32
Marc Zyngier7ad71b62012-09-05 14:36:18 +000033static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
Rob Herring67388452011-05-17 21:02:49 -050034{
Rob Herring0b3455a2012-12-30 10:15:05 -060035 highbank_set_cpu_jump(cpu, secondary_startup);
Rob Herringb1cffeb2012-11-26 15:05:48 -060036 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
Rob Herring67388452011-05-17 21:02:49 -050037 return 0;
38}
39
40/*
41 * Initialise the CPU possible map early - this describes the CPUs
42 * which may be present or become present in the system.
43 */
Marc Zyngier7ad71b62012-09-05 14:36:18 +000044static void __init highbank_smp_init_cpus(void)
Rob Herring67388452011-05-17 21:02:49 -050045{
Rob Herring7a2848d2012-10-25 12:13:47 -050046 unsigned int i, ncores = 4;
Rob Herring67388452011-05-17 21:02:49 -050047
48 /* sanity check */
49 if (ncores > NR_CPUS) {
50 printk(KERN_WARNING
51 "highbank: no. of cores (%d) greater than configured "
52 "maximum of %d - clipping\n",
53 ncores, NR_CPUS);
54 ncores = NR_CPUS;
55 }
56
57 for (i = 0; i < ncores; i++)
58 set_cpu_possible(i, true);
Rob Herring67388452011-05-17 21:02:49 -050059}
60
Marc Zyngier7ad71b62012-09-05 14:36:18 +000061static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
Rob Herring67388452011-05-17 21:02:49 -050062{
Rob Herring7a2848d2012-10-25 12:13:47 -050063 if (scu_base_addr)
64 scu_enable(scu_base_addr);
Rob Herring67388452011-05-17 21:02:49 -050065}
Marc Zyngier7ad71b62012-09-05 14:36:18 +000066
67struct smp_operations highbank_smp_ops __initdata = {
68 .smp_init_cpus = highbank_smp_init_cpus,
69 .smp_prepare_cpus = highbank_smp_prepare_cpus,
70 .smp_secondary_init = highbank_secondary_init,
71 .smp_boot_secondary = highbank_boot_secondary,
72#ifdef CONFIG_HOTPLUG_CPU
73 .cpu_die = highbank_cpu_die,
74#endif
75};