From: Stefan Agner <stefan.ag...@toradex.com> 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 <stefan.ag...@toradex.com> Acked-by: Max Krummenacher <max.krummenac...@toradex.com> Signed-off-by: Marcel Ziswiler <marcel.ziswi...@toradex.com> Reviewed-by: Igor Opaniuk <igor.opan...@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvo...@toradex.com> --- Changes in v2: - Added my S-b and others R-bs. 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 f69c4433b2..67e0557f67 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"); -- 2.21.0 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot