diff options
author | Denys Drozdov <denys.drozdov@toradex.com> | 2021-07-23 22:18:23 +0300 |
---|---|---|
committer | Denys Drozdov <denys.drozdov@toradex.com> | 2021-07-23 23:02:11 +0300 |
commit | 75753aa1e30af46e9f3c8949414b29ea170aa57b (patch) | |
tree | 83a2ca7ee0e017515e3c6b9a8c2f4b3f951f7ab2 | |
parent | 1a7d3dafa0aa166d1917183669ee3767189795ec (diff) |
board: toradex: apalis-imx8: Select proper DTs
Toradex Linux kernel supports different device trees
for Apalis iMX8QM and Apalis iMX8QP SKUs and
board revisions. Update apalis-imx8 to support both
QM and QP revisions
Related-to: ELB-3338
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
-rw-r--r-- | board/toradex/apalis-imx8/apalis-imx8.c | 39 | ||||
-rw-r--r-- | include/configs/apalis-imx8.h | 8 |
2 files changed, 31 insertions, 16 deletions
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c index 1add6fba66..330064b1c2 100644 --- a/board/toradex/apalis-imx8/apalis-imx8.c +++ b/board/toradex/apalis-imx8/apalis-imx8.c @@ -221,22 +221,35 @@ static pcb_rev_t get_pcb_revision(void) static void select_dt_from_module_version(void) { - char *fdt_env = env_get("fdtfile"); - - switch(get_pcb_revision()) { - case PCB_VERSION_1_0: - if (strcmp(FDT_FILE_V1_0, fdt_env)) { - env_set("fdtfile", FDT_FILE_V1_0); - printf("Detected a V1.0 module, setting " \ - "correct devicetree\n"); -#ifndef CONFIG_ENV_IS_NOWHERE - env_save(); -#endif - } + 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); + else + env_set("fdtfile", FDT_FILE_IMX8QM_V1_0); break; - default: + + /* Select Apalis iMX8QP device trees */ + case APALIS_IMX8QP_WIFI_BT: + case APALIS_IMX8QP: + env_set("fdtfile", FDT_FILE_IMX8QP); break; + default: + printf("Unknown Apalis iMX8 module\n"); + return; } + + printf("Detected V%s module, setting correct devicetree\n", + (board_revision == PCB_VERSION_1_0) ? "1.0" : "1.1"); + +#ifndef CONFIG_ENV_IS_NOWHERE + env_save(); +#endif } static int do_select_dt_from_module_version(cmd_tbl_t *cmdtp, int flag, int argc, diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h index ad859cb6b6..8894c90c4b 100644 --- a/include/configs/apalis-imx8.h +++ b/include/configs/apalis-imx8.h @@ -82,8 +82,10 @@ #define AHAB_ENV "sec_boot=no\0" #endif -#define FDT_FILE "imx8qm-apalis-v1.1-eval.dtb" -#define FDT_FILE_V1_0 "imx8qm-apalis-eval.dtb" +#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" @@ -104,7 +106,7 @@ "console=ttyLP1 earlycon\0" \ "fdt_high=\0" \ "boot_fdt=try\0" \ - "fdtfile=" FDT_FILE "\0" \ + "fdtfile=" FDT_FILE_IMX8QM "\0" \ "finduuid=part uuid mmc ${mmcdev}:2 uuid\0" \ "hdp_file=hdmitxfw.bin\0" \ "loadhdp=${load_cmd} ${hdp_addr} ${hdp_file}\0" \ |