diff options
Diffstat (limited to 'arch/mips/cobalt/reset.c')
| -rw-r--r-- | arch/mips/cobalt/reset.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c index 084c8e59f42c..805a0e88507b 100644 --- a/arch/mips/cobalt/reset.c +++ b/arch/mips/cobalt/reset.c | |||
| @@ -16,48 +16,45 @@ | |||
| 16 | #include <asm/reboot.h> | 16 | #include <asm/reboot.h> |
| 17 | #include <asm/system.h> | 17 | #include <asm/system.h> |
| 18 | #include <asm/mipsregs.h> | 18 | #include <asm/mipsregs.h> |
| 19 | #include <asm/cobalt/cobalt.h> | ||
| 19 | 20 | ||
| 20 | void cobalt_machine_restart(char *command) | 21 | void cobalt_machine_halt(void) |
| 21 | { | 22 | { |
| 22 | *(volatile char *)0xbc000000 = 0x0f; | 23 | int state, last, diff; |
| 24 | unsigned long mark; | ||
| 23 | 25 | ||
| 24 | /* | 26 | /* |
| 25 | * Ouch, we're still alive ... This time we take the silver bullet ... | 27 | * turn off bar on Qube, flash power off LED on RaQ (0.5Hz) |
| 26 | * ... and find that we leave the hardware in a state in which the | 28 | * |
| 27 | * kernel in the flush locks up somewhen during of after the PCI | 29 | * restart if ENTER and SELECT are pressed |
| 28 | * detection stuff. | ||
| 29 | */ | 30 | */ |
| 30 | set_c0_status(ST0_BEV | ST0_ERL); | ||
| 31 | change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); | ||
| 32 | flush_cache_all(); | ||
| 33 | write_c0_wired(0); | ||
| 34 | __asm__ __volatile__( | ||
| 35 | "jr\t%0" | ||
| 36 | : | ||
| 37 | : "r" (0xbfc00000)); | ||
| 38 | } | ||
| 39 | 31 | ||
| 40 | extern int led_state; | 32 | last = COBALT_KEY_PORT; |
| 41 | #define kLED 0xBC000000 | ||
| 42 | #define LEDSet(x) (*(volatile unsigned char *) kLED) = (( unsigned char)x) | ||
| 43 | 33 | ||
| 44 | void cobalt_machine_halt(void) | 34 | for (state = 0;;) { |
| 45 | { | 35 | |
| 46 | int mark; | 36 | state ^= COBALT_LED_POWER_OFF; |
| 37 | COBALT_LED_PORT = state; | ||
| 38 | |||
| 39 | diff = COBALT_KEY_PORT ^ last; | ||
| 40 | last ^= diff; | ||
| 47 | 41 | ||
| 48 | /* Blink our cute? little LED (number 3)... */ | 42 | if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) |
| 49 | while (1) { | 43 | COBALT_LED_PORT = COBALT_LED_RESET; |
| 50 | led_state = led_state | ( 1 << 3 ); | 44 | |
| 51 | LEDSet(led_state); | 45 | for (mark = jiffies; jiffies - mark < HZ;) |
| 52 | mark = jiffies; | 46 | ; |
| 53 | while (jiffies<(mark+HZ)); | ||
| 54 | led_state = led_state & ~( 1 << 3 ); | ||
| 55 | LEDSet(led_state); | ||
| 56 | mark = jiffies; | ||
| 57 | while (jiffies<(mark+HZ)); | ||
| 58 | } | 47 | } |
| 59 | } | 48 | } |
| 60 | 49 | ||
| 50 | void cobalt_machine_restart(char *command) | ||
| 51 | { | ||
| 52 | COBALT_LED_PORT = COBALT_LED_RESET; | ||
| 53 | |||
| 54 | /* we should never get here */ | ||
| 55 | cobalt_machine_halt(); | ||
| 56 | } | ||
| 57 | |||
| 61 | /* | 58 | /* |
| 62 | * This triggers the luser mode device driver for the power switch ;-) | 59 | * This triggers the luser mode device driver for the power switch ;-) |
| 63 | */ | 60 | */ |
