[PATCH V2 00/10] board/ti: k3 boards: Stop using findfdt

This is a wide cleanup to switch to setting fdtfile using env_set instead of scripted magic. 'fdtfile' is expected to be set by default. This allows the stdboot triggered efi loaders to find the correct OS device tree file even if regular boot process is interrupted by user intervention.
This is a refresh of https://lore.kernel.org/all/86le9dwz4d.fsf@udb0321960.dhcp.ti.com/ which was the wrong approach.
Updates from V1: * Renames of variables and macros for various review comments. * Commit message updates in some patches for clarity.
Bootlogs: https://gist.github.com/nmenon/843e343cde645ec4aa57b60cece5256a
based on master: c5e461fbf7cc Merge tag 'u-boot-imx-master-20240108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
NOTE: There are a couple of checkpatch WARN (around LATE_INIT) and CHECK (fdt_ops #ifdeffery) that on closer inspection looks fine and consistent with other similar usage.
V1: https://lore.kernel.org/all/20240108173301.2692332-1-nm@ti.com/
Nishanth Menon (10): board: ti: common: Introduce a common fdt ops library board: ti: am62ax: Set fdtfile from C code instead of findfdt script board: ti: am62x: Set fdtfile from C code instead of findfdt script board: ti: am64x: Set fdtfile from C code instead of findfdt script board: ti: am65x: Set fdtfile from C code instead of findfdt script board: ti: j721e: Set fdtfile from C code instead of findfdt script board: ti: j721s2: Set fdtfile from C code instead of findfdt script board: beagle: beagleboneai64: Set fdtfile from C code instead of findfdt script board: beagle: beagleplay: Set fdtfile from C code instead of findfdt script include: env: ti: Drop default_findfdt
board/beagle/beagleboneai64/beagleboneai64.c | 14 ++++ .../beagle/beagleboneai64/beagleboneai64.env | 1 - board/beagle/beagleplay/beagleplay.c | 14 ++++ board/beagle/beagleplay/beagleplay.env | 1 - board/ti/am62ax/am62ax.env | 1 - board/ti/am62ax/evm.c | 10 +++ board/ti/am62x/am62x.env | 1 - board/ti/am62x/evm.c | 8 +++ board/ti/am64x/am64x.env | 9 --- board/ti/am64x/evm.c | 8 +++ board/ti/am65x/am65x.env | 3 - board/ti/am65x/evm.c | 2 + board/ti/common/Kconfig | 12 ++++ board/ti/common/Makefile | 1 + board/ti/common/fdt_ops.c | 64 +++++++++++++++++++ board/ti/common/fdt_ops.h | 42 ++++++++++++ board/ti/j721e/evm.c | 8 +++ board/ti/j721e/j721e.env | 10 --- board/ti/j721s2/evm.c | 8 +++ board/ti/j721s2/j721s2.env | 8 --- configs/am62ax_evm_a53_defconfig | 1 + configs/am62x_beagleplay_a53_defconfig | 3 +- configs/am62x_evm_a53_defconfig | 1 + configs/j721e_beagleboneai64_a72_defconfig | 3 +- include/env/ti/default_findfdt.env | 12 ---- 25 files changed, 197 insertions(+), 48 deletions(-) create mode 100644 board/ti/common/fdt_ops.c create mode 100644 board/ti/common/fdt_ops.h delete mode 100644 include/env/ti/default_findfdt.env

Introduce a common fdt operations library for basic device tree operations that are common between various boards.
The first library to introduce here is the capability to set up fdtfile as a standard variable as part of board identification rather than depend on scripted ifdeffery.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes Since v1: * s/TI_EVM_FDT_FOLDER_PATH/TI_FDT_FOLDER_PATH s/name_fdt/board_name s/TI_NAME_FDT_MAX/TI_BOARD_NAME_MAX * Comment updates in various places for review clarification. * Still maintain the fall back using CONFIG_DEFAULT_DEVICE_TREE for reasons explained in review comment response. * Added a specific u-boot version number for deprecation of legacy env variables.
V1: https://lore.kernel.org/r/20240108173301.2692332-2-nm@ti.com
board/ti/common/Kconfig | 12 ++++++++ board/ti/common/Makefile | 1 + board/ti/common/fdt_ops.c | 64 +++++++++++++++++++++++++++++++++++++++ board/ti/common/fdt_ops.h | 42 +++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 board/ti/common/fdt_ops.c create mode 100644 board/ti/common/fdt_ops.h
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig index 49edd98014ab..de44e4de2115 100644 --- a/board/ti/common/Kconfig +++ b/board/ti/common/Kconfig @@ -49,3 +49,15 @@ config TI_COMMON_CMD_OPTIONS imply CMD_SPI imply CMD_TIME imply CMD_USB if USB + +config TI_FDT_FOLDER_PATH + string "Location of Folder path where dtb is present" + default "ti/davinci" if ARCH_DAVINCI + default "ti/keystone" if ARCH_KEYSTONE + default "ti/omap" if ARCH_OMAP2PLUS + default "ti" if ARCH_K3 + depends on ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 + help + Folder path for kernel device tree default. + This is used along with fdtfile path to locate the kernel + device tree blob. diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile index 26bf12e2e6d5..5ac361ba7fcf 100644 --- a/board/ti/common/Makefile +++ b/board/ti/common/Makefile @@ -3,3 +3,4 @@
obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o obj-${CONFIG_CMD_EXTENSION} += cape_detect.o +obj-${CONFIG_OF_LIBFDT} += fdt_ops.o diff --git a/board/ti/common/fdt_ops.c b/board/ti/common/fdt_ops.c new file mode 100644 index 000000000000..eb917be9e0da --- /dev/null +++ b/board/ti/common/fdt_ops.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Library to support FDT file operations which are common + * + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/ + */ + +#include <env.h> +#include <vsprintf.h> +#include "fdt_ops.h" + +void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map) +{ + char *fdt_file_name = NULL; + char fdtfile[TI_FDT_FILE_MAX]; + + if (board_name) { + while (fdt_map) { + /* Check for NULL terminator in the list */ + if (!fdt_map->board_name) + break; + if (!strncmp(fdt_map->board_name, board_name, TI_BOARD_NAME_MAX)) { + fdt_file_name = fdt_map->fdt_file_name; + break; + } + fdt_map++; + } + } + + /* match not found OR null board_name */ + if (!fdt_file_name) { + /* + * Prioritize CONFIG_DEFAULT_FDT_FILE - if that is not defined, + * or is empty, then use CONFIG_DEFAULT_DEVICE_TREE + */ +#ifdef CONFIG_DEFAULT_FDT_FILE + if (strlen(CONFIG_DEFAULT_FDT_FILE)) { + snprintf(fdtfile, sizeof(fdtfile), "%s/%s", + CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_FDT_FILE); + } else +#endif + { + snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb", + CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE); + } + } else { + snprintf(fdtfile, sizeof(fdtfile), "%s/%s", CONFIG_TI_FDT_FOLDER_PATH, + fdt_file_name); + } + + env_set("fdtfile", fdtfile); + + /* + * XXX: DEPRECATION WARNING: 2 u-boot versions (2024.10). + * + * Maintain compatibility with downstream scripts that may be using + * name_fdt + */ + if (board_name) + env_set("name_fdt", fdtfile); + /* Also set the findfdt legacy script to warn users to stop using this */ + env_set("findfdt", + "echo WARN: fdtfile already set. Stop using findfdt in script"); +} diff --git a/board/ti/common/fdt_ops.h b/board/ti/common/fdt_ops.h new file mode 100644 index 000000000000..5d304994fb6e --- /dev/null +++ b/board/ti/common/fdt_ops.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Library to support common device tree manipulation for TI EVMs + * + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com + */ + +#ifndef __FDT_OPS_H +#define __FDT_OPS_H + +#define TI_BOARD_NAME_MAX 20 +#define TI_FDT_FILE_MAX 200 + +/** + * struct ti_fdt_map - mapping of device tree blob name to board name + * @board_name: board_name up to TI_BOARD_NAME_MAX long + * @fdt_file_name: device tree blob name as described by kernel + */ +struct ti_fdt_map { + const char *board_name; + char *fdt_file_name; +}; + +/** + * ti_set_fdt_env - Find the correct device tree file name based on the + * board name and set 'fdtfile' env variable with correct folder + * structure appropriate to the architecture and Linux kernel's + * 'make install_dtbs' conventions. This function is invoked typically + * as part of board_late_init. + * + * fdt name is picked by: + * a) If a board name match is found, use the match + * b) If not, CONFIG_DEFAULT_FDT_FILE (Boot OS device tree) if that is defined + * and not null + * c) If not, Use CONFIG_DEFAULT_DEVICE_TREE (DT control for bootloader) + * + * @board_name: match to search with (max of TI_BOARD_NAME_MAX chars) + * @fdt_map: NULL terminated array of device tree file name matches. + */ +void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map); + +#endif /* __FDT_OPS_H */

Nishanth Menon nm@ti.com writes:
Introduce a common fdt operations library for basic device tree operations that are common between various boards.
The first library to introduce here is the capability to set up fdtfile as a standard variable as part of board identification rather than depend on scripted ifdeffery.
Signed-off-by: Nishanth Menon nm@ti.com
Changes Since v1:
- s/TI_EVM_FDT_FOLDER_PATH/TI_FDT_FOLDER_PATH s/name_fdt/board_name s/TI_NAME_FDT_MAX/TI_BOARD_NAME_MAX
- Comment updates in various places for review clarification.
- Still maintain the fall back using CONFIG_DEFAULT_DEVICE_TREE for reasons explained in review comment response.
- Added a specific u-boot version number for deprecation of legacy env variables.
V1: https://lore.kernel.org/r/20240108173301.2692332-2-nm@ti.com
board/ti/common/Kconfig | 12 ++++++++ board/ti/common/Makefile | 1 + board/ti/common/fdt_ops.c | 64 +++++++++++++++++++++++++++++++++++++++ board/ti/common/fdt_ops.h | 42 +++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 board/ti/common/fdt_ops.c create mode 100644 board/ti/common/fdt_ops.h
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig index 49edd98014ab..de44e4de2115 100644 --- a/board/ti/common/Kconfig +++ b/board/ti/common/Kconfig @@ -49,3 +49,15 @@ config TI_COMMON_CMD_OPTIONS imply CMD_SPI imply CMD_TIME imply CMD_USB if USB
+config TI_FDT_FOLDER_PATH
- string "Location of Folder path where dtb is present"
- default "ti/davinci" if ARCH_DAVINCI
- default "ti/keystone" if ARCH_KEYSTONE
- default "ti/omap" if ARCH_OMAP2PLUS
- default "ti" if ARCH_K3
- depends on ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3
- help
Folder path for kernel device tree default.
This is used along with fdtfile path to locate the kernel
device tree blob.
diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile index 26bf12e2e6d5..5ac361ba7fcf 100644 --- a/board/ti/common/Makefile +++ b/board/ti/common/Makefile @@ -3,3 +3,4 @@
obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o obj-${CONFIG_CMD_EXTENSION} += cape_detect.o +obj-${CONFIG_OF_LIBFDT} += fdt_ops.o diff --git a/board/ti/common/fdt_ops.c b/board/ti/common/fdt_ops.c new file mode 100644 index 000000000000..eb917be9e0da --- /dev/null +++ b/board/ti/common/fdt_ops.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/*
- Library to support FDT file operations which are common
- Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
- */
+#include <env.h> +#include <vsprintf.h> +#include "fdt_ops.h"
+void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map) +{
- char *fdt_file_name = NULL;
- char fdtfile[TI_FDT_FILE_MAX];
- if (board_name) {
while (fdt_map) {
/* Check for NULL terminator in the list */
if (!fdt_map->board_name)
break;
if (!strncmp(fdt_map->board_name, board_name, TI_BOARD_NAME_MAX)) {
fdt_file_name = fdt_map->fdt_file_name;
break;
}
fdt_map++;
}
- }
- /* match not found OR null board_name */
- if (!fdt_file_name) {
/*
* Prioritize CONFIG_DEFAULT_FDT_FILE - if that is not defined,
* or is empty, then use CONFIG_DEFAULT_DEVICE_TREE
*/
+#ifdef CONFIG_DEFAULT_FDT_FILE
if (strlen(CONFIG_DEFAULT_FDT_FILE)) {
snprintf(fdtfile, sizeof(fdtfile), "%s/%s",
CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_FDT_FILE);
} else
+#endif
{
snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb",
CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE);
}
- } else {
snprintf(fdtfile, sizeof(fdtfile), "%s/%s", CONFIG_TI_FDT_FOLDER_PATH,
fdt_file_name);
- }
- env_set("fdtfile", fdtfile);
- /*
* XXX: DEPRECATION WARNING: 2 u-boot versions (2024.10).
*
* Maintain compatibility with downstream scripts that may be using
* name_fdt
*/
- if (board_name)
env_set("name_fdt", fdtfile);
- /* Also set the findfdt legacy script to warn users to stop using this */
- env_set("findfdt",
"echo WARN: fdtfile already set. Stop using findfdt in script");
+} diff --git a/board/ti/common/fdt_ops.h b/board/ti/common/fdt_ops.h new file mode 100644 index 000000000000..5d304994fb6e --- /dev/null +++ b/board/ti/common/fdt_ops.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/*
- Library to support common device tree manipulation for TI EVMs
- Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com
- */
+#ifndef __FDT_OPS_H +#define __FDT_OPS_H
+#define TI_BOARD_NAME_MAX 20 +#define TI_FDT_FILE_MAX 200
+/**
- struct ti_fdt_map - mapping of device tree blob name to board name
- @board_name: board_name up to TI_BOARD_NAME_MAX long
- @fdt_file_name: device tree blob name as described by kernel
- */
+struct ti_fdt_map {
- const char *board_name;
- char *fdt_file_name;
+};
+/**
- ti_set_fdt_env - Find the correct device tree file name based on the
- board name and set 'fdtfile' env variable with correct folder
- structure appropriate to the architecture and Linux kernel's
- 'make install_dtbs' conventions. This function is invoked typically
- as part of board_late_init.
- fdt name is picked by:
- a) If a board name match is found, use the match
- b) If not, CONFIG_DEFAULT_FDT_FILE (Boot OS device tree) if that is defined
- and not null
- c) If not, Use CONFIG_DEFAULT_DEVICE_TREE (DT control for bootloader)
- @board_name: match to search with (max of TI_BOARD_NAME_MAX chars)
- @fdt_map: NULL terminated array of device tree file name matches.
- */
+void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map);
+#endif /* __FDT_OPS_H */
2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

