[U-Boot] [PATCH v4 3/7] mmc: imx6: call spl_board_mmc_init

John Tobias john.tobias.ph at gmail.com
Tue Nov 11 23:50:17 CET 2014


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 at gmail.com>
---
 drivers/mmc/mmc.c | 9 ++++++---
 include/mmc.h     | 3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 44a4feb..88c1b03 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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();
diff --git a/include/mmc.h b/include/mmc.h
index d74a190..37119b8 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -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
-- 
1.9.1



More information about the U-Boot mailing list