From f499632b31f88dbd313fe9f742e2019c56032558 Mon Sep 17 00:00:00 2001 From: Denys Drozdov Date: Tue, 27 Jul 2021 18:18:23 +0300 Subject: apalis-imx8: construct fdtfile dynamically The following expression is used to construct the device tree name: fdtfile=${soc}-apalis${variant}-${fdt_board}.dtb - soc is set dynamically (either imx8qp or imx8qm), - variant is set dynamically (either empty or -v1.1), - fdt_board can be modified by the user (eval or ixora) Related-to: ELB-3338 Signed-off-by: Denys Drozdov --- board/toradex/apalis-imx8/apalis-imx8.c | 13 ++++++------- configs/apalis-imx8_defconfig | 2 ++ configs/apalis-imx8_tezi_defconfig | 2 ++ include/configs/apalis-imx8.h | 7 +------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c index 8b86d4509b..63f8add1fd 100644 --- a/board/toradex/apalis-imx8/apalis-imx8.c +++ b/board/toradex/apalis-imx8/apalis-imx8.c @@ -221,23 +221,22 @@ static pcb_rev_t get_pcb_revision(void) static void select_dt_from_module_version(void) { - int board_revision = get_pcb_revision(); - - /* Check For Apalis iMX8QP SKU */ switch (tdx_hw_tag.prodid) { /* Select Apalis iMX8QM device trees */ case APALIS_IMX8QM_IT: case APALIS_IMX8QM_WIFI_BT_IT: - if (board_revision != PCB_VERSION_1_0) - env_set("fdtfile", FDT_FILE_IMX8QM); + env_set("soc", "imx8qm"); + if (get_pcb_revision() == PCB_VERSION_1_0) + env_set("variant", ""); else - env_set("fdtfile", FDT_FILE_IMX8QM_V1_0); + env_set("variant", "-v1.1"); break; /* Select Apalis iMX8QP device trees */ case APALIS_IMX8QP_WIFI_BT: case APALIS_IMX8QP: - env_set("fdtfile", FDT_FILE_IMX8QP); + env_set("soc", "imx8qp"); + env_set("variant", "-v1.1"); break; default: printf("Unknown Apalis iMX8 module\n"); diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig index 1cd2994622..42700e4571 100644 --- a/configs/apalis-imx8_defconfig +++ b/configs/apalis-imx8_defconfig @@ -16,6 +16,8 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="setenv fdtfile ${soc}-apalis${variant}-${fdt_board}.dtb" CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/apalis-imx8/apalis-imx8-imximage.cfg" CONFIG_BOOTDELAY=1 CONFIG_LOG=y diff --git a/configs/apalis-imx8_tezi_defconfig b/configs/apalis-imx8_tezi_defconfig index bf21f2c9bc..d2ca3028ce 100644 --- a/configs/apalis-imx8_tezi_defconfig +++ b/configs/apalis-imx8_tezi_defconfig @@ -17,6 +17,8 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="setenv fdtfile ${soc}-apalis-${variant}-${fdt_board}.dtb" CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/apalis-imx8/apalis-imx8-imximage.cfg" CONFIG_BOOTDELAY=1 CONFIG_LOG=y diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h index 8894c90c4b..9cc7c493ce 100644 --- a/include/configs/apalis-imx8.h +++ b/include/configs/apalis-imx8.h @@ -82,11 +82,6 @@ #define AHAB_ENV "sec_boot=no\0" #endif -#define FDT_FILE_IMX8QP "imx8qp-apalis-v1.1-eval.dtb" -#define FDT_FILE_IMX8QM "imx8qm-apalis-v1.1-eval.dtb" -#define FDT_FILE_IMX8QM_V1_0 "imx8qm-apalis-eval.dtb" - - #if defined(CONFIG_TDX_EASY_INSTALLER) # define BOOT_SCRIPT "boot-tezi.scr" #else @@ -106,7 +101,7 @@ "console=ttyLP1 earlycon\0" \ "fdt_high=\0" \ "boot_fdt=try\0" \ - "fdtfile=" FDT_FILE_IMX8QM "\0" \ + "fdt_board=eval\0" \ "finduuid=part uuid mmc ${mmcdev}:2 uuid\0" \ "hdp_file=hdmitxfw.bin\0" \ "loadhdp=${load_cmd} ${hdp_addr} ${hdp_file}\0" \ -- cgit v1.2.3