@@ -1441,11 +1441,14 @@ int mmc_initialize(bd_t *bis)
INIT_LIST_HEAD (&mmc_devices);
cur_dev_num = 0;
- if (board_mmc_init(bis) < 0)
+#ifdef CONFIG_SPL_BUILD
+ if (spl_board_mmc_init(bis) < 0)
cpu_mmc_init(bis);
+#else
+ if (board_mmc_init(bis) < 0)
+ cpu_mmc_init(bis);
-#ifndef CONFIG_SPL_BUILD
- print_mmc_devices(',');
+ print_mmc_devices(',');
#endif
do_preinit();
@@ -388,6 +388,9 @@ int mmc_legacy_init(int verbose);
int board_mmc_init(bd_t *bis);
int cpu_mmc_init(bd_t *bis);
int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr);
+#ifdef CONFIG_SPL
+int spl_board_mmc_init(bd_t *bis);
+#endif
/* Set block count limit because of 16 bit register limit on some hardware*/
#ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
When the spl_mmc_load_image function being called, it will call mmc_initialize function. By default, it will call board_mmc_init. The main purpose of board_mmc_init (in practice) is to initialize all the mmc ports defined by CONFIG_SYS_FSL_USDHC_NUM. While, in spl_board_mmc_init, it read the bootstrap to see which mmc port is active and configure it. Then, it pass the configuration to fsl_esdhc_initialize for initialization. Finally, the spl_mmc_load_image could load and run the u-boot.img Signed-off-by: John Tobias <john.tobias.ph@gmail.com> --- drivers/mmc/mmc.c | 9 ++++++--- include/mmc.h | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-)