[PATCH 09/13] mmc: core: Hold re-tuning while bkops ongoing

Adrian Hunter
2014-12-05T17:43:25Z

Hold re-tuning during bkops to prevent
it from conflicting with the busy state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/core.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3da5fa8..8fc90d3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -304,6 +304,10 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
} else {
timeout = 0;
use_busy_signal = false;
+ /* Hold re-tuning for ongoing bkops */
+ err = mmc_retune_and_hold(card->host);
+ if (err)
+ goto out;
}

err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -312,6 +316,9 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
if (err) {
pr_warn("%s: Error %d starting bkops\n",
mmc_hostname(card->host), err);
+ /* bkops not ongoing, so release re-tuning */
+ if (!use_busy_signal)
+ mmc_retune_release(card->host);
goto out;
}

@@ -749,6 +756,7 @@ int mmc_stop_bkops(struct mmc_card *card)
*/
if (!err || (err == -EINVAL)) {
mmc_card_clr_doing_bkops(card);
+ mmc_retune_release(card->host);
err = 0;
}

--
1.9.1