mmc: msm_sdcc: add warning if data timeout is zero
SDCC controller's MCI_DATA_TIMER register is programmed
with data timeout value while doing data transfer from/to
card. If this register is programmed with 0 timeout for
data transfer, controller will immediately throw the data
timeout error at the start of data transfer itself.
Programming timeout value as 0 is an error condition and
this patch adds WARN() when this condition is encountered.
Change-Id: I7fdde98857afeecd8e851d37a93917933caf24de
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index e7838f5..1b4eb61 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1173,6 +1173,9 @@
clks = (unsigned long long)data->timeout_ns * host->clk_rate;
do_div(clks, 1000000000UL);
timeout = data->timeout_clks + (unsigned int)clks*2 ;
+ WARN(!timeout,
+ "%s: data timeout is zero. timeout_ns=0x%x, timeout_clks=0x%x\n",
+ mmc_hostname(host->mmc), data->timeout_ns, data->timeout_clks);
if (host->is_dma_mode && (datactrl & MCI_DPSM_DMAENABLE)) {
/* Use ADM (Application Data Mover) HW for Data transfer */