diff options
Diffstat (limited to 'arch/mips/loongson/common/reset.c')
-rw-r--r-- | arch/mips/loongson/common/reset.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c new file mode 100644 index 000000000000..97e918251edd --- /dev/null +++ b/arch/mips/loongson/common/reset.c | |||
@@ -0,0 +1,44 @@ | |||
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. | ||
6 | * | ||
7 | * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology | ||
8 | * Author: Fuxin Zhang, zhangfx@lemote.com | ||
9 | * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology | ||
10 | * Author: Zhangjin Wu, wuzj@lemote.com | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/pm.h> | ||
14 | |||
15 | #include <asm/reboot.h> | ||
16 | |||
17 | #include <loongson.h> | ||
18 | |||
19 | static void loongson_restart(char *command) | ||
20 | { | ||
21 | /* do preparation for reboot */ | ||
22 | mach_prepare_reboot(); | ||
23 | |||
24 | /* reboot via jumping to boot base address */ | ||
25 | ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) (); | ||
26 | } | ||
27 | |||
28 | static void loongson_halt(void) | ||
29 | { | ||
30 | mach_prepare_shutdown(); | ||
31 | while (1) | ||
32 | ; | ||
33 | } | ||
34 | |||
35 | static int __init mips_reboot_setup(void) | ||
36 | { | ||
37 | _machine_restart = loongson_restart; | ||
38 | _machine_halt = loongson_halt; | ||
39 | pm_power_off = loongson_halt; | ||
40 | |||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | arch_initcall(mips_reboot_setup); | ||