linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction
@ 2019-12-17 11:40 Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 1/5] mmc: renesas_sdhi: remove double clear of automatic correction Wolfram Sang
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

Add manual tap correction because the automatic one fails for HS400 on
Gen3.

Changes since RFC v1:

* rebased to mmc/next
* added review tags from Shimoda-san
* fixed "enforce" in one commit message (Thanks Geert!)
* new patch 3/5: I think it makes sense to incorporate this patch from
  the BSP here already because it enhances manual correction. It could
  be argued if it should be merged with 2/5, yet for easier review I
  left it seperate for now
* new patch 5/5: a cleanup I came up with while working on 3/5.

I kept all tap_related variables 'unsigned long' for now. Geert has a
point that some of them could be changed to 'unsigned int'. I'd like to
leave this as a seperate issue, though, once we dealt with the other
HS400 issues. (Yes, more patches coming...)

I did some more testing but with my environment here, I hardly see taps
changing. What I see is that with HS400 RVSERR is regularly set but
SMPCMP is all cleared. So, this series maybe saves some unneeded tuning
for me. But I think the relevant cases are created in a lab, so some
more testing would be much appreciated. We definately want to wait for
Shimoda-san's comments before applying this.

This series depends on mmc/next because of this other series:
[PATCH 0/5] mmc: renesas_sdhi: prepare for recent HS400 updates

A branch is here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/sdhi/new_manual_calib

Kind regards,

   Wolfram


Takeshi Saito (2):
  mmc: renesas_sdhi: Add manual correction
  mmc: renesas_sdhi: only check CMD status for HS400 manual correction

Wolfram Sang (3):
  mmc: renesas_sdhi: remove double clear of automatic correction
  mmc: renesas_sdhi: enforce manual correction for Gen3
  mmc: renesas_sdhi: cleanup SCC defines

 drivers/mmc/host/renesas_sdhi.h      |   1 +
 drivers/mmc/host/renesas_sdhi_core.c | 104 ++++++++++++++++++++++-----
 2 files changed, 86 insertions(+), 19 deletions(-)

-- 
2.20.1


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

* [RFC PATCH v2 1/5] mmc: renesas_sdhi: remove double clear of automatic correction
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
@ 2019-12-17 11:40 ` Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 2/5] mmc: renesas_sdhi: Add manual correction Wolfram Sang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

hw_reset() clears the automatic correction bit twice. I couldn't find
anything in the docs recommending that. Removing one of them didn't
cause any regressions here, so keep it simple.

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 35cb24cd45b4..519d91ae3373 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -531,10 +531,6 @@ static void renesas_sdhi_hw_reset(struct tmio_mmc_host *host)
 		       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
 		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
 
-	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
-		       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
-		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
-
 	if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
 		sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK,
 					     TMIO_MASK_INIT_RCAR2);
-- 
2.20.1


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

* [RFC PATCH v2 2/5] mmc: renesas_sdhi: Add manual correction
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 1/5] mmc: renesas_sdhi: remove double clear of automatic correction Wolfram Sang
@ 2019-12-17 11:40 ` Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 " Wolfram Sang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Takeshi Saito, Wolfram Sang

From: Takeshi Saito <takeshi.saito.xv@renesas.com>

This patch adds a manual correction mechanism for SDHI. Currently, SDHI
uses automatic TAP position correction. However, TAP position can also
be corrected manually via correction error status flags.

Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi.h      |  1 +
 drivers/mmc/host/renesas_sdhi_core.c | 61 +++++++++++++++++++++++-----
 2 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index f524251d5113..11a0b2bca3aa 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -57,6 +57,7 @@ struct renesas_sdhi {
 	void __iomem *scc_ctl;
 	u32 scc_tappos;
 	u32 scc_tappos_hs400;
+	bool doing_tune;
 };
 
 #define host_to_priv(host) \
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 519d91ae3373..6cedc0a10593 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -263,6 +263,8 @@ static int renesas_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
 #define SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN	BIT(0)
 /* Definitions for values the SH_MOBILE_SDHI_SCC_RVSREQ register */
 #define SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR	BIT(2)
+#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP	BIT(1)
+#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN	BIT(0)
 /* Definitions for values the SH_MOBILE_SDHI_SCC_TMPPORT2 register */
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL	BIT(4)
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN	BIT(31)
@@ -321,6 +323,8 @@ static void renesas_sdhi_prepare_tuning(struct tmio_mmc_host *host,
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 
+	priv->doing_tune = true;
+
 	/* Set sampling clock position */
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, tap);
 }
@@ -426,6 +430,8 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 	unsigned long ntap;     /* temporary counter of tuning success */
 	unsigned long i;
 
+	priv->doing_tune = false;
+
 	/* Clear SCC_RVSREQ */
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
 
@@ -485,6 +491,47 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 	return 0;
 }
 