Stop using the findfdt script and switch to setting the fdtfile from C code.
While at this, replace findfdt in environment with a warning as it is no longer needed
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-3-nm@ti.com
board/ti/am62ax/am62ax.env | 1 - board/ti/am62ax/evm.c | 10 ++++++++++ configs/am62ax_evm_a53_defconfig | 1 + 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/board/ti/am62ax/am62ax.env b/board/ti/am62ax/am62ax.env index a6d967e982d4..334374abb73e 100644 --- a/board/ti/am62ax/am62ax.env +++ b/board/ti/am62ax/am62ax.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/board/ti/am62ax/evm.c b/board/ti/am62ax/evm.c index cd3360a43029..62d3664936e7 100644 --- a/board/ti/am62ax/evm.c +++ b/board/ti/am62ax/evm.c @@ -13,6 +13,8 @@ #include <fdt_support.h> #include <spl.h>
+#include "../common/fdt_ops.h" + int board_init(void) { return 0; @@ -27,3 +29,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig index 38083586a3ec..e5fcd8cc5b6f 100644 --- a/configs/am62ax_evm_a53_defconfig +++ b/configs/am62ax_evm_a53_defconfig @@ -24,6 +24,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

Nishanth Menon nm@ti.com writes:
Stop using the findfdt script and switch to setting the fdtfile from C code.
While at this, replace findfdt in environment with a warning as it is no longer needed
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-3-nm@ti.com
board/ti/am62ax/am62ax.env | 1 - board/ti/am62ax/evm.c | 10 ++++++++++ configs/am62ax_evm_a53_defconfig | 1 + 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/board/ti/am62ax/am62ax.env b/board/ti/am62ax/am62ax.env index a6d967e982d4..334374abb73e 100644 --- a/board/ti/am62ax/am62ax.env +++ b/board/ti/am62ax/am62ax.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/board/ti/am62ax/evm.c b/board/ti/am62ax/evm.c index cd3360a43029..62d3664936e7 100644 --- a/board/ti/am62ax/evm.c +++ b/board/ti/am62ax/evm.c @@ -13,6 +13,8 @@ #include <fdt_support.h> #include <spl.h>
+#include "../common/fdt_ops.h"
int board_init(void) { return 0; @@ -27,3 +29,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); }
+#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{
- ti_set_fdt_env(NULL, NULL);
- return 0;
+} +#endif diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig index 38083586a3ec..e5fcd8cc5b6f 100644 --- a/configs/am62ax_evm_a53_defconfig +++ b/configs/am62ax_evm_a53_defconfig @@ -24,6 +24,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y -- 2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

