Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de> |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 4 | * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 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 | |
Simon Glass | ef0ab85 | 2017-04-15 13:11:31 -0600 | [diff] [blame] | 16 | /** |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 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. |
Philipp Tomsich | 7234c73 | 2017-10-10 16:21:16 +0200 | [diff] [blame] | 26 | * |
| 27 | * @brom_cmd: indicates how the bootrom should continue the boot |
| 28 | * sequence (e.g. load the next stage) |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 29 | */ |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 30 | enum rockchip_bootrom_cmd { |
| 31 | /* |
| 32 | * These can not start at 0, as 0 has a special meaning |
| 33 | * for setjmp(). |
| 34 | */ |
Simon Glass | ef0ab85 | 2017-04-15 13:11:31 -0600 | [diff] [blame] | 35 | |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 36 | BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */ |
| 37 | BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */ |
| 38 | }; |
| 39 | |
Philipp Tomsich | 7234c73 | 2017-10-10 16:21:16 +0200 | [diff] [blame] | 40 | void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd); |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 41 | |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 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, |
Jonas Karlman | adb7894 | 2023-05-18 15:39:30 +0000 | [diff] [blame] | 51 | BROM_BOOTSOURCE_SPINOR_RK3588 = 6, |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 52 | BROM_BOOTSOURCE_USB = 10, |
| 53 | BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB |
| 54 | }; |
| 55 | |
Kever Yang | 3ef783e | 2019-07-22 19:59:11 +0800 | [diff] [blame] | 56 | extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1]; |
| 57 | |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 58 | /** |
| 59 | * Locations of the boot-device identifier in SRAM |
| 60 | */ |
Tom Rini | 3088b31 | 2022-12-04 10:04:13 -0500 | [diff] [blame] | 61 | #define BROM_BOOTSOURCE_ID_ADDR (CFG_IRAM_BASE + 0x10) |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 62 | |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 63 | #endif |