smc91x: Add missing #inclusion of <linux/irq.h>
[linux-2.6/cjktty.git] / arch / sh / kernel / reboot.c
blobb1fca66bb92eca13b57e2ed6f94cc4ae383cbebd
1 #include <linux/pm.h>
2 #include <linux/kexec.h>
3 #include <linux/kernel.h>
4 #include <linux/reboot.h>
5 #include <linux/module.h>
6 #ifdef CONFIG_SUPERH32
7 #include <asm/watchdog.h>
8 #endif
9 #include <asm/addrspace.h>
10 #include <asm/reboot.h>
11 #include <asm/system.h>
13 void (*pm_power_off)(void);
14 EXPORT_SYMBOL(pm_power_off);
16 #ifdef CONFIG_SUPERH32
17 static void watchdog_trigger_immediate(void)
19 sh_wdt_write_cnt(0xFF);
20 sh_wdt_write_csr(0xC2);
22 #endif
24 static void native_machine_restart(char * __unused)
26 local_irq_disable();
28 /* Address error with SR.BL=1 first. */
29 trigger_address_error();
31 #ifdef CONFIG_SUPERH32
32 /* If that fails or is unsupported, go for the watchdog next. */
33 watchdog_trigger_immediate();
34 #endif
37 * Give up and sleep.
39 while (1)
40 cpu_sleep();
43 static void native_machine_shutdown(void)
45 smp_send_stop();
48 static void native_machine_power_off(void)
50 if (pm_power_off)
51 pm_power_off();
54 static void native_machine_halt(void)
56 /* stop other cpus */
57 machine_shutdown();
59 /* stop this cpu */
60 stop_this_cpu(NULL);
63 struct machine_ops machine_ops = {
64 .power_off = native_machine_power_off,
65 .shutdown = native_machine_shutdown,
66 .restart = native_machine_restart,
67 .halt = native_machine_halt,
68 #ifdef CONFIG_KEXEC
69 .crash_shutdown = native_machine_crash_shutdown,
70 #endif
73 void machine_power_off(void)
75 machine_ops.power_off();
78 void machine_shutdown(void)
80 machine_ops.shutdown();
83 void machine_restart(char *cmd)
85 machine_ops.restart(cmd);
88 void machine_halt(void)
90 machine_ops.halt();
93 #ifdef CONFIG_KEXEC
94 void machine_crash_shutdown(struct pt_regs *regs)
96 machine_ops.crash_shutdown(regs);
98 #endif