ARM: mach-shmobile: Fix headsmp.S code to use CPUINIT
[deliverable/linux.git] / arch / arm / mach-shmobile / platsmp.c
CommitLineData
1c51ed4f
MD
1/*
2 * SMP support for R-Mobile / SH-Mobile
3 *
4 * Copyright (C) 2010 Magnus Damm
c413521e 5 * Copyright (C) 2011 Paul Mundt
1c51ed4f
MD
6 *
7 * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/init.h>
14#include <linux/errno.h>
15#include <linux/delay.h>
16#include <linux/device.h>
17#include <linux/smp.h>
18#include <linux/io.h>
0f7b332f 19#include <asm/hardware/gic.h>
1c51ed4f 20#include <asm/localtimer.h>
72f4d579
MD
21#include <asm/mach-types.h>
22#include <mach/common.h>
1c51ed4f 23
28626632
MD
24#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2())
25
1c51ed4f
MD
26static unsigned int __init shmobile_smp_get_core_count(void)
27{
28626632 28 if (is_sh73a0())
72f4d579
MD
29 return sh73a0_get_core_count();
30
1c51ed4f
MD
31 return 1;
32}
33
34static void __init shmobile_smp_prepare_cpus(void)
35{
28626632 36 if (is_sh73a0())
72f4d579 37 sh73a0_smp_prepare_cpus();
1c51ed4f
MD
38}
39
1c51ed4f
MD
40void __cpuinit platform_secondary_init(unsigned int cpu)
41{
42 trace_hardirqs_off();
72f4d579 43
28626632 44 if (is_sh73a0())
72f4d579 45 sh73a0_secondary_init(cpu);
1c51ed4f
MD
46}
47
48int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
49{
28626632 50 if (is_sh73a0())
72f4d579
MD
51 return sh73a0_boot_secondary(cpu);
52
1c51ed4f
MD
53 return -ENOSYS;
54}
55
56void __init smp_init_cpus(void)
57{
58 unsigned int ncores = shmobile_smp_get_core_count();
59 unsigned int i;
60
a06f916b
RK
61 if (ncores > nr_cpu_ids) {
62 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
63 ncores, nr_cpu_ids);
64 ncores = nr_cpu_ids;
65 }
66
1c51ed4f
MD
67 for (i = 0; i < ncores; i++)
68 set_cpu_possible(i, true);
0f7b332f
RK
69
70 set_smp_cross_call(gic_raise_softirq);
1c51ed4f
MD
71}
72
c413521e 73void __init platform_smp_prepare_cpus(unsigned int max_cpus)
1c51ed4f 74{
c413521e 75 shmobile_smp_prepare_cpus();
1c51ed4f 76}
This page took 0.078271 seconds and 5 git commands to generate.