aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/pm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 12:38:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 12:38:59 -0500
commit18656782a820f075cb5c168a2e381a8938b1550a (patch)
treedb431928382a8ae2cc6a153ad28e5bb6a8d5d67e /arch/arm/mach-exynos/pm.c
parenta233bb742aed62fc6164073d9835135f639b8828 (diff)
parent6f4554bdff6870c9e0f0b152bbec71d7a0f366f1 (diff)
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson: "These are changes for drivers that are intimately tied to some SoC and for some reason could not get merged through the respective subsystem maintainer tree. This time around, much of this is for at91, with the bulk of it being syscon and udc drivers. Also, there's: - coupled cpuidle support for Samsung Exynos4210 - Renesas 73A0 common-clk work - of/platform changes to tear down DMA mappings on device destruction - a few updates to the TI Keystone knav code" * tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (26 commits) cpuidle: exynos: add coupled cpuidle support for exynos4210 ARM: EXYNOS: apply S5P_CENTRAL_SEQ_OPTION fix only when necessary soc: ti: knav_qmss_queue: change knav_range_setup_acc_irq to static soc: ti: knav_qmss_queue: makefile tweak to build as dynamic module pcmcia: at91_cf: depend on !ARCH_MULTIPLATFORM soc: ti: knav_qmss_queue: export API calls for use by user driver of/platform: teardown DMA mappings on device destruction usb: gadget: at91_udc: Allocate udc instance usb: gadget: at91_udc: Update DT binding documentation usb: gadget: at91_udc: Rework for multi-platform kernel support usb: gadget: at91_udc: Simplify probe and remove functions usb: gadget: at91_udc: Remove non-DT handling code usb: gadget: at91_udc: Document DT clocks and clock-names property usb: gadget: at91_udc: Drop uclk clock usb: gadget: at91_udc: Fix clock names mfd: syscon: Add Atmel SMC binding doc mfd: syscon: Add atmel-smc registers definition mfd: syscon: Add Atmel Matrix bus DT binding documentation mfd: syscon: Add atmel-matrix registers definition clk: shmobile: fix sparse NULL pointer warning ...
Diffstat (limited to 'arch/arm/mach-exynos/pm.c')
-rw-r--r--arch/arm/mach-exynos/pm.c133
1 files changed, 129 insertions, 4 deletions
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index dfc8594e5b1f..e6209dadc00d 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -98,10 +98,6 @@ void exynos_pm_central_suspend(void)
98 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); 98 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
99 tmp &= ~S5P_CENTRAL_LOWPWR_CFG; 99 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
100 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); 100 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
101
102 /* Setting SEQ_OPTION register */
103 pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
104 S5P_CENTRAL_SEQ_OPTION);
105} 101}
106 102
107int exynos_pm_central_resume(void) 103int exynos_pm_central_resume(void)
@@ -165,6 +161,13 @@ void exynos_enter_aftr(void)
165 161
166 exynos_pm_central_suspend(); 162 exynos_pm_central_suspend();
167 163
164 if (of_machine_is_compatible("samsung,exynos4212") ||
165 of_machine_is_compatible("samsung,exynos4412")) {
166 /* Setting SEQ_OPTION register */
167 pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
168 S5P_CENTRAL_SEQ_OPTION);
169 }
170
168 cpu_suspend(0, exynos_aftr_finisher); 171 cpu_suspend(0, exynos_aftr_finisher);
169 172
170 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { 173 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
@@ -177,3 +180,125 @@ void exynos_enter_aftr(void)
177 180
178 cpu_pm_exit(); 181 cpu_pm_exit();
179} 182}
183
184static atomic_t cpu1_wakeup = ATOMIC_INIT(0);
185
186static int exynos_cpu0_enter_aftr(void)
187{
188 int ret = -1;
189
190 /*
191 * If the other cpu is powered on, we have to power it off, because
192 * the AFTR state won't work otherwise
193 */
194 if (cpu_online(1)) {
195 /*
196 * We reach a sync point with the coupled idle state, we know
197 * the other cpu will power down itself or will abort the
198 * sequence, let's wait for one of these to happen
199 */
200 while (exynos_cpu_power_state(1)) {
201 /*
202 * The other cpu may skip idle and boot back
203 * up again
204 */
205 if (atomic_read(&cpu1_wakeup))
206 goto abort;
207
208 /*
209 * The other cpu may bounce through idle and
210 * boot back up again, getting stuck in the
211 * boot rom code
212 */
213 if (__raw_readl(cpu_boot_reg_base()) == 0)
214 goto abort;
215
216 cpu_relax();
217 }
218 }
219
220 exynos_enter_aftr();
221 ret = 0;
222
223abort:
224 if (cpu_online(1)) {
225 /*
226 * Set the boot vector to something non-zero
227 */
228 __raw_writel(virt_to_phys(exynos_cpu_resume),
229 cpu_boot_reg_base());
230 dsb();
231
232 /*
233 * Turn on cpu1 and wait for it to be on
234 */
235 exynos_cpu_power_up(1);
236 while (exynos_cpu_power_state(1) != S5P_CORE_LOCAL_PWR_EN)
237 cpu_relax();
238
239 while (!atomic_read(&cpu1_wakeup)) {
240 /*
241 * Poke cpu1 out of the boot rom
242 */
243 __raw_writel(virt_to_phys(exynos_cpu_resume),
244 cpu_boot_reg_base());
245
246 arch_send_wakeup_ipi_mask(cpumask_of(1));
247 }
248 }
249
250 return ret;
251}
252
253static int exynos_wfi_finisher(unsigned long flags)
254{
255 cpu_do_idle();
256
257 return -1;
258}
259
260static int exynos_cpu1_powerdown(void)
261{
262 int ret = -1;
263
264 /*
265 * Idle sequence for cpu1
266 */
267 if (cpu_pm_enter())
268 goto cpu1_aborted;
269
270 /*
271 * Turn off cpu 1
272 */
273 exynos_cpu_power_down(1);
274
275 ret = cpu_suspend(0, exynos_wfi_finisher);
276
277 cpu_pm_exit();
278
279cpu1_aborted:
280 dsb();
281 /*
282 * Notify cpu 0 that cpu 1 is awake
283 */
284 atomic_set(&cpu1_wakeup, 1);
285
286 return ret;
287}
288
289static void exynos_pre_enter_aftr(void)
290{
291 __raw_writel(virt_to_phys(exynos_cpu_resume), cpu_boot_reg_base());
292}
293
294static void exynos_post_enter_aftr(void)
295{
296 atomic_set(&cpu1_wakeup, 0);
297}
298
299struct cpuidle_exynos_data cpuidle_coupled_exynos_data = {
300 .cpu0_enter_aftr = exynos_cpu0_enter_aftr,
301 .cpu1_powerdown = exynos_cpu1_powerdown,
302 .pre_enter_aftr = exynos_pre_enter_aftr,
303 .post_enter_aftr = exynos_post_enter_aftr,
304};