Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck...
[deliverable/linux.git] / arch / arm / mach-exynos / hotplug.c
CommitLineData
7d30e8b3 1/* linux arch/arm/mach-exynos4/hotplug.c
11adcc29
CY
2 *
3 * Cloned from linux/arch/arm/mach-realview/hotplug.c
4 *
5 * Copyright (C) 2002 ARM Ltd.
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/smp.h>
911c29b0 16#include <linux/io.h>
11adcc29
CY
17
18#include <asm/cacheflush.h>
15d07dc9 19#include <asm/cp15.h>
eb50439b 20#include <asm/smp_plat.h>
11adcc29 21
06853ae4 22#include "common.h"
65c9a853 23#include "regs-pmu.h"
06853ae4 24
11adcc29
CY
25static inline void cpu_leave_lowpower(void)
26{
27 unsigned int v;
28
29 asm volatile(
30 "mrc p15, 0, %0, c1, c0, 0\n"
e3d9c625 31 " orr %0, %0, %1\n"
11adcc29
CY
32 " mcr p15, 0, %0, c1, c0, 0\n"
33 " mrc p15, 0, %0, c1, c0, 1\n"
ad849a22 34 " orr %0, %0, %2\n"
11adcc29
CY
35 " mcr p15, 0, %0, c1, c0, 1\n"
36 : "=&r" (v)
ad849a22 37 : "Ir" (CR_C), "Ir" (0x40)
11adcc29
CY
38 : "cc");
39}
40
d4450261 41static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
11adcc29 42{
11adcc29 43 for (;;) {
911c29b0
JM
44
45 /* make cpu1 to be turned off at next WFI command */
46 if (cpu == 1)
664ba443 47 exynos_cpu_power_down(cpu);
911c29b0 48
b92ad209 49 wfi();
11adcc29 50
2f41c36b 51 if (pen_release == cpu_logical_map(cpu)) {
11adcc29
CY
52 /*
53 * OK, proper wakeup, we're done
54 */
55 break;
56 }
57
58 /*
d4450261 59 * Getting here, means that we have come out of WFI without
11adcc29
CY
60 * having been woken up - this shouldn't happen
61 *
d4450261
RK
62 * Just note it happening - when we're woken, we can report
63 * its occurrence.
11adcc29 64 */
d4450261 65 (*spurious)++;
11adcc29
CY
66 }
67}
68
11adcc29
CY
69/*
70 * platform-specific code to shutdown a CPU
71 *
72 * Called with IRQs disabled
73 */
06853ae4 74void __ref exynos_cpu_die(unsigned int cpu)
11adcc29 75{
d4450261
RK
76 int spurious = 0;
77
75ad2ab2 78 v7_exit_coherency_flush(louis);
756e46db 79
d4450261 80 platform_do_lowpower(cpu, &spurious);
11adcc29
CY
81
82 /*
83 * bring this CPU back into the world of cache
84 * coherency, and then restore interrupts
85 */
86 cpu_leave_lowpower();
d4450261
RK
87
88 if (spurious)
89 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
11adcc29 90}
This page took 0.220453 seconds and 5 git commands to generate.