diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2007-10-10 12:29:49 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-10-10 12:29:49 -0400 |
commit | 2714d9a6d1e68d30f5be8871722a7cff388c2d74 (patch) | |
tree | ccf786e468a2f3b79f10a862321c2f0e842bcab4 /arch/blackfin/kernel/reboot.c | |
parent | 4b3f058a7a34a10d99937e86bb28da118710ca9a (diff) |
Blackfin arch: Workaround reboot bug, issue SSYNC at the start of bfin_reset
reboot failes on BF533
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3500
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin/kernel/reboot.c')
-rw-r--r-- | arch/blackfin/kernel/reboot.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c new file mode 100644 index 000000000000..356078ec462b --- /dev/null +++ b/arch/blackfin/kernel/reboot.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * arch/blackfin/kernel/reboot.c - handle shutdown/reboot | ||
3 | * | ||
4 | * Copyright 2004-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/interrupt.h> | ||
10 | #include <asm/bfin-global.h> | ||
11 | #include <asm/reboot.h> | ||
12 | #include <asm/system.h> | ||
13 | |||
14 | #if defined(BF537_FAMILY) || defined(BF533_FAMILY) | ||
15 | #define SYSCR_VAL 0x0 | ||
16 | #elif defined(BF561_FAMILY) | ||
17 | #define SYSCR_VAL 0x20 | ||
18 | #elif defined(BF548_FAMILY) | ||
19 | #define SYSCR_VAL 0x10 | ||
20 | #endif | ||
21 | |||
22 | /* A system soft reset makes external memory unusable | ||
23 | * so force this function into L1. | ||
24 | */ | ||
25 | __attribute__((l1_text)) | ||
26 | void bfin_reset(void) | ||
27 | { | ||
28 | /* force BMODE and disable Core B (as needed) */ | ||
29 | bfin_write_SYSCR(SYSCR_VAL); | ||
30 | |||
31 | /* we use asm ssync here because it's save and we save some L1 */ | ||
32 | asm("ssync;"); | ||
33 | |||
34 | while (1) { | ||
35 | /* initiate system soft reset with magic 0x7 */ | ||
36 | bfin_write_SWRST(0x7); | ||
37 | asm("ssync;"); | ||
38 | /* clear system soft reset */ | ||
39 | bfin_write_SWRST(0); | ||
40 | asm("ssync;"); | ||
41 | /* issue core reset */ | ||
42 | asm("raise 1"); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | __attribute__((weak)) | ||
47 | void native_machine_restart(char *cmd) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | void machine_restart(char *cmd) | ||
52 | { | ||
53 | native_machine_restart(cmd); | ||
54 | local_irq_disable(); | ||
55 | bfin_reset(); | ||
56 | } | ||
57 | |||
58 | __attribute__((weak)) | ||
59 | void native_machine_halt(void) | ||
60 | { | ||
61 | idle_with_irq_disabled(); | ||
62 | } | ||
63 | |||
64 | void machine_halt(void) | ||
65 | { | ||
66 | native_machine_halt(); | ||
67 | } | ||
68 | |||
69 | __attribute__((weak)) | ||
70 | void native_machine_power_off(void) | ||
71 | { | ||
72 | idle_with_irq_disabled(); | ||
73 | } | ||
74 | |||
75 | void machine_power_off(void) | ||
76 | { | ||
77 | native_machine_power_off(); | ||
78 | } | ||