aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-qcom/platsmp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 16:51:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 16:51:19 -0400
commitdfc25e4503aef6b82a1de4a0fbe19aafa8648fbe (patch)
tree0a4f3a07e2286918298e635186e42726f4658cbd /arch/arm/mach-qcom/platsmp.c
parent9f800363bb0ea459e15bef0928a72c88d374e489 (diff)
parent8f881c67368f82d0e20e1072b50b21132cc2440d (diff)
Merge tag 'cleanup-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Arnd Bergmann: "These cleanup patches are mainly move stuff around and should all be harmless. They are mainly split out so that other branches can be based on top to avoid conflicts. Notable changes are: - We finally remove all mach/timex.h, after CLOCK_TICK_RATE is no longer used (Uwe Kleine-König) - The Qualcomm MSM platform is split out into legacy mach-msm and new-style mach-qcom, to allow easier maintainance of the new hardware support without regressions (Kumar Gala) - A rework of some of the Kconfig logic to simplify multiplatform support (Rob Herring) - Samsung Exynos gets closer to supporting multiplatform (Sachin Kamat and others) - mach-bcm3528 gets merged into mach-bcm (Stephen Warren) - at91 gains some common clock framework support (Alexandre Belloni, Jean-Jacques Hiblot and other French people)" * tag 'cleanup-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (89 commits) ARM: hisi: select HAVE_ARM_SCU only for SMP ARM: efm32: allow uncompress debug output ARM: prima2: build reset code standalone ARM: at91: add PWM clock ARM: at91: move sam9261 SoC to common clk ARM: at91: prepare common clk transition for sam9261 SoC ARM: at91: updated the at91_dt_defconfig with support for the ADS7846 ARM: at91: dt: sam9261: Device Tree support for the at91sam9261ek ARM: at91: dt: defconfig: Added the sam9261 to the list of DT-enabled SOCs ARM: at91: dt: Add at91sam9261 dt SoC support ARM: at91: switch sam9rl to common clock framework ARM: at91/dt: define main clk frequency of at91sam9rlek ARM: at91/dt: define at91sam9rl clocks ARM: at91: prepare common clk transition for sam9rl SoCs ARM: at91: prepare sam9 dt boards transition to common clk ARM: at91: dt: sam9rl: Device Tree for the at91sam9rlek ARM: at91/defconfig: Add the sam9rl to the list of DT-enabled SOCs ARM: at91: Add at91sam9rl DT SoC support ARM: at91: prepare at91sam9rl DT transition ARM: at91/defconfig: refresh at91sam9260_9g20_defconfig ...
Diffstat (limited to 'arch/arm/mach-qcom/platsmp.c')
-rw-r--r--arch/arm/mach-qcom/platsmp.c137
1 files changed, 137 insertions, 0 deletions
diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c
new file mode 100644
index 000000000000..9c53ea70550d
--- /dev/null
+++ b/arch/arm/mach-qcom/platsmp.c
@@ -0,0 +1,137 @@
1/*
2 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
5 * Copyright (c) 2014 The Linux Foundation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/init.h>
13#include <linux/errno.h>
14#include <linux/delay.h>
15#include <linux/device.h>
16#include <linux/smp.h>
17#include <linux/io.h>
18
19#include <asm/cputype.h>
20#include <asm/smp_plat.h>
21
22#include "scm-boot.h"
23
24#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0
25#define SCSS_CPU1CORE_RESET 0xD80
26#define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64
27
28extern void secondary_startup(void);
29
30static DEFINE_SPINLOCK(boot_lock);
31
32#ifdef CONFIG_HOTPLUG_CPU
33static void __ref qcom_cpu_die(unsigned int cpu)
34{
35 wfi();
36}
37#endif
38
39static inline int get_core_count(void)
40{
41 /* 1 + the PART[1:0] field of MIDR */
42 return ((read_cpuid_id() >> 4) & 3) + 1;
43}
44
45static void qcom_secondary_init(unsigned int cpu)
46{
47 /*
48 * Synchronise with the boot thread.
49 */
50 spin_lock(&boot_lock);
51 spin_unlock(&boot_lock);
52}
53
54static void prepare_cold_cpu(unsigned int cpu)
55{
56 int ret;
57 ret = scm_set_boot_addr(virt_to_phys(secondary_startup),
58 SCM_FLAG_COLDBOOT_CPU1);
59 if (ret == 0) {
60 void __iomem *sc1_base_ptr;
61 sc1_base_ptr = ioremap_nocache(0x00902000, SZ_4K*2);
62 if (sc1_base_ptr) {
63 writel(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
64 writel(0, sc1_base_ptr + SCSS_CPU1CORE_RESET);
65 writel(3, sc1_base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP);
66 iounmap(sc1_base_ptr);
67 }
68 } else
69 printk(KERN_DEBUG "Failed to set secondary core boot "
70 "address\n");
71}
72
73static int qcom_boot_secondary(unsigned int cpu, struct task_struct *idle)
74{
75 static int cold_boot_done;
76
77 /* Only need to bring cpu out of reset this way once */
78 if (cold_boot_done == false) {
79 prepare_cold_cpu(cpu);
80 cold_boot_done = true;
81 }
82
83 /*
84 * set synchronisation state between this boot processor
85 * and the secondary one
86 */
87 spin_lock(&boot_lock);
88
89 /*
90 * Send the secondary CPU a soft interrupt, thereby causing
91 * the boot monitor to read the system wide flags register,
92 * and branch to the address found there.
93 */
94 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
95
96 /*
97 * now the secondary core is starting up let it run its
98 * calibrations, then wait for it to finish
99 */
100 spin_unlock(&boot_lock);
101
102 return 0;
103}
104
105/*
106 * Initialise the CPU possible map early - this describes the CPUs
107 * which may be present or become present in the system. The msm8x60
108 * does not support the ARM SCU, so just set the possible cpu mask to
109 * NR_CPUS.
110 */
111static void __init qcom_smp_init_cpus(void)
112{
113 unsigned int i, ncores = get_core_count();
114
115 if (ncores > nr_cpu_ids) {
116 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
117 ncores, nr_cpu_ids);
118 ncores = nr_cpu_ids;
119 }
120
121 for (i = 0; i < ncores; i++)
122 set_cpu_possible(i, true);
123}
124
125static void __init qcom_smp_prepare_cpus(unsigned int max_cpus)
126{
127}
128
129struct smp_operations qcom_smp_ops __initdata = {
130 .smp_init_cpus = qcom_smp_init_cpus,
131 .smp_prepare_cpus = qcom_smp_prepare_cpus,
132 .smp_secondary_init = qcom_secondary_init,
133 .smp_boot_secondary = qcom_boot_secondary,
134#ifdef CONFIG_HOTPLUG_CPU
135 .cpu_die = qcom_cpu_die,
136#endif
137};