diff options
Diffstat (limited to 'arch/mips/cobalt/reset.c')
-rw-r--r-- | arch/mips/cobalt/reset.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c index 43cca21fdbc0..71eb4ccc4bc1 100644 --- a/arch/mips/cobalt/reset.c +++ b/arch/mips/cobalt/reset.c | |||
@@ -8,36 +8,46 @@ | |||
8 | * Copyright (C) 1995, 1996, 1997 by Ralf Baechle | 8 | * Copyright (C) 1995, 1996, 1997 by Ralf Baechle |
9 | * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) | 9 | * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) |
10 | */ | 10 | */ |
11 | #include <linux/init.h> | ||
12 | #include <linux/io.h> | ||
11 | #include <linux/jiffies.h> | 13 | #include <linux/jiffies.h> |
12 | 14 | #include <linux/leds.h> | |
13 | #include <asm/io.h> | ||
14 | #include <asm/reboot.h> | ||
15 | 15 | ||
16 | #include <cobalt.h> | 16 | #include <cobalt.h> |
17 | 17 | ||
18 | #define RESET_PORT ((void __iomem *)CKSEG1ADDR(0x1c000000)) | ||
19 | #define RESET 0x0f | ||
20 | |||
21 | DEFINE_LED_TRIGGER(power_off_led_trigger); | ||
22 | |||
23 | static int __init ledtrig_power_off_init(void) | ||
24 | { | ||
25 | led_trigger_register_simple("power-off", &power_off_led_trigger); | ||
26 | return 0; | ||
27 | } | ||
28 | device_initcall(ledtrig_power_off_init); | ||
29 | |||
18 | void cobalt_machine_halt(void) | 30 | void cobalt_machine_halt(void) |
19 | { | 31 | { |
20 | int state, last, diff; | 32 | int state, last, diff; |
21 | unsigned long mark; | 33 | unsigned long mark; |
22 | 34 | ||
23 | /* | 35 | /* |
24 | * turn off bar on Qube, flash power off LED on RaQ (0.5Hz) | 36 | * turn on power off LED on RaQ |
25 | * | 37 | * |
26 | * restart if ENTER and SELECT are pressed | 38 | * restart if ENTER and SELECT are pressed |
27 | */ | 39 | */ |
28 | 40 | ||
29 | last = COBALT_KEY_PORT; | 41 | last = COBALT_KEY_PORT; |
30 | 42 | ||
31 | for (state = 0;;) { | 43 | led_trigger_event(power_off_led_trigger, LED_FULL); |
32 | |||
33 | state ^= COBALT_LED_POWER_OFF; | ||
34 | COBALT_LED_PORT = state; | ||
35 | 44 | ||
45 | for (state = 0;;) { | ||
36 | diff = COBALT_KEY_PORT ^ last; | 46 | diff = COBALT_KEY_PORT ^ last; |
37 | last ^= diff; | 47 | last ^= diff; |
38 | 48 | ||
39 | if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) | 49 | if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) |
40 | COBALT_LED_PORT = COBALT_LED_RESET; | 50 | writeb(RESET, RESET_PORT); |
41 | 51 | ||
42 | for (mark = jiffies; jiffies - mark < HZ;) | 52 | for (mark = jiffies; jiffies - mark < HZ;) |
43 | ; | 53 | ; |
@@ -46,17 +56,8 @@ void cobalt_machine_halt(void) | |||
46 | 56 | ||
47 | void cobalt_machine_restart(char *command) | 57 | void cobalt_machine_restart(char *command) |
48 | { | 58 | { |
49 | COBALT_LED_PORT = COBALT_LED_RESET; | 59 | writeb(RESET, RESET_PORT); |
50 | 60 | ||
51 | /* we should never get here */ | 61 | /* we should never get here */ |
52 | cobalt_machine_halt(); | 62 | cobalt_machine_halt(); |
53 | } | 63 | } |
54 | |||
55 | /* | ||
56 | * This triggers the luser mode device driver for the power switch ;-) | ||
57 | */ | ||
58 | void cobalt_machine_power_off(void) | ||
59 | { | ||
60 | printk("You can switch the machine off now.\n"); | ||
61 | cobalt_machine_halt(); | ||
62 | } | ||