aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2013-02-18 08:47:54 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-03-12 13:13:21 -0400
commitfd0865c3f7054d9068007fd280681cb4ea7929a1 (patch)
treeb818b709e45828c8f934d9d505520f0d5a1dc060 /arch
parenteebadd676499e4c8aee181a669cc8a386e308c31 (diff)
ARM: shmobile: Rearrange r8a7779 cpu hotplug code
Update the r8a7779 SMP code and CPU Hotplug in particular to follow the same style as sh73a0. This means dropping __maybe_unused for #ifdef CONFIG_HOTPLUG_CPU. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index bdd38091dc9e..ea4535a5c4e2 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -66,16 +66,6 @@ void __init r8a7779_register_twd(void)
66} 66}
67#endif 67#endif
68 68
69static int r8a7779_scu_psr_core_disabled(int cpu)
70{
71 unsigned long mask = 3 << (cpu * 8);
72
73 if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask)
74 return 1;
75
76 return 0;
77}
78
79static int r8a7779_platform_cpu_kill(unsigned int cpu) 69static int r8a7779_platform_cpu_kill(unsigned int cpu)
80{ 70{
81 struct r8a7779_pm_ch *ch = NULL; 71 struct r8a7779_pm_ch *ch = NULL;
@@ -92,43 +82,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
92 return ret ? ret : 1; 82 return ret ? ret : 1;
93} 83}
94 84
95static int __maybe_unused r8a7779_cpu_kill(unsigned int cpu)
96{
97 int k;
98
99 /* this function is running on another CPU than the offline target,
100 * here we need wait for shutdown code in platform_cpu_die() to
101 * finish before asking SoC-specific code to power off the CPU core.
102 */
103 for (k = 0; k < 1000; k++) {
104 if (r8a7779_scu_psr_core_disabled(cpu))
105 return r8a7779_platform_cpu_kill(cpu);
106
107 mdelay(1);
108 }
109
110 return 0;
111}
112
113static void __maybe_unused r8a7779_cpu_die(unsigned int cpu)
114{
115 dsb();
116 flush_cache_all();
117
118 /* disable cache coherency */
119 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
120
121 /* Endless loop until power off from r8a7779_cpu_kill() */
122 while (1)
123 cpu_do_idle();
124}
125
126static int __maybe_unused r8a7779_cpu_disable(unsigned int cpu)
127{
128 /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */
129 return cpu == 0 ? -EPERM : 0;
130}
131
132static void __cpuinit r8a7779_secondary_init(unsigned int cpu) 85static void __cpuinit r8a7779_secondary_init(unsigned int cpu)
133{ 86{
134 gic_secondary_init(0); 87 gic_secondary_init(0);
@@ -176,6 +129,55 @@ static void __init r8a7779_smp_init_cpus(void)
176 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base)); 129 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base));
177} 130}
178 131
132#ifdef CONFIG_HOTPLUG_CPU
133static int r8a7779_scu_psr_core_disabled(int cpu)
134{
135 unsigned long mask = 3 << (cpu * 8);
136
137 if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask)
138 return 1;
139
140 return 0;
141}
142
143static int r8a7779_cpu_kill(unsigned int cpu)
144{
145 int k;
146
147 /* this function is running on another CPU than the offline target,
148 * here we need wait for shutdown code in platform_cpu_die() to
149 * finish before asking SoC-specific code to power off the CPU core.
150 */
151 for (k = 0; k < 1000; k++) {
152 if (r8a7779_scu_psr_core_disabled(cpu))
153 return r8a7779_platform_cpu_kill(cpu);
154
155 mdelay(1);
156 }
157
158 return 0;
159}
160
161static void r8a7779_cpu_die(unsigned int cpu)
162{
163 dsb();
164 flush_cache_all();
165
166 /* disable cache coherency */
167 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
168
169 /* Endless loop until power off from r8a7779_cpu_kill() */
170 while (1)
171 cpu_do_idle();
172}
173
174static int r8a7779_cpu_disable(unsigned int cpu)
175{
176 /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */
177 return cpu == 0 ? -EPERM : 0;
178}
179#endif /* CONFIG_HOTPLUG_CPU */
180
179struct smp_operations r8a7779_smp_ops __initdata = { 181struct smp_operations r8a7779_smp_ops __initdata = {
180 .smp_init_cpus = r8a7779_smp_init_cpus, 182 .smp_init_cpus = r8a7779_smp_init_cpus,
181 .smp_prepare_cpus = r8a7779_smp_prepare_cpus, 183 .smp_prepare_cpus = r8a7779_smp_prepare_cpus,