i.MX6: engicam: Move set_fdt_file to common
authorJagan Teki <jagannadh.teki@gmail.com>
Mon, 20 Nov 2017 18:32:10 +0000 (00:02 +0530)
committerStefano Babic <sbabic@denx.de>
Mon, 27 Nov 2017 09:36:40 +0000 (10:36 +0100)
setenv_fdt_file to common code and set dtb based on
CONFIG_DEFAULT_DEVICE_TREE and cpu_type.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
board/engicam/common/board.c
board/engicam/common/board.h
board/engicam/geam6ul/geam6ul.c
board/engicam/icorem6/icorem6.c
board/engicam/icorem6_rqs/icorem6_rqs.c
board/engicam/isiotmx6ul/isiotmx6ul.c

index c7ec55ff825af8cdcc81f9a70898cb64d4930981..f86fb2be42873c65fd16dd4910d8462ff1e86296 100644 (file)
@@ -32,6 +32,30 @@ static void mmc_late_init(void)
 }
 #endif
 
+static void setenv_fdt_file(void)
+{
+       const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
+
+       if (!strcmp(cmp_dtb, "imx6q-icore")) {
+               if (is_mx6dq())
+                       env_set("fdt_file", "imx6q-icore.dtb");
+               else if(is_mx6dl() || is_mx6solo())
+                       env_set("fdt_file", "imx6dl-icore.dtb");
+       } else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
+               if (is_mx6dq())
+                       env_set("fdt_file", "imx6q-icore-rqs.dtb");
+               else if(is_mx6dl() || is_mx6solo())
+                       env_set("fdt_file", "imx6dl-icore-rqs.dtb");
+       } else if (!strcmp(cmp_dtb, "imx6ul-geam-kit"))
+               env_set("fdt_file", "imx6ul-geam-kit.dtb");
+       else if (!strcmp(cmp_dtb, "imx6ul-isiot-mmc"))
+               env_set("fdt_file", "imx6ul-isiot-mmc.dtb");
+       else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
+               env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
+       else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
+               env_set("fdt_file", "imx6ul-isiot-nand.dtb");
+}
+
 int board_late_init(void)
 {
        switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
index f364a23296dd29f2ac5abeea8e105b02e4357bf5..c720b0bcd057b1242f230236db8c48176437a631 100644 (file)
@@ -6,7 +6,6 @@
 
 #ifndef _BOARD_H_
 #define _BOARD_H_
-void setenv_fdt_file(void);
 void setup_gpmi_nand(void);
 void setup_display(void);
 #endif /* _BOARD_H_ */
index ffd383a0eecac0b57df8dbb7094974c81aebd269..15bd8b2c30021ee65ac911fcfa32a6bd2c07fce4 100644 (file)
@@ -90,12 +90,6 @@ void setup_gpmi_nand(void)
 }
 #endif /* CONFIG_NAND_MXS */
 
-void setenv_fdt_file(void)
-{
-       if (is_mx6ul())
-               env_set("fdt_file", "imx6ul-geam-kit.dtb");
-}
-
 #ifdef CONFIG_SPL_BUILD
 /* MMC board initialization is needed till adding DM support in SPL */
 #if defined(CONFIG_FSL_ESDHC) && !defined(CONFIG_DM_MMC)
index 3d4f713c3e2b80783e1ee7ee5cc328390225043a..59c085bb2c55d9cca00890d4be91b52917d96d7e 100644 (file)
@@ -192,14 +192,6 @@ void setup_display(void)
 }
 #endif /* CONFIG_VIDEO_IPUV3 */
 
-void setenv_fdt_file(void)
-{
-       if (is_mx6dq())
-               env_set("fdt_file", "imx6q-icore.dtb");
-       else if(is_mx6dl() || is_mx6solo())
-               env_set("fdt_file", "imx6dl-icore.dtb");
-}
-
 #ifdef CONFIG_SPL_BUILD
 /* MMC board initialization is needed till adding DM support in SPL */
 #if defined(CONFIG_FSL_ESDHC) && !defined(CONFIG_DM_MMC)
index 01148894c3f4ca51aaf82f81de8b8e671b4816de..8afc9beaf9091305d30b57b95013837e976ea6f0 100644 (file)
@@ -31,14 +31,6 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-void setenv_fdt_file(void)
-{
-       if (is_mx6dq())
-               env_set("fdt_file", "imx6q-icore-rqs.dtb");
-       else if(is_mx6dl() || is_mx6solo())
-               env_set("fdt_file", "imx6dl-icore-rqs.dtb");
-}
-
 #ifdef CONFIG_SPL_BUILD
 #include <spl.h>
 
index fbf17242f87ef60972372720e3d480cee3cf388d..9afa8e4065bac1ce7cdae18a343cba2a548799b9 100644 (file)
@@ -98,17 +98,6 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-void setenv_fdt_file(void)
-{
-       if (is_mx6ul()) {
-#ifdef CONFIG_ENV_IS_IN_MMC
-               env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
-#else
-               env_set("fdt_file", "imx6ul-isiot-nand.dtb");
-#endif
-       }
-}
-
 #ifdef CONFIG_SPL_BUILD
 #include <spl.h>