From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH v3 2/3] mmc: tmio: fix reset operation
Date: Thu, 1 Nov 2018 00:05:53 +0100 [thread overview]
Message-ID: <20181031230554.1660-3-niklas.soderlund@ragnatech.se> (raw)
In-Reply-To: <20181031230554.1660-1-niklas.soderlund@ragnatech.se>
From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
SD / MMC did not operate properly when suspend transition failed.
Because the SCC was not reset at resume, issue of the command failed.
Call the host specific reset function and reset the hardware in order to
add reset of SCC. This change also fixes tuning on some stubborn cards
on Gen2.
Based on work from Masaharu Hayakawa.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes sine v1
- Merge tmio_mmc_reset() into tmio_mmc_hw_reset() as it's now the only
caller.
* Changes since v2
- Rebased on mmc/next caused small refactoring of the code.
---
drivers/mmc/host/tmio_mmc_core.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 953562a12a0d6ebc..662161be03b6d52e 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -171,6 +171,18 @@ 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);
+
+ host->reset(host);
+
+ tmio_mmc_abort_dma(host);
+
+ if (host->hw_reset)
+ host->hw_reset(host);
+}
+
static void tmio_mmc_reset_work(struct work_struct *work)
{
struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host,
@@ -209,7 +221,7 @@ static void tmio_mmc_reset_work(struct work_struct *work)
spin_unlock_irqrestore(&host->lock, flags);
- host->reset(host);
+ tmio_mmc_hw_reset(host->mmc);
/* Ready for new calls */
host->mrq = NULL;
@@ -696,14 +708,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);
@@ -1228,7 +1232,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
_host->set_clock(_host, 0);
- _host->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);
@@ -1329,7 +1333,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
struct tmio_mmc_host *host = dev_get_drvdata(dev);
tmio_mmc_clk_enable(host);
- host->reset(host);
+ tmio_mmc_hw_reset(host->mmc);
if (host->clk_cache)
host->set_clock(host, host->clk_cache);
--
2.19.1
next prev parent reply other threads:[~2018-11-01 8:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-31 23:05 [PATCH v3 0/3] mmc: tmio: fix reset operation Niklas Söderlund
2018-10-31 23:05 ` [PATCH v3 1/3] mmc: tmio: enable module clock before resetting when resuming Niklas Söderlund
2018-11-01 19:01 ` Wolfram Sang
2018-11-02 6:51 ` Masahiro Yamada
2018-11-02 11:58 ` Simon Horman
2018-10-31 23:05 ` Niklas Söderlund [this message]
2018-11-01 19:02 ` [PATCH v3 2/3] mmc: tmio: fix reset operation Wolfram Sang
2018-11-02 6:54 ` Masahiro Yamada
2018-11-26 16:53 ` Niklas Söderlund
2018-10-31 23:05 ` [PATCH v3 3/3] mmc: renesas_sdhi: add initial setting of interrupt mask register Niklas Söderlund
2018-11-01 19:02 ` Wolfram Sang
2018-11-02 12:02 ` Simon Horman
2018-11-01 19:04 ` [PATCH v3 0/3] mmc: tmio: fix reset operation Wolfram Sang
2018-11-01 19:35 ` Wolfram Sang
2018-11-19 12:08 ` Ulf Hansson
2018-11-19 12:14 ` Wolfram Sang
2018-11-19 13:08 ` Ulf Hansson
2018-11-19 13:33 ` Wolfram Sang
2018-11-19 17:28 ` Niklas Söderlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181031230554.1660-3-niklas.soderlund@ragnatech.se \
--to=niklas.soderlund@ragnatech.se \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.