summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Dannenberg <[email protected]>2019-06-13 10:29:45 +0530
committerTom Rini <[email protected]>2019-07-26 21:49:26 -0400
commitf94a07c8a1c1da21aaba7c4f60843a5f14b34e2d (patch)
tree9d515ca2823dbaf195165e6408940a756c16997b
parentb73fcbced9dfa1345ffcafbcfd84dfad7c291915 (diff)
armv7R: K3: j721e: Store boot index from ROM
Obtain the boot index as left behind by the device boot ROM and store it in scratch pad SRAM for later use before it may get overwritten. Signed-off-by: Andreas Dannenberg <[email protected]>
-rw-r--r--arch/arm/mach-k3/j721e_init.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index ba6a1cf0e60..b7f0546dd78 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -53,12 +53,25 @@ static void ctrl_mmr_unlock(void)
mmr_unlock(CTRL_MMR0_BASE, 7);
}
+/*
+ * This uninitialized global variable would normal end up in the .bss section,
+ * but the .bss is cleared between writing and reading this variable, so move
+ * it to the .data section.
+ */
+u32 bootindex __attribute__((section(".data")));
+
+static void store_boot_index_from_rom(void)
+{
+ bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
+}
+
void board_init_f(ulong dummy)
{
/*
- * ToDo:
- * - Store boot rom index.
+ * Cannot delay this further as there is a chance that
+ * K3_BOOT_PARAM_TABLE_INDEX can be over written by SPL MALLOC section.
*/
+ store_boot_index_from_rom();
/* Make all control module registers accessible */
ctrl_mmr_unlock();