engicam: Set fdt_file env during run-time

Set fdt_file env variable during board_late_init

Cc: Stefano Babic <sbabic@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
diff --git a/board/engicam/geam6ul/geam6ul.c b/board/engicam/geam6ul/geam6ul.c
index 3593719..eb0e533 100644
--- a/board/engicam/geam6ul/geam6ul.c
+++ b/board/engicam/geam6ul/geam6ul.c
@@ -141,6 +141,9 @@
 		break;
 	}
 
+	if (is_mx6ul())
+		setenv("fdt_file", "imx6ul-geam-kit.dtb");
+
 	return 0;
 }
 
diff --git a/board/engicam/icorem6/icorem6.c b/board/engicam/icorem6/icorem6.c
index 55fc77f..0687329 100644
--- a/board/engicam/icorem6/icorem6.c
+++ b/board/engicam/icorem6/icorem6.c
@@ -243,6 +243,11 @@
 		break;
 	}
 
+	if (is_mx6dq())
+		setenv("fdt_file", "imx6q-icore.dtb");
+	else if(is_mx6dl() || is_mx6solo())
+		setenv("fdt_file", "imx6dl-icore.dtb");
+
 	return 0;
 }
 
diff --git a/board/engicam/icorem6_rqs/icorem6_rqs.c b/board/engicam/icorem6_rqs/icorem6_rqs.c
index 01380f1..e95c165 100644
--- a/board/engicam/icorem6_rqs/icorem6_rqs.c
+++ b/board/engicam/icorem6_rqs/icorem6_rqs.c
@@ -88,6 +88,11 @@
 		break;
 	}
 
+	if (is_mx6dq())
+		setenv("fdt_file", "imx6q-icore-rqs.dtb");
+	else if(is_mx6dl() || is_mx6solo())
+		setenv("fdt_file", "imx6dl-icore-rqs.dtb");
+
 	return 0;
 }
 
diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c
index 29a137d..5d1c693 100644
--- a/board/engicam/isiotmx6ul/isiotmx6ul.c
+++ b/board/engicam/isiotmx6ul/isiotmx6ul.c
@@ -149,6 +149,14 @@
 		break;
 	}
 
+	if (is_mx6ul()) {
+#ifdef CONFIG_ENV_IS_IN_MMC
+		setenv("fdt_file", "imx6ul-isiot-emmc.dtb");
+#else
+		setenv("fdt_file", "imx6ul-isiot-nand.dtb");
+#endif
+	}
+
 	return 0;
 }
 
