]> git.ipfire.org Git - thirdparty/u-boot.git/blob - arch/arm/cpu/arm1176/cpu.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[thirdparty/u-boot.git] / arch / arm / cpu / arm1176 / cpu.c
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
9 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
10 *
11 * SPDX-License-Identifier: GPL-2.0+
12 */
13
14 /*
15 * CPU specific code
16 */
17
18 #include <common.h>
19 #include <command.h>
20 #include <asm/system.h>
21
22 static void cache_flush (void);
23
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();
38 /* flush I/D-cache */
39 cache_flush();
40
41 return 0;
42 }
43
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 }