Stop using the findfdt script and switch to setting the fdtfile from C code.
While at this, replace findfdt in environment with a warning as it is no longer needed
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-4-nm@ti.com board/ti/am62x/am62x.env | 1 - board/ti/am62x/evm.c | 8 ++++++++ configs/am62x_evm_a53_defconfig | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env index e53a55c38fbb..9cb186c2a03c 100644 --- a/board/ti/am62x/am62x.env +++ b/board/ti/am62x/am62x.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/board/ti/am62x/evm.c b/board/ti/am62x/evm.c index ad939088402e..b76ef1b94a61 100644 --- a/board/ti/am62x/evm.c +++ b/board/ti/am62x/evm.c @@ -54,6 +54,14 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); }
+#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif + int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index aa96c1b3125c..3cf3b93a93fc 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -32,6 +32,7 @@ CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000

Nishanth Menon nm@ti.com writes:
Stop using the findfdt script and switch to setting the fdtfile from C code.
While at this, replace findfdt in environment with a warning as it is no longer needed
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-4-nm@ti.com board/ti/am62x/am62x.env | 1 - board/ti/am62x/evm.c | 8 ++++++++ configs/am62x_evm_a53_defconfig | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env index e53a55c38fbb..9cb186c2a03c 100644 --- a/board/ti/am62x/am62x.env +++ b/board/ti/am62x/am62x.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/board/ti/am62x/evm.c b/board/ti/am62x/evm.c index ad939088402e..b76ef1b94a61 100644 --- a/board/ti/am62x/evm.c +++ b/board/ti/am62x/evm.c @@ -54,6 +54,14 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); }
+#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{
- ti_set_fdt_env(NULL, NULL);
- return 0;
+} +#endif
int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index aa96c1b3125c..3cf3b93a93fc 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -32,6 +32,7 @@ CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000 -- 2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None. I have retained the the existing names used in the file as is for now, a cleanup as suggested in review is probably something to do in a follow on series.
V1: https://lore.kernel.org/r/20240108173301.2692332-5-nm@ti.com
board/ti/am64x/am64x.env | 9 --------- board/ti/am64x/evm.c | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env index efd736b99be4..9a8812d4ee54 100644 --- a/board/ti/am64x/am64x.env +++ b/board/ti/am64x/am64x.env @@ -2,14 +2,6 @@ #include <env/ti/mmc.env> #include <env/ti/k3_dfu.env>
-findfdt= - if test $board_name = am64x_gpevm; then - setenv name_fdt ti/k3-am642-evm.dtb; fi; - if test $board_name = am64x_skevm; then - setenv name_fdt ti/k3-am642-sk.dtb; fi; - if test $name_fdt = undefined; then - echo WARNING: Could not determine device tree to use; fi; - setenv fdtfile ${name_fdt} name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts} @@ -43,7 +35,6 @@ get_fit_usb=load usb ${bootpart} ${addr_fit} usbboot=setenv boot usb; setenv bootpart 0:2; usb start; - run findfdt; run init_usb; run get_kern_usb; run get_fdt_usb; diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c index a6dcff2eb434..e2f506d2c6ea 100644 --- a/board/ti/am64x/evm.c +++ b/board/ti/am64x/evm.c @@ -16,6 +16,7 @@ #include <env.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_am64x_gpevm() (board_ti_k3_is("AM64-GPEVM") || \ board_ti_k3_is("AM64-HSEVM")) @@ -180,6 +181,12 @@ int checkboard(void) }
#ifdef CONFIG_BOARD_LATE_INIT +static struct ti_fdt_map ti_am64_evm_fdt_map[] = { + {"am64x_gpevm", "k3-am642-evm.dtb"}, + {"am64x_skevm", "k3-am642-sk.dtb"}, + { /* Sentinel. */ } +}; + static void setup_board_eeprom_env(void) { char *name = "am64x_gpevm"; @@ -197,6 +204,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name); + ti_set_fdt_env(name, ti_am64_evm_fdt_map); }
static void setup_serial(void)

