From: Stefan Agner Date: Fri, 12 Jul 2019 10:35:05 +0000 (+0200) Subject: toradex: configblock: initialize MMC before switching partition X-Git-Tag: v2019.10-rc1~9^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42a4f182555e095256926630f1ecde0190ded25f;p=platform%2Fkernel%2Fu-boot.git 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 Signed-off-by: Marcel Ziswiler Reviewed-by: Igor Opaniuk Reviewed-by: Oleksandr Suvorov --- diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index f69c443..67e0557 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -129,6 +129,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");