From 49d6f5d5cca3a66fa65568a50f75cbbac87ba312 Mon Sep 17 00:00:00 2001 From: Haibo Chen <haibo.chen@nxp.com> Date: Fri, 22 Feb 2019 17:56:18 +0800 Subject: [PATCH] MLK-20957-2 mmc: cqhci: clear the HALT bit in the first request when resume back After system suspend, CQE is in cqhci_off state, which set the HALT bit, make CQE in HALT state. If the SoC do not power down the USDHC module, then when system resume back, this bit keep the same, still set. So need to clear this bit when enable CQE for the first request after system resume back. If not, imx8mm will stuck in the first CMDQ request after system resume back. On imx8qxp and imx8qm, we do not find this issue because usdhc module lost power during system suspend/resume, and all the register return to the default reset value, and the reset value of bit HALT is 0. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> --- drivers/mmc/host/cqhci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index 159270e947cf62..43010e37b332eb 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -271,6 +271,13 @@ static void __cqhci_enable(struct cqhci_host *cq_host) cqhci_writel(cq_host, cqcfg, CQHCI_CFG); + /* clear halt and clear all tasks */ + cqhci_writel(cq_host, 0, CQHCI_CTL); + if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) { + pr_err("%s: cqhci: CQE failed to exit halt state\n", + mmc_hostname(mmc)); + } + mmc->cqe_on = true; if (cq_host->ops->enable) -- GitLab