Nishanth Menon nm@ti.com writes:
We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None. I have retained the the existing names used in the file as is for now, a cleanup as suggested in review is probably something to do in a follow on series.
V1: https://lore.kernel.org/r/20240108173301.2692332-5-nm@ti.com
board/ti/am64x/am64x.env | 9 --------- board/ti/am64x/evm.c | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env index efd736b99be4..9a8812d4ee54 100644 --- a/board/ti/am64x/am64x.env +++ b/board/ti/am64x/am64x.env @@ -2,14 +2,6 @@ #include <env/ti/mmc.env> #include <env/ti/k3_dfu.env>
-findfdt=
- if test $board_name = am64x_gpevm; then
setenv name_fdt ti/k3-am642-evm.dtb; fi;
- if test $board_name = am64x_skevm; then
setenv name_fdt ti/k3-am642-sk.dtb; fi;
- if test $name_fdt = undefined; then
echo WARNING: Could not determine device tree to use; fi;
- setenv fdtfile ${name_fdt}
name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts} @@ -43,7 +35,6 @@ get_fit_usb=load usb ${bootpart} ${addr_fit} usbboot=setenv boot usb; setenv bootpart 0:2; usb start;
- run findfdt; run init_usb; run get_kern_usb; run get_fdt_usb;
diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c index a6dcff2eb434..e2f506d2c6ea 100644 --- a/board/ti/am64x/evm.c +++ b/board/ti/am64x/evm.c @@ -16,6 +16,7 @@ #include <env.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_am64x_gpevm() (board_ti_k3_is("AM64-GPEVM") || \ board_ti_k3_is("AM64-HSEVM")) @@ -180,6 +181,12 @@ int checkboard(void) }
#ifdef CONFIG_BOARD_LATE_INIT +static struct ti_fdt_map ti_am64_evm_fdt_map[] = {
- {"am64x_gpevm", "k3-am642-evm.dtb"},
- {"am64x_skevm", "k3-am642-sk.dtb"},
- { /* Sentinel. */ }
+};
static void setup_board_eeprom_env(void) { char *name = "am64x_gpevm"; @@ -197,6 +204,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name);
- ti_set_fdt_env(name, ti_am64_evm_fdt_map);
}
static void setup_serial(void)
2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-6-nm@ti.com board/ti/am65x/am65x.env | 3 --- board/ti/am65x/evm.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/board/ti/am65x/am65x.env b/board/ti/am65x/am65x.env index 286b9c300c05..814374d68cf0 100644 --- a/board/ti/am65x/am65x.env +++ b/board/ti/am65x/am65x.env @@ -5,9 +5,6 @@ #include <env/ti/k3_rproc.env> #endif
-findfdt= - setenv name_fdt ti/k3-am654-base-board.dtb; - setenv fdtfile ${name_fdt} name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x02800000 diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index df209021c1b7..3109c9a2acac 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -22,6 +22,7 @@ #include <linux/printk.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_am65x_base_board() board_ti_is("AM6-COMPROCEVM")
@@ -141,6 +142,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name); + ti_set_fdt_env(NULL, NULL); }
static int init_daughtercard_det_gpio(char *gpio_name, struct gpio_desc *desc)

