1/*
2 * BRIEF MODULE DESCRIPTION
3 *	Galileo EV96100 reset routines.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 *         	ppopov@mvista.com or source@mvista.com
8 *
9 * This file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/generic/reset.c
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
14 *
15 *  This program is free software; you can redistribute  it and/or modify it
16 *  under  the terms of  the GNU General  Public License as published by the
17 *  Free Software Foundation;  either version 2 of the  License, or (at your
18 *  option) any later version.
19 *
20 *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
21 *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
22 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
23 *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
24 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
26 *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
28 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 *  You should have received a copy of the  GNU General Public License along
32 *  with this program; if not, write  to the Free Software Foundation, Inc.,
33 *  675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/sched.h>
36#include <linux/mm.h>
37#include <asm/io.h>
38#include <asm/pgtable.h>
39#include <asm/processor.h>
40#include <asm/reboot.h>
41#include <asm/system.h>
42
43#include <asm/reboot.h>
44#include <asm/galileo-boards/ev96100.h>
45
46static void mips_machine_restart(char *command);
47static void mips_machine_halt(void);
48
49static void mips_machine_restart(char *command)
50{
51	set_c0_status(ST0_BEV | ST0_ERL);
52	change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
53	flush_cache_all();
54	write_c0_wired(0);
55	__asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
56	while (1);
57}
58
59static void mips_machine_halt(void)
60{
61	printk(KERN_NOTICE "You can safely turn off the power\n");
62	while (1)
63		__asm__(".set\tmips3\n\t"
64	                "wait\n\t"
65			".set\tmips0");
66}
67
68void mips_reboot_setup(void)
69{
70	_machine_restart = mips_machine_restart;
71	_machine_halt = mips_machine_halt;
72}
73