diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-04-22 20:01:31 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-04-22 20:01:31 -0400 |
commit | 6a42a91019cb8744435e903f0693bd0e424061f8 (patch) | |
tree | 2e3b8b7f8d73874d6fc9637c88899a2d9486ae72 /arch/blackfin | |
parent | 9fcdc78c5ebaba0970d006dd72376a815aee1efa (diff) |
[Blackfin] arch: update reboot code to match latest info (really just copy from u-boot)
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/reboot.c | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c index 483f93dfc1b5..367e2dc09881 100644 --- a/arch/blackfin/kernel/reboot.c +++ b/arch/blackfin/kernel/reboot.c | |||
@@ -11,45 +11,56 @@ | |||
11 | #include <asm/reboot.h> | 11 | #include <asm/reboot.h> |
12 | #include <asm/system.h> | 12 | #include <asm/system.h> |
13 | 13 | ||
14 | #if defined(BF537_FAMILY) || defined(BF533_FAMILY) || defined(BF527_FAMILY) | 14 | /* A system soft reset makes external memory unusable so force |
15 | #define SYSCR_VAL 0x0 | 15 | * this function into L1. We use the compiler ssync here rather |
16 | #elif defined(BF561_FAMILY) | 16 | * than SSYNC() because it's safe (no interrupts and such) and |
17 | #define SYSCR_VAL 0x20 | 17 | * we save some L1. We do not need to force sanity in the SYSCR |
18 | #elif defined(BF548_FAMILY) | 18 | * register as the BMODE selection bit is cleared by the soft |
19 | #define SYSCR_VAL 0x10 | 19 | * reset while the Core B bit (on dual core parts) is cleared by |
20 | #endif | 20 | * the core reset. |
21 | |||
22 | /* | ||
23 | * Delay min 5 SCLK cycles using worst case CCLK/SCLK ratio (15) | ||
24 | */ | ||
25 | #define SWRST_DELAY (5 * 15) | ||
26 | |||
27 | /* A system soft reset makes external memory unusable | ||
28 | * so force this function into L1. | ||
29 | */ | 21 | */ |
30 | __attribute__((l1_text)) | 22 | __attribute__((l1_text)) |
31 | void bfin_reset(void) | 23 | void bfin_reset(void) |
32 | { | 24 | { |
33 | /* force BMODE and disable Core B (as needed) */ | 25 | /* Wait for completion of "system" events such as cache line |
34 | bfin_write_SYSCR(SYSCR_VAL); | 26 | * line fills so that we avoid infinite stalls later on as |
35 | 27 | * much as possible. This code is in L1, so it won't trigger | |
36 | /* we use asm ssync here because it's save and we save some L1 */ | 28 | * any such event after this point in time. |
37 | asm("ssync;"); | 29 | */ |
30 | __builtin_bfin_ssync(); | ||
38 | 31 | ||
39 | while (1) { | 32 | while (1) { |
40 | /* initiate system soft reset with magic 0x7 */ | 33 | /* Initiate System software reset. */ |
41 | bfin_write_SWRST(0x7); | 34 | bfin_write_SWRST(0x7); |
42 | 35 | ||
43 | /* Wait for System reset to actually reset, needs to be 5 SCLKs, */ | 36 | /* Due to the way reset is handled in the hardware, we need |
44 | /* Assume CCLK / SCLK ratio is worst case (15), and use 5*15 */ | 37 | * to delay for 7 SCLKS. The only reliable way to do this is |
45 | 38 | * to calculate the CCLK/SCLK ratio and multiply 7. For now, | |
46 | asm("LSETUP(.Lfoo,.Lfoo) LC0 = %0\n .Lfoo: NOP;\n" | 39 | * we'll assume worse case which is a 1:15 ratio. |
47 | : : "a" (SWRST_DELAY) : "LC0", "LT0", "LB0"); | 40 | */ |
41 | asm( | ||
42 | "LSETUP (1f, 1f) LC0 = %0\n" | ||
43 | "1: nop;" | ||
44 | : | ||
45 | : "a" (15 * 7) | ||
46 | : "LC0", "LB0", "LT0" | ||
47 | ); | ||
48 | 48 | ||
49 | /* clear system soft reset */ | 49 | /* Clear System software reset */ |
50 | bfin_write_SWRST(0); | 50 | bfin_write_SWRST(0); |
51 | asm("ssync;"); | 51 | |
52 | /* issue core reset */ | 52 | /* Wait for the SWRST write to complete. Cannot rely on SSYNC |
53 | * though as the System state is all reset now. | ||
54 | */ | ||
55 | asm( | ||
56 | "LSETUP (1f, 1f) LC1 = %0\n" | ||
57 | "1: nop;" | ||
58 | : | ||
59 | : "a" (15 * 1) | ||
60 | : "LC1", "LB1", "LT1" | ||
61 | ); | ||
62 | |||
63 | /* Issue core reset */ | ||
53 | asm("raise 1"); | 64 | asm("raise 1"); |
54 | } | 65 | } |
55 | } | 66 | } |