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 /board | |
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>
Diffstat (limited to 'board')
-rw-r--r-- | board/toradex/apalis-imx8/apalis-imx8.c | 39 |
1 files changed, 26 insertions, 13 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, |