1 /* 2 * Cobalt Reset operations 3 * 4 * This file is subject to the terms and conditions of the GNU General Public 5 * License. See the file "COPYING" in the main directory of this archive 6 * for more details. 7 * 8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle 9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) 10 * 11 */ 12 #include <linux/sched.h> 13 #include <linux/mm.h> 14 #include <asm/io.h> 15 #include <asm/pgtable.h> 16 #include <asm/processor.h> 17 #include <asm/reboot.h> 18 #include <asm/system.h> 19 #include <asm/mipsregs.h> 20 cobalt_machine_restart(char * command)21void cobalt_machine_restart(char *command) 22 { 23 *(volatile char *)0xbc000000 = 0x0f; 24 25 /* 26 * Ouch, we're still alive ... This time we take the silver bullet ... 27 * ... and find that we leave the hardware in a state in which the 28 * kernel in the flush locks up somewhen during of after the PCI 29 * detection stuff. 30 */ 31 set_c0_status(ST0_BEV | ST0_ERL); 32 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); 33 flush_cache_all(); 34 write_c0_wired(0); 35 __asm__ __volatile__( 36 "jr\t%0" 37 : 38 : "r" (0xbfc00000)); 39 } 40 41 extern int led_state; 42 #define kLED 0xBC000000 43 #define LEDSet(x) (*(volatile unsigned char *) kLED) = (( unsigned char)x) 44 cobalt_machine_halt(void)45void cobalt_machine_halt(void) 46 { 47 int mark; 48 49 /* Blink our cute? little LED (number 3)... */ 50 while (1) { 51 led_state = led_state | ( 1 << 3 ); 52 LEDSet(led_state); 53 mark = jiffies; 54 while (jiffies<(mark+HZ)); 55 led_state = led_state & ~( 1 << 3 ); 56 LEDSet(led_state); 57 mark = jiffies; 58 while (jiffies<(mark+HZ)); 59 } 60 } 61 62 /* 63 * This triggers the luser mode device driver for the power switch ;-) 64 */ cobalt_machine_power_off(void)65void cobalt_machine_power_off(void) 66 { 67 printk("You can switch the machine off now.\n"); 68 cobalt_machine_halt(); 69 } 70