From 099bc1b8ef7994781fc0ad1ed2abdc1dd8d5b6e3 Mon Sep 17 00:00:00 2001 From: Philippe Schenker Date: Thu, 16 Apr 2020 12:08:43 +0200 Subject: verdin-imx8mm: choose correct devicetree with configblock This commit makes u-boot choose the right variant wifi or nonwifi of the devicetree with the information stored in toradex configblock. Related-to: ELB-2642 Signed-off-by: Philippe Schenker --- board/toradex/verdin-imx8mm/verdin-imx8mm.c | 11 +++++++++++ configs/verdin-imx8mm_defconfig | 1 - include/configs/verdin-imx8mm.h | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c index ff9d36661e..0d2620b782 100644 --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c @@ -523,6 +523,17 @@ size_t display_count = ARRAY_SIZE(displays); int board_late_init(void) { +#ifdef CONFIG_TDX_CFG_BLOCK + /* + * If we have a valid config block and it says we are a module with + * Wi-Fi/Bluetooth make sure we use the -wifi device tree. + */ + if (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT) + env_set("variant", "wifi"); + else + env_set("variant", "nonwifi"); +#endif + return 0; } diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index f81bbea5e7..ff5cd573f9 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -11,7 +11,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,SPL_TEXT_BASE=0x7E1000" CONFIG_BOOTDELAY=1 CONFIG_LOG=y -CONFIG_DEFAULT_FDT_FILE="fsl-imx8mm-verdin-wifi-dev.dtb" CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_ARCH_MISC_INIT=y diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h index fdc1456243..627fb69139 100644 --- a/include/configs/verdin-imx8mm.h +++ b/include/configs/verdin-imx8mm.h @@ -95,6 +95,8 @@ #define CONFIG_SERVERIP 192.168.10.1 #endif /* CONFIG_CMD_NET */ +#define FDT_FILE "fsl-imx8mm-verdin-${variant}-${fdt_board}.dtb" + #define MEM_LAYOUT_ENV_SETTINGS \ "fdt_addr_r=0x44000000\0" \ "kernel_addr_r=0x42000000\0" \ @@ -106,6 +108,7 @@ /* Enable Distro Boot */ #ifndef CONFIG_SPL_BUILD +#define CONFIG_BOOTCOMMAND "setenv fdtfile " FDT_FILE " && run distro_bootcmd;" #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 1) \ func(MMC, mmc, 0) \ @@ -124,7 +127,7 @@ "bootcmd_mfg=fastboot 0\0" \ "console=ttymxc0\0" \ "fdt_addr=0x43000000\0" \ - "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdt_board=dev\0" \ "initrd_addr=0x43800000\0" \ "initrd_high=0xffffffffffffffff\0" \ "kernel_image=Image\0" \ -- cgit v1.2.3