change switch register access macros
[librecmc/librecmc.git] / target / linux / adm5120 / files / arch / mips / adm5120 / reset.c
1 /*
2  *  $Id$
3  *
4  *  ADM5120 specific reset routines
5  *
6  *  Copyright (C) ADMtek Incorporated.
7  *  Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
8  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9  *  Copyright (C) 2007 OpenWrt.org
10  *
11  *  This program is free software; you can redistribute it and/or
12  *  modify it under the terms of the GNU General Public License
13  *  as published by the Free Software Foundation; either version 2
14  *  of the License, or (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the
23  *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  *  Boston, MA  02110-1301, USA.
25  *
26  */
27
28 #include <linux/types.h>
29 #include <linux/kernel.h>
30 #include <linux/init.h>
31
32 #include <linux/irq.h>
33 #include <linux/io.h>
34
35 #include <asm/bootinfo.h>
36 #include <asm/addrspace.h>
37
38 #include <adm5120_info.h>
39 #include <adm5120_defs.h>
40 #include <adm5120_switch.h>
41
42 void (*adm5120_board_reset)(void);
43
44 void adm5120_restart(char *command)
45 {
46         /* TODO: stop switch before reset */
47
48         if (adm5120_board_reset)
49                 adm5120_board_reset();
50
51         SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1);
52 }
53
54 void adm5120_halt(void)
55 {
56         local_irq_disable();
57
58         printk(KERN_NOTICE "\n** You can safely turn off the power\n");
59         while (1) {
60                 if (cpu_wait)
61                         cpu_wait();
62         };
63 }