From: Hai Pham <[email protected]> When tuning command (CMD21) fails with command error, call mmc_send_stop_transmission() to send stop command (CMD12).
Reviewed-by: Takeshi Kihara <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Signed-off-by: Hai Pham <[email protected]> Signed-off-by: Marek Vasut <[email protected]> [Marek: Add dev_dbg() message in case tuning abort fails Move tuning opcode check from mmc_abort_tuning()] --- Cc: "Ying-Chun Liu (PaulLiu)" <[email protected]> Cc: Hai Pham <[email protected]> Cc: Jaehoon Chung <[email protected]> Cc: Loic Poulain <[email protected]> Cc: Peng Fan <[email protected]> Cc: Simon Glass <[email protected]> Cc: Takeshi Kihara <[email protected]> --- drivers/mmc/renesas-sdhi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index 280d96dbc2d..74d98795838 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -611,6 +611,17 @@ int renesas_sdhi_execute_tuning(struct udevice *dev, uint opcode) priv->smpcmp |= BIT(i); mdelay(1); + + /* + * eMMC specification specifies that CMD12 can be used to stop a tuning + * command, but SD specification does not, so do nothing unless it is + * eMMC. + */ + if (ret && (opcode == MMC_CMD_SEND_TUNING_BLOCK_HS200)) { + ret = mmc_send_stop_transmission(mmc); + if (ret < 0) + dev_dbg(dev, "Tuning abort fail (%d)\n", ret); + } } ret = renesas_sdhi_select_tuning(priv, taps); -- 2.39.2

