blob: e736772fda755a5b8f96d6605a0bb989fb95e697 [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
Tom Rini883ab042024-04-30 07:35:36 -060010#include <linux/types.h>
11
Heiko Stübner5c43acb2017-02-18 19:46:26 +010012/*
13 * Saved Stack pointer address.
14 * Access might be needed in some special cases.
15 */
16extern u32 SAVE_SP_ADDR;
17
Simon Glassef0ab852017-04-15 13:11:31 -060018/**
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020019 * back_to_bootrom() - return to bootrom (for TPL/SPL), passing a
20 * result code
21 *
22 * Transfer control back to the Rockchip BROM, restoring necessary
23 * register context and passing a command/result code to the BROM
24 * to instruct its next actions (e.g. continue boot sequence, enter
25 * download mode, ...).
26 *
27 * This function does not return.
Philipp Tomsich7234c732017-10-10 16:21:16 +020028 *
29 * @brom_cmd: indicates how the bootrom should continue the boot
30 * sequence (e.g. load the next stage)
Heiko Stübner5c43acb2017-02-18 19:46:26 +010031 */
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020032enum rockchip_bootrom_cmd {
33 /*
34 * These can not start at 0, as 0 has a special meaning
35 * for setjmp().
36 */
Simon Glassef0ab852017-04-15 13:11:31 -060037
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020038 BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */
39 BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */
40};
41
Philipp Tomsich7234c732017-10-10 16:21:16 +020042void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);
Heiko Stübner5c43acb2017-02-18 19:46:26 +010043
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020044/**
45 * Boot-device identifiers as used by the BROM
46 */
47enum {
Jason Zhube986f22024-03-22 20:50:20 +000048 BROM_BOOTSOURCE_UNKNOWN = 0,
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020049 BROM_BOOTSOURCE_NAND = 1,
50 BROM_BOOTSOURCE_EMMC = 2,
51 BROM_BOOTSOURCE_SPINOR = 3,
52 BROM_BOOTSOURCE_SPINAND = 4,
53 BROM_BOOTSOURCE_SD = 5,
Jason Zhube986f22024-03-22 20:50:20 +000054 BROM_BOOTSOURCE_I2C = 8,
55 BROM_BOOTSOURCE_SPI = 9,
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020056 BROM_BOOTSOURCE_USB = 10,
57 BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
58};
59
Kever Yang3ef783e2019-07-22 19:59:11 +080060extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];
61
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020062/**
63 * Locations of the boot-device identifier in SRAM
64 */
Tom Rini3088b312022-12-04 10:04:13 -050065#define BROM_BOOTSOURCE_ID_ADDR (CFG_IRAM_BASE + 0x10)
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020066
Heiko Stübner5c43acb2017-02-18 19:46:26 +010067#endif