From ca63b592db3b4b26dbbb850ee42b3a1ab75f0289 Mon Sep 17 00:00:00 2001 From: Md Sadre Alam Date: Tue, 19 Feb 2019 20:53:10 +0530 Subject: [PATCH] driver: mmc: sdhci: Add condition for DAT inhibit bit. This change will handle masking of DAT inhibit bit of present state register. This status bit is genarated if either the DAT Line Active or Read Transfer Active is set to 1. If this bit is 0, it indicates the host controller can issue the next command. Commands with busy signal belong to Command Inhibit(DAT). e.g (R1b, R5b type). Changing from 1 to 0 generates a transfer complete interrupt in normal interrupt status register. If this bit value is 1: Cannot issue command which uses DAT line. If this bit value is 0: Can issue command which uses DAT line. This change is masking SDHCI_DATA_INHIBIT bit only if card is in busy state. Without this change we can get the erase timeout error. error: MMC erase: dev # 0, block # 27682, count 16383 ... sdhci_send_command: MMC: 0 busy timeout increasing to: 2000 ms. Change-Id: I0612e576c09a7fd077bed1a1ee717afcddfa7e87 Signed-off-by: Md Sadre Alam --- drivers/mmc/sdhci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index ae23983999..6cb2a3b3d6 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -252,7 +252,10 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, static unsigned int cmd_timeout = CONFIG_SDHCI_CMD_DEFAULT_TIMEOUT; sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS); - mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT; + + mask = SDHCI_CMD_INHIBIT; + if ((data != NULL) || (cmd->resp_type & MMC_RSP_BUSY)) + mask |= SDHCI_DATA_INHIBIT; /* We shouldn't wait for data inihibit for stop commands, even though they might use busy signaling */