[PATCH v2 11/18] arm: mach-k3: j7200: Detect if ROM has already loaded sysfw

Lokesh Vutla lokeshvutla at ti.com
Mon Jul 27 11:45:36 CEST 2020


Detect if sysfw is already loaded by ROM and pass this information to
sysfw loader. Based on this information sysfw loader either loads the
sysfw image from boot media or just received the boot notification
message form sysfw.

Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
---
 arch/arm/mach-k3/common.c     | 8 ++++++++
 arch/arm/mach-k3/common.h     | 2 ++
 arch/arm/mach-k3/j721e_init.c | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index d065bdbc83..7b0369ffb0 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -71,6 +71,14 @@ void mmr_unlock(phys_addr_t base, u32 partition)
 	writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1);
 }
 
+bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data)
+{
+	if (strncmp(data->header, K3_ROM_BOOT_HEADER_MAGIC, 7))
+		return false;
+
+	return data->num_components > 1;
+}
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_K3_EARLY_CONS
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 8f5a5f323a..15a98fb653 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -7,6 +7,7 @@
  */
 
 #include <asm/armv7_mpu.h>
+#include <asm/hardware.h>
 
 #define AM65X	0xbb5a
 #define J721E	0xbb64
@@ -30,3 +31,4 @@ int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
 void k3_sysfw_print_ver(void);
 void spl_enable_dcache(void);
 void mmr_unlock(phys_addr_t base, u32 partition);
+bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 6246de3a26..a36e4ed603 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -177,7 +177,8 @@ void board_init_f(ulong dummy)
 	 * callback hook, effectively switching on (or over) the console
 	 * output.
 	 */
-	k3_sysfw_loader(false, k3_mmc_stop_clock, k3_mmc_restart_clock);
+	k3_sysfw_loader(is_rom_loaded_sysfw(&bootdata),
+			k3_mmc_stop_clock, k3_mmc_restart_clock);
 
 	/* Prepare console output */
 	preloader_console_init();
-- 
2.27.0



More information about the U-Boot mailing list