]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
12d8a729 | 2 | /* |
3 | * (C) Copyright 2010,2011 | |
4 | * Vladimir Khusainov, Emcraft Systems, [email protected] | |
5 | * | |
6 | * (C) Copyright 2015 | |
5be93569 | 7 | * Kamil Lulko, <[email protected]> |
12d8a729 | 8 | */ |
9 | ||
9edefc27 | 10 | #include <cpu_func.h> |
36bf446b | 11 | #include <irq_func.h> |
12d8a729 | 12 | #include <asm/io.h> |
13 | #include <asm/armv7m.h> | |
027b0e9c | 14 | #include <spl.h> |
12d8a729 | 15 | |
16 | /* | |
17 | * This is called right before passing control to | |
18 | * the Linux kernel point. | |
19 | */ | |
20 | int cleanup_before_linux(void) | |
21 | { | |
4098d206 VM |
22 | /* |
23 | * this function is called just before we call linux | |
24 | * it prepares the processor for linux | |
25 | * | |
26 | * disable interrupt and turn off caches etc ... | |
27 | */ | |
28 | disable_interrupts(); | |
29 | /* | |
30 | * turn off D-cache | |
31 | * dcache_disable() in turn flushes the d-cache | |
32 | * MPU is still enabled & can't be disabled as the u-boot | |
33 | * code might be running in sdram which by default is not | |
34 | * executable area. | |
35 | */ | |
36 | dcache_disable(); | |
37 | /* invalidate to make sure no cache line gets dirty between | |
38 | * dcache flushing and disabling dcache */ | |
39 | invalidate_dcache_all(); | |
40 | ||
d409c962 PC |
41 | icache_disable(); |
42 | invalidate_icache_all(); | |
43 | ||
12d8a729 | 44 | return 0; |
45 | } | |
46 | ||
47 | /* | |
48 | * Perform the low-level reset. | |
49 | */ | |
35b65dd8 | 50 | void reset_cpu(void) |
12d8a729 | 51 | { |
52 | /* | |
53 | * Perform reset but keep priority group unchanged. | |
54 | */ | |
55 | writel((V7M_AIRCR_VECTKEY << V7M_AIRCR_VECTKEY_SHIFT) | |
56 | | (V7M_SCB->aircr & V7M_AIRCR_PRIGROUP_MSK) | |
57 | | V7M_AIRCR_SYSRESET, &V7M_SCB->aircr); | |
58 | } | |
027b0e9c OP |
59 | |
60 | void spl_perform_fixups(struct spl_image_info *spl_image) | |
61 | { | |
62 | spl_image->entry_point |= 0x1; | |
63 | } |