Merge tag 'v3.5-rc6' into irqdomain/next
[deliverable/linux.git] / arch / arm / mach-shmobile / platsmp.c
1 /*
2 * SMP support for R-Mobile / SH-Mobile
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2011 Paul Mundt
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>
19 #include <linux/of.h>
20 #include <asm/hardware/gic.h>
21 #include <asm/mach-types.h>
22 #include <mach/common.h>
23 #include <mach/emev2.h>
24
25 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \
26 of_machine_is_compatible("renesas,sh73a0"))
27 #define is_r8a7779() machine_is_marzen()
28
29 #ifdef CONFIG_ARCH_EMEV2
30 #define is_emev2() of_machine_is_compatible("renesas,emev2")
31 #else
32 #define is_emev2() (0)
33 #endif
34
35 static unsigned int __init shmobile_smp_get_core_count(void)
36 {
37 if (is_sh73a0())
38 return sh73a0_get_core_count();
39
40 if (is_r8a7779())
41 return r8a7779_get_core_count();
42
43 if (is_emev2())
44 return emev2_get_core_count();
45
46 return 1;
47 }
48
49 static void __init shmobile_smp_prepare_cpus(void)
50 {
51 if (is_sh73a0())
52 sh73a0_smp_prepare_cpus();
53
54 if (is_r8a7779())
55 r8a7779_smp_prepare_cpus();
56
57 if (is_emev2())
58 emev2_smp_prepare_cpus();
59 }
60
61 int shmobile_platform_cpu_kill(unsigned int cpu)
62 {
63 if (is_r8a7779())
64 return r8a7779_platform_cpu_kill(cpu);
65
66 if (is_emev2())
67 return emev2_platform_cpu_kill(cpu);
68
69 return 1;
70 }
71
72 void __cpuinit platform_secondary_init(unsigned int cpu)
73 {
74 trace_hardirqs_off();
75
76 if (is_sh73a0())
77 sh73a0_secondary_init(cpu);
78
79 if (is_r8a7779())
80 r8a7779_secondary_init(cpu);
81
82 if (is_emev2())
83 emev2_secondary_init(cpu);
84 }
85
86 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
87 {
88 if (is_sh73a0())
89 return sh73a0_boot_secondary(cpu);
90
91 if (is_r8a7779())
92 return r8a7779_boot_secondary(cpu);
93
94 if (is_emev2())
95 return emev2_boot_secondary(cpu);
96
97 return -ENOSYS;
98 }
99
100 void __init smp_init_cpus(void)
101 {
102 unsigned int ncores = shmobile_smp_get_core_count();
103 unsigned int i;
104
105 if (ncores > nr_cpu_ids) {
106 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
107 ncores, nr_cpu_ids);
108 ncores = nr_cpu_ids;
109 }
110
111 for (i = 0; i < ncores; i++)
112 set_cpu_possible(i, true);
113
114 set_smp_cross_call(gic_raise_softirq);
115 }
116
117 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
118 {
119 shmobile_smp_prepare_cpus();
120 }
This page took 0.032315 seconds and 5 git commands to generate.