]> git.sur5r.net Git - u-boot/blob - arch/arm/cpu/sa1100/cpu.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / arch / arm / cpu / sa1100 / 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  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
9  * Alex Zuepke <azu@sysgo.de>
10  */
11
12 /*
13  * CPU specific code
14  */
15
16 #include <common.h>
17 #include <command.h>
18 #include <asm/system.h>
19 #include <asm/io.h>
20
21 static void cache_flush(void);
22
23 int cleanup_before_linux (void)
24 {
25         /*
26          * this function is called just before we call linux
27          * it prepares the processor for linux
28          *
29          * just disable everything that can disturb booting linux
30          */
31
32         disable_interrupts ();
33
34         /* turn off I-cache */
35         icache_disable();
36         dcache_disable();
37
38         /* flush I-cache */
39         cache_flush();
40
41         return (0);
42 }
43
44 /* flush I/D-cache */
45 static void cache_flush (void)
46 {
47         unsigned long i = 0;
48
49         asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
50 }
51
52 #define RST_BASE 0x90030000
53 #define RSRR    0x00
54 #define RCSR    0x04
55
56 __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
57 {
58         /* repeat endlessly */
59         while (1) {
60                 writel(0, RST_BASE + RCSR);
61                 writel(1, RST_BASE + RSRR);
62         }
63 }