[PATCH v3 0/4] Fix fdtfile for j722s and am62p

fdtfile wasn't being populated in these boards in legacy boot using bootcmd_ti_mmc, migrate these platforms to ti_set_fdt_env.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- Changes in v3: - Update the commit messages to make the change more clear. - Link to v2: https://lore.kernel.org/r/20240701-b4-upstream-streamline-platform-v2-0-7539...
--- Dhruva Gole (1): include: env: ti_common: Remove findfdt from bootcmd_ti_mmc
Manorit Chawdhry (3): board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT include: env: ti: mmc: Change name_fdt usage to fdtfile
board/ti/am62px/evm.c | 9 +++++++++ board/ti/j722s/evm.c | 9 +++++++++ configs/am62px_evm_a53_defconfig | 1 + configs/j722s_evm_a53_defconfig | 1 + include/env/ti/mmc.env | 2 +- include/env/ti/ti_common.env | 2 +- 6 files changed, 22 insertions(+), 2 deletions(-) --- base-commit: 899b088674b6905710ce546f0a8848662904852a change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2
Best regards,

stdboot and legacy boot depend on fdtfile. Since findfdt is getting deprecated, move the rest of k3 platforms dependent on findfdt to ti_set_fdt_env.
Populate fdtfile by calling ti_set_fdt_env in board files.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- board/ti/am62px/evm.c | 9 +++++++++ board/ti/j722s/evm.c | 9 +++++++++ 2 files changed, 18 insertions(+)
diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c index 1a2c46c462b4..7362fa4520a3 100644 --- a/board/ti/am62px/evm.c +++ b/board/ti/am62px/evm.c @@ -13,6 +13,7 @@ #include <env.h> #include <fdt_support.h> #include <spl.h> +#include "../common/fdt_ops.h"
struct efi_fw_image fw_images[] = { { @@ -61,3 +62,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +#if IS_ENABLED(CONFIG_BOARD_LATE_INIT) +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif diff --git a/board/ti/j722s/evm.c b/board/ti/j722s/evm.c index 515aaa818783..29e06a5442fe 100644 --- a/board/ti/j722s/evm.c +++ b/board/ti/j722s/evm.c @@ -12,6 +12,7 @@ #include <env.h> #include <fdt_support.h> #include <spl.h> +#include "../common/fdt_ops.h"
int board_init(void) { @@ -27,3 +28,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +#if IS_ENABLED(CONFIG_BOARD_LATE_INIT) +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif

This is called to set fdtfile based on evm.c code calling ti_set_fdt_env.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- configs/am62px_evm_a53_defconfig | 1 + configs/j722s_evm_a53_defconfig | 1 + 2 files changed, 2 insertions(+)
diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig index e1c9c8535e43..87005d03dee3 100644 --- a/configs/am62px_evm_a53_defconfig +++ b/configs/am62px_evm_a53_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_BOOTSTD_FULL=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_SYS_MALLOC_SIMPLE=y diff --git a/configs/j722s_evm_a53_defconfig b/configs/j722s_evm_a53_defconfig index da0e9f4d524d..1675cedb25ef 100644 --- a/configs/j722s_evm_a53_defconfig +++ b/configs/j722s_evm_a53_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_BOOTSTD_FULL=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_SYS_MALLOC_SIMPLE=y

name_fdt is kept for backward compatibility but it depends on EEPROM detection logic and some of the TI K3 platforms don't have that anymore which causes boot failure in legacy boot flow using bootcmd_ti_mmc.
K2g platforms which uses the same file have their own override causing this change to be no-impact for them.
Replacing name_fdt usage to fdtfile as fdtfile is populated based on CONFIG_DEFAULT_DEVICE_TREE after using ti_set_fdt_env.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- include/env/ti/mmc.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env index 0256a2d2aaca..037a09010ce4 100644 --- a/include/env/ti/mmc.env +++ b/include/env/ti/mmc.env @@ -16,7 +16,7 @@ importbootenv=echo Importing environment from mmc${mmcdev} ...; loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} -get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} +get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} envboot=if mmc dev ${mmcdev}; then if mmc rescan; then echo SD/MMC found on device ${mmcdev};

From: Dhruva Gole d-gole@ti.com
findfdt is used by bootcmd_ti_mmc by default which used to help populate the fdtfile. The users of findfdt from bootcmd_ti_mmc have migrated to ti_set_fdt_env for populating fdtfile; Hence, findfdt can be removed from bootcmd_ti_mmc having no-impact for any platform.
Remove findfdt to not print out the warning that gets set after calling ti_set_fdt_env. viz. "echo WARN: fdtfile already set. Stop using findfdt in script"
Signed-off-by: Dhruva Gole d-gole@ti.com Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- include/env/ti/ti_common.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env index c5c36421770c..7029d12bf203 100644 --- a/include/env/ti/ti_common.env +++ b/include/env/ti/ti_common.env @@ -25,7 +25,7 @@ get_fit_config=setexpr name_fit_config gsub / _ conf-${fdtfile} run_fit=run get_fit_config; bootm ${addr_fit}#${name_fit_config}${overlaystring} do_main_cpsw0_qsgmii_phyinit=0 bootcmd_ti_mmc= - run findfdt; run init_${boot}; + run init_${boot}; #if CONFIG_CMD_REMOTEPROC if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1; then run main_cpsw0_qsgmii_phyinit;
participants (2)
-
Manorit Chawdhry
-
Tom Rini