diff --git a/configs/imx6dl_icore_mmc_defconfig b/configs/imx6dl_icore_mmc_defconfig
index 6b67156..c0644d7 100644
--- a/configs/imx6dl_icore_mmc_defconfig
+++ b/configs/imx6dl_icore_mmc_defconfig
@@ -15,7 +15,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6dl-icore.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6dl_icore_nand_defconfig b/configs/imx6dl_icore_nand_defconfig
index 2099370..20d183f 100644
--- a/configs/imx6dl_icore_nand_defconfig
+++ b/configs/imx6dl_icore_nand_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_NAND"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6dl-icore.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6dl_icore_rqs_mmc_defconfig b/configs/imx6dl_icore_rqs_mmc_defconfig
index 1a7d8ef..18e1b9e 100644
--- a/configs/imx6dl_icore_rqs_mmc_defconfig
+++ b/configs/imx6dl_icore_rqs_mmc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6dl-icore-rqs.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6q_icore_mmc_defconfig b/configs/imx6q_icore_mmc_defconfig
index adb0472..48de950 100644
--- a/configs/imx6q_icore_mmc_defconfig
+++ b/configs/imx6q_icore_mmc_defconfig
@@ -15,7 +15,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6q-icore.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6q_icore_nand_defconfig b/configs/imx6q_icore_nand_defconfig
index 45d5fce..0ebb2dd 100644
--- a/configs/imx6q_icore_nand_defconfig
+++ b/configs/imx6q_icore_nand_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_NAND"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6q-icore.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6q_icore_rqs_mmc_defconfig b/configs/imx6q_icore_rqs_mmc_defconfig
index aef6d36..ecccd75 100644
--- a/configs/imx6q_icore_rqs_mmc_defconfig
+++ b/configs/imx6q_icore_rqs_mmc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6q-icore-rqs.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6ul_geam_mmc_defconfig b/configs/imx6ul_geam_mmc_defconfig
index 35610c6f..8751a36 100644
--- a/configs/imx6ul_geam_mmc_defconfig
+++ b/configs/imx6ul_geam_mmc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6ul-geam-kit.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6ul_geam_nand_defconfig b/configs/imx6ul_geam_nand_defconfig
index 7010d3d..704c0c0 100644
--- a/configs/imx6ul_geam_nand_defconfig
+++ b/configs/imx6ul_geam_nand_defconfig
@@ -13,7 +13,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_NAND"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6ul-geam-kit.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6ul_isiot_emmc_defconfig b/configs/imx6ul_isiot_emmc_defconfig
index 58c56f5..1f501cb 100644
--- a/configs/imx6ul_isiot_emmc_defconfig
+++ b/configs/imx6ul_isiot_emmc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6ul-isiot-emmc.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6ul_isiot_mmc_defconfig b/configs/imx6ul_isiot_mmc_defconfig
index 89bd8a0..5214479 100644
--- a/configs/imx6ul_isiot_mmc_defconfig
+++ b/configs/imx6ul_isiot_mmc_defconfig
@@ -14,7 +14,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_MMC"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6ul-isiot-emmc.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/imx6ul_isiot_nand_defconfig b/configs/imx6ul_isiot_nand_defconfig
index f7240cc..1b28336 100644
--- a/configs/imx6ul_isiot_nand_defconfig
+++ b/configs/imx6ul_isiot_nand_defconfig
@@ -13,7 +13,6 @@
 CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,ENV_IS_IN_NAND"
 CONFIG_BOOTDELAY=3
-CONFIG_DEFAULT_FDT_FILE="imx6ul-isiot-nand.dtb"
 CONFIG_SPL=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_HUSH_PARSER=y
diff --git a/include/configs/imx6qdl_icore.h b/include/configs/imx6qdl_icore.h
index 4bdba57..f783eac 100644
--- a/include/configs/imx6qdl_icore.h
+++ b/include/configs/imx6qdl_icore.h
@@ -42,7 +42,6 @@
 	"fit_image=fit.itb\0" \
 	"console=ttymxc3\0" \
 	"fdt_high=0xffffffff\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"fdt_addr=0x18000000\0" \
 	"boot_fdt=try\0" \
 	"mmcpart=1\0" \
diff --git a/include/configs/imx6qdl_icore_rqs.h b/include/configs/imx6qdl_icore_rqs.h
index 3358320..a639468 100644
--- a/include/configs/imx6qdl_icore_rqs.h
+++ b/include/configs/imx6qdl_icore_rqs.h
@@ -37,7 +37,6 @@
 	"fit_image=fit.itb\0" \
 	"console=ttymxc3\0" \
 	"fdt_high=0xffffffff\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"fdt_addr=0x18000000\0" \
 	"boot_fdt=try\0" \
 	"mmcpart=1\0" \
diff --git a/include/configs/imx6ul_geam.h b/include/configs/imx6ul_geam.h
index d331744..9f66dd3 100644
--- a/include/configs/imx6ul_geam.h
+++ b/include/configs/imx6ul_geam.h
@@ -41,7 +41,6 @@
 	"fit_image=fit.itb\0" \
 	"console=ttymxc0\0" \
 	"fdt_high=0xffffffff\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"fdt_addr=0x87800000\0" \
 	"boot_fdt=try\0" \
 	"mmcpart=1\0" \
diff --git a/include/configs/imx6ul_isiot.h b/include/configs/imx6ul_isiot.h
index 4009648..5ce70ae 100644
--- a/include/configs/imx6ul_isiot.h
+++ b/include/configs/imx6ul_isiot.h
@@ -42,7 +42,6 @@
 	"splashpos=m,m\0" \
 	"console=ttymxc0\0" \
 	"fdt_high=0xffffffff\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"fdt_addr=0x87800000\0" \
 	"boot_fdt=try\0" \
 	"mmcpart=1\0" \