12 #include <linux/kernel.h>
13 #include <linux/sched.h>
20 #include <asm/addrspace.h>
22 #include <asm/reboot.h>
28 #define POWERDOWN_TIMEOUT 120
32 #define POWERDOWN_FREQ (HZ / 4)
33 #define PANIC_FREQ (HZ / 8)
35 static struct timer_list power_timer, blink_timer, debounce_timer;
36 static int has_panicked, shuting_down;
39 static void ip32_machine_halt(
void)
__attribute__((noreturn));
40 static
void ip32_machine_power_off(
void)
__attribute__((noreturn));
42 static
void ip32_machine_restart(
char *
cmd)
48 static inline void ip32_machine_halt(
void)
50 ip32_machine_power_off();
53 static void ip32_machine_power_off(
void)
55 unsigned char reg_a, xctrl_a, xctrl_b;
79 static void power_timeout(
unsigned long data)
81 ip32_machine_power_off();
84 static void blink_timeout(
unsigned long data)
91 static void debounce(
unsigned long data)
93 unsigned char reg_a, reg_c, xctrl_a;
102 debounce_timer.expires =
jiffies + 50;
113 ip32_machine_restart(
NULL);
118 static inline void ip32_power_button(
void)
123 if (shuting_down || kill_cad_pid(
SIGINT, 1)) {
125 ip32_machine_power_off();
133 power_timer.function = power_timeout;
143 if (!(reg_c & RTC_IRQF)) {
145 "%s: RTC IRQ without RTC_IRQF\n", __func__);
150 debounce_timer.function = debounce;
151 debounce_timer.expires =
jiffies + 50;
179 .notifier_call = panic_event,
182 static __init int ip32_reboot_setup(
void)
185 unsigned long led =
mace->perif.ctrl.misc;
195 blink_timer.function = blink_timeout;
199 panic(
"Can't allocate MACEISA RTC IRQ");