diff options
author | Jonas Bonn <jonas@southpole.se> | 2011-06-04 15:28:42 -0400 |
---|---|---|
committer | Jonas Bonn <jonas@southpole.se> | 2011-07-22 12:46:35 -0400 |
commit | 2a7be1160a7ccc8b53693ef793fccb4ad2e75bbc (patch) | |
tree | 9a5e78cf0884951ed17bf62ca292a106205f9e5e /arch/openrisc/kernel/idle.c | |
parent | 09abb90107202d3b18cf5a69076a1d05d11244e6 (diff) |
OpenRISC: Idle/Power management
Minimal functionality...
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/openrisc/kernel/idle.c')
-rw-r--r-- | arch/openrisc/kernel/idle.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c new file mode 100644 index 000000000000..d5bc5f813e89 --- /dev/null +++ b/arch/openrisc/kernel/idle.c | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * OpenRISC idle.c | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * Modifications for the OpenRISC architecture: | ||
9 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
10 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * Idle daemon for or32. Idle daemon will handle any action | ||
18 | * that needs to be taken when the system becomes idle. | ||
19 | */ | ||
20 | |||
21 | #include <linux/errno.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/smp.h> | ||
26 | #include <linux/stddef.h> | ||
27 | #include <linux/unistd.h> | ||
28 | #include <linux/ptrace.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/tick.h> | ||
31 | |||
32 | #include <asm/pgtable.h> | ||
33 | #include <asm/uaccess.h> | ||
34 | #include <asm/system.h> | ||
35 | #include <asm/io.h> | ||
36 | #include <asm/processor.h> | ||
37 | #include <asm/mmu.h> | ||
38 | #include <asm/cache.h> | ||
39 | #include <asm/pgalloc.h> | ||
40 | |||
41 | void (*powersave) (void) = NULL; | ||
42 | |||
43 | static inline void pm_idle(void) | ||
44 | { | ||
45 | barrier(); | ||
46 | } | ||
47 | |||
48 | void cpu_idle(void) | ||
49 | { | ||
50 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
51 | |||
52 | /* endless idle loop with no priority at all */ | ||
53 | while (1) { | ||
54 | tick_nohz_stop_sched_tick(1); | ||
55 | |||
56 | while (!need_resched()) { | ||
57 | check_pgt_cache(); | ||
58 | rmb(); | ||
59 | |||
60 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
61 | |||
62 | local_irq_disable(); | ||
63 | /* Don't trace irqs off for idle */ | ||
64 | stop_critical_timings(); | ||
65 | if (!need_resched() && powersave != NULL) | ||
66 | powersave(); | ||
67 | start_critical_timings(); | ||
68 | local_irq_enable(); | ||
69 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
70 | } | ||
71 | |||
72 | tick_nohz_restart_sched_tick(); | ||
73 | preempt_enable_no_resched(); | ||
74 | schedule(); | ||
75 | preempt_disable(); | ||
76 | } | ||
77 | } | ||