+static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_4tap)
+{
+	struct renesas_sdhi *priv = host_to_priv(host);
+	u32 val;
+
+	val = sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ);
+	if (!val)
+		return false;
+
+	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
+
+	/* Change TAP position according to correction status */
+	if (val & SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR)
+		return true;    /* Need re-tune */
+	else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP)
+		host->tap_set = (host->tap_set + 1) % host->tap_num;
+	else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN)
+		host->tap_set = (host->tap_set - 1) % host->tap_num;
+	else
+		return false;
+
+	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET,
+		       host->tap_set / (use_4tap ? 2 : 1));
+
+	return false;
+}
+
+static bool renesas_sdhi_auto_correction(struct tmio_mmc_host *host)
+{
+	struct renesas_sdhi *priv = host_to_priv(host);
+
+	/* Check SCC error */
+	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ) &
+	    SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR) {
+		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
+		return true;
+	}
+
+	return false;
+}
+
 static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
@@ -499,20 +546,14 @@ static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS400 && !use_4tap))
 		return false;
 
-	if (mmc_doing_retune(host->mmc))
+	if (mmc_doing_retune(host->mmc) || priv->doing_tune)
 		return false;
 
-	/* Check SCC error */
 	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
-	    SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &&
-	    sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ) &
-	    SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR) {
-		/* Clear SCC error */
-		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
-		return true;
-	}
+	    SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN)
+		return renesas_sdhi_auto_correction(host);
 
-	return false;
+	return renesas_sdhi_manual_correction(host, use_4tap);
 }
 
 static void renesas_sdhi_hw_reset(struct tmio_mmc_host *host)
-- 
2.20.1


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

* [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 manual correction
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 1/5] mmc: renesas_sdhi: remove double clear of automatic correction Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 2/5] mmc: renesas_sdhi: Add manual correction Wolfram Sang
@ 2019-12-17 11:40 ` Wolfram Sang
  2020-01-30 10:04   ` Yoshihiro Shimoda
  2019-12-17 11:40 ` [RFC PATCH v2 4/5] mmc: renesas_sdhi: enforce manual correction for Gen3 Wolfram Sang
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Takeshi Saito, Wolfram Sang

From: Takeshi Saito <takeshi.saito.xv@renesas.com>

R-Car Gen3 cannot use correction error status with HS400.
HS200: CMD and DAT signal timing are based on CLK signal.
HS400: CMD signal is based on CLK. DAT signal is based on DS signal.

In HS400, CMD signal is 200MHz(SDR). DAT signal is 200MHz(DDR).
Center position of signal is different between CMD and DAT.

TAP position should be adjusted to the center position of CMD signal.
DAT sampling timing is adjusted by HS400 calibration circuit regardless
of TAP position. Refer to renesas_sdhi_adjust_hs400mode_enable().

However, correction error status contains CMD and DAT status in HS400
(DAT signal is not masked in HS400). Therefore, correction error status
cannot use in HS400. It means that auto correction cannot be uses in
HS400. Manual correction can change to the correct TAP position by
ignoring DAT correction error status and using only CMD correction
status.

Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[wsa: refactored patch from BSP]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 41 ++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 6cedc0a10593..e5db96fd0a69 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -250,6 +250,7 @@ static int renesas_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
 #define SH_MOBILE_SDHI_SCC_CKSEL	0x006
 #define SH_MOBILE_SDHI_SCC_RVSCNTL	0x008
 #define SH_MOBILE_SDHI_SCC_RVSREQ	0x00A
+#define SH_MOBILE_SDHI_SCC_SMPCMP       0x00C
 #define SH_MOBILE_SDHI_SCC_TMPPORT2	0x00E
 
 /* Definitions for values the SH_MOBILE_SDHI_SCC_DTCNTL register */
@@ -265,6 +266,10 @@ static int renesas_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
 #define SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR	BIT(2)
 #define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP	BIT(1)
 #define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN	BIT(0)
+/* Definitions for values the SH_MOBILE_SDHI_SCC_SMPCMP register */
+#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_ERR	(BIT(24) | BIT(8))
+#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQUP	BIT(24)
+#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQDOWN	BIT(8)
 /* Definitions for values the SH_MOBILE_SDHI_SCC_TMPPORT2 register */
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL	BIT(4)
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN	BIT(31)
@@ -494,6 +499,7 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_4tap)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
+	unsigned long new_tap = host->tap_set;
 	u32 val;
 
 	val = sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ);
@@ -503,15 +509,34 @@ static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
 
 	/* Change TAP position according to correction status */
-	if (val & SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR)
-		return true;    /* Need re-tune */
-	else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP)
-		host->tap_set = (host->tap_set + 1) % host->tap_num;
-	else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN)
-		host->tap_set = (host->tap_set - 1) % host->tap_num;
-	else
-		return false;
+	if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC &&
+	    host->mmc->ios.timing == MMC_TIMING_MMC_HS400) {
+		/*
+		 * With HS400, the DAT signal is based on DS, not CLK.
+		 * Therefore, use only CMD status.
+		 */
+		u32 smpcmp = sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP) &
+					   SH_MOBILE_SDHI_SCC_SMPCMP_CMD_ERR;
+		if (!smpcmp)
+			return false;	/* no error in CMD signal */
+		else if (smpcmp == SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQUP)
+			new_tap++;
+		else if (smpcmp == SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQDOWN)
+			new_tap--;
+		else
+			return true;	/* need retune */
+	} else {
+		if (val & SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR)
+			return true;    /* need retune */
+		else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP)
+			new_tap++;
+		else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN)
+			new_tap--;
+		else
+			return false;
+	}
 
+	host->tap_set = (new_tap % host->tap_num);
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET,
 		       host->tap_set / (use_4tap ? 2 : 1));
 
-- 
2.20.1


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

* [RFC PATCH v2 4/5] mmc: renesas_sdhi: enforce manual correction for Gen3
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
                   ` (2 preceding siblings ...)
  2019-12-17 11:40 ` [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 " Wolfram Sang
@ 2019-12-17 11:40 ` Wolfram Sang
  2019-12-17 11:40 ` [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines Wolfram Sang
  2020-02-13 13:55 ` [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Ulf Hansson
  5 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

HW engineers say that automatic tap correction cannot be used for HS400
in all R-Car Gen3 SoCs. So, check for that SDHI variant and disable it
when HS400 is about to be enabled.

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index e5db96fd0a69..04f502345b91 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -348,6 +348,12 @@ static void renesas_sdhi_hs400_complete(struct tmio_mmc_host *host)
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF,
 		       priv->scc_tappos_hs400);
 
