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> |
60063497 | 19 | #include <linux/atomic.h> |
f03c4866 | 20 | #include <asm/pgalloc.h> |
763142d1 | 21 | #include <asm/smp.h> |
e839ca52 | 22 | #include <asm/bl_bit.h> |
1da1180c | 23 | |
3738fa5b | 24 | static void (*sh_idle)(void); |
fbb82b03 | 25 | |
dc775dd8 | 26 | void default_idle(void) |
f533c3d3 | 27 | { |
dc775dd8 | 28 | set_bl_bit(); |
f533c3d3 | 29 | local_irq_enable(); |
dc775dd8 TG |
30 | /* Isn't this racy ? */ |
31 | cpu_sleep(); | |
32 | clear_bl_bit(); | |
f533c3d3 PM |
33 | } |
34 | ||
dc775dd8 | 35 | void arch_cpu_idle_dead(void) |
1da1180c | 36 | { |
dc775dd8 | 37 | play_dead(); |
1da1180c PM |
38 | } |
39 | ||
dc775dd8 | 40 | void arch_cpu_idle(void) |
1da1180c | 41 | { |
f0c5cdb5 | 42 | sh_idle(); |
1da1180c | 43 | } |
2e046b94 | 44 | |
90851c40 | 45 | void __init select_idle_routine(void) |
f533c3d3 PM |
46 | { |
47 | /* | |
48 | * If a platform has set its own idle routine, leave it alone. | |
49 | */ | |
dc775dd8 | 50 | if (!sh_idle) |
3738fa5b | 51 | sh_idle = default_idle; |
f533c3d3 PM |
52 | } |
53 | ||
fbb82b03 PM |
54 | void stop_this_cpu(void *unused) |
55 | { | |
56 | local_irq_disable(); | |
f0ccf277 | 57 | set_cpu_online(smp_processor_id(), false); |
fbb82b03 PM |
58 | |
59 | for (;;) | |
60 | cpu_sleep(); | |
61 | } |