change danube 2 ifxmips
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / files / arch / mips / danube / reset.c
1 /*
2 * arch/mips/danube/prom.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) 2005 infineon
19 *
20 * Rewrite of Infineon Danube code, thanks to infineon for the support,
21 * software and hardware
22 *
23 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
24 *
25 */
26
27 #include <linux/kernel.h>
28 #include <linux/pm.h>
29 #include <asm/reboot.h>
30 #include <asm/system.h>
31 #include <asm/io.h>
32 #include <asm/danube/danube.h>
33
34 static void
35 danube_machine_restart (char *command)
36 {
37 printk (KERN_NOTICE "System restart\n");
38 local_irq_disable ();
39
40 writel(readl(IFXMIPS_RCU_REQ) | IFXMIPS_RST_ALL, IFXMIPS_RCU_REQ);
41 for (;;);
42 }
43
44 static void
45 danube_machine_halt (void)
46 {
47 printk (KERN_NOTICE "System halted.\n");
48 local_irq_disable ();
49 for (;;);
50 }
51
52 static void
53 danube_machine_power_off (void)
54 {
55 printk (KERN_NOTICE "Please turn off the power now.\n");
56 local_irq_disable ();
57 for (;;);
58 }
59
60 void
61 danube_reboot_setup (void)
62 {
63 _machine_restart = danube_machine_restart;
64 _machine_halt = danube_machine_halt;
65 pm_power_off = danube_machine_power_off;
66 }