blob: 0da78f30b6191f309365ff282d7a0a8034511a9a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Heiko Stübner5c43acb2017-02-18 19:46:26 +01002/*
3 * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de>
Philipp Tomsich39bf18d2017-10-10 16:21:14 +02004 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
Heiko Stübner5c43acb2017-02-18 19:46:26 +01005 */
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 */
14extern u32 SAVE_SP_ADDR;
15
Simon Glassef0ab852017-04-15 13:11:31 -060016/**
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020017 * 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.
Philipp Tomsich7234c732017-10-10 16:21:16 +020026 *
27 * @brom_cmd: indicates how the bootrom should continue the boot
28 * sequence (e.g. load the next stage)
Heiko Stübner5c43acb2017-02-18 19:46:26 +010029 */
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020030enum rockchip_bootrom_cmd {
31 /*
32 * These can not start at 0, as 0 has a special meaning
33 * for setjmp().
34 */
Simon Glassef0ab852017-04-15 13:11:31 -060035
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020036 BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */
37 BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */
38};
39
Philipp Tomsich7234c732017-10-10 16:21:16 +020040void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);
Heiko Stübner5c43acb2017-02-18 19:46:26 +010041
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020042/**
43 * Boot-device identifiers as used by the BROM
44 */
45enum {
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
Kever Yang3ef783e2019-07-22 19:59:11 +080055extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];
56
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020057/**
58 * Locations of the boot-device identifier in SRAM
59 */
Kever Yangdc6a4612019-07-22 19:59:10 +080060#define BROM_BOOTSOURCE_ID_ADDR (CONFIG_IRAM_BASE + 0x10)
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020061
Heiko Stübner5c43acb2017-02-18 19:46:26 +010062#endif