All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected
@ 2018-08-29 23:32 Niklas Söderlund
  2018-08-29 23:32 ` [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune Niklas Söderlund
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Niklas Söderlund @ 2018-08-29 23:32 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc
  Cc: linux-renesas-soc, Niklas Söderlund

Hi,

These patches triggers a retune if a SCC error is detected. They where
ported from the renesas BSP. Masaharu-san did all the real work I just
ported them to upstream and did small fixups.

These patches where broken out of my retuning series as more work where
needed to adapt them to the recent HS400 series picked-up. It's tested
on M3-N using both HS200 and HS400 and on H3 ES2.0 using HS200.

Masaharu Hayakawa (2):
  mmc: renesas_sdhi: skip SCC error check when retuning
  mmc: tmio: Fix SCC error detection

Niklas Söderlund (1):
  mmc: core: add helper to see if a host is doing a retune

 drivers/mmc/host/renesas_sdhi_core.c | 13 +++++++++++++
 drivers/mmc/host/tmio_mmc_core.c     |  4 ++--
 include/linux/mmc/host.h             |  5 +++++
 3 files changed, 20 insertions(+), 2 deletions(-)

-- 
2.18.0

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

* [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune
  2018-08-29 23:32 [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Niklas Söderlund
@ 2018-08-29 23:32 ` Niklas Söderlund
  2018-08-30  9:57   ` Wolfram Sang
  2018-08-29 23:32 ` [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning Niklas Söderlund
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Niklas Söderlund @ 2018-08-29 23:32 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc
  Cc: linux-renesas-soc, Niklas Söderlund

Add a helper to allow host drivers checking if a retune is in progress.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/linux/mmc/host.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index beed7121c7818b74..2a5fe75dd0821d03 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -569,6 +569,11 @@ static inline bool mmc_can_retune(struct mmc_host *host)
 	return host->can_retune == 1;
 }
 
