Commit | Line | Data |
---|---|---|
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 MD |
23 | |
24 | static unsigned int __init shmobile_smp_get_core_count(void) | |
25 | { | |
72f4d579 MD |
26 | if (machine_is_ag5evm()) |
27 | return sh73a0_get_core_count(); | |
28 | ||
1c51ed4f MD |
29 | return 1; |
30 | } | |
31 | ||
32 | static void __init shmobile_smp_prepare_cpus(void) | |
33 | { | |
72f4d579 MD |
34 | if (machine_is_ag5evm()) |
35 | sh73a0_smp_prepare_cpus(); | |
1c51ed4f MD |
36 | } |
37 | ||
1c51ed4f MD |
38 | void __cpuinit platform_secondary_init(unsigned int cpu) |
39 | { | |
40 | trace_hardirqs_off(); | |
72f4d579 MD |
41 | |
42 | if (machine_is_ag5evm()) | |
43 | sh73a0_secondary_init(cpu); | |
1c51ed4f MD |
44 | } |
45 | ||
46 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |
47 | { | |
72f4d579 MD |
48 | if (machine_is_ag5evm()) |
49 | return sh73a0_boot_secondary(cpu); | |
50 | ||
1c51ed4f MD |
51 | return -ENOSYS; |
52 | } | |
53 | ||
54 | void __init smp_init_cpus(void) | |
55 | { | |
56 | unsigned int ncores = shmobile_smp_get_core_count(); | |
57 | unsigned int i; | |
58 | ||
59 | for (i = 0; i < ncores; i++) | |
60 | set_cpu_possible(i, true); | |
0f7b332f RK |
61 | |
62 | set_smp_cross_call(gic_raise_softirq); | |
1c51ed4f MD |
63 | } |
64 | ||
c413521e | 65 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
1c51ed4f | 66 | { |
c413521e | 67 | shmobile_smp_prepare_cpus(); |
1c51ed4f | 68 | } |