Skip to content

Commit 2c9017d

Browse files
Wolfram Sangstorulf
authored andcommitted
mmc: renesas_sdhi: abort tuning when timeout detected
We have to bring the eMMC from sending-data state back to transfer state once we detected a CRC error (timeout) during tuning. So, send a stop command via mmc_abort_tuning(). Fixes: 4f11997 ("mmc: tmio: Add tuning support") Reported-by Yoshihiro Shimoda <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Tested-by: Yoshihiro Shimoda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent c468154 commit 2c9017d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/mmc/host/renesas_sdhi_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,19 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode)
692692

693693
/* Issue CMD19 twice for each tap */
694694
for (i = 0; i < 2 * priv->tap_num; i++) {
695+
int cmd_error;
696+
695697
/* Set sampling clock position */
696698
sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num);
697699

698-
if (mmc_send_tuning(mmc, opcode, NULL) == 0)
700+
if (mmc_send_tuning(mmc, opcode, &cmd_error) == 0)
699701
set_bit(i, priv->taps);
700702

701703
if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP) == 0)
702704
set_bit(i, priv->smpcmp);
705+
706+
if (cmd_error)
707+
mmc_abort_tuning(mmc, opcode);
703708
}
704709

705710
ret = renesas_sdhi_select_tuning(host);

0 commit comments

Comments
 (0)