1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de> 4 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH 5 */ 6 7 #ifndef _ASM_ARCH_BOOTROM_H 8 #define _ASM_ARCH_BOOTROM_H 9 10 #include <linux/types.h> 11 12 /* 13 * Saved Stack pointer address. 14 * Access might be needed in some special cases. 15 */ 16 extern u32 SAVE_SP_ADDR; 17 18 /** 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. 28 * 29 * @brom_cmd: indicates how the bootrom should continue the boot 30 * sequence (e.g. load the next stage) 31 */ 32 enum rockchip_bootrom_cmd { 33 /* 34 * These can not start at 0, as 0 has a special meaning 35 * for setjmp(). 36 */ 37 38 BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */ 39 BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */ 40 }; 41 42 void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd); 43 44 /** 45 * Boot-device identifiers as used by the BROM 46 */ 47 enum { 48 BROM_BOOTSOURCE_UNKNOWN = 0, 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, 54 BROM_BOOTSOURCE_I2C = 8, 55 BROM_BOOTSOURCE_SPI = 9, 56 BROM_BOOTSOURCE_USB = 10, 57 BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB 58 }; 59 60 extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1]; 61 62 /** 63 * Locations of the boot-device identifier in SRAM 64 */ 65 #define BROM_BOOTSOURCE_ID_ADDR (CFG_IRAM_BASE + 0x10) 66 67 #endif 68