]> Pileus Git - ~andy/linux/blob - arch/arm/mach-shmobile/platsmp.c
regulator: extend the fixed dummy voltage regulator to accept voltage
[~andy/linux] / 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 #define is_emev2() of_machine_is_compatible("renesas,emev2")
29
30 static unsigned int __init shmobile_smp_get_core_count(void)
31 {
32         if (is_sh73a0())
33                 return sh73a0_get_core_count();
34
35         if (is_r8a7779())
36                 return r8a7779_get_core_count();
37
38         if (is_emev2())
39                 return emev2_get_core_count();
40
41         return 1;
42 }
43
44 static void __init shmobile_smp_prepare_cpus(void)
45 {
46         if (is_sh73a0())
47                 sh73a0_smp_prepare_cpus();
48
49         if (is_r8a7779())
50                 r8a7779_smp_prepare_cpus();
51
52         if (is_emev2())
53                 emev2_smp_prepare_cpus();
54 }
55
56 int shmobile_platform_cpu_kill(unsigned int cpu)
57 {
58         if (is_r8a7779())
59                 return r8a7779_platform_cpu_kill(cpu);
60
61         if (is_emev2())
62                 return emev2_platform_cpu_kill(cpu);
63
64         return 1;
65 }
66
67 void __cpuinit platform_secondary_init(unsigned int cpu)
68 {
69         trace_hardirqs_off();
70
71         if (is_sh73a0())
72                 sh73a0_secondary_init(cpu);
73
74         if (is_r8a7779())
75                 r8a7779_secondary_init(cpu);
76
77         if (is_emev2())
78                 emev2_secondary_init(cpu);
79 }
80
81 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
82 {
83         if (is_sh73a0())
84                 return sh73a0_boot_secondary(cpu);
85
86         if (is_r8a7779())
87                 return r8a7779_boot_secondary(cpu);
88
89         if (is_emev2())
90                 return emev2_boot_secondary(cpu);
91
92         return -ENOSYS;
93 }
94
95 void __init smp_init_cpus(void)
96 {
97         unsigned int ncores = shmobile_smp_get_core_count();
98         unsigned int i;
99
100         if (ncores > nr_cpu_ids) {
101                 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
102                         ncores, nr_cpu_ids);
103                 ncores = nr_cpu_ids;
104         }
105
106         for (i = 0; i < ncores; i++)
107                 set_cpu_possible(i, true);
108
109         set_smp_cross_call(gic_raise_softirq);
110 }
111
112 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
113 {
114         shmobile_smp_prepare_cpus();
115 }