]>
Commit | Line | Data |
---|---|---|
74f4304e WD |
1 | /* |
2 | * (C) Copyright 2002 | |
3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
4 | * Marius Groeger <[email protected]> | |
5 | * | |
6 | * (C) Copyright 2002 | |
792a09eb | 7 | * Gary Jennejohn, DENX Software Engineering, <[email protected]> |
74f4304e | 8 | * |
3765b3e7 | 9 | * SPDX-License-Identifier: GPL-2.0+ |
74f4304e WD |
10 | */ |
11 | ||
12 | /* | |
13 | * CPU specific code | |
14 | */ | |
15 | ||
16 | #include <common.h> | |
17 | #include <command.h> | |
677e62f4 | 18 | #include <asm/system.h> |
cd6cc344 | 19 | #include <asm/io.h> |
74f4304e | 20 | |
b3acb6cd | 21 | static void cache_flush(void); |
74f4304e | 22 | |
74f4304e WD |
23 | int cleanup_before_linux (void) |
24 | { | |
25 | /* | |
26 | * this function is called just before we call linux | |
27 | * it prepares the processor for linux | |
28 | * | |
29 | * we turn off caches etc ... | |
30 | */ | |
31 | ||
74f4304e WD |
32 | disable_interrupts (); |
33 | ||
fe7eb5d8 WD |
34 | /* ARM926E-S needs the protection unit enabled for the icache to have |
35 | * been enabled - left for possible later use | |
74f4304e | 36 | * should turn off the protection unit as well.... |
fe7eb5d8 | 37 | */ |
74f4304e | 38 | /* turn off I/D-cache */ |
b3acb6cd JCPV |
39 | icache_disable(); |
40 | dcache_disable(); | |
74f4304e | 41 | /* flush I/D-cache */ |
b3acb6cd JCPV |
42 | cache_flush(); |
43 | ||
44 | return 0; | |
74f4304e WD |
45 | } |
46 | ||
b3acb6cd JCPV |
47 | /* flush I/D-cache */ |
48 | static void cache_flush (void) | |
74f4304e | 49 | { |
b3acb6cd | 50 | unsigned long i = 0; |
74f4304e | 51 | |
b3acb6cd JCPV |
52 | asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i)); |
53 | asm ("mcr p15, 0, %0, c7, c6, 0": :"r" (i)); | |
74f4304e | 54 | } |
cd6cc344 AA |
55 | |
56 | #ifndef CONFIG_INTEGRATOR | |
57 | ||
58 | __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused))) | |
59 | { | |
60 | writew(0x0, 0xfffece10); | |
61 | writew(0x8, 0xfffece10); | |
62 | for (;;) | |
63 | ; | |
64 | } | |
65 | ||
66 | #endif /* #ifdef CONFIG_INTEGRATOR */ |