mtd: nand: omap: Fix comment in platform data using wrong Kconfig symbol
[linux/fpc-iii.git] / arch / arm / plat-versatile / hotplug.c
blobc974958417fe7ccf76bdb1f1d2f051abbece6f3e
1 /*
2 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This hotplug implementation is _specific_ to the situation found on
10 * ARM development platforms where there is _no_ possibility of actually
11 * taking a CPU offline, resetting it, or otherwise. Real platforms must
12 * NOT copy this code.
14 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/smp.h>
18 #include <asm/smp_plat.h>
19 #include <asm/cp15.h>
21 #include <plat/platsmp.h>
23 static inline void versatile_immitation_enter_lowpower(unsigned int actrl_mask)
25 unsigned int v;
27 asm volatile(
28 "mcr p15, 0, %1, c7, c5, 0\n"
29 " mcr p15, 0, %1, c7, c10, 4\n"
31 * Turn off coherency
33 " mrc p15, 0, %0, c1, c0, 1\n"
34 " bic %0, %0, %3\n"
35 " mcr p15, 0, %0, c1, c0, 1\n"
36 " mrc p15, 0, %0, c1, c0, 0\n"
37 " bic %0, %0, %2\n"
38 " mcr p15, 0, %0, c1, c0, 0\n"
39 : "=&r" (v)
40 : "r" (0), "Ir" (CR_C), "Ir" (actrl_mask)
41 : "cc");
44 static inline void versatile_immitation_leave_lowpower(unsigned int actrl_mask)
46 unsigned int v;
48 asm volatile(
49 "mrc p15, 0, %0, c1, c0, 0\n"
50 " orr %0, %0, %1\n"
51 " mcr p15, 0, %0, c1, c0, 0\n"
52 " mrc p15, 0, %0, c1, c0, 1\n"
53 " orr %0, %0, %2\n"
54 " mcr p15, 0, %0, c1, c0, 1\n"
55 : "=&r" (v)
56 : "Ir" (CR_C), "Ir" (actrl_mask)
57 : "cc");
60 static inline void versatile_immitation_do_lowpower(unsigned int cpu, int *spurious)
63 * there is no power-control hardware on this platform, so all
64 * we can do is put the core into WFI; this is safe as the calling
65 * code will have already disabled interrupts.
67 * This code should not be used outside Versatile platforms.
69 for (;;) {
70 wfi();
72 if (versatile_cpu_release == cpu_logical_map(cpu)) {
74 * OK, proper wakeup, we're done
76 break;
80 * Getting here, means that we have come out of WFI without
81 * having been woken up - this shouldn't happen
83 * Just note it happening - when we're woken, we can report
84 * its occurrence.
86 (*spurious)++;
91 * platform-specific code to shutdown a CPU.
92 * This code supports immitation-style CPU hotplug for Versatile/Realview/
93 * Versatile Express platforms that are unable to do real CPU hotplug.
95 void versatile_immitation_cpu_die(unsigned int cpu, unsigned int actrl_mask)
97 int spurious = 0;
99 versatile_immitation_enter_lowpower(actrl_mask);
100 versatile_immitation_do_lowpower(cpu, &spurious);
101 versatile_immitation_leave_lowpower(actrl_mask);
103 if (spurious)
104 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);