xref: /openbmc/u-boot/arch/arm/cpu/arm946es/cpu.c (revision f77d4410)
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 <asm/system.h>
18 #include <asm/io.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 	/* ARM926E-S needs the protection unit enabled for the icache to have
34 	 * been enabled	 - left for possible later use
35 	 * should turn off the protection unit as well....
36 	 */
37 	/* turn off I/D-cache */
38 	icache_disable();
39 	dcache_disable();
40 	/* flush I/D-cache */
41 	cache_flush();
42 
43 	return 0;
44 }
45 
46 /* flush I/D-cache */
47 static void cache_flush (void)
48 {
49 	unsigned long i = 0;
50 
51 	asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
52 	asm ("mcr p15, 0, %0, c7, c6, 0": :"r" (i));
53 }
54 
55 #ifndef CONFIG_ARCH_INTEGRATOR
56 
57 __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
58 {
59 	writew(0x0, 0xfffece10);
60 	writew(0x8, 0xfffece10);
61 	for (;;)
62 		;
63 }
64 
65 #endif	/* #ifdef CONFIG_ARCH_INTEGRATOR */
66