+	/* Gen3 can't do automatic tap correction with HS400, so disable it */
+	if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC)
+		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
+			       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
+			       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
+
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2,
 		       (SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN |
 			SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) |
-- 
2.20.1


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

* [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
                   ` (3 preceding siblings ...)
  2019-12-17 11:40 ` [RFC PATCH v2 4/5] mmc: renesas_sdhi: enforce manual correction for Gen3 Wolfram Sang
@ 2019-12-17 11:40 ` Wolfram Sang
  2020-01-30 10:05   ` Yoshihiro Shimoda
  2020-02-13 13:55 ` [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Ulf Hansson
  5 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2019-12-17 11:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

Use increasing BIT numbers consistently and remove some superfluous
comments.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 04f502345b91..6a112454ca26 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -253,24 +253,22 @@ static int renesas_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
 #define SH_MOBILE_SDHI_SCC_SMPCMP       0x00C
 #define SH_MOBILE_SDHI_SCC_TMPPORT2	0x00E
 
-/* Definitions for values the SH_MOBILE_SDHI_SCC_DTCNTL register */
 #define SH_MOBILE_SDHI_SCC_DTCNTL_TAPEN		BIT(0)
 #define SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_SHIFT	16
 #define SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_MASK	0xff
 
-/* Definitions for values the SH_MOBILE_SDHI_SCC_CKSEL register */
 #define SH_MOBILE_SDHI_SCC_CKSEL_DTSEL		BIT(0)
-/* Definitions for values the SH_MOBILE_SDHI_SCC_RVSCNTL register */
+
 #define SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN	BIT(0)
-/* Definitions for values the SH_MOBILE_SDHI_SCC_RVSREQ register */
-#define SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR	BIT(2)
-#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP	BIT(1)
+
 #define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN	BIT(0)
-/* Definitions for values the SH_MOBILE_SDHI_SCC_SMPCMP register */
-#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_ERR	(BIT(24) | BIT(8))
-#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQUP	BIT(24)
+#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP	BIT(1)
+#define SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR	BIT(2)
+
 #define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQDOWN	BIT(8)
-/* Definitions for values the SH_MOBILE_SDHI_SCC_TMPPORT2 register */
+#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQUP	BIT(24)
+#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_ERR	(BIT(8) | BIT(24))
+
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL	BIT(4)
 #define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN	BIT(31)
 
-- 
2.20.1


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

* RE: [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 manual correction
  2019-12-17 11:40 ` [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 " Wolfram Sang
@ 2020-01-30 10:04   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 9+ messages in thread
From: Yoshihiro Shimoda @ 2020-01-30 10:04 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Takeshi Saito

Hi Wolfram-san,

> From: Wolfram Sang, Sent: Tuesday, December 17, 2019 8:41 PM
> 
> R-Car Gen3 cannot use correction error status with HS400.
> HS200: CMD and DAT signal timing are based on CLK signal.
> HS400: CMD signal is based on CLK. DAT signal is based on DS signal.
> 
> In HS400, CMD signal is 200MHz(SDR). DAT signal is 200MHz(DDR).
> Center position of signal is different between CMD and DAT.
> 
> TAP position should be adjusted to the center position of CMD signal.
> DAT sampling timing is adjusted by HS400 calibration circuit regardless
> of TAP position. Refer to renesas_sdhi_adjust_hs400mode_enable().
> 
> However, correction error status contains CMD and DAT status in HS400
> (DAT signal is not masked in HS400). Therefore, correction error status
> cannot use in HS400. It means that auto correction cannot be uses in
> HS400. Manual correction can change to the correct TAP position by
> ignoring DAT correction error status and using only CMD correction
> status.
> 
> Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
> [wsa: refactored patch from BSP]
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


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

* RE: [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines
  2019-12-17 11:40 ` [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines Wolfram Sang
@ 2020-01-30 10:05   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 9+ messages in thread
From: Yoshihiro Shimoda @ 2020-01-30 10:05 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc

Hi Wolfram-san,

> From: Wolfram Sang, Sent: Tuesday, December 17, 2019 8:41 PM
> 
> Use increasing BIT numbers consistently and remove some superfluous
> comments.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


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

* Re: [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction
  2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
                   ` (4 preceding siblings ...)
  2019-12-17 11:40 ` [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines Wolfram Sang
@ 2020-02-13 13:55 ` Ulf Hansson
  5 siblings, 0 replies; 9+ messages in thread
From: Ulf Hansson @ 2020-02-13 13:55 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Yoshihiro Shimoda

On Tue, 17 Dec 2019 at 12:40, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Add manual tap correction because the automatic one fails for HS400 on
> Gen3.
>
> Changes since RFC v1:
>
> * rebased to mmc/next
> * added review tags from Shimoda-san
> * fixed "enforce" in one commit message (Thanks Geert!)
> * new patch 3/5: I think it makes sense to incorporate this patch from
>   the BSP here already because it enhances manual correction. It could
>   be argued if it should be merged with 2/5, yet for easier review I
>   left it seperate for now
> * new patch 5/5: a cleanup I came up with while working on 3/5.
>
> I kept all tap_related variables 'unsigned long' for now. Geert has a
> point that some of them could be changed to 'unsigned int'. I'd like to
> leave this as a seperate issue, though, once we dealt with the other
> HS400 issues. (Yes, more patches coming...)
>
> I did some more testing but with my environment here, I hardly see taps
> changing. What I see is that with HS400 RVSERR is regularly set but
> SMPCMP is all cleared. So, this series maybe saves some unneeded tuning
> for me. But I think the relevant cases are created in a lab, so some
> more testing would be much appreciated. We definately want to wait for
> Shimoda-san's comments before applying this.
>
> This series depends on mmc/next because of this other series:
> [PATCH 0/5] mmc: renesas_sdhi: prepare for recent HS400 updates
>
> A branch is here:
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/sdhi/new_manual_calib
>
> Kind regards,
>
>    Wolfram
>
>
> Takeshi Saito (2):
>   mmc: renesas_sdhi: Add manual correction
>   mmc: renesas_sdhi: only check CMD status for HS400 manual correction
>
> Wolfram Sang (3):
>   mmc: renesas_sdhi: remove double clear of automatic correction
>   mmc: renesas_sdhi: enforce manual correction for Gen3
>   mmc: renesas_sdhi: cleanup SCC defines
>
>  drivers/mmc/host/renesas_sdhi.h      |   1 +
>  drivers/mmc/host/renesas_sdhi_core.c | 104 ++++++++++++++++++++++-----
>  2 files changed, 86 insertions(+), 19 deletions(-)
>
> --
> 2.20.1
>

Applied for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2020-02-13 13:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 11:40 [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction Wolfram Sang
2019-12-17 11:40 ` [RFC PATCH v2 1/5] mmc: renesas_sdhi: remove double clear of automatic correction Wolfram Sang
2019-12-17 11:40 ` [RFC PATCH v2 2/5] mmc: renesas_sdhi: Add manual correction Wolfram Sang
2019-12-17 11:40 ` [RFC PATCH v2 3/5] mmc: renesas_sdhi: only check CMD status for HS400 " Wolfram Sang
2020-01-30 10:04   ` Yoshihiro Shimoda
2019-12-17 11:40 ` [RFC PATCH v2 4/5] mmc: renesas_sdhi: enforce manual correction for Gen3 Wolfram Sang
2019-12-17 11:40 ` [RFC PATCH v2 5/5] mmc: renesas_sdhi: cleanup SCC defines Wolfram Sang
2020-01-30 10:05   ` Yoshihiro Shimoda
2020-02-13 13:55 ` [RFC PATCH v2 0/5] mmc: renesas_sdhi: add manual correction 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).