1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2019 NXP
4 */
5
6#include <config.h>
7
8.align 8
9.global boot_pointer
10boot_pointer:
11	.space 32
12
13/*
14 * Routine: save_boot_params (called after reset from start.S)
15 */
16
17.global save_boot_params
18save_boot_params:
19	/* The firmware provided ATAG/FDT address can be found in r2/x0 */
20	adr	x0, boot_pointer
21	stp	x1, x2, [x0], #16
22	stp	x3, x4, [x0], #16
23
24	/*
25	 * We use absolute address not PC relative address for return.
26	 * When running SPL on iMX8, the A core starts at address 0,
27	 * an alias to OCRAM 0x100000, our linker address for SPL is
28	 * from 0x100000. So using absolute address can jump to the OCRAM
29	 * address from the alias. The alias only map first 96KB of OCRAM,
30	 * so this require the SPL size can't beyond 96KB.
31	 * But when using SPL DM, the size increase significantly and
32	 * always beyonds 96KB. That's why we have to jump to OCRAM.
33	 * Normal u-boot also runs into this codes, but there is no impact.
34	 */
35	ldr	x1, =save_boot_params_ret
36	br	x1
37