653d42c84966fe72e26b64466ebcfca68416fce5
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / reset.c
1 /*
2 * $Id$
3 *
4 * ADM5120 specific reset routines
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
10 * done by Jeroen Vreeken
11 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
12 *
13 * Jeroen's code was based on the Linux 2.4.xx source codes found in various
14 * tarballs released by Edimax for it's ADM5120 based devices.
15 * Copyright (C) ADMtek Incorporated
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License version 2 as published
19 * by the Free Software Foundation.
20 *
21 */
22
23 #include <linux/types.h>
24 #include <linux/kernel.h>
25 #include <linux/init.h>
26
27 #include <linux/irq.h>
28 #include <linux/io.h>
29
30 #include <asm/addrspace.h>
31
32 #include <adm5120_info.h>
33 #include <adm5120_defs.h>
34 #include <adm5120_switch.h>
35
36 void (*adm5120_board_reset)(void);
37
38 void adm5120_restart(char *command)
39 {
40 /* TODO: stop switch before reset */
41
42 if (adm5120_board_reset)
43 adm5120_board_reset();
44
45 SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1);
46 }
47
48 void adm5120_halt(void)
49 {
50 local_irq_disable();
51
52 while (1) {
53 if (cpu_wait)
54 cpu_wait();
55 };
56 }