aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/process.c')
-rw-r--r--arch/sh/kernel/process.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index a4dc2b532e10..9fd1723e6219 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -15,21 +15,18 @@
15#include <linux/unistd.h> 15#include <linux/unistd.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/elfcore.h> 17#include <linux/elfcore.h>
18#include <linux/slab.h>
19#include <linux/a.out.h> 18#include <linux/a.out.h>
19#include <linux/slab.h>
20#include <linux/pm.h>
20#include <linux/ptrace.h> 21#include <linux/ptrace.h>
21#include <linux/platform.h> 22#include <linux/platform.h>
22#include <linux/kallsyms.h> 23#include <linux/kallsyms.h>
24#include <linux/kexec.h>
23 25
24#include <asm/io.h> 26#include <asm/io.h>
25#include <asm/uaccess.h> 27#include <asm/uaccess.h>
26#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
27#include <asm/elf.h> 29#include <asm/elf.h>
28#if defined(CONFIG_SH_HS7751RVOIP)
29#include <asm/hs7751rvoip/hs7751rvoip.h>
30#elif defined(CONFIG_SH_RTS7751R2D)
31#include <asm/rts7751r2d/rts7751r2d.h>
32#endif
33 30
34static int hlt_counter=0; 31static int hlt_counter=0;
35 32
@@ -37,6 +34,11 @@ int ubc_usercnt = 0;
37 34
38#define HARD_IDLE_TIMEOUT (HZ / 3) 35#define HARD_IDLE_TIMEOUT (HZ / 3)
39 36
37void (*pm_idle)(void);
38
39void (*pm_power_off)(void);
40EXPORT_SYMBOL(pm_power_off);
41
40void disable_hlt(void) 42void disable_hlt(void)
41{ 43{
42 hlt_counter++; 44 hlt_counter++;
@@ -51,17 +53,25 @@ void enable_hlt(void)
51 53
52EXPORT_SYMBOL(enable_hlt); 54EXPORT_SYMBOL(enable_hlt);
53 55
56void default_idle(void)
57{
58 if (!hlt_counter)
59 cpu_sleep();
60 else
61 cpu_relax();
62}
63
54void cpu_idle(void) 64void cpu_idle(void)
55{ 65{
56 /* endless idle loop with no priority at all */ 66 /* endless idle loop with no priority at all */
57 while (1) { 67 while (1) {
58 if (hlt_counter) { 68 void (*idle)(void) = pm_idle;
59 while (!need_resched()) 69
60 cpu_relax(); 70 if (!idle)
61 } else { 71 idle = default_idle;
62 while (!need_resched()) 72
63 cpu_sleep(); 73 while (!need_resched())
64 } 74 idle();
65 75
66 preempt_enable_no_resched(); 76 preempt_enable_no_resched();
67 schedule(); 77 schedule();
@@ -88,28 +98,16 @@ void machine_restart(char * __unused)
88 98
89void machine_halt(void) 99void machine_halt(void)
90{ 100{
91#if defined(CONFIG_SH_HS7751RVOIP) 101 local_irq_disable();
92 unsigned short value;
93 102
94 value = ctrl_inw(PA_OUTPORTR);
95 ctrl_outw((value & 0xffdf), PA_OUTPORTR);
96#elif defined(CONFIG_SH_RTS7751R2D)
97 ctrl_outw(0x0001, PA_POWOFF);
98#endif
99 while (1) 103 while (1)
100 cpu_sleep(); 104 cpu_sleep();
101} 105}
102 106
103void machine_power_off(void) 107void machine_power_off(void)
104{ 108{
105#if defined(CONFIG_SH_HS7751RVOIP) 109 if (pm_power_off)
106 unsigned short value; 110 pm_power_off();
107
108 value = ctrl_inw(PA_OUTPORTR);
109 ctrl_outw((value & 0xffdf), PA_OUTPORTR);
110#elif defined(CONFIG_SH_RTS7751R2D)
111 ctrl_outw(0x0001, PA_POWOFF);
112#endif
113} 111}
114 112
115void show_regs(struct pt_regs * regs) 113void show_regs(struct pt_regs * regs)