]>
Commit | Line | Data |
---|---|---|
3d818266 WD |
1 | /* |
2 | * (C) Copyright 2002 | |
3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
4 | * Marius Groeger <mgroeger@sysgo.de> | |
5 | * | |
6 | * (C) Copyright 2002 | |
792a09eb | 7 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
3d818266 | 8 | * |
1a459660 | 9 | * SPDX-License-Identifier: GPL-2.0+ |
3d818266 WD |
10 | */ |
11 | ||
12 | /* | |
13 | * CPU specific code | |
14 | */ | |
15 | ||
16 | #include <common.h> | |
17 | #include <command.h> | |
677e62f4 | 18 | #include <asm/system.h> |
3d818266 | 19 | |
b3acb6cd | 20 | static void cache_flush(void); |
3d818266 | 21 | |
3d818266 WD |
22 | int cleanup_before_linux (void) |
23 | { | |
24 | /* | |
25 | * this function is called just before we call linux | |
26 | * it prepares the processor for linux | |
27 | * | |
28 | * we turn off caches etc ... | |
29 | */ | |
30 | ||
3d818266 WD |
31 | disable_interrupts (); |
32 | ||
33 | /* turn off I/D-cache */ | |
b3acb6cd JCPV |
34 | icache_disable(); |
35 | dcache_disable(); | |
3d818266 | 36 | /* flush I/D-cache */ |
b3acb6cd | 37 | cache_flush(); |
74f4304e | 38 | |
b3acb6cd | 39 | return 0; |
3d818266 WD |
40 | } |
41 | ||
b3acb6cd JCPV |
42 | /* flush I/D-cache */ |
43 | static void cache_flush (void) | |
3d818266 | 44 | { |
b3acb6cd | 45 | unsigned long i = 0; |
3d818266 | 46 | |
b3acb6cd | 47 | asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i)); |
3d818266 | 48 | } |