[PATCH V2 08/10] board: beagle: beagleboneai64: Set fdtfile from C code instead of findfdt script

Nishanth Menon
2024-01-09T19:19:37Z

Stop using the findfdt script and switch to setting the fdtfile from C
code.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes from V1:
* Just macro name change s/TI_EVM_FDT_FOLDER_PATH/TI_FDT_FOLDER_PATH
* Commit message update to drop the "warning added to findfdt" since
that is not done.

I have retained the explicit setting of fdtfile to remove dependency on
TI evm specific logic. Also, the dynamic population of fdtfile instead
of env_set("fdtfile", "ti/k3-j721e-beagleboneai64.dtb") to allow for the
upcoming board variants to be able to configure the dtb name via a
config fragment.

V1: https://lore.kernel.org/r/20240108173301.2692332-9-nm@ti.com
board/beagle/beagleboneai64/beagleboneai64.c | 14 ++++++++++++++
board/beagle/beagleboneai64/beagleboneai64.env | 1 -
configs/j721e_beagleboneai64_a72_defconfig | 3 ++-
3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/board/beagle/beagleboneai64/beagleboneai64.c b/board/beagle/beagleboneai64/beagleboneai64.c
index c8c1c78ae5a2..c5b4ff7df47a 100644
--- a/board/beagle/beagleboneai64/beagleboneai64.c
+++ b/board/beagle/beagleboneai64/beagleboneai64.c
@@ -28,3 +28,17 @@ int dram_init_banksize(void)
{
return fdtdec_setup_memory_banksize();
}
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+ char fdtfile[50];
+
+ snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb",
+ CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE);
+
+ env_set("fdtfile", fdtfile);
+
+ return 0;
+}
+#endif
diff --git a/board/beagle/beagleboneai64/beagleboneai64.env b/board/beagle/beagleboneai64/beagleboneai64.env
index 4f0a94a8113e..647b25d14c8e 100644
--- a/board/beagle/beagleboneai64/beagleboneai64.env
+++ b/board/beagle/beagleboneai64/beagleboneai64.env
@@ -1,5 +1,4 @@
#include <env/ti/ti_common.env>
-#include <env/ti/default_findfdt.env>
#include <env/ti/mmc.env>

name_kern=Image
diff --git a/configs/j721e_beagleboneai64_a72_defconfig b/configs/j721e_beagleboneai64_a72_defconfig
index 959f86844d32..9e53658eacb9 100644
--- a/configs/j721e_beagleboneai64_a72_defconfig
+++ b/configs/j721e_beagleboneai64_a72_defconfig
@@ -34,7 +34,8 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
CONFIG_AUTOBOOT_DELAY_STR="d"
CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_BOOTCOMMAND="run set_led_state_start_load;run findfdt; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOOTCOMMAND="run set_led_state_start_load; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOARD_LATE_INIT=y
CONFIG_LOGLEVEL=7
CONFIG_SPL_MAX_SIZE=0xc0000
CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
--
2.43.0