Skip to content

Commit cc5d169

Browse files
wenbinmei1storulf
authored andcommitted
mmc: mtk-sd: Clear interrupts when cqe off/disable
Currently we don't clear MSDC interrupts when cqe off/disable, which led to the data complete interrupt will be reserved for the next command. If the next command with data transfer after cqe off/disable, we process the CMD ready interrupt and trigger DMA start for data, but the data complete interrupt is already exists, then SW assume that the data transfer is complete, SW will trigger DMA stop, but the data may not be transmitted yet or is transmitting, so we may encounter the following error: mtk-msdc 11230000.mmc: CMD bus busy detected. Signed-off-by: Wenbin Mei <[email protected]> Fixes: 88bd652 ("mmc: mediatek: command queue support") Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent b886f54 commit cc5d169

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/mmc/host/mtk-sd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,9 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
24462446
/* disable busy check */
24472447
sdr_clr_bits(host->base + MSDC_PATCH_BIT1, MSDC_PB1_BUSY_CHECK_SEL);
24482448

2449+
val = readl(host->base + MSDC_INT);
2450+
writel(val, host->base + MSDC_INT);
2451+
24492452
if (recovery) {
24502453
sdr_set_field(host->base + MSDC_DMA_CTRL,
24512454
MSDC_DMA_CTRL_STOP, 1);
@@ -2932,11 +2935,14 @@ static int __maybe_unused msdc_suspend(struct device *dev)
29322935
struct mmc_host *mmc = dev_get_drvdata(dev);
29332936
struct msdc_host *host = mmc_priv(mmc);
29342937
int ret;
2938+
u32 val;
29352939

29362940
if (mmc->caps2 & MMC_CAP2_CQE) {
29372941
ret = cqhci_suspend(mmc);
29382942
if (ret)
29392943
return ret;
2944+
val = readl(host->base + MSDC_INT);
2945+
writel(val, host->base + MSDC_INT);
29402946
}
29412947

29422948
/*

0 commit comments

Comments
 (0)