Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2002 ARM Ltd. |
| 3 | * All Rights Reserved |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame^] | 4 | * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 11 | #include <linux/init.h> |
Joel King | 274621c | 2011-12-05 06:18:20 -0800 | [diff] [blame] | 12 | #include <linux/kernel.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 13 | #include <linux/init.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 14 | #include <linux/cpumask.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 15 | #include <linux/delay.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 16 | #include <linux/interrupt.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 17 | #include <linux/io.h> |
Stepan Moskovchenko | 6b1d5df | 2012-08-11 22:33:20 -0700 | [diff] [blame] | 18 | #include <linux/regulator/krait-regulator.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 19 | |
| 20 | #include <asm/hardware/gic.h> |
| 21 | #include <asm/cacheflush.h> |
Jeff Ohlstein | 41ff445 | 2011-04-07 17:41:09 -0700 | [diff] [blame] | 22 | #include <asm/cputype.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 23 | #include <asm/mach-types.h> |
Will Deacon | eb50439 | 2012-01-20 12:01:12 +0100 | [diff] [blame] | 24 | #include <asm/smp_plat.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 25 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | #include <mach/socinfo.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 27 | #include <mach/hardware.h> |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 28 | #include <mach/msm_iomap.h> |
| 29 | |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 30 | #include "pm.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 31 | #include "platsmp.h" |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 32 | #include "scm-boot.h" |
Stepan Moskovchenko | 9bbe585 | 2012-01-09 13:28:28 -0800 | [diff] [blame] | 33 | #include "spm.h" |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 34 | |
| 35 | #define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0 |
| 36 | #define SCSS_CPU1CORE_RESET 0xD80 |
| 37 | #define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64 |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 38 | #define BOOT_REMAP_ENABLE 0x01 |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 39 | |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 40 | /* |
| 41 | * control for which core is the next to come out of the secondary |
| 42 | * boot "holding pen". |
| 43 | */ |
| 44 | volatile int pen_release = -1; |
| 45 | |
Stephen Boyd | f5e9082 | 2012-08-08 13:36:15 -0700 | [diff] [blame] | 46 | /* |
| 47 | * Write pen_release in a way that is guaranteed to be visible to all |
| 48 | * observers, irrespective of whether they're taking part in coherency |
| 49 | * or not. This is necessary for the hotplug code to work reliably. |
| 50 | */ |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 51 | void __cpuinit write_pen_release(int val) |
Stephen Boyd | f5e9082 | 2012-08-08 13:36:15 -0700 | [diff] [blame] | 52 | { |
| 53 | pen_release = val; |
| 54 | smp_wmb(); |
| 55 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); |
| 56 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); |
| 57 | } |
| 58 | |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 59 | static DEFINE_SPINLOCK(boot_lock); |
| 60 | |
| 61 | void __cpuinit platform_secondary_init(unsigned int cpu) |
| 62 | { |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 63 | WARN_ON(msm_platform_secondary_init(cpu)); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 64 | |
| 65 | /* |
| 66 | * if any interrupts are already enabled for the primary |
| 67 | * core (e.g. timer irq), then they will not have been enabled |
| 68 | * for us: do so |
| 69 | */ |
| 70 | gic_secondary_init(0); |
| 71 | |
| 72 | /* |
Stephen Boyd | f5e9082 | 2012-08-08 13:36:15 -0700 | [diff] [blame] | 73 | * let the primary processor know we're out of the |
| 74 | * pen, then head off into the C entry point |
| 75 | */ |
| 76 | write_pen_release(-1); |
| 77 | |
| 78 | /* |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 79 | * Synchronise with the boot thread. |
| 80 | */ |
| 81 | spin_lock(&boot_lock); |
| 82 | spin_unlock(&boot_lock); |
| 83 | } |
| 84 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 85 | static int __cpuinit release_secondary_sim(unsigned long base, int cpu) |
| 86 | { |
| 87 | void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K); |
| 88 | if (!base_ptr) |
| 89 | return -ENODEV; |
| 90 | |
| 91 | writel_relaxed(0x800, base_ptr+0x04); |
| 92 | writel_relaxed(0x3FFF, base_ptr+0x14); |
| 93 | |
| 94 | mb(); |
| 95 | iounmap(base_ptr); |
| 96 | return 0; |
| 97 | } |
| 98 | |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 99 | static int __cpuinit scorpion_release_secondary(void) |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 100 | { |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 101 | void *base_ptr = ioremap_nocache(0x00902000, SZ_4K*2); |
| 102 | if (!base_ptr) |
| 103 | return -EINVAL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 104 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 105 | writel_relaxed(0, base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 106 | dmb(); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 107 | writel_relaxed(0, base_ptr + SCSS_CPU1CORE_RESET); |
| 108 | writel_relaxed(3, base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 109 | mb(); |
| 110 | iounmap(base_ptr); |
| 111 | |
| 112 | return 0; |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 113 | } |
| 114 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 115 | static int __cpuinit msm8960_release_secondary(unsigned long base, int cpu) |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 116 | { |
Sathish Ambley | 576a697 | 2012-03-20 12:38:45 -0700 | [diff] [blame] | 117 | void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 118 | if (!base_ptr) |
| 119 | return -ENODEV; |
| 120 | |
Stepan Moskovchenko | 9bbe585 | 2012-01-09 13:28:28 -0800 | [diff] [blame] | 121 | msm_spm_turn_on_cpu_rail(cpu); |
| 122 | |
Stepan Moskovchenko | 986b515 | 2012-12-11 18:33:07 -0800 | [diff] [blame] | 123 | writel_relaxed(0x109, base_ptr+0x04); |
| 124 | writel_relaxed(0x101, base_ptr+0x04); |
| 125 | mb(); |
| 126 | ndelay(300); |
| 127 | |
| 128 | writel_relaxed(0x121, base_ptr+0x04); |
Stepan Moskovchenko | 121f75f | 2012-08-16 21:10:13 -0700 | [diff] [blame] | 129 | mb(); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 130 | udelay(2); |
| 131 | |
Stepan Moskovchenko | 986b515 | 2012-12-11 18:33:07 -0800 | [diff] [blame] | 132 | writel_relaxed(0x120, base_ptr+0x04); |
Stepan Moskovchenko | 121f75f | 2012-08-16 21:10:13 -0700 | [diff] [blame] | 133 | mb(); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 134 | udelay(2); |
| 135 | |
Stepan Moskovchenko | 986b515 | 2012-12-11 18:33:07 -0800 | [diff] [blame] | 136 | writel_relaxed(0x100, base_ptr+0x04); |
Stepan Moskovchenko | 121f75f | 2012-08-16 21:10:13 -0700 | [diff] [blame] | 137 | mb(); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 138 | udelay(100); |
| 139 | |
Stepan Moskovchenko | 986b515 | 2012-12-11 18:33:07 -0800 | [diff] [blame] | 140 | writel_relaxed(0x180, base_ptr+0x04); |
Stepan Moskovchenko | 964e103 | 2012-01-06 18:16:10 -0800 | [diff] [blame] | 141 | mb(); |
| 142 | iounmap(base_ptr); |
| 143 | return 0; |
| 144 | } |
| 145 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 146 | static int __cpuinit msm8974_release_secondary(unsigned long base, int cpu) |
Stepan Moskovchenko | 2517372 | 2012-08-09 13:43:02 -0700 | [diff] [blame] | 147 | { |
| 148 | void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K); |
| 149 | if (!base_ptr) |
| 150 | return -ENODEV; |
| 151 | |
Stepan Moskovchenko | 6b1d5df | 2012-08-11 22:33:20 -0700 | [diff] [blame] | 152 | secondary_cpu_hs_init(base_ptr); |
| 153 | |
Stepan Moskovchenko | 2517372 | 2012-08-09 13:43:02 -0700 | [diff] [blame] | 154 | writel_relaxed(0x021, base_ptr+0x04); |
| 155 | mb(); |
| 156 | udelay(2); |
| 157 | |
| 158 | writel_relaxed(0x020, base_ptr+0x04); |
| 159 | mb(); |
| 160 | udelay(2); |
| 161 | |
| 162 | writel_relaxed(0x000, base_ptr+0x04); |
| 163 | mb(); |
| 164 | |
| 165 | writel_relaxed(0x080, base_ptr+0x04); |
| 166 | mb(); |
| 167 | iounmap(base_ptr); |
| 168 | return 0; |
| 169 | } |
| 170 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 171 | static int __cpuinit release_from_pen(unsigned int cpu) |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 172 | { |
| 173 | unsigned long timeout; |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 174 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 175 | /* Set preset_lpj to avoid subsequent lpj recalculations */ |
| 176 | preset_lpj = loops_per_jiffy; |
| 177 | |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 178 | /* |
| 179 | * set synchronisation state between this boot processor |
| 180 | * and the secondary one |
| 181 | */ |
| 182 | spin_lock(&boot_lock); |
| 183 | |
| 184 | /* |
| 185 | * The secondary processor is waiting to be released from |
| 186 | * the holding pen - release it, then wait for it to flag |
| 187 | * that it has been released by resetting pen_release. |
| 188 | * |
| 189 | * Note that "pen_release" is the hardware CPU ID, whereas |
| 190 | * "cpu" is Linux's internal ID. |
| 191 | */ |
Stephen Boyd | f5e9082 | 2012-08-08 13:36:15 -0700 | [diff] [blame] | 192 | write_pen_release(cpu_logical_map(cpu)); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 193 | |
| 194 | /* |
| 195 | * Send the secondary CPU a soft interrupt, thereby causing |
| 196 | * the boot monitor to read the system wide flags register, |
| 197 | * and branch to the address found there. |
| 198 | */ |
Russell King | 0f7b332 | 2011-04-03 13:01:30 +0100 | [diff] [blame] | 199 | gic_raise_softirq(cpumask_of(cpu), 1); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 200 | |
| 201 | timeout = jiffies + (1 * HZ); |
| 202 | while (time_before(jiffies, timeout)) { |
| 203 | smp_rmb(); |
| 204 | if (pen_release == -1) |
| 205 | break; |
| 206 | |
| 207 | udelay(10); |
| 208 | } |
| 209 | |
| 210 | /* |
| 211 | * now the secondary core is starting up let it run its |
| 212 | * calibrations, then wait for it to finish |
| 213 | */ |
| 214 | spin_unlock(&boot_lock); |
| 215 | |
| 216 | return pen_release != -1 ? -ENOSYS : 0; |
| 217 | } |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 218 | |
| 219 | DEFINE_PER_CPU(int, cold_boot_done); |
| 220 | |
| 221 | int __cpuinit scorpion_boot_secondary(unsigned int cpu, |
| 222 | struct task_struct *idle) |
| 223 | { |
| 224 | pr_debug("Starting secondary CPU %d\n", cpu); |
| 225 | |
| 226 | if (per_cpu(cold_boot_done, cpu) == false) { |
| 227 | scorpion_release_secondary(); |
| 228 | per_cpu(cold_boot_done, cpu) = true; |
| 229 | } |
| 230 | return release_from_pen(cpu); |
| 231 | } |
| 232 | |
| 233 | int __cpuinit msm8960_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 234 | { |
| 235 | pr_debug("Starting secondary CPU %d\n", cpu); |
| 236 | |
| 237 | if (per_cpu(cold_boot_done, cpu) == false) { |
| 238 | msm8960_release_secondary(0x02088000, cpu); |
| 239 | per_cpu(cold_boot_done, cpu) = true; |
| 240 | } |
| 241 | return release_from_pen(cpu); |
| 242 | } |
| 243 | |
| 244 | int __cpuinit msm8974_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 245 | { |
| 246 | pr_debug("Starting secondary CPU %d\n", cpu); |
| 247 | |
| 248 | if (per_cpu(cold_boot_done, cpu) == false) { |
| 249 | if (machine_is_msm8974_sim() || machine_is_mpq8092_sim()) |
| 250 | release_secondary_sim(0xf9088000, cpu); |
| 251 | else if (machine_is_msm8974_rumi()) |
| 252 | return 0; |
| 253 | else |
| 254 | msm8974_release_secondary(0xf9088000, cpu); |
| 255 | |
| 256 | per_cpu(cold_boot_done, cpu) = true; |
| 257 | } |
| 258 | return release_from_pen(cpu); |
| 259 | } |
| 260 | |
| 261 | int __cpuinit arm_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 262 | { |
| 263 | pr_debug("Starting secondary CPU %d\n", cpu); |
| 264 | |
| 265 | if (per_cpu(cold_boot_done, cpu) == false) { |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame^] | 266 | if (machine_is_msm8226_sim() || machine_is_msm8610_sim()) |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 267 | release_secondary_sim(0xf9088000, cpu); |
| 268 | |
| 269 | per_cpu(cold_boot_done, cpu) = true; |
| 270 | } |
| 271 | return release_from_pen(cpu); |
| 272 | } |
| 273 | |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 274 | /* |
| 275 | * Initialise the CPU possible map early - this describes the CPUs |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 276 | * which may be present or become present in the system. |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 277 | */ |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 278 | static void __init msm_smp_init_cpus(void) |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 279 | { |
Jeff Ohlstein | 41ff445 | 2011-04-07 17:41:09 -0700 | [diff] [blame] | 280 | unsigned int i, ncores = get_core_count(); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 281 | |
Russell King | a06f916 | 2011-10-20 22:04:18 +0100 | [diff] [blame] | 282 | if (ncores > nr_cpu_ids) { |
| 283 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", |
| 284 | ncores, nr_cpu_ids); |
| 285 | ncores = nr_cpu_ids; |
| 286 | } |
| 287 | |
Jeff Ohlstein | 41ff445 | 2011-04-07 17:41:09 -0700 | [diff] [blame] | 288 | for (i = 0; i < ncores; i++) |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 289 | set_cpu_possible(i, true); |
Russell King | 0f7b332 | 2011-04-03 13:01:30 +0100 | [diff] [blame] | 290 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 291 | set_smp_cross_call(gic_raise_softirq); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 292 | } |
| 293 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 294 | static void __init arm_smp_init_cpus(void) |
| 295 | { |
| 296 | unsigned int i, ncores; |
| 297 | |
| 298 | ncores = (__raw_readl(MSM_APCS_GCC_BASE + 0x30)) & 0xF; |
| 299 | |
| 300 | if (ncores > nr_cpu_ids) { |
| 301 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", |
| 302 | ncores, nr_cpu_ids); |
| 303 | ncores = nr_cpu_ids; |
| 304 | } |
| 305 | |
| 306 | for (i = 0; i < ncores; i++) |
| 307 | set_cpu_possible(i, true); |
| 308 | |
| 309 | set_smp_cross_call(gic_raise_softirq); |
| 310 | } |
| 311 | |
Stephen Boyd | 8699b37 | 2012-08-08 15:22:04 -0700 | [diff] [blame] | 312 | static int cold_boot_flags[] __initdata = { |
| 313 | 0, |
| 314 | SCM_FLAG_COLDBOOT_CPU1, |
| 315 | SCM_FLAG_COLDBOOT_CPU2, |
| 316 | SCM_FLAG_COLDBOOT_CPU3, |
| 317 | }; |
| 318 | |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 319 | static void __init msm_platform_smp_prepare_cpus(unsigned int max_cpus) |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 320 | { |
Stephen Boyd | 8699b37 | 2012-08-08 15:22:04 -0700 | [diff] [blame] | 321 | int cpu, map; |
| 322 | unsigned int flags = 0; |
| 323 | |
| 324 | for_each_present_cpu(cpu) { |
| 325 | map = cpu_logical_map(cpu); |
| 326 | if (map > ARRAY_SIZE(cold_boot_flags)) { |
| 327 | set_cpu_present(cpu, false); |
| 328 | __WARN(); |
| 329 | continue; |
| 330 | } |
| 331 | flags |= cold_boot_flags[map]; |
| 332 | } |
| 333 | |
| 334 | if (scm_set_boot_addr(virt_to_phys(msm_secondary_startup), flags)) |
| 335 | pr_warn("Failed to set CPU boot address\n"); |
Jeff Ohlstein | e14411d | 2010-11-30 13:06:36 -0800 | [diff] [blame] | 336 | } |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 337 | |
| 338 | static void __init arm_platform_smp_prepare_cpus(unsigned int max_cpus) |
| 339 | { |
| 340 | void *remap_ptr = ioremap_nocache(0xF9010000, SZ_4K); |
| 341 | if (!remap_ptr) { |
| 342 | pr_err("Failed to ioremap for secondary cores\n"); |
| 343 | return; |
| 344 | } |
| 345 | |
| 346 | /* |
| 347 | * Write the address of secondary startup into boot remapper |
| 348 | * register and enable boot remapping. |
| 349 | */ |
| 350 | __raw_writel((virt_to_phys(msm_secondary_startup)|BOOT_REMAP_ENABLE), |
| 351 | (remap_ptr + 0x4)); |
| 352 | mb(); |
| 353 | iounmap(remap_ptr); |
| 354 | } |
| 355 | |
| 356 | struct smp_operations arm_smp_ops __initdata = { |
| 357 | .smp_init_cpus = arm_smp_init_cpus, |
| 358 | .smp_prepare_cpus = arm_platform_smp_prepare_cpus, |
| 359 | .smp_secondary_init = platform_secondary_init, |
| 360 | .smp_boot_secondary = arm_boot_secondary, |
| 361 | .cpu_kill = platform_cpu_kill, |
| 362 | .cpu_die = platform_cpu_die, |
| 363 | .cpu_disable = platform_cpu_disable |
| 364 | }; |
| 365 | |
| 366 | struct smp_operations msm8974_smp_ops __initdata = { |
| 367 | .smp_init_cpus = msm_smp_init_cpus, |
| 368 | .smp_prepare_cpus = msm_platform_smp_prepare_cpus, |
| 369 | .smp_secondary_init = platform_secondary_init, |
| 370 | .smp_boot_secondary = msm8974_boot_secondary, |
| 371 | .cpu_kill = platform_cpu_kill, |
| 372 | .cpu_die = platform_cpu_die, |
| 373 | .cpu_disable = platform_cpu_disable |
| 374 | }; |
| 375 | |
| 376 | struct smp_operations msm8960_smp_ops __initdata = { |
| 377 | .smp_init_cpus = msm_smp_init_cpus, |
| 378 | .smp_prepare_cpus = msm_platform_smp_prepare_cpus, |
| 379 | .smp_secondary_init = platform_secondary_init, |
| 380 | .smp_boot_secondary = msm8960_boot_secondary, |
| 381 | .cpu_kill = platform_cpu_kill, |
| 382 | .cpu_die = platform_cpu_die, |
| 383 | .cpu_disable = platform_cpu_disable |
| 384 | }; |
| 385 | |
| 386 | struct smp_operations scorpion_smp_ops __initdata = { |
| 387 | .smp_init_cpus = msm_smp_init_cpus, |
| 388 | .smp_prepare_cpus = msm_platform_smp_prepare_cpus, |
| 389 | .smp_secondary_init = platform_secondary_init, |
| 390 | .smp_boot_secondary = scorpion_boot_secondary, |
| 391 | .cpu_kill = platform_cpu_kill, |
| 392 | .cpu_die = platform_cpu_die, |
| 393 | .cpu_disable = platform_cpu_disable |
| 394 | }; |