[PATCH 07/10] arm: mach-k3: am625_init: Update board specific API name to K3 generic API's

Nitin Yadav n-yadav at ti.com
Wed Apr 26 11:39:03 CEST 2023


Though the board_init_f API initializes the SoC, the API
name is incorrectly specified and misleads the functionality.
This file should only include k3-specific functionality.
Change the API's name to something more K3-specific and
separate the function to make it more modular.

Add k3_spl_post_dt_magic() to establish early console and
configure and startup system controller firmware.

Signed-off-by: Nitin Yadav <n-yadav at ti.com>
---
 arch/arm/mach-k3/am625_init.c             | 34 ++++++++++++++++++-----
 arch/arm/mach-k3/include/mach/sys_proto.h |  1 +
 board/ti/am62x/evm.c                      | 11 ++++++++
 3 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
index a91c15ca4e..18e7179339 100644
--- a/arch/arm/mach-k3/am625_init.c
+++ b/arch/arm/mach-k3/am625_init.c
@@ -6,14 +6,22 @@
  *	Suman Anna <s-anna at ti.com>
  */
 
+#include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/io.h>
+#include <asm/armv7_mpu.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sysfw-loader.h>
+#include <asm/arch/sys_proto.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
 #include "common.h"
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/pinctrl.h>
+#include <dm/root.h>
+#include <mmc.h>
+#include <remoteproc.h>
 
 /*
  * This uninitialized global variable would normal end up in the .bss section,
@@ -71,7 +79,7 @@ static __maybe_unused void enable_mcu_esm_reset(void)
 	writel(stat, CTRLMMR_MCU_RST_CTRL);
 }
 
-void board_init_f(ulong dummy)
+void k3_spl_init(void)
 {
 	struct udevice *dev;
 	int ret;
@@ -100,6 +108,7 @@ void board_init_f(ulong dummy)
 	 * respectively and the firmware depend on SPL to initialize the pin
 	 * settings.
 	 */
+
 	ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
 	if (!ret)
 		pinctrl_select_state(dev, "default");
@@ -109,6 +118,12 @@ void board_init_f(ulong dummy)
 		pinctrl_select_state(dev, "default");
 
 	preloader_console_init();
+}
+
+void k3_spl_post_dt_magic(void)
+{
+	struct udevice *dev;
+	int ret;
 
 #ifdef CONFIG_K3_EARLY_CONS
 	/*
@@ -133,7 +148,6 @@ void board_init_f(ulong dummy)
 
 	k3_sysfw_loader(true, NULL, NULL);
 #endif
-
 	/*
 	 * Force probe of clk_k3 driver here to ensure basic default clock
 	 * configuration is always done.
@@ -162,12 +176,18 @@ void board_init_f(ulong dummy)
 
 		enable_mcu_esm_reset();
 	}
+}
 
-#if defined(CONFIG_K3_AM64_DDRSS)
-	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
-	if (ret)
-		panic("DRAM init failed: %d\n", ret);
-#endif
+void k3_mem_init(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	if (IS_ENABLED(CONFIG_TARGET_AM625_R5_EVM)) {
+		ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+		if (ret)
+			panic("DRAM init failed: %d\n", ret);
+	}
 }
 
 u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 3d3d90d02d..886bb4f5d6 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -21,5 +21,6 @@ bool soc_is_j7200(void);
 
 void k3_spl_init(void);
 void k3_mem_init(void);
+void k3_spl_post_dt_magic(void);
 bool check_rom_loaded_sysfw(void);
 #endif
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index 20b2a70122..cc8e31824b 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -102,3 +102,14 @@ void spl_perform_fixups(struct spl_image_info *spl_image)
 #endif
 }
 #endif
+
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+	k3_spl_init();
+
+	k3_spl_post_dt_magic();
+
+	k3_mem_init();
+}
+#endif
-- 
2.25.1



More information about the U-Boot mailing list