Nishanth Menon nm@ti.com writes:
We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None. I have retained the central call ti_set_fdt_env() to retain the population of fdtfile name using the CONFIG fall back logic and the population of (now deprecated) legacy variables for downstream script users.
V1: https://lore.kernel.org/r/20240108173301.2692332-6-nm@ti.com board/ti/am65x/am65x.env | 3 --- board/ti/am65x/evm.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/board/ti/am65x/am65x.env b/board/ti/am65x/am65x.env index 286b9c300c05..814374d68cf0 100644 --- a/board/ti/am65x/am65x.env +++ b/board/ti/am65x/am65x.env @@ -5,9 +5,6 @@ #include <env/ti/k3_rproc.env> #endif
-findfdt=
- setenv name_fdt ti/k3-am654-base-board.dtb;
- setenv fdtfile ${name_fdt}
name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x02800000 diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index df209021c1b7..3109c9a2acac 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -22,6 +22,7 @@ #include <linux/printk.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_am65x_base_board() board_ti_is("AM6-COMPROCEVM")
@@ -141,6 +142,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name);
- ti_set_fdt_env(NULL, NULL);
}
static int init_daughtercard_det_gpio(char *gpio_name, struct gpio_desc *desc)
2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None.
v1: https://lore.kernel.org/r/20240108173301.2692332-7-nm@ti.com board/ti/j721e/evm.c | 8 ++++++++ board/ti/j721e/j721e.env | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index c541880107ec..ad6ef4553e04 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -16,6 +16,7 @@ #include <dm.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \ board_ti_k3_is("J721EX-PM2-SOM")) @@ -424,6 +425,12 @@ void configure_serdes_sierra(void) }
#ifdef CONFIG_BOARD_LATE_INIT +static struct ti_fdt_map ti_j721e_evm_fdt_map[] = { + {"j721e", "k3-j721e-common-proc-board.dtb"}, + {"j721e-sk", "k3-j721e-sk.dtb"}, + {"j7200", "k3-j7200-common-proc-board.dtb"}, + { /* Sentinel. */ } +}; static void setup_board_eeprom_env(void) { char *name = "j721e"; @@ -443,6 +450,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name); + ti_set_fdt_env(name, ti_j721e_evm_fdt_map); }
static void setup_serial(void) diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index cb27bf5e2b24..38bfd7d49634 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -7,16 +7,6 @@ #include <env/ti/k3_rproc.env> #endif
-default_device_tree=ti/k3-j721e-common-proc-board.dtb -findfdt= - setenv name_fdt ${default_device_tree}; - if test $board_name = j721e; then - setenv name_fdt ti/k3-j721e-common-proc-board.dtb; fi; - if test $board_name = j7200; then - setenv name_fdt ti/k3-j7200-common-proc-board.dtb; fi; - if test $board_name = j721e-eaik || test $board_name = j721e-sk; then - setenv name_fdt ti/k3-j721e-sk.dtb; fi; - setenv fdtfile ${name_fdt} name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000

