Linux-2.6.12-rc2
[linux-2.6/next.git] / arch / mips / gt64120 / momenco_ocelot / reset.c
blob3fd499adf4cfaef257f9d6aa431261b5ad13802c
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.
7 * Copyright (C) 1997, 2001 Ralf Baechle
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
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>
20 void momenco_ocelot_restart(char *command)
22 void *nvram = ioremap_nocache(0x2c807000, 0x1000);
24 if (!nvram) {
25 printk(KERN_NOTICE "ioremap of reset register failed\n");
26 return;
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");
35 void momenco_ocelot_halt(void)
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");
44 void momenco_ocelot_power_off(void)
46 momenco_ocelot_halt();