4874b620e6b2accc63b9e0c0a2ffd79ab881e2e1
[oweals/u-boot.git] / arch / arm / cpu / arm920t / cpu.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2002
4  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
5  * Marius Groeger <mgroeger@sysgo.de>
6  *
7  * (C) Copyright 2002
8  * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
9  */
10
11 /*
12  * CPU specific code
13  */
14
15 #include <common.h>
16 #include <command.h>
17 #include <cpu_func.h>
18 #include <asm/system.h>
19
20 static void cache_flush(void);
21
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
31         disable_interrupts();
32
33         /* turn off I/D-cache */
34         icache_disable();
35         dcache_disable();
36         /* flush I/D-cache */
37         cache_flush();
38
39         return 0;
40 }
41
42 /* flush I/D-cache */
43 static void cache_flush (void)
44 {
45         unsigned long i = 0;
46
47         asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
48 }