blob: 103b7995939620c07c1fca00fdc0c8f4dc0c1af7 [file] [log] [blame]
Heiko Stübner5c43acb2017-02-18 19:46:26 +01001/*
2 * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de>
Philipp Tomsich39bf18d2017-10-10 16:21:14 +02003 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
Heiko Stübner5c43acb2017-02-18 19:46:26 +01004 *
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 */
15extern u32 SAVE_SP_ADDR;
16
Simon Glassef0ab852017-04-15 13:11:31 -060017/**
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020018 * 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.
Philipp Tomsich7234c732017-10-10 16:21:16 +020027 *
28 * @brom_cmd: indicates how the bootrom should continue the boot
29 * sequence (e.g. load the next stage)
Heiko Stübner5c43acb2017-02-18 19:46:26 +010030 */
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020031enum rockchip_bootrom_cmd {
32 /*
33 * These can not start at 0, as 0 has a special meaning
34 * for setjmp().
35 */
Simon Glassef0ab852017-04-15 13:11:31 -060036
Philipp Tomsich39bf18d2017-10-10 16:21:14 +020037 BROM_BOOT_NEXTSTAGE = 1, /* continue boot-sequence */
38 BROM_BOOT_ENTER_DNL, /* have BROM enter download-mode */
39};
40
Philipp Tomsich7234c732017-10-10 16:21:16 +020041void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);
Heiko Stübner5c43acb2017-02-18 19:46:26 +010042
Philipp Tomsich1cd4e122017-09-29 19:27:55 +020043/**
44 * Boot-device identifiers as used by the BROM
45 */
46enum {
47 BROM_BOOTSOURCE_NAND = 1,
48 BROM_BOOTSOURCE_EMMC = 2,
49 BROM_BOOTSOURCE_SPINOR = 3,
50 BROM_BOOTSOURCE_SPINAND = 4,
51 BROM_BOOTSOURCE_SD = 5,
52 BROM_BOOTSOURCE_USB = 10,
53 BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
54};
55
56/**
57 * Locations of the boot-device identifier in SRAM
58 */
59#define RK3399_BROM_BOOTSOURCE_ID_ADDR 0xff8c0010
60
Heiko Stübner5c43acb2017-02-18 19:46:26 +010061#endif