xref: /openbmc/u-boot/arch/arm/cpu/armv8/cpu.c (revision a7da6f8c)
1 /*
2  * (C) Copyright 2008 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 #include <common.h>
15 #include <command.h>
16 #include <asm/system.h>
17 #include <linux/compiler.h>
18 
19 int cleanup_before_linux(void)
20 {
21 	/*
22 	 * this function is called just before we call linux
23 	 * it prepares the processor for linux
24 	 *
25 	 * disable interrupt and turn off caches etc ...
26 	 */
27 	disable_interrupts();
28 
29 	/*
30 	 * Turn off I-cache and invalidate it
31 	 */
32 	icache_disable();
33 	invalidate_icache_all();
34 
35 	/*
36 	 * turn off D-cache
37 	 * dcache_disable() in turn flushes the d-cache and disables MMU
38 	 */
39 	dcache_disable();
40 	invalidate_dcache_all();
41 
42 	return 0;
43 }
44