17c01dd81fd97cc76e39ba1a484b64a1ba2ac1c6
[oweals/u-boot.git] / 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 <cpu_func.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 }