summaryrefslogtreecommitdiff
path: root/arch/arm/mach-k3
diff options
context:
space:
mode:
authorDave Gerlach <d-gerlach@ti.com>2021-04-23 19:27:35 +0300
committerLokesh Vutla <lokeshvutla@ti.com>2021-05-12 13:57:57 +0300
commit6d52c9dd9022314f494c087fbd7dc68836896523 (patch)
treec8e06d7859d0bfe97a4dde56a20adbc91fe18e45 /arch/arm/mach-k3
parentb4a8c3b242aced38ee7aa1cce664f0108fc3242c (diff)
downloadu-boot-6d52c9dd9022314f494c087fbd7dc68836896523.tar.xz
arm: mach-k3: am642: Store boot info from ROM
For AM642, ROM supports loading system firmware directly from boot image. ROM passes information about the number of images that are loaded to bootloader at a specific address that is temporary. Add support for storing this information somewhere permanent before it gets corrupted. Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Diffstat (limited to 'arch/arm/mach-k3')
-rw-r--r--arch/arm/mach-k3/am642_init.c21
-rw-r--r--arch/arm/mach-k3/include/mach/am64_hardware.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index aa0eb72a87..08f0b736a1 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -29,12 +29,33 @@ static void ctrl_mmr_unlock(void)
mmr_unlock(CTRL_MMR0_BASE, 6);
}
+/*
+ * 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 __section(".data");
+static struct rom_extended_boot_data bootdata __section(.data);
+
+static void store_boot_info_from_rom(void)
+{
+ bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
+ memcpy(&bootdata, (uintptr_t *)ROM_ENTENDED_BOOT_DATA_INFO,
+ sizeof(struct rom_extended_boot_data));
+}
+
void board_init_f(ulong dummy)
{
#if defined(CONFIG_CPU_V7R)
setup_k3_mpu_regions();
#endif
+ /*
+ * 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_info_from_rom();
+
ctrl_mmr_unlock();
/* Init DM early */
diff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/mach-k3/include/mach/am64_hardware.h
index 06b19b80db..8dc318bfbf 100644
--- a/arch/arm/mach-k3/include/mach/am64_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am64_hardware.h
@@ -47,4 +47,6 @@
#define CTRLMMR_LOCK_KICK1 0x0100c
#define CTRLMMR_LOCK_KICK1_UNLOCK_VAL 0xd172bc5a
+#define ROM_ENTENDED_BOOT_DATA_INFO 0x701beb00
+
#endif /* __ASM_ARCH_DRA8_HARDWARE_H */