+static inline bool mmc_doing_retune(struct mmc_host *host)
+{
+	return host->doing_retune == 1;
+}
+
 static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
 {
 	return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-- 
2.18.0

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

* [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning
  2018-08-29 23:32 [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Niklas Söderlund
  2018-08-29 23:32 ` [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune Niklas Söderlund
@ 2018-08-29 23:32 ` Niklas Söderlund
  2018-08-30  9:57   ` Wolfram Sang
  2018-08-29 23:32 ` [PATCH v4 3/3] mmc: tmio: Fix SCC error detection Niklas Söderlund
  2018-08-30 12:30 ` [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Ulf Hansson
  3 siblings, 1 reply; 8+ messages in thread
From: Niklas Söderlund @ 2018-08-29 23:32 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc
  Cc: linux-renesas-soc, Masaharu Hayakawa, Niklas Söderlund

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

Checking for SCC error during retuning is unnecessary.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[Niklas: fix small style issue]
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

---

* Changes since v3
- Use the newly introduce helper mmc_doing_retune() instead of checking
  host->mmc->doing_retune in the host driver.

* Changes since v2
- Add comment to describe why checking SCC errors when using 4 taps is
  not needed.

* Changes since v1
- Use intermediate variable use_4tap to simplify check.
---
 drivers/mmc/host/renesas_sdhi_core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index c2c0e444cfc9f2dc..360777e9f35cbb3e 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -500,6 +500,19 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
+	bool use_4tap = host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400;
+
+	/*
+	 * Skip checking SCC errors when running on 4 taps in HS400 mode as
+	 * any retuning would still result in the same 4 taps being used.
+	 */
+	if (!(host->mmc->ios.timing == MMC_TIMING_UHS_SDR104) &&
+	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS200) &&
+	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS400 && !use_4tap))
+		return false;
+
+	if (mmc_doing_retune(host->mmc))
+		return false;
 
 	/* Check SCC error */
 	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
-- 
2.18.0

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

* [PATCH v4 3/3] mmc: tmio: Fix SCC error detection
  2018-08-29 23:32 [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Niklas Söderlund
  2018-08-29 23:32 ` [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune Niklas Söderlund
  2018-08-29 23:32 ` [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning Niklas Söderlund
@ 2018-08-29 23:32 ` Niklas Söderlund
  2018-08-30  9:58   ` Wolfram Sang
  2018-08-30 12:30 ` [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Ulf Hansson
  3 siblings, 1 reply; 8+ messages in thread
From: Niklas Söderlund @ 2018-08-29 23:32 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc
  Cc: linux-renesas-soc, Masaharu Hayakawa, Niklas Söderlund

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

SDR104, HS200 and HS400 need to check for SCC error. If SCC error is
detected, retuning is necessary.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[Niklas: update commit message]
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

---

* Changes since v3
- Updated commit message to mention also HS400.
---
 drivers/mmc/host/tmio_mmc_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index d48cd0402087ab31..f05c3a622f090cd6 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -839,8 +839,8 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 	if (mrq->cmd->error || (mrq->data && mrq->data->error))
 		tmio_mmc_abort_dma(host);
 
-	if (host->check_scc_error)
-		host->check_scc_error(host);
+	if (host->check_scc_error && host->check_scc_error(host))
+		mrq->cmd->error = -EILSEQ;
 
 	/* If SET_BLOCK_COUNT, continue with main command */
 	if (host->mrq && !mrq->cmd->error) {
-- 
2.18.0

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

* Re: [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune
  2018-08-29 23:32 ` [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune Niklas Söderlund
@ 2018-08-30  9:57   ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-08-30  9:57 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On Thu, Aug 30, 2018 at 01:32:05AM +0200, Niklas Söderlund wrote:
> Add a helper to allow host drivers checking if a retune is in progress.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning
  2018-08-29 23:32 ` [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning Niklas Söderlund
@ 2018-08-30  9:57   ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-08-30  9:57 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc,
	Masaharu Hayakawa

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Thu, Aug 30, 2018 at 01:32:06AM +0200, Niklas Söderlund wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> 
> Checking for SCC error during retuning is unnecessary.
> 
> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> [Niklas: fix small style issue]
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v4 3/3] mmc: tmio: Fix SCC error detection
  2018-08-29 23:32 ` [PATCH v4 3/3] mmc: tmio: Fix SCC error detection Niklas Söderlund
@ 2018-08-30  9:58   ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-08-30  9:58 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc,
	Masaharu Hayakawa

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

On Thu, Aug 30, 2018 at 01:32:07AM +0200, Niklas Söderlund wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> 
> SDR104, HS200 and HS400 need to check for SCC error. If SCC error is
> detected, retuning is necessary.
> 
> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> [Niklas: update commit message]
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected
  2018-08-29 23:32 [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Niklas Söderlund
                   ` (2 preceding siblings ...)
  2018-08-29 23:32 ` [PATCH v4 3/3] mmc: tmio: Fix SCC error detection Niklas Söderlund
@ 2018-08-30 12:30 ` Ulf Hansson
  3 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2018-08-30 12:30 UTC (permalink / raw)
  To: Niklas Söderlund; +Cc: Wolfram Sang, linux-mmc, Linux-Renesas

On 30 August 2018 at 01:32, Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Hi,
>
> These patches triggers a retune if a SCC error is detected. They where
> ported from the renesas BSP. Masaharu-san did all the real work I just
> ported them to upstream and did small fixups.
>
> These patches where broken out of my retuning series as more work where
> needed to adapt them to the recent HS400 series picked-up. It's tested
> on M3-N using both HS200 and HS400 and on H3 ES2.0 using HS200.
>
> Masaharu Hayakawa (2):
>   mmc: renesas_sdhi: skip SCC error check when retuning
>   mmc: tmio: Fix SCC error detection
>
> Niklas Söderlund (1):
>   mmc: core: add helper to see if a host is doing a retune
>
>  drivers/mmc/host/renesas_sdhi_core.c | 13 +++++++++++++
>  drivers/mmc/host/tmio_mmc_core.c     |  4 ++--
>  include/linux/mmc/host.h             |  5 +++++
>  3 files changed, 20 insertions(+), 2 deletions(-)
>
> --
> 2.18.0
>

Applied for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2018-08-30 16:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 23:32 [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Niklas Söderlund
2018-08-29 23:32 ` [PATCH v4 1/3] mmc: core: add helper to see if a host is doing a retune Niklas Söderlund
2018-08-30  9:57   ` Wolfram Sang
2018-08-29 23:32 ` [PATCH v4 2/3] mmc: renesas_sdhi: skip SCC error check when retuning Niklas Söderlund
2018-08-30  9:57   ` Wolfram Sang
2018-08-29 23:32 ` [PATCH v4 3/3] mmc: tmio: Fix SCC error detection Niklas Söderlund
2018-08-30  9:58   ` Wolfram Sang
2018-08-30 12:30 ` [PATCH v4 0/3] mmc: {tmio,renesas_sdhi}: retune if SCC error detected Ulf Hansson

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.