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
33static void lasat_machine_restart(char *command);
34static void lasat_machine_halt(void);
35
36/* Used to set machine to boot in service mode via /proc interface */
37int lasat_boot_to_service = 0;
38
39static void lasat_machine_restart(char *command)
40{
41	cli();
42
43	{
44		volatile unsigned int *softres_reg = lasat_misc->reset_reg;
45
46		if (lasat_boot_to_service) {
47			printk("machine_restart: Rebooting to service mode\n");
48			*(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
49			*(volatile unsigned int *)0xa00000fc = 0xfedeabba;
50		}
51		*softres_reg = 0xbedead;
52	}
53	for (;;) ;
54}
55
56#define MESSAGE "System halted"
57static void lasat_machine_halt(void)
58{
59	/* Disable interrupts and loop forever */
60	printk(KERN_NOTICE MESSAGE "\n");
61#ifdef CONFIG_PICVUE
62	pvc_clear();
63	pvc_write_string(MESSAGE, 0, 0);
64#endif
65	cli();
66	for (;;) ;
67}
68
69void lasat_reboot_setup(void)
70{
71	_machine_restart = lasat_machine_restart;
72	_machine_halt = lasat_machine_halt;
73	_machine_power_off = lasat_machine_halt;
74}
75