summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-18 18:53:10 +0200
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-10-02 11:20:55 +0200
commitf4919b2ecdc2029ad8993f698b75530dbd21f3c3 (patch)
tree49f7d790f7667ccaa7773269de6db7b178a69918
parentaaaaaa2d4863e69063dee36d7bbe70108f84806c (diff)
rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM
The RK3188 implementation previously passed the address of the stack frame created during save_boot_params via pmu->os_reg[2]. This was not strictly necessary, as the save_boot_params() function was called twice (first: for TPL, saving the context for the BROM; next: for SPL, saving the context for the TPL) and a back-to-bootrom from the SPL would thus return to TPL. To simplify things, we now assume that the state of the TPL is not corrupted during SPL (the binaries are non-overlapping) and that the SPL can safely return to TPL using the back-to-bootrom mechanism. Consequently, the TPL should expect the SPL to return control and then further return to the actual bootrom by performing another back-to-bootrom transition. Series-changes: 2 - [added in v2] chain back_to_bootrom calls for SPL, first returning to the TPL (using the same mechanism) and the to the BROM from the TPL
-rw-r--r--arch/arm/mach-rockchip/rk3188-board-spl.c10
-rw-r--r--arch/arm/mach-rockchip/rk3188-board-tpl.c17
2 files changed, 10 insertions, 17 deletions
diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
index d3866bf029..05d4ae682f 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -101,7 +101,6 @@ static int setup_arm_clock(void)
void board_init_f(ulong dummy)
{
struct udevice *pinctrl, *dev;
- struct rk3188_pmu *pmu;
int ret;
/* Example code showing how to enable the debug UART on RK3188 */
@@ -145,15 +144,6 @@ void board_init_f(ulong dummy)
return;
}
- /*
- * Recover the bootrom's stackpointer.
- * For whatever reason needs to run after rockchip_get_clk.
- */
- pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU);
- if (IS_ERR(pmu))
- error("pmu syscon returned %ld\n", PTR_ERR(pmu));
- SAVE_SP_ADDR = readl(&pmu->sys_reg[2]);
-
ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
if (ret) {
debug("Pinctrl init failed: %d\n", ret);
diff --git a/arch/arm/mach-rockchip/rk3188-board-tpl.c b/arch/arm/mach-rockchip/rk3188-board-tpl.c
index b458ef6ea8..c714278e33 100644
--- a/arch/arm/mach-rockchip/rk3188-board-tpl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-tpl.c
@@ -21,15 +21,16 @@ static int rk3188_num_entries __attribute__ ((section(".data")));
static void jump_to_spl(void)
{
- typedef void __noreturn (*image_entry_noargs_t)(void);
+ typedef void (*image_entry_noargs_t)(void);
- struct rk3188_pmu * const pmu = (void *)PMU_BASE;
image_entry_noargs_t tpl_entry =
(image_entry_noargs_t)(unsigned long)SPL_ENTRY;
- /* Store the SAVE_SP_ADDR in a location shared with SPL. */
- writel(SAVE_SP_ADDR, &pmu->sys_reg[2]);
tpl_entry();
+ /*
+ * If the SPL stage triggers a 'return to bootrom', it will
+ * return to here.
+ */
}
void board_init_f(ulong dummy)
@@ -77,10 +78,12 @@ void board_init_f(ulong dummy)
back_to_bootrom();
} else {
/*
- * TPL part of the loader should now wait for us
- * at offset 0xC00 in the sram. Should never return
- * from there.
+ * SPL part of the loader should now wait for us at
+ * offset 0xC00 in the sram. If the SPL returns to us,
+ * we should in turn return to the BROM (i.e. chain
+ * through).
*/
jump_to_spl();
+ back_to_bootrom();
}
}