From cdcc3a8660fa4254d6d3ca6932a7cd599c0f1662 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 22 Jan 2016 18:06:12 -0800 Subject: toradex: configblock: initialize MMC before switching partition If the module is in serial downloader mode, we do no longer read the environment from eMMC. Therefor, the eMMC is unitialized when trying to read the config block. Use mmc_init to initialize the selected MMC device before using it. Note: In case the MMC has already been initialized, the mmc_init detects that and returns immediately. Signed-off-by: Stefan Agner Acked-by: Max Krummenacher Conflicts: board/toradex/common/configblock.c (cherry picked from commit 0520b532d77d238be8015d3041a95188e47945cc) (cherry picked from commit 3cb5f6450c39678a6361620bd45c423a503895cd) (cherry picked from commit 79d3008acaebc0d33ba8fc21ffe46f058416d4a3) Conflicts: board/toradex/common/tdx-cfg-block.c --- board/toradex/common/tdx-cfg-block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index ad5a6ad399..76dfeae948 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -118,6 +118,10 @@ static int tdx_cfg_block_mmc_storage(u8 *config_block, int write) ret = -ENODEV; goto out; } + if (mmc_init(mmc)) { + puts("MMC init failed\n"); + return -EINVAL; + } if (part != mmc_get_blk_desc(mmc)->hwpart) { if (blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part)) { puts("MMC partition switch failed\n"); -- cgit v1.2.3