]>
Commit | Line | Data |
---|---|---|
5933f6d2 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da1180c PM |
2 | /* |
3 | * The idle loop for all SuperH platforms. | |
4 | * | |
2e046b94 | 5 | * Copyright (C) 2002 - 2009 Paul Mundt |
1da1180c PM |
6 | */ |
7 | #include <linux/module.h> | |
8 | #include <linux/init.h> | |
9 | #include <linux/mm.h> | |
10 | #include <linux/pm.h> | |
11 | #include <linux/tick.h> | |
12 | #include <linux/preempt.h> | |
13 | #include <linux/thread_info.h> | |
14 | #include <linux/irqflags.h> | |
2e046b94 | 15 | #include <linux/smp.h> |
60063497 | 16 | #include <linux/atomic.h> |
763142d1 | 17 | #include <asm/smp.h> |
e839ca52 | 18 | #include <asm/bl_bit.h> |
1da1180c | 19 | |
3738fa5b | 20 | static void (*sh_idle)(void); |
fbb82b03 | 21 | |
dc775dd8 | 22 | void default_idle(void) |
f533c3d3 | 23 | { |
dc775dd8 | 24 | set_bl_bit(); |
f533c3d3 | 25 | local_irq_enable(); |
dc775dd8 TG |
26 | /* Isn't this racy ? */ |
27 | cpu_sleep(); | |
28 | clear_bl_bit(); | |
f533c3d3 PM |
29 | } |
30 | ||
dc775dd8 | 31 | void arch_cpu_idle_dead(void) |
1da1180c | 32 | { |
dc775dd8 | 33 | play_dead(); |
1da1180c PM |
34 | } |
35 | ||
dc775dd8 | 36 | void arch_cpu_idle(void) |
1da1180c | 37 | { |
f0c5cdb5 | 38 | sh_idle(); |
1da1180c | 39 | } |
2e046b94 | 40 | |
90851c40 | 41 | void __init select_idle_routine(void) |
f533c3d3 PM |
42 | { |
43 | /* | |
44 | * If a platform has set its own idle routine, leave it alone. | |
45 | */ | |
dc775dd8 | 46 | if (!sh_idle) |
3738fa5b | 47 | sh_idle = default_idle; |
f533c3d3 PM |
48 | } |
49 | ||
fbb82b03 PM |
50 | void stop_this_cpu(void *unused) |
51 | { | |
52 | local_irq_disable(); | |
f0ccf277 | 53 | set_cpu_online(smp_processor_id(), false); |
fbb82b03 PM |
54 | |
55 | for (;;) | |
56 | cpu_sleep(); | |
57 | } |