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 | #include <linux/sched.h> |
| 12 | #include <linux/mm.h> |
| 13 | #include <asm/io.h> |
| 14 | #include <asm/pgtable.h> |
| 15 | #include <asm/processor.h> |
| 16 | #include <asm/reboot.h> |
| 17 | #include <asm/system.h> |
| 18 | #include <linux/delay.h> |
| 19 | |
| 20 | void momenco_ocelot_restart(char *command) |
| 21 | { |
| 22 | void *nvram = ioremap_nocache(0x2c807000, 0x1000); |
| 23 | |
| 24 | if (!nvram) { |
| 25 | printk(KERN_NOTICE "ioremap of reset register failed\n"); |
| 26 | return; |
| 27 | } |
| 28 | writeb(0x84, nvram + 0xff7); /* Ask the NVRAM/RTC/watchdog chip to |
| 29 | assert reset in 1/16 second */ |
| 30 | mdelay(10+(1000/16)); |
| 31 | iounmap(nvram); |
| 32 | printk(KERN_NOTICE "Watchdog reset failed\n"); |
| 33 | } |
| 34 | |
| 35 | void momenco_ocelot_halt(void) |
| 36 | { |
| 37 | printk(KERN_NOTICE "\n** You can safely turn off the power\n"); |
| 38 | while (1) |
| 39 | __asm__(".set\tmips3\n\t" |
| 40 | "wait\n\t" |
| 41 | ".set\tmips0"); |
| 42 | } |
| 43 | |
| 44 | void momenco_ocelot_power_off(void) |
| 45 | { |
| 46 | momenco_ocelot_halt(); |
| 47 | } |