mmc: core: Add retuning to cmdq path
In cmdq mode, do tuning if required before issueing request to controller. This is required when we are in HS200 or HS400 without enhanced strobe mode and we had gated the clock. So after ungating the clock, do retuning. Change-Id: I8c506a69053022fda65d78838f09e905519f07cc Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
This commit is contained in:
parent
34f009cf75
commit
1f57af666c
2 changed files with 43 additions and 1 deletions
|
@ -1170,6 +1170,46 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mmc_cmdq_check_retune(struct mmc_host *host)
|
||||||
|
{
|
||||||
|
bool cmdq_mode;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if (!host->need_retune || host->doing_retune || !host->card ||
|
||||||
|
mmc_card_hs400es(host->card) ||
|
||||||
|
(host->ios.clock <= MMC_HIGH_DDR_MAX_DTR))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
cmdq_mode = mmc_card_cmdq(host->card);
|
||||||
|
if (cmdq_mode) {
|
||||||
|
err = mmc_cmdq_halt(host, true);
|
||||||
|
if (err) {
|
||||||
|
pr_err("%s: %s: failed halting queue (%d)\n",
|
||||||
|
mmc_hostname(host), __func__, err);
|
||||||
|
host->cmdq_ops->dumpstate(host);
|
||||||
|
goto halt_failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mmc_retune_hold(host);
|
||||||
|
err = mmc_retune(host);
|
||||||
|
mmc_retune_release(host);
|
||||||
|
|
||||||
|
if (cmdq_mode) {
|
||||||
|
if (mmc_cmdq_halt(host, false)) {
|
||||||
|
pr_err("%s: %s: cmdq unhalt failed\n",
|
||||||
|
mmc_hostname(host), __func__);
|
||||||
|
host->cmdq_ops->dumpstate(host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
halt_failed:
|
||||||
|
pr_debug("%s: %s: Retuning done err: %d\n",
|
||||||
|
mmc_hostname(host), __func__, err);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int mmc_start_cmdq_request(struct mmc_host *host,
|
static int mmc_start_cmdq_request(struct mmc_host *host,
|
||||||
struct mmc_request *mrq)
|
struct mmc_request *mrq)
|
||||||
{
|
{
|
||||||
|
@ -1196,6 +1236,7 @@ static int mmc_start_cmdq_request(struct mmc_host *host,
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc_host_clk_hold(host);
|
mmc_host_clk_hold(host);
|
||||||
|
mmc_cmdq_check_retune(host);
|
||||||
if (likely(host->cmdq_ops->request)) {
|
if (likely(host->cmdq_ops->request)) {
|
||||||
ret = host->cmdq_ops->request(host, mrq);
|
ret = host->cmdq_ops->request(host, mrq);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -388,7 +388,8 @@ int mmc_retune(struct mmc_host *host)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!host->need_retune || host->doing_retune || !host->card)
|
if (!host->need_retune || host->doing_retune || !host->card ||
|
||||||
|
mmc_card_hs400es(host->card))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
host->need_retune = 0;
|
host->need_retune = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue