1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de>
4  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
5  */
6 
7 #ifndef _ASM_ARCH_BOOTROM_H
8 #define _ASM_ARCH_BOOTROM_H
9 
10 /*
11  * Saved Stack pointer address.
12  * Access might be needed in some special cases.
13  */
14 extern u32 SAVE_SP_ADDR;
15 
16 /**
17  * back_to_bootrom() - return to bootrom (for TPL/SPL), passing a
18  *                     result code
19  *
20  * Transfer control back to the Rockchip BROM, restoring necessary
21  * register context and passing a command/result code to the BROM
22  * to instruct its next actions (e.g. continue boot sequence, enter
23  * download mode, ...).
24  *
25  * This function does not return.
26  *
27  * @brom_cmd: indicates how the bootrom should continue the boot
28  *            sequence (e.g. load the next stage)
29  */
30 enum rockchip_bootrom_cmd {
31 	/*
32 	 * These can not start at 0, as 0 has a special meaning
33 	 * for setjmp().
34 	 */
35 
36 	BROM_BOOT_NEXTSTAGE = 1,  /* continue boot-sequence */
37 	BROM_BOOT_ENTER_DNL,      /* have BROM enter download-mode */
38 };
39 
40 void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);
41 
42 /**
43  * Boot-device identifiers as used by the BROM
44  */
45 enum {
46 	BROM_BOOTSOURCE_NAND = 1,
47 	BROM_BOOTSOURCE_EMMC = 2,
48 	BROM_BOOTSOURCE_SPINOR = 3,
49 	BROM_BOOTSOURCE_SPINAND = 4,
50 	BROM_BOOTSOURCE_SD = 5,
51 	BROM_BOOTSOURCE_USB = 10,
52 	BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
53 };
54 
55 /**
56  * Locations of the boot-device identifier in SRAM
57  */
58 #define RK3399_BROM_BOOTSOURCE_ID_ADDR   0xff8c0010
59 
60 #endif
61