summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-29 19:27:58 +0200
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-10-01 00:33:34 +0200
commitc55addd36008e82cd0081c591a68a1f1667346e7 (patch)
tree27060c7aa865c4c494b1c4792f75d2cc76059c3f
parent80e9f88e67398ae65c89af3bace59e7e14debd33 (diff)
rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()
To support the new "same-as-spl" specifier in the boot-order on the RK3399, this implements the chip-specific mapping from the information obtainable from the BROM to a OF path name. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/arm/mach-rockchip/rk3399-board-spl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
index 8e38ef19a3..9c20f56dc9 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -26,6 +26,30 @@ void board_return_to_bootrom(void)
back_to_bootrom();
}
+static const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
+ [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe330000",
+ [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000",
+ [BROM_BOOTSOURCE_SD] = "/dwmmc@fe320000",
+};
+
+const char *board_spl_was_booted_from(void)
+{
+ u32 bootdevice_brom_id = readl(RK3399_BROM_BOOTSOURCE_ID_ADDR);
+ const char *bootdevice_ofpath = NULL;
+
+ if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
+ bootdevice_ofpath = boot_devices[bootdevice_brom_id];
+
+ if (bootdevice_ofpath)
+ debug("%s: brom_bootdevice_id %x maps to '%s'\n",
+ __func__, bootdevice_brom_id, bootdevice_ofpath);
+ else
+ debug("%s: failed to resolve brom_bootdevice_id %x\n",
+ __func__, bootdevice_brom_id);
+
+ return bootdevice_ofpath;
+}
+
u32 spl_boot_device(void)
{
u32 boot_device = BOOT_DEVICE_MMC1;