Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License as published by the |
| 4 | * Free Software Foundation; either version 2 of the License, or (at your |
| 5 | * option) any later version. |
| 6 | * |
| 7 | * Copyright (C) 1997, 2001 Ralf Baechle |
| 8 | * Copyright 2001 MontaVista Software Inc. |
| 9 | * Author: jsun@mvista.com or jsun@junsun.net |
| 10 | * |
| 11 | * Copyright (C) 2002 Momentum Computer Inc. |
| 12 | * Author: Matthew Dharm <mdharm@momenco.com> |
| 13 | * |
| 14 | * Louis Hamilton, Red Hat, Inc. |
| 15 | * hamilton@redhat.com [MIPS64 modifications] |
| 16 | */ |
| 17 | #include <linux/config.h> |
| 18 | #include <linux/sched.h> |
| 19 | #include <linux/mm.h> |
| 20 | #include <asm/io.h> |
| 21 | #include <asm/pgtable.h> |
| 22 | #include <asm/processor.h> |
| 23 | #include <asm/reboot.h> |
| 24 | #include <asm/system.h> |
| 25 | #include <linux/delay.h> |
| 26 | |
| 27 | void momenco_jaguar_restart(char *command) |
| 28 | { |
| 29 | /* base address of timekeeper portion of part */ |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 30 | #ifdef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | void *nvram = (void*) 0xfffffffffc807000; |
| 32 | #else |
| 33 | void *nvram = (void*) 0xfc807000; |
| 34 | #endif |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 35 | /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | writeb(0x84, nvram + 0xff7); |
| 37 | |
| 38 | /* wait for the watchdog to go off */ |
| 39 | mdelay(100+(1000/16)); |
| 40 | |
| 41 | /* if the watchdog fails for some reason, let people know */ |
| 42 | printk(KERN_NOTICE "Watchdog reset failed\n"); |
| 43 | } |
| 44 | |
| 45 | void momenco_jaguar_halt(void) |
| 46 | { |
| 47 | printk(KERN_NOTICE "\n** You can safely turn off the power\n"); |
| 48 | while (1) |
| 49 | __asm__(".set\tmips3\n\t" |
| 50 | "wait\n\t" |
| 51 | ".set\tmips0"); |
| 52 | } |
| 53 | |
| 54 | void momenco_jaguar_power_off(void) |
| 55 | { |
| 56 | momenco_jaguar_halt(); |
| 57 | } |