diff mbox

[3/4] mmc: renesas_sdhi: Fix sampling clock position selecting

Message ID 20180606204724.26055-4-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Niklas Söderlund June 6, 2018, 8:47 p.m. UTC
From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

When the result of tuning was different between the first set and the
second set, there was a case where the wrong sampling clock position was
selected. As a countermeasure, make the two results the same.

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>
---
 drivers/mmc/host/renesas_sdhi_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Wolfram Sang June 7, 2018, 8:58 a.m. UTC | #1
On Wed, Jun 06, 2018 at 10:47:23PM +0200, Niklas Söderlund wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> 
> When the result of tuning was different between the first set and the
> second set, there was a case where the wrong sampling clock position was
> selected. As a countermeasure, make the two results the same.
> 
> 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>

As mentioned on IRC, I think this needs an updated patch description
IMHO.
diff mbox

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 45c015da2e757c90..85152e73e6386f1c 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -301,6 +301,15 @@  static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 	/* Clear SCC_RVSREQ */
 	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0);
 
+	/* Merge the results */
+	for (i = 0; i < host->tap_num * 2; i++) {
+		if (!test_bit(i, host->taps)) {
+			clear_bit(i % host->tap_num, host->taps);
+			clear_bit((i % host->tap_num) + host->tap_num,
+				  host->taps);
+		}
+	}
+
 	/*
 	 * Find the longest consecutive run of successful probes.  If that
 	 * is more than SH_MOBILE_SDHI_MAX_TAP probes long then use the