soc: rockchip: thunderboot_mmc: Send CMD12 after transmission completion

There're two ways to support read multiple blocks transmission:
- Current design: SET_BLOCK_COUNT(CMD23) + READ_MULTIPLE_BLOCK(CMD18)
- READ_MULTIPLE_BLOCK(CMD18) + STOP_TRANSMISSION(CMD12)

CMD23 only support 2^16 blocks, we should change to plan B for the
larger size transmission.

Change-Id: Id8f3d11dbff65b8bac4b74ef2024862b6722fc26
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
Ziyuan Xu
2025-08-26 11:14:57 +08:00
committed by Tao Huang
parent 3be4ad7282
commit 468b76b222

View File

@@ -17,6 +17,8 @@
#include <linux/soc/rockchip/rockchip_thunderboot_crypto.h>
#define SDMMC_CTRL 0x000
#define SDMMC_CMDARG 0x028
#define SDMMC_CMD 0x02c
#define SDMMC_RINTSTS 0x044
#define SDMMC_STATUS 0x048
#define SDMMC_BMOD 0x080
@@ -84,6 +86,18 @@ static int rk_tb_mmc_thread(void *p)
writel(0, regs + SDMMC_BMOD);
writel(0, regs + SDMMC_DBADDR);
/* Send CMD12 to stop transmission */
writel(0xffffffff, regs + SDMMC_RINTSTS);
writel(0, regs + SDMMC_CMDARG);
writel(0xa000414c, regs + SDMMC_CMD);
if (readl_poll_timeout(regs + SDMMC_RINTSTS, status,
!(status & BIT(2)), 100,
11 * USEC_PER_MSEC)) {
dev_err(dev, "Send CMD12 timeout!\n");
goto out;
}
/* Parse ramdisk addr and help start decompressing */
if (rds && rdd) {
struct resource src, dst;