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 | |
Tom Rini | 883ab04 | 2024-04-30 07:35:36 -0600 | [diff] [blame] | 10 | #include <linux/types.h> |
| 11 | |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 12 | /* |
| 13 | * Saved Stack pointer address. |
| 14 | * Access might be needed in some special cases. |
| 15 | */ |
| 16 | extern u32 SAVE_SP_ADDR; |
| 17 | |
Simon Glass | ef0ab85 | 2017-04-15 13:11:31 -0600 | [diff] [blame] | 18 | /** |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 19 | * 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 Tomsich | 7234c73 | 2017-10-10 16:21:16 +0200 | [diff] [blame] | 28 | * |
| 29 | * @brom_cmd: indicates how the bootrom should continue the boot |
| 30 | * sequence (e.g. load the next stage) |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 31 | */ |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 32 | enum rockchip_bootrom_cmd { |
| 33 | /* |
| 34 | * These can not start at 0, as 0 has a special meaning |
| 35 | * for setjmp(). |
| 36 | */ |
Simon Glass | ef0ab85 | 2017-04-15 13:11:31 -0600 | [diff] [blame] | 37 | |
Philipp Tomsich | 39bf18d | 2017-10-10 16:21:14 +0200 | [diff] [blame] | 38 | BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */ |
| 39 | BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */ |
| 40 | }; |
| 41 | |
Philipp Tomsich | 7234c73 | 2017-10-10 16:21:16 +0200 | [diff] [blame] | 42 | void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd); |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 43 | |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 44 | /** |
| 45 | * Boot-device identifiers as used by the BROM |
| 46 | */ |
| 47 | enum { |
Jason Zhu | be986f2 | 2024-03-22 20:50:20 +0000 | [diff] [blame] | 48 | BROM_BOOTSOURCE_UNKNOWN = 0, |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 49 | 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 Zhu | be986f2 | 2024-03-22 20:50:20 +0000 | [diff] [blame] | 54 | BROM_BOOTSOURCE_I2C = 8, |
| 55 | BROM_BOOTSOURCE_SPI = 9, |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 56 | BROM_BOOTSOURCE_USB = 10, |
| 57 | BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB |
| 58 | }; |
| 59 | |
Kever Yang | 3ef783e | 2019-07-22 19:59:11 +0800 | [diff] [blame] | 60 | extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1]; |
| 61 | |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 62 | /** |
| 63 | * Locations of the boot-device identifier in SRAM |
| 64 | */ |
Tom Rini | 3088b31 | 2022-12-04 10:04:13 -0500 | [diff] [blame] | 65 | #define BROM_BOOTSOURCE_ID_ADDR (CFG_IRAM_BASE + 0x10) |
Philipp Tomsich | 1cd4e12 | 2017-09-29 19:27:55 +0200 | [diff] [blame] | 66 | |
Heiko Stübner | 5c43acb | 2017-02-18 19:46:26 +0100 | [diff] [blame] | 67 | #endif |