xref: /openbmc/u-boot/arch/arm/cpu/sa1100/cpu.c (revision 0649cd0d)
1 /*
2  * (C) Copyright 2002
3  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4  * Marius Groeger <mgroeger@sysgo.de>
5  *
6  * (C) Copyright 2002
7  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8  * Alex Zuepke <azu@sysgo.de>
9  *
10  * SPDX-License-Identifier:	GPL-2.0+
11  */
12 
13 /*
14  * CPU specific code
15  */
16 
17 #include <common.h>
18 #include <command.h>
19 #include <asm/system.h>
20 #include <asm/io.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 	 * just disable everything that can disturb booting linux
31 	 */
32 
33 	disable_interrupts ();
34 
35 	/* turn off I-cache */
36 	icache_disable();
37 	dcache_disable();
38 
39 	/* flush I-cache */
40 	cache_flush();
41 
42 	return (0);
43 }
44 
45 /* flush I/D-cache */
46 static void cache_flush (void)
47 {
48 	unsigned long i = 0;
49 
50 	asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
51 }
52 
53 #define RST_BASE 0x90030000
54 #define RSRR	0x00
55 #define RCSR	0x04
56 
57 __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
58 {
59 	/* repeat endlessly */
60 	while (1) {
61 		writel(0, RST_BASE + RCSR);
62 		writel(1, RST_BASE + RSRR);
63 	}
64 }
65