Nishanth Menon nm@ti.com writes:
We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None.
v1: https://lore.kernel.org/r/20240108173301.2692332-7-nm@ti.com board/ti/j721e/evm.c | 8 ++++++++ board/ti/j721e/j721e.env | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index c541880107ec..ad6ef4553e04 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -16,6 +16,7 @@ #include <dm.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
#define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \ board_ti_k3_is("J721EX-PM2-SOM")) @@ -424,6 +425,12 @@ void configure_serdes_sierra(void) }
#ifdef CONFIG_BOARD_LATE_INIT +static struct ti_fdt_map ti_j721e_evm_fdt_map[] = {
- {"j721e", "k3-j721e-common-proc-board.dtb"},
- {"j721e-sk", "k3-j721e-sk.dtb"},
- {"j7200", "k3-j7200-common-proc-board.dtb"},
- { /* Sentinel. */ }
+}; static void setup_board_eeprom_env(void) { char *name = "j721e"; @@ -443,6 +450,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name);
- ti_set_fdt_env(name, ti_j721e_evm_fdt_map);
}
static void setup_serial(void) diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index cb27bf5e2b24..38bfd7d49634 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -7,16 +7,6 @@ #include <env/ti/k3_rproc.env> #endif
-default_device_tree=ti/k3-j721e-common-proc-board.dtb -findfdt=
- setenv name_fdt ${default_device_tree};
- if test $board_name = j721e; then
setenv name_fdt ti/k3-j721e-common-proc-board.dtb; fi;
- if test $board_name = j7200; then
setenv name_fdt ti/k3-j7200-common-proc-board.dtb; fi;
- if test $board_name = j721e-eaik || test $board_name = j721e-sk; then
setenv name_fdt ti/k3-j721e-sk.dtb; fi;
- setenv fdtfile ${name_fdt}
name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 -- 2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None.
V1: https://lore.kernel.org/r/20240108173301.2692332-8-nm@ti.com board/ti/j721s2/evm.c | 8 ++++++++ board/ti/j721s2/j721s2.env | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index 1220cd84519b..5a0281d6b483 100644 --- a/board/ti/j721s2/evm.c +++ b/board/ti/j721s2/evm.c @@ -23,6 +23,7 @@ #include <dm/root.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -114,6 +115,12 @@ int checkboard(void) return 0; }
+static struct ti_fdt_map ti_j721s2_evm_fdt_map[] = { + {"j721s2", "k3-j721s2-common-proc-board.dtb"}, + {"am68-sk", "k3-am68-sk-base-board.dtb"}, + { /* Sentinel. */ } +}; + static void setup_board_eeprom_env(void) { char *name = "j721s2"; @@ -131,6 +138,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name); + ti_set_fdt_env(name, ti_j721s2_evm_fdt_map); }
static void setup_serial(void) diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env index 64e3d9da85f0..9a03b9f30aee 100644 --- a/board/ti/j721s2/j721s2.env +++ b/board/ti/j721s2/j721s2.env @@ -7,14 +7,6 @@ #include <env/ti/k3_rproc.env> #endif
-default_device_tree=ti/k3-j721s2-common-proc-board.dtb -findfdt= - setenv name_fdt ${default_device_tree}; - if test $board_name = j721s2; then \ - setenv name_fdt ti/k3-j721s2-common-proc-board.dtb; fi; - if test $board_name = am68-sk; then - setenv name_fdt ti/k3-am68-sk-base-board.dtb; fi; - setenv fdtfile ${name_fdt} name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02880000

Nishanth Menon nm@ti.com writes:
We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
While at this, replace findfdt in environment with a warning as it is no longer needed.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None.
V1: https://lore.kernel.org/r/20240108173301.2692332-8-nm@ti.com board/ti/j721s2/evm.c | 8 ++++++++ board/ti/j721s2/j721s2.env | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index 1220cd84519b..5a0281d6b483 100644 --- a/board/ti/j721s2/evm.c +++ b/board/ti/j721s2/evm.c @@ -23,6 +23,7 @@ #include <dm/root.h>
#include "../common/board_detect.h" +#include "../common/fdt_ops.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -114,6 +115,12 @@ int checkboard(void) return 0; }
+static struct ti_fdt_map ti_j721s2_evm_fdt_map[] = {
- {"j721s2", "k3-j721s2-common-proc-board.dtb"},
- {"am68-sk", "k3-am68-sk-base-board.dtb"},
- { /* Sentinel. */ }
+};
static void setup_board_eeprom_env(void) { char *name = "j721s2"; @@ -131,6 +138,7 @@ static void setup_board_eeprom_env(void)
invalid_eeprom: set_board_info_env_am6(name);
- ti_set_fdt_env(name, ti_j721s2_evm_fdt_map);
}
static void setup_serial(void) diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env index 64e3d9da85f0..9a03b9f30aee 100644 --- a/board/ti/j721s2/j721s2.env +++ b/board/ti/j721s2/j721s2.env @@ -7,14 +7,6 @@ #include <env/ti/k3_rproc.env> #endif
-default_device_tree=ti/k3-j721s2-common-proc-board.dtb -findfdt=
- setenv name_fdt ${default_device_tree};
- if test $board_name = j721s2; then \
setenv name_fdt ti/k3-j721s2-common-proc-board.dtb; fi;
- if test $board_name = am68-sk; then
setenv name_fdt ti/k3-am68-sk-base-board.dtb; fi;
- setenv fdtfile ${name_fdt}
name_kern=Image console=ttyS2,115200n8 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02880000 -- 2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

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

