ipq806x: Add support for IPQ806x chip family
[openwrt/staging/wigyori.git] / target / linux / ipq806x / patches / 0002-ARM-msm-Remove-pen_release-usage.patch
1 From 18d53dfa103e63154fb8e548d55016d6ad210d28 Mon Sep 17 00:00:00 2001
2 From: Rohit Vaswani <rvaswani@codeaurora.org>
3 Date: Fri, 21 Jun 2013 12:17:37 -0700
4 Subject: [PATCH 002/182] ARM: msm: Remove pen_release usage
5
6 pen_release is no longer required as the synchronization
7 is now managed by generic arm code.
8 This is done as suggested in https://lkml.org/lkml/2013/6/4/184
9
10 Cc: Russell King <linux@arm.linux.org.uk>
11 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
12 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
13 Signed-off-by: Kumar Gala <galak@codeaurora.org>
14 ---
15 arch/arm/mach-msm/Makefile | 2 +-
16 arch/arm/mach-msm/headsmp.S | 39 ---------------------------------------
17 arch/arm/mach-msm/hotplug.c | 31 ++++---------------------------
18 arch/arm/mach-msm/platsmp.c | 37 +++----------------------------------
19 4 files changed, 8 insertions(+), 101 deletions(-)
20 delete mode 100644 arch/arm/mach-msm/headsmp.S
21
22 diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
23 index 8e307a1..721f27f 100644
24 --- a/arch/arm/mach-msm/Makefile
25 +++ b/arch/arm/mach-msm/Makefile
26 @@ -19,7 +19,7 @@ obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
27 CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
28
29 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
30 -obj-$(CONFIG_SMP) += headsmp.o platsmp.o
31 +obj-$(CONFIG_SMP) += platsmp.o
32
33 obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o
34 obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o
35 diff --git a/arch/arm/mach-msm/headsmp.S b/arch/arm/mach-msm/headsmp.S
36 deleted file mode 100644
37 index 6c62c3f..0000000
38 --- a/arch/arm/mach-msm/headsmp.S
39 +++ /dev/null
40 @@ -1,39 +0,0 @@
41 -/*
42 - * linux/arch/arm/mach-realview/headsmp.S
43 - *
44 - * Copyright (c) 2003 ARM Limited
45 - * All Rights Reserved
46 - *
47 - * This program is free software; you can redistribute it and/or modify
48 - * it under the terms of the GNU General Public License version 2 as
49 - * published by the Free Software Foundation.
50 - */
51 -#include <linux/linkage.h>
52 -#include <linux/init.h>
53 -
54 -/*
55 - * MSM specific entry point for secondary CPUs. This provides
56 - * a "holding pen" into which all secondary cores are held until we're
57 - * ready for them to initialise.
58 - */
59 -ENTRY(msm_secondary_startup)
60 - mrc p15, 0, r0, c0, c0, 5
61 - and r0, r0, #15
62 - adr r4, 1f
63 - ldmia r4, {r5, r6}
64 - sub r4, r4, r5
65 - add r6, r6, r4
66 -pen: ldr r7, [r6]
67 - cmp r7, r0
68 - bne pen
69 -
70 - /*
71 - * we've been released from the holding pen: secondary_stack
72 - * should now contain the SVC stack for this core
73 - */
74 - b secondary_startup
75 -ENDPROC(msm_secondary_startup)
76 -
77 - .align
78 -1: .long .
79 - .long pen_release
80 diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
81 index 326a872..cea80fc 100644
82 --- a/arch/arm/mach-msm/hotplug.c
83 +++ b/arch/arm/mach-msm/hotplug.c
84 @@ -24,33 +24,10 @@ static inline void cpu_leave_lowpower(void)
85
86 static inline void platform_do_lowpower(unsigned int cpu)
87 {
88 - /* Just enter wfi for now. TODO: Properly shut off the cpu. */
89 - for (;;) {
90 - /*
91 - * here's the WFI
92 - */
93 - asm("wfi"
94 - :
95 - :
96 - : "memory", "cc");
97 -
98 - if (pen_release == cpu_logical_map(cpu)) {
99 - /*
100 - * OK, proper wakeup, we're done
101 - */
102 - break;
103 - }
104 -
105 - /*
106 - * getting here, means that we have come out of WFI without
107 - * having been woken up - this shouldn't happen
108 - *
109 - * The trouble is, letting people know about this is not really
110 - * possible, since we are currently running incoherently, and
111 - * therefore cannot safely call printk() or anything else
112 - */
113 - pr_debug("CPU%u: spurious wakeup call\n", cpu);
114 - }
115 + asm("wfi"
116 + :
117 + :
118 + : "memory", "cc");
119 }
120
121 /*
122 diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
123 index f10a1f5..3721b31 100644
124 --- a/arch/arm/mach-msm/platsmp.c
125 +++ b/arch/arm/mach-msm/platsmp.c
126 @@ -12,13 +12,10 @@
127 #include <linux/errno.h>
128 #include <linux/delay.h>
129 #include <linux/device.h>
130 -#include <linux/jiffies.h>
131 #include <linux/smp.h>
132 #include <linux/io.h>
133
134 -#include <asm/cacheflush.h>
135 #include <asm/cputype.h>
136 -#include <asm/mach-types.h>
137 #include <asm/smp_plat.h>
138
139 #include "scm-boot.h"
140 @@ -28,7 +25,7 @@
141 #define SCSS_CPU1CORE_RESET 0xD80
142 #define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64
143
144 -extern void msm_secondary_startup(void);
145 +extern void secondary_startup(void);
146
147 static DEFINE_SPINLOCK(boot_lock);
148
149 @@ -41,13 +38,6 @@ static inline int get_core_count(void)
150 static void msm_secondary_init(unsigned int cpu)
151 {
152 /*
153 - * let the primary processor know we're out of the
154 - * pen, then head off into the C entry point
155 - */
156 - pen_release = -1;
157 - smp_wmb();
158 -
159 - /*
160 * Synchronise with the boot thread.
161 */
162 spin_lock(&boot_lock);
163 @@ -57,7 +47,7 @@ static void msm_secondary_init(unsigned int cpu)
164 static void prepare_cold_cpu(unsigned int cpu)
165 {
166 int ret;
167 - ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup),
168 + ret = scm_set_boot_addr(virt_to_phys(secondary_startup),
169 SCM_FLAG_COLDBOOT_CPU1);
170 if (ret == 0) {
171 void __iomem *sc1_base_ptr;
172 @@ -75,7 +65,6 @@ static void prepare_cold_cpu(unsigned int cpu)
173
174 static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
175 {
176 - unsigned long timeout;
177 static int cold_boot_done;
178
179 /* Only need to bring cpu out of reset this way once */
180 @@ -91,39 +80,19 @@ static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
181 spin_lock(&boot_lock);
182
183 /*
184 - * The secondary processor is waiting to be released from
185 - * the holding pen - release it, then wait for it to flag
186 - * that it has been released by resetting pen_release.
187 - *
188 - * Note that "pen_release" is the hardware CPU ID, whereas
189 - * "cpu" is Linux's internal ID.
190 - */
191 - pen_release = cpu_logical_map(cpu);
192 - sync_cache_w(&pen_release);
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 */
199 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
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 + return 0;
218 }
219
220 /*
221 --
222 1.7.10.4
223