toradex: tdx-cfg-block: fix switch to user partition
authorStefan Eichenberger <stefan.eichenberger@toradex.com>
Fri, 24 Jan 2025 15:14:30 +0000 (16:14 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 31 Jan 2025 17:00:49 +0000 (11:00 -0600)
The Toradex configuration block is stored in the first boot partition of
the eMMC. After reading the configuration block, U-Boot switches back to
the user partition. Currently, this operation always targets mmc device
0, even when the configuration block is stored on mmc device 2.

This patch addresses the issue by switching the mmc device set in
CONFIG_TDX_CFG_BLOCK_DEV to the user partition, rather than using the
hardcoded device 0.

Fixes: a2777ecb9d11 ("toradex: config block handling")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
board/toradex/common/tdx-cfg-block.c

index 3855e15..b214943 100644 (file)
@@ -312,7 +312,7 @@ static int tdx_cfg_block_mmc_storage(u8 *config_block, int write)
 
 out:
        /* Switch back to regular eMMC user partition */
-       blk_select_hwpart_devnum(UCLASS_MMC, 0, 0);
+       blk_select_hwpart_devnum(UCLASS_MMC, dev, 0);
 
        return ret;
 }