1/*
2 * SPDX-License-Identifier:	GPL-2.0+
3 */
4
5#include <config.h>
6#include <linux/linkage.h>
7
8ENTRY(save_boot_params)
9	stmfd	sp!, {r0 - r12, lr}	/* @ save registers on stack */
10	ldr	r12, =CONFIG_SPL_BOOTROM_SAVE
11	str	sp, [r12]
12	b	save_boot_params_ret
13ENDPROC(save_boot_params)
14
15ENTRY(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)
21
22/*
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
72