Nishanth Menon nm@ti.com writes:
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
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

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-am625-beagleplay.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-10-nm@ti.com board/beagle/beagleplay/beagleplay.c | 14 ++++++++++++++ board/beagle/beagleplay/beagleplay.env | 1 - configs/am62x_beagleplay_a53_defconfig | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/board/beagle/beagleplay/beagleplay.c b/board/beagle/beagleplay/beagleplay.c index 1c376dea372f..20819ecf45b4 100644 --- a/board/beagle/beagleplay/beagleplay.c +++ b/board/beagle/beagleplay/beagleplay.c @@ -27,3 +27,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/beagleplay/beagleplay.env b/board/beagle/beagleplay/beagleplay.env index 4f0a94a8113e..647b25d14c8e 100644 --- a/board/beagle/beagleplay/beagleplay.env +++ b/board/beagle/beagleplay/beagleplay.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/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig index 0be20045a974..1f43891d10bb 100644 --- a/configs/am62x_beagleplay_a53_defconfig +++ b/configs/am62x_beagleplay_a53_defconfig @@ -33,7 +33,8 @@ CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_DELAY_STR="d" CONFIG_AUTOBOOT_STOP_STR=" " -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_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000

Nishanth Menon nm@ti.com writes:
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-am625-beagleplay.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-10-nm@ti.com board/beagle/beagleplay/beagleplay.c | 14 ++++++++++++++ board/beagle/beagleplay/beagleplay.env | 1 - configs/am62x_beagleplay_a53_defconfig | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/board/beagle/beagleplay/beagleplay.c b/board/beagle/beagleplay/beagleplay.c index 1c376dea372f..20819ecf45b4 100644 --- a/board/beagle/beagleplay/beagleplay.c +++ b/board/beagle/beagleplay/beagleplay.c @@ -27,3 +27,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/beagleplay/beagleplay.env b/board/beagle/beagleplay/beagleplay.env index 4f0a94a8113e..647b25d14c8e 100644 --- a/board/beagle/beagleplay/beagleplay.env +++ b/board/beagle/beagleplay/beagleplay.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/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig index 0be20045a974..1f43891d10bb 100644 --- a/configs/am62x_beagleplay_a53_defconfig +++ b/configs/am62x_beagleplay_a53_defconfig @@ -33,7 +33,8 @@ CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_DELAY_STR="d" CONFIG_AUTOBOOT_STOP_STR=" " -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_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000 -- 2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

We shouldn't need finfdt anymore. Drop the env script.
Signed-off-by: Nishanth Menon nm@ti.com --- Changes from V1: None.
V1: https://lore.kernel.org/r/20240108173301.2692332-11-nm@ti.com include/env/ti/default_findfdt.env | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 include/env/ti/default_findfdt.env
diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env deleted file mode 100644 index a2b51dd923bb..000000000000 --- a/include/env/ti/default_findfdt.env +++ /dev/null @@ -1,12 +0,0 @@ -default_device_tree=CONFIG_DEFAULT_DEVICE_TREE -default_device_tree_arch=ti -#ifdef CONFIG_ARM64 -findfdt= - setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb; - setenv fdtfile ${name_fdt} -#else -default_device_tree_subarch=omap -findfdt= - setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb; - setenv fdtfile ${name_fdt} -#endif

On 09/01/2024 21:15, Nishanth Menon wrote:
We shouldn't need finfdt anymore. Drop the env script.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None.
V1: https://lore.kernel.org/r/20240108173301.2692332-11-nm@ti.com include/env/ti/default_findfdt.env | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 include/env/ti/default_findfdt.env
diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env deleted file mode 100644 index a2b51dd923bb..000000000000 --- a/include/env/ti/default_findfdt.env +++ /dev/null @@ -1,12 +0,0 @@ -default_device_tree=CONFIG_DEFAULT_DEVICE_TREE -default_device_tree_arch=ti -#ifdef CONFIG_ARM64 -findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#else -default_device_tree_subarch=omap -findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#endif
FYI. findfdt is still used in:
am335x_baltos_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;" am335x_boneblack_vboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_evm_spiboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_hs_evm_uart_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_igep003x_defconfig:CONFIG_BOOTCOMMAND="run findfdt;run mmcboot;run nandboot;run netboot;" am43xx_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_qspiboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_rtconly_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_usbhost_boot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_hs_evm_qspi_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am57xx_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am57xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am57xx_hs_evm_usb_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am65x_evm_a53_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; if test ${boot_fit} -eq 1; then run get_fit_${boot}; run get_overlaystring; run run_fit; else; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern; fi;" dra7xx_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " dra7xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " dra7xx_hs_evm_usb_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " k2g_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_mon_${boot} run_mon; run set_name_pmmc get_pmmc_${boot} run_pmmc; run get_kern_${boot}; run init_fw_rd_${boot}; run get_fdt_${boot}; run run_kern" k2g_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run envboot; run run_mon_hs; run init_${boot}; run get_fit_${boot}; bootm ${addr_fit}#${name_fdt}" omap3_beagle_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd" omap4_panda_defconfig:CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" omap4_sdp4430_defconfig:CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"

On 19:31-20240110, Roger Quadros wrote:
[..]
FYI. findfdt is still used in:
am335x_baltos_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;" am335x_boneblack_vboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_evm_spiboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_hs_evm_uart_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd" am335x_igep003x_defconfig:CONFIG_BOOTCOMMAND="run findfdt;run mmcboot;run nandboot;run netboot;" am43xx_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_qspiboot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_rtconly_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_evm_usbhost_boot_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am43xx_hs_evm_qspi_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" am57xx_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am57xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am57xx_hs_evm_usb_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " am65x_evm_a53_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; if test ${boot_fit} -eq 1; then run get_fit_${boot}; run get_overlaystring; run run_fit; else; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern; fi;" dra7xx_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " dra7xx_hs_evm_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " dra7xx_hs_evm_usb_defconfig:CONFIG_BOOTCOMMAND="if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 1;fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run finduuid; run distro_bootcmd;run emmc_android_boot; " k2g_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_mon_${boot} run_mon; run set_name_pmmc get_pmmc_${boot} run_pmmc; run get_kern_${boot}; run init_fw_rd_${boot}; run get_fdt_${boot}; run run_kern" k2g_hs_evm_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run envboot; run run_mon_hs; run init_${boot}; run get_fit_${boot}; bootm ${addr_fit}#${name_fdt}" omap3_beagle_defconfig:CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd" omap4_panda_defconfig:CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" omap4_sdp4430_defconfig:CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"
Yep - I have not cleaned up OR moved to stdboot any of the older platforms (pre k3). That said the script that this patch is deleting is not used anywhere else at this point in the series. So, it is safe to remove. The existing platforms implement findfdt in many different ways unfortunately.

