[PATCH 4/5] drivers: mmc: sdhci: Add option to configure sdhci timeout

From: Piyush Malgujar
Date: Mon Dec 19 2022 - 09:26:01 EST


From: Jayanthi Annadurai <jannadurai@xxxxxxxxxxx>

Add config option to choose the sdhci timeout in seconds.

Signed-off-by: Jayanthi Annadurai <jannadurai@xxxxxxxxxxx>
Signed-off-by: Piyush Malgujar <pmalgujar@xxxxxxxxxxx>
---
drivers/mmc/host/Kconfig | 8 ++++++++
drivers/mmc/host/sdhci.c | 3 ++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index b5b2ae0bb4625bdb9d17acdbb1887c9caa3a1f32..ab48f2bc4cff73d1aad8d7da542d761cf0346d9f 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -1132,3 +1132,11 @@ config MMC_LITEX
module will be called litex_mmc.

If unsure, say N.
+
+config MMC_SDHCI_TIMEOUT
+ int
+ default 1 if MMC_SDHCI_CADENCE
+ default 10
+ depends on MMC_SDHCI
+ help
+ Default timeout value for command and data.
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f3af1bd0f7b955272fbd8b034ecb591860b89aed..e9bc24258746834ec9c8f13fe24456587a2b758d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1707,7 +1707,8 @@ static bool sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
else if (!cmd->data && cmd->busy_timeout > 9000)
timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ;
else
- timeout += 10 * HZ;
+ timeout += CONFIG_MMC_SDHCI_TIMEOUT * HZ;
+
sdhci_mod_timer(host, cmd->mrq, timeout);

if (host->use_external_dma)
--
2.17.1