diff mbox series

[v2,7/8] mmc: mtk-sd: fix hang when data read quickly

Message ID 20191231032926.2194-8-mingming.lee@mediatek.com
State Accepted
Commit fb80eaa9d8c15840bbceb4b8152c3759a84ae39e
Delegated to: Tom Rini
Headers show
Series Add support for MediaTek MT8512 Soc | expand

Commit Message

mingming lee Dec. 31, 2019, 3:29 a.m. UTC
For CMD21 tuning data, the 128/64 bytes data may coming in very
short time, before msdc_start_data(), the read data has already
come, in this case, clear MSDC_INT will cause the interrupt disappear
and lead to the thread hang.

the solution is just clear all interrupts before command was sent.

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
---
 drivers/mmc/mtk-sd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Tom Rini Jan. 16, 2020, 2:41 p.m. UTC | #1
On Tue, Dec 31, 2019 at 11:29:25AM +0800, mingming lee wrote:

> For CMD21 tuning data, the 128/64 bytes data may coming in very
> short time, before msdc_start_data(), the read data has already
> come, in this case, clear MSDC_INT will cause the interrupt disappear
> and lead to the thread hang.
> 
> the solution is just clear all interrupts before command was sent.
> 
> Signed-off-by: mingming lee <mingming.lee@mediatek.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
index 23413731dc..b0365877d7 100644
--- a/drivers/mmc/mtk-sd.c
+++ b/drivers/mmc/mtk-sd.c
@@ -14,7 +14,6 @@ 
 #include <malloc.h>
 #include <mapmem.h>
 #include <stdbool.h>
-#include <watchdog.h>
 #include <asm/gpio.h>
 #include <dm/pinctrl.h>
 #include <linux/bitops.h>
@@ -531,6 +530,7 @@  static int msdc_start_command(struct msdc_host *host, struct mmc_cmd *cmd,
 		blocks = data->blocks;
 
 	writel(CMD_INTS_MASK, &host->base->msdc_int);
+	writel(DATA_INTS_MASK, &host->base->msdc_int);
 	writel(blocks, &host->base->sdc_blk_num);
 	writel(cmd->cmdarg, &host->base->sdc_arg);
 	writel(rawcmd, &host->base->sdc_cmd);
@@ -677,13 +677,9 @@  static int msdc_start_data(struct msdc_host *host, struct mmc_data *data)
 	u32 size;
 	int ret;
 
-	WATCHDOG_RESET();
-
 	if (data->flags == MMC_DATA_WRITE)
 		host->last_data_write = 1;
 
-	writel(DATA_INTS_MASK, &host->base->msdc_int);
-
 	size = data->blocks * data->blocksize;
 
 	if (data->flags == MMC_DATA_WRITE)