Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | #include <asm/gt64120.h> |
| 43 | |
| 44 | static void mips_machine_restart(char *command); |
| 45 | static void mips_machine_halt(void); |
| 46 | |
| 47 | static void mips_machine_restart(char *command) |
| 48 | { |
| 49 | set_c0_status(ST0_BEV | ST0_ERL); |
| 50 | change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); |
| 51 | flush_cache_all(); |
| 52 | write_c0_wired(0); |
| 53 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); |
| 54 | while (1); |
| 55 | } |
| 56 | |
| 57 | static void mips_machine_halt(void) |
| 58 | { |
| 59 | printk(KERN_NOTICE "You can safely turn off the power\n"); |
| 60 | while (1) |
| 61 | __asm__(".set\tmips3\n\t" |
| 62 | "wait\n\t" |
| 63 | ".set\tmips0"); |
| 64 | } |
| 65 | |
| 66 | void mips_reboot_setup(void) |
| 67 | { |
| 68 | _machine_restart = mips_machine_restart; |
| 69 | _machine_halt = mips_machine_halt; |
| 70 | } |