import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / lasat / reset.c
1 /* 
2  *
3  * Thomas Horsten <thh@lasat.com>
4  * Copyright (C) 2000 LASAT Networks A/S.
5  *
6  * ########################################################################
7  *
8  *  This program is free software; you can distribute it and/or modify it
9  *  under the terms of the GNU General Public License (Version 2) as
10  *  published by the Free Software Foundation.
11  *
12  *  This program is distributed in the hope it will be useful, but WITHOUT
13  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  *  for more details.
16  *
17  *  You should have received a copy of the GNU General Public License along
18  *  with this program; if not, write to the Free Software Foundation, Inc.,
19  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20  *
21  * ########################################################################
22  *
23  * Reset the LASAT board.
24  *
25  */
26
27 #include <linux/kernel.h>
28 #include <asm/reboot.h>
29 #include <asm/system.h>
30 #include <asm/lasat/lasat.h>
31 #include "picvue.h"
32 #include "prom.h"
33
34 static void lasat_machine_restart(char *command);
35 static void lasat_machine_halt(void);
36
37 /* Used to set machine to boot in service mode via /proc interface */
38 int lasat_boot_to_service = 0;
39
40 static void lasat_machine_restart(char *command)
41 {
42         local_irq_disable();
43
44         if (lasat_boot_to_service) {
45                 printk("machine_restart: Rebooting to service mode\n");
46                 *(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
47                 *(volatile unsigned int *)0xa00000fc = 0xfedeabba;
48         }
49         *lasat_misc->reset_reg = 0xbedead;
50         for (;;) ;
51 }
52
53 #define MESSAGE "System halted"
54 static void lasat_machine_halt(void)
55 {
56         local_irq_disable();
57
58         /* Disable interrupts and loop forever */
59         printk(KERN_NOTICE MESSAGE "\n");
60 #ifdef CONFIG_PICVUE
61         pvc_clear();
62         pvc_write_string(MESSAGE, 0, 0);
63 #endif
64         prom_monitor();
65         for (;;) ;
66 }
67
68 void lasat_reboot_setup(void)
69 {
70         _machine_restart = lasat_machine_restart;
71         _machine_halt = lasat_machine_halt;
72         _machine_power_off = lasat_machine_halt;
73 }