Nishanth Menon nm@ti.com writes:
We shouldn't need finfdt anymore. Drop the env script.
Signed-off-by: Nishanth Menon nm@ti.com
Changes from V1: None.
V1: https://lore.kernel.org/r/20240108173301.2692332-11-nm@ti.com include/env/ti/default_findfdt.env | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 include/env/ti/default_findfdt.env
diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env deleted file mode 100644 index a2b51dd923bb..000000000000 --- a/include/env/ti/default_findfdt.env +++ /dev/null @@ -1,12 +0,0 @@ -default_device_tree=CONFIG_DEFAULT_DEVICE_TREE -default_device_tree_arch=ti -#ifdef CONFIG_ARM64 -findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#else -default_device_tree_subarch=omap -findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#endif
2.43.0
Reviewed-by: Jonathan Humphreys j-humphreys@ti.com

On 09/01/2024 21:14, Nishanth Menon wrote:
This is a wide cleanup to switch to setting fdtfile using env_set instead of scripted magic. 'fdtfile' is expected to be set by default. This allows the stdboot triggered efi loaders to find the correct OS device tree file even if regular boot process is interrupted by user intervention.
This is a refresh of https://lore.kernel.org/all/86le9dwz4d.fsf@udb0321960.dhcp.ti.com/ which was the wrong approach.
Updates from V1:
- Renames of variables and macros for various review comments.
- Commit message updates in some patches for clarity.
Bootlogs: https://gist.github.com/nmenon/843e343cde645ec4aa57b60cece5256a
based on master: c5e461fbf7cc Merge tag 'u-boot-imx-master-20240108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
NOTE: There are a couple of checkpatch WARN (around LATE_INIT) and CHECK (fdt_ops #ifdeffery) that on closer inspection looks fine and consistent with other similar usage.
V1: https://lore.kernel.org/all/20240108173301.2692332-1-nm@ti.com/
Nishanth Menon (10): board: ti: common: Introduce a common fdt ops library board: ti: am62ax: Set fdtfile from C code instead of findfdt script board: ti: am62x: Set fdtfile from C code instead of findfdt script board: ti: am64x: Set fdtfile from C code instead of findfdt script board: ti: am65x: Set fdtfile from C code instead of findfdt script board: ti: j721e: Set fdtfile from C code instead of findfdt script board: ti: j721s2: Set fdtfile from C code instead of findfdt script board: beagle: beagleboneai64: Set fdtfile from C code instead of findfdt script board: beagle: beagleplay: Set fdtfile from C code instead of findfdt script include: env: ti: Drop default_findfdt
For this series:
Reviewed-by: Roger Quadros rogerq@kernel.org

On Tue, Jan 09, 2024 at 01:14:55PM -0600, Nishanth Menon wrote:
This is a wide cleanup to switch to setting fdtfile using env_set instead of scripted magic. 'fdtfile' is expected to be set by default. This allows the stdboot triggered efi loaders to find the correct OS device tree file even if regular boot process is interrupted by user intervention.
This is a refresh of https://lore.kernel.org/all/86le9dwz4d.fsf@udb0321960.dhcp.ti.com/ which was the wrong approach.
Updates from V1:
- Renames of variables and macros for various review comments.
- Commit message updates in some patches for clarity.
Bootlogs: https://gist.github.com/nmenon/843e343cde645ec4aa57b60cece5256a
based on master: c5e461fbf7cc Merge tag 'u-boot-imx-master-20240108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
NOTE: There are a couple of checkpatch WARN (around LATE_INIT) and CHECK (fdt_ops #ifdeffery) that on closer inspection looks fine and consistent with other similar usage.
V1: https://lore.kernel.org/all/20240108173301.2692332-1-nm@ti.com/
Unfortunately this FTB's on omap3_evm omap4_panda omap4_sdp4430: board/ti/common/fdt_ops.c: In function 'ti_set_fdt_env': board/ti/common/fdt_ops.c:39:34: error: 'CONFIG_TI_FDT_FOLDER_PATH' undeclared (first use in this function) 39 | CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_FDT_FILE); | ^~~~~~~~~~~~~~~~~~~~~~~~~ board/ti/common/fdt_ops.c:39:34: note: each undeclared identifier is reported only once for each function it appears in And even tho I should delete omap4_panda and omap4_sdp4430, omap3_evm is maintained. It also FTB's on am62x_evm_a53: board/ti/am62x/evm.c: In function 'board_late_init': board/ti/am62x/evm.c:60:9: error: implicit declaration of function 'ti_set_fdt_env' [-Werror=implicit-function-declaration] 60 | ti_set_fdt_env(NULL, NULL); | ^~~~~~~~~~~~~~
participants (4)
-
Jon Humphreys
-
Nishanth Menon
-
Roger Quadros
-
Tom Rini