Commit | Line | Data |
---|---|---|
1da1180c PM |
1 | /* |
2 | * The idle loop for all SuperH platforms. | |
3 | * | |
2e046b94 | 4 | * Copyright (C) 2002 - 2009 Paul Mundt |
1da1180c PM |
5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | */ | |
10 | #include <linux/module.h> | |
11 | #include <linux/init.h> | |
12 | #include <linux/mm.h> | |
13 | #include <linux/pm.h> | |
14 | #include <linux/tick.h> | |
15 | #include <linux/preempt.h> | |
16 | #include <linux/thread_info.h> | |
17 | #include <linux/irqflags.h> | |
2e046b94 | 18 | #include <linux/smp.h> |
a0bfa137 | 19 | #include <linux/cpuidle.h> |
60063497 | 20 | #include <linux/atomic.h> |
f03c4866 | 21 | #include <asm/pgalloc.h> |
763142d1 | 22 | #include <asm/smp.h> |
e839ca52 | 23 | #include <asm/bl_bit.h> |
1da1180c | 24 | |
3738fa5b | 25 | static void (*sh_idle)(void); |
fbb82b03 | 26 | |
dc775dd8 | 27 | void default_idle(void) |
f533c3d3 | 28 | { |
dc775dd8 | 29 | set_bl_bit(); |
f533c3d3 | 30 | local_irq_enable(); |
dc775dd8 TG |
31 | /* Isn't this racy ? */ |
32 | cpu_sleep(); | |
33 | clear_bl_bit(); | |
f533c3d3 PM |
34 | } |
35 | ||
dc775dd8 | 36 | void arch_cpu_idle_dead(void) |
1da1180c | 37 | { |
dc775dd8 | 38 | play_dead(); |
1da1180c PM |
39 | } |
40 | ||
dc775dd8 | 41 | void arch_cpu_idle(void) |
1da1180c | 42 | { |
dc775dd8 TG |
43 | if (cpuidle_idle_call()) |
44 | sh_idle(); | |
1da1180c | 45 | } |
2e046b94 | 46 | |
90851c40 | 47 | void __init select_idle_routine(void) |
f533c3d3 PM |
48 | { |
49 | /* | |
50 | * If a platform has set its own idle routine, leave it alone. | |
51 | */ | |
dc775dd8 | 52 | if (!sh_idle) |
3738fa5b | 53 | sh_idle = default_idle; |
f533c3d3 PM |
54 | } |
55 | ||
fbb82b03 PM |
56 | void stop_this_cpu(void *unused) |
57 | { | |
58 | local_irq_disable(); | |
f0ccf277 | 59 | set_cpu_online(smp_processor_id(), false); |
fbb82b03 PM |
60 | |
61 | for (;;) | |
62 | cpu_sleep(); | |
63 | } |