mmc: block: fix cmdq shutdown flow
This change fixes cmdq shutdown flow:
- claims host (since devfreq scaling context could race)
- holds clocks
- disables cmdq controller mode
- updates cmdq card state mode
Change-Id: Ie25664516f782812fe39fba574be50e44ece815c
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 2cfd5c5..3e8352b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -3250,13 +3250,14 @@
struct mmc_card *card = mq->card;
struct mmc_host *host = card->host;
+ mmc_get_card(card);
+ mmc_host_clk_hold(host);
err = mmc_cmdq_halt(host, true);
if (err) {
pr_err("%s: halt: failed: %d\n", __func__, err);
return;
}
- mmc_get_card(card);
/* disable CQ mode in card */
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_CMDQ, 0,
@@ -3266,9 +3267,12 @@
__func__, err);
goto out;
} else {
+ mmc_card_clr_cmdq(card);
+ host->cmdq_ops->disable(host, false);
host->card->cmdq_init = false;
}
out:
+ mmc_host_clk_release(host);
mmc_put_card(card);
}