mmc: cmdq_hci: Add retry mechanism for cmdq_halt
Currently all functions which calls cmdq_halt relies upon HALT to pass other wise considers it as a FATAL error (like clk scaling). So add retry mechanism in halt - retry if halt completion timesout & HALT also did not complete(by doing register read). Change-Id: I59e199681e46085f804636f4c07249e6f21de1d5 Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This commit is contained in:
parent
9a4df9847e
commit
24bd8b95d9
1 changed files with 17 additions and 7 deletions
|
@ -778,17 +778,27 @@ static int cmdq_halt(struct mmc_host *mmc, bool halt)
|
||||||
{
|
{
|
||||||
struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);
|
struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
int retries = 3;
|
||||||
|
|
||||||
cmdq_runtime_pm_get(cq_host);
|
cmdq_runtime_pm_get(cq_host);
|
||||||
if (halt) {
|
if (halt) {
|
||||||
cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) | HALT,
|
while (retries) {
|
||||||
CQCTL);
|
cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) | HALT,
|
||||||
ret = wait_for_completion_timeout(&cq_host->halt_comp,
|
CQCTL);
|
||||||
|
ret = wait_for_completion_timeout(&cq_host->halt_comp,
|
||||||
msecs_to_jiffies(HALT_TIMEOUT_MS));
|
msecs_to_jiffies(HALT_TIMEOUT_MS));
|
||||||
/* halt done: re-enable legacy interrupts */
|
if (!ret && !(cmdq_readl(cq_host, CQCTL) & HALT)) {
|
||||||
if (cq_host->ops->clear_set_irqs)
|
retries--;
|
||||||
cq_host->ops->clear_set_irqs(mmc, false);
|
continue;
|
||||||
ret = ret ? 0 : -ETIMEDOUT;
|
} else {
|
||||||
|
/* halt done: re-enable legacy interrupts */
|
||||||
|
if (cq_host->ops->clear_set_irqs)
|
||||||
|
cq_host->ops->clear_set_irqs(mmc,
|
||||||
|
false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retries ? 0 : -ETIMEDOUT;
|
||||||
} else {
|
} else {
|
||||||
if (cq_host->ops->set_data_timeout)
|
if (cq_host->ops->set_data_timeout)
|
||||||
cq_host->ops->set_data_timeout(mmc, 0xf);
|
cq_host->ops->set_data_timeout(mmc, 0xf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue