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