Return-Path: Received: from vsp-unauthed02.binero.net ([195.74.38.227]:55519 "EHLO vsp-unauthed02.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeJPJ1k (ORCPT ); Tue, 16 Oct 2018 05:27:40 -0400 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Wolfram Sang , Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v2 2/3] mmc: tmio: fix reset operation Date: Tue, 16 Oct 2018 03:38:31 +0200 Message-Id: <20181016013832.2385-3-niklas.soderlund@ragnatech.se> In-Reply-To: <20181016013832.2385-1-niklas.soderlund@ragnatech.se> References: <20181016013832.2385-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-renesas-soc-owner@vger.kernel.org List-ID: From: Niklas Söderlund SD / MMC did not operate properly when suspend transition failed. Because the SCC was not reset at resume, issue of the command failed. Merge tmio_mmc_reset() into tmio_mmc_hw_reset() in order to add reset of SCC to tmio_mmc_host_runtime_resume(). Based on work from Masaharu Hayakawa. Signed-off-by: Niklas Söderlund --- * Changes sine v1 - Merge tmio_mmc_reset() into tmio_mmc_hw_reset() as it's now the only caller. --- drivers/mmc/host/tmio_mmc_core.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 71d3b380760d425f..da7a5ceeeef0b7ae 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -157,8 +157,10 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) } } -static void tmio_mmc_reset(struct tmio_mmc_host *host) +static void tmio_mmc_hw_reset(struct mmc_host *mmc) { + struct tmio_mmc_host *host = mmc_priv(mmc); + /* FIXME - should we set stop clock reg here */ sd_ctrl_write16(host, CTL_RESET_SD, 0x0000); if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) @@ -174,6 +176,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); } + tmio_mmc_abort_dma(host); + + if (host->hw_reset) + host->hw_reset(host); } static void tmio_mmc_reset_work(struct work_struct *work) @@ -214,7 +220,7 @@ static void tmio_mmc_reset_work(struct work_struct *work) spin_unlock_irqrestore(&host->lock, flags); - tmio_mmc_reset(host); + tmio_mmc_hw_reset(host->mmc); /* Ready for new calls */ host->mrq = NULL; @@ -701,14 +707,6 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host, return 0; } -static void tmio_mmc_hw_reset(struct mmc_host *mmc) -{ - struct tmio_mmc_host *host = mmc_priv(mmc); - - if (host->hw_reset) - host->hw_reset(host); -} - static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct tmio_mmc_host *host = mmc_priv(mmc); @@ -1230,7 +1228,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; _host->set_clock(_host, 0); - tmio_mmc_reset(_host); + tmio_mmc_hw_reset(mmc); _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); @@ -1331,7 +1329,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev) struct tmio_mmc_host *host = dev_get_drvdata(dev); tmio_mmc_clk_enable(host); - tmio_mmc_reset(host); + tmio_mmc_hw_reset(host->mmc); if (host->clk_cache) host->set_clock(host, host->clk_cache); -- 2.19.1