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