linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection
@ 2020-12-23  7:30 Yoshihiro Shimoda
  2020-12-23  7:30 ` [PATCH 1/2] mmc: tmio: " Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2020-12-23  7:30 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas; +Cc: linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

This patch series is based on the mmc.git / next branch. The patch 1/2
is a updated patch from Wolfram-san submitted [1]. And, I talked
him locally, I can write this Reviewed-by and Tested-by instead of
SoB. The patch 2/2 is a new patch for retuning a card when
the host controller detects cmd/data timeout. And, I got Wolfram-san's
Reviewed-by locally.

Note that I don't include Hayakawa-san's email account which is
the author of the patch 1/2 in To/CC because he left from Renesas
now.

[1]
https://lore.kernel.org/linux-mmc/20201120150647.123237-3-wsa+renesas@sang-engineering.com/

Masaharu Hayakawa (1):
  mmc: tmio: Add data timeout error detection

Yoshihiro Shimoda (1):
  mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for
    retune

 drivers/mmc/host/renesas_sdhi_core.c | 16 +++++++++++++---
 drivers/mmc/host/tmio_mmc.h          |  2 +-
 drivers/mmc/host/tmio_mmc_core.c     |  8 +++++---
 3 files changed, 19 insertions(+), 7 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] mmc: tmio: Add data timeout error detection
  2020-12-23  7:30 [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Yoshihiro Shimoda
@ 2020-12-23  7:30 ` Yoshihiro Shimoda
  2020-12-23  7:30 ` [PATCH 2/2] mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for retune Yoshihiro Shimoda
  2021-01-13 11:25 ` [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2020-12-23  7:30 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas
  Cc: linux-mmc, linux-renesas-soc, Masaharu Hayakawa, Yoshihiro Shimoda

From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

Currently, busy timeout is not checked for data transfer command. But,
if the temperature condition changes, the data cannot be acquired
correctly and timeout may occur. Also, we could reproduce an issue by
using mmc_test driver (e.g. "Correct xfer_size at write (start
failure)"). Therefore, this adds timeout error check.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[saito: rework commit message.]
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[shimoda: rebase, add commit description]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 942b8375..21492b5 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -477,8 +477,10 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 	if (!data)
 		goto out;
 
-	if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
-	    stat & TMIO_STAT_TXUNDERRUN)
+	if (stat & TMIO_STAT_DATATIMEOUT)
+		data->error = -ETIMEDOUT;
+	else if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
+		 stat & TMIO_STAT_TXUNDERRUN)
 		data->error = -EILSEQ;
 	if (host->dma_on && (data->flags & MMC_DATA_WRITE)) {
 		u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for retune
  2020-12-23  7:30 [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Yoshihiro Shimoda
  2020-12-23  7:30 ` [PATCH 1/2] mmc: tmio: " Yoshihiro Shimoda
@ 2020-12-23  7:30 ` Yoshihiro Shimoda
  2021-01-13 11:25 ` [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2020-12-23  7:30 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas; +Cc: linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

According to the datasheet, this controller needs retune when
cmd or data timeout happens. So, add a condition into .check_retune().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 16 +++++++++++++---
 drivers/mmc/host/tmio_mmc.h          |  2 +-
 drivers/mmc/host/tmio_mmc_core.c     |  2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 38f028e..158c21e 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -768,10 +768,12 @@ static bool renesas_sdhi_auto_correction(struct tmio_mmc_host *host)
 	return false;
 }
 
-static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
+static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host,
+					 struct mmc_request *mrq)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 	bool use_4tap = priv->quirks && priv->quirks->hs400_4taps;
+	bool ret = false;
 
 	/*
 	 * Skip checking SCC errors when running on 4 taps in HS400 mode as
@@ -785,11 +787,19 @@ static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 	if (mmc_doing_tune(host->mmc))
 		return false;
 
+	if (((mrq->cmd->error == -ETIMEDOUT) ||
+	     (mrq->data && mrq->data->error == -ETIMEDOUT)) &&
+	    ((host->mmc->caps & MMC_CAP_NONREMOVABLE) ||
+	     (host->ops.get_cd && host->ops.get_cd(host->mmc))))
+		ret |= true;
+
 	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
 	    SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN)
-		return renesas_sdhi_auto_correction(host);
+		ret |= renesas_sdhi_auto_correction(host);
+	else
+		ret |= renesas_sdhi_manual_correction(host, use_4tap);
 
-	return renesas_sdhi_manual_correction(host, use_4tap);
+	return ret;
 }
 
 static int renesas_sdhi_wait_idle(struct tmio_mmc_host *host, u32 bit)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 784fa6e..2d1db93 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -181,7 +181,7 @@ struct tmio_mmc_host {
 			      unsigned int direction, int blk_size);
 	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
 	void (*reset)(struct tmio_mmc_host *host);
-	bool (*check_retune)(struct tmio_mmc_host *host);
+	bool (*check_retune)(struct tmio_mmc_host *host, struct mmc_request *mrq);
 	void (*fixup_request)(struct tmio_mmc_host *host, struct mmc_request *mrq);
 	unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host);
 
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 21492b5..49c2d40 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -804,7 +804,7 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 	}
 
 	/* Error means retune, but executed command was still successful */
-	if (host->check_retune && host->check_retune(host))
+	if (host->check_retune && host->check_retune(host, mrq))
 		mmc_retune_needed(host->mmc);
 
 	/* If SET_BLOCK_COUNT, continue with main command */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection
  2020-12-23  7:30 [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Yoshihiro Shimoda
  2020-12-23  7:30 ` [PATCH 1/2] mmc: tmio: " Yoshihiro Shimoda
  2020-12-23  7:30 ` [PATCH 2/2] mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for retune Yoshihiro Shimoda
@ 2021-01-13 11:25 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-01-13 11:25 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: Wolfram Sang, linux-mmc, Linux-Renesas

On Wed, 23 Dec 2020 at 08:30, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
>
> This patch series is based on the mmc.git / next branch. The patch 1/2
> is a updated patch from Wolfram-san submitted [1]. And, I talked
> him locally, I can write this Reviewed-by and Tested-by instead of
> SoB. The patch 2/2 is a new patch for retuning a card when
> the host controller detects cmd/data timeout. And, I got Wolfram-san's
> Reviewed-by locally.
>
> Note that I don't include Hayakawa-san's email account which is
> the author of the patch 1/2 in To/CC because he left from Renesas
> now.
>
> [1]
> https://lore.kernel.org/linux-mmc/20201120150647.123237-3-wsa+renesas@sang-engineering.com/
>
> Masaharu Hayakawa (1):
>   mmc: tmio: Add data timeout error detection
>
> Yoshihiro Shimoda (1):
>   mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for
>     retune
>
>  drivers/mmc/host/renesas_sdhi_core.c | 16 +++++++++++++---
>  drivers/mmc/host/tmio_mmc.h          |  2 +-
>  drivers/mmc/host/tmio_mmc_core.c     |  8 +++++---
>  3 files changed, 19 insertions(+), 7 deletions(-)
>

Applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-13 11:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23  7:30 [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Yoshihiro Shimoda
2020-12-23  7:30 ` [PATCH 1/2] mmc: tmio: " Yoshihiro Shimoda
2020-12-23  7:30 ` [PATCH 2/2] mmc: host: renesas_sdhi: Add a condition of cmd/data timeout for retune Yoshihiro Shimoda
2021-01-13 11:25 ` [PATCH 0/2] mmc: host: tmio/renesas_sdhi: Add data timeout error detection Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).