diff mbox series

[4.4.y-cip,63/83] mmc: tmio: always get number of taps

Message ID 1573115572-13513-64-git-send-email-biju.das@bp.renesas.com (mailing list archive)
State Changes Requested
Headers show
Series Add RZ/G1C SD/eMMC support | expand

Commit Message

Biju Das Nov. 7, 2019, 8:32 a.m. UTC
From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

commit 43b0b361b0170030603cf76f70b099f3323edcf3 upstream.

Current code gets number of taps only once and keeps the value. This is
not correct, we need to obtain it every time before executing tuning,
so remove the outer if-block.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[wsa: extracted from a larger patch and reworded commit message]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
---
 drivers/mmc/host/tmio_mmc_pio.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Pavel Machek Nov. 8, 2019, 9:44 a.m. UTC | #1
Hi!

> commit 43b0b361b0170030603cf76f70b099f3323edcf3 upstream.
> 
> Current code gets number of taps only once and keeps the value. This is
> not correct, we need to obtain it every time before executing tuning,
> so remove the outer if-block.

I'd somehow assume number of tuning parameters would be fixed... Does
the hardware really change it? Out of curiosity, why is it doing so?

Best regards,
								Pavel
Biju Das Nov. 8, 2019, 1:28 p.m. UTC | #2
Hi Pavel,

> Subject: Re: [PATCH 4.4.y-cip 63/83] mmc: tmio: always get number of taps
> 
> Hi!
> 
> > commit 43b0b361b0170030603cf76f70b099f3323edcf3 upstream.
> >
> > Current code gets number of taps only once and keeps the value. This
> > is not correct, we need to obtain it every time before executing
> > tuning, so remove the outer if-block.
> 
> I'd somehow assume number of tuning parameters would be fixed... Does
> the hardware really change it? Out of curiosity, why is it doing so?

I guess it is for hs200 and hs400 tuning.

Regds,
Biju
diff mbox series

Patch

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 35dbeb5..4764f96 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -819,16 +819,14 @@  static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	struct tmio_mmc_host *host = mmc_priv(mmc);
 	int i, ret = 0;
 
-	if (!host->tap_num) {
-		if (!host->init_tuning || !host->select_tuning)
-			/* Tuning is not supported */
-			goto out;
+	if (!host->init_tuning || !host->select_tuning)
+		/* Tuning is not supported */
+		goto out;
 
-		host->tap_num = host->init_tuning(host);
-		if (!host->tap_num)
-			/* Tuning is not supported */
-			goto out;
-	}
+	host->tap_num = host->init_tuning(host);
+	if (!host->tap_num)
+		/* Tuning is not supported */
+		goto out;
 
 	if (host->tap_num * 2 >= sizeof(host->taps) * BITS_PER_BYTE) {
 		dev_warn_once(&host->pdev->dev,