diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/mips/loongson/common/reset.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/mips/loongson/common/reset.c')
-rw-r--r-- | arch/mips/loongson/common/reset.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c index 97e918251edd..9e10d6225d9b 100644 --- a/arch/mips/loongson/common/reset.c +++ b/arch/mips/loongson/common/reset.c | |||
@@ -6,8 +6,8 @@ | |||
6 | * | 6 | * |
7 | * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology | 7 | * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology |
8 | * Author: Fuxin Zhang, zhangfx@lemote.com | 8 | * Author: Fuxin Zhang, zhangfx@lemote.com |
9 | * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology | 9 | * Copyright (C) 2009 Lemote, Inc. |
10 | * Author: Zhangjin Wu, wuzj@lemote.com | 10 | * Author: Zhangjin Wu, wuzhangjin@gmail.com |
11 | */ | 11 | */ |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
@@ -16,27 +16,53 @@ | |||
16 | 16 | ||
17 | #include <loongson.h> | 17 | #include <loongson.h> |
18 | 18 | ||
19 | static inline void loongson_reboot(void) | ||
20 | { | ||
21 | #ifndef CONFIG_CPU_JUMP_WORKAROUNDS | ||
22 | ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) (); | ||
23 | #else | ||
24 | void (*func)(void); | ||
25 | |||
26 | func = (void *)ioremap_nocache(LOONGSON_BOOT_BASE, 4); | ||
27 | |||
28 | __asm__ __volatile__( | ||
29 | " .set noat \n" | ||
30 | " jr %[func] \n" | ||
31 | " .set at \n" | ||
32 | : /* No outputs */ | ||
33 | : [func] "r" (func)); | ||
34 | #endif | ||
35 | } | ||
36 | |||
19 | static void loongson_restart(char *command) | 37 | static void loongson_restart(char *command) |
20 | { | 38 | { |
21 | /* do preparation for reboot */ | 39 | /* do preparation for reboot */ |
22 | mach_prepare_reboot(); | 40 | mach_prepare_reboot(); |
23 | 41 | ||
24 | /* reboot via jumping to boot base address */ | 42 | /* reboot via jumping to boot base address */ |
25 | ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) (); | 43 | loongson_reboot(); |
26 | } | 44 | } |
27 | 45 | ||
28 | static void loongson_halt(void) | 46 | static void loongson_poweroff(void) |
29 | { | 47 | { |
30 | mach_prepare_shutdown(); | 48 | mach_prepare_shutdown(); |
31 | while (1) | 49 | unreachable(); |
32 | ; | 50 | } |
51 | |||
52 | static void loongson_halt(void) | ||
53 | { | ||
54 | pr_notice("\n\n** You can safely turn off the power now **\n\n"); | ||
55 | while (1) { | ||
56 | if (cpu_wait) | ||
57 | cpu_wait(); | ||
58 | } | ||
33 | } | 59 | } |
34 | 60 | ||
35 | static int __init mips_reboot_setup(void) | 61 | static int __init mips_reboot_setup(void) |
36 | { | 62 | { |
37 | _machine_restart = loongson_restart; | 63 | _machine_restart = loongson_restart; |
38 | _machine_halt = loongson_halt; | 64 | _machine_halt = loongson_halt; |
39 | pm_power_off = loongson_halt; | 65 | pm_power_off = loongson_poweroff; |
40 | 66 | ||
41 | return 0; | 67 | return 0; |
42 | } | 68 | } |