]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/engicam/icorem6_rqs/icorem6_rqs.c
icorem6: Make SPL to pick suitable fdt
[people/ms/u-boot.git] / board / engicam / icorem6_rqs / icorem6_rqs.c
index cc7f897f6324e40a3aa03910143bad4c7b662e2f..2027b283ace85fdc85744e45db437d0a45192a7a 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <mmc.h>
 
 #include <asm/io.h>
 #include <asm/gpio.h>
@@ -45,6 +46,30 @@ int board_init(void)
        return 0;
 }
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+int board_mmc_get_env_dev(int devno)
+{
+       /* dev 0 for SD/eSD, dev 1 for MMC/eMMC */
+       return (devno == 3) ? 1 : 0;
+}
+
+static void mmc_late_init(void)
+{
+       char cmd[32];
+       char mmcblk[32];
+       u32 dev_no = mmc_get_env_dev();
+
+       setenv_ulong("mmcdev", dev_no);
+
+       /* Set mmcblk env */
+       sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
+       setenv("mmcroot", mmcblk);
+
+       sprintf(cmd, "mmc dev %d", dev_no);
+       run_command(cmd, 0);
+}
+#endif
+
 int board_late_init(void)
 {
        switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
@@ -53,6 +78,9 @@ int board_late_init(void)
        case IMX6_BMODE_ESD:
        case IMX6_BMODE_MMC:
        case IMX6_BMODE_EMMC:
+#ifdef CONFIG_ENV_IS_IN_MMC
+               mmc_late_init();
+#endif
                setenv("modeboot", "mmcboot");
                break;
        default:
@@ -60,6 +88,11 @@ int board_late_init(void)
                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;
 }
 
@@ -191,6 +224,18 @@ void board_boot_order(u32 *spl_boot_list)
 #endif
 #endif
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+       if (is_mx6dq() && !strcmp(name, "imx6q-icore-rqs"))
+               return 0;
+       else if ((is_mx6dl() || is_mx6solo()) && !strcmp(name, "imx6dl-icore-rqs"))
+               return 0;
+       else
+               return -1;
+}
+#endif
+
 /*
  * Driving strength:
  *   0x30 == 40 Ohm