From 150548af412a635bdf7bdbe53f91add21c5e4bdc Mon Sep 17 00:00:00 2001 From: Douglas Anderson Date: Tue, 31 Oct 2017 14:19:17 +0800 Subject: [PATCH] BACKPORT: UPSTREAM: mmc: dw_mmc: cancel the CTO timer after a voltage switch When running with the commit 03de19212ea3 ("mmc: dw_mmc: introduce timer for broken command transfer over scheme") I found this message in the log: Unexpected command timeout, state 7 It turns out that we weren't properly cancelling the new CTO timer in the case that a voltage switch was done. Let's promote the cancel into the dw_mci_cmd_interrupt() function to fix this. Change-Id: I2ee3537eb7a756d64964cc49114011ad329409b8 Fixes: 03de19212ea3 ("mmc: dw_mmc: introduce timer for broken command transfer over scheme") Tested-by: Emil Renner Berthing Reviewed-by: Shawn Lin Signed-off-by: Douglas Anderson Signed-off-by: Ulf Hansson Signed-off-by: Shawn Lin (cherry picked from https://patchwork.kernel.org/patch/10002779/) --- drivers/mmc/host/dw_mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 0267825955d0..7d6a9af68ff3 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2384,6 +2384,8 @@ done: static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status) { + del_timer(&host->cto_timer); + if (!host->cmd_status) host->cmd_status = status; @@ -2494,7 +2496,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) } if (pending & SDMMC_INT_CMD_DONE) { - del_timer(&host->cto_timer); mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE); dw_mci_cmd_interrupt(host, pending); }