blob: 49e0b906d583f52ad89fe48b98bd639ec1480241 [file] [log] [blame]
Stefan Roesee463bf32015-01-19 11:33:42 +01001/*
2 * SPDX-License-Identifier: GPL-2.0+
3 */
4
5#include <config.h>
Stefan Roesee463bf32015-01-19 11:33:42 +01006#include <linux/linkage.h>
7
8ENTRY(save_boot_params)
Stefan Roese99b3ea72015-08-25 13:49:41 +02009 stmfd sp!, {r0 - r12, lr} /* @ save registers on stack */
10 ldr r12, =CONFIG_SPL_BOOTROM_SAVE
11 str sp, [r12]
Stefan Roese00b154f2015-03-11 12:05:04 +010012 b save_boot_params_ret
Stefan Roesee463bf32015-01-19 11:33:42 +010013ENDPROC(save_boot_params)
14
Stefan Roese99b3ea72015-08-25 13:49:41 +020015ENTRY(return_to_bootrom)
16 ldr r12, =CONFIG_SPL_BOOTROM_SAVE
17 ldr sp, [r12]
18 mov r0, #0x0 /* @ return value: 0x0 NO_ERR */
19 ldmfd sp!, {r0 - r12, pc} /* @ restore regs and return */
20ENDPROC(return_to_bootrom)
Stefan Roese99b3ea72015-08-25 13:49:41 +020021
Stefan Roesee463bf32015-01-19 11:33:42 +010022/*
23 * cache_inv - invalidate Cache line
24 * r0 - dest
25 */
26 .global cache_inv
27 .type cache_inv, %function
28 cache_inv:
29
30 stmfd sp!, {r1-r12}
31
32 mcr p15, 0, r0, c7, c6, 1
33
34 ldmfd sp!, {r1-r12}
35 bx lr
36
37
38/*
39 * flush_l1_v6 - l1 cache clean invalidate
40 * r0 - dest
41 */
42 .global flush_l1_v6
43 .type flush_l1_v6, %function
44 flush_l1_v6:
45
46 stmfd sp!, {r1-r12}
47
48 mcr p15, 0, r0, c7, c10, 5 /* @ data memory barrier */
49 mcr p15, 0, r0, c7, c14, 1 /* @ clean & invalidate D line */
50 mcr p15, 0, r0, c7, c10, 4 /* @ data sync barrier */
51
52 ldmfd sp!, {r1-r12}
53 bx lr
54
55
56/*
57 * flush_l1_v7 - l1 cache clean invalidate
58 * r0 - dest
59 */
60 .global flush_l1_v7
61 .type flush_l1_v7, %function
62 flush_l1_v7:
63
64 stmfd sp!, {r1-r12}
65
66 dmb /* @data memory barrier */
67 mcr p15, 0, r0, c7, c14, 1 /* @ clean & invalidate D line */
68 dsb /* @data sync barrier */
69
70 ldmfd sp!, {r1-r12}
71 bx lr