fixes ifxmips pci support and adds GENERIC_GPIO
[openwrt-10.03/.git] / target / linux / ifxmips / files / arch / mips / ifxmips / reset.c
1 /*
2  *   arch/mips/ifxmips/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 IFXMips 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/ifxmips/ifxmips.h>
33
34 static void
35 ifxmips_machine_restart (char *command)
36 {
37         printk (KERN_NOTICE "System restart\n");
38         local_irq_disable ();
39
40         ifxmips_w32(ifxmips_r32(IFXMIPS_RCU_REQ) | IFXMIPS_RST_ALL, IFXMIPS_RCU_REQ);
41         for (;;);
42 }
43
44 static void
45 ifxmips_machine_halt (void)
46 {
47         printk (KERN_NOTICE "System halted.\n");
48         local_irq_disable ();
49         for (;;);
50 }
51
52 static void
53 ifxmips_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 ifxmips_reboot_setup (void)
62 {
63         _machine_restart = ifxmips_machine_restart;
64         _machine_halt = ifxmips_machine_halt;
65         pm_power_off = ifxmips_machine_power_off;
66 }