Skip to content

Commit c0a2074

Browse files
wenbinmei1storulf
authored andcommitted
mmc: mediatek: Fix system suspend/resume support for CQHCI
Before we got these errors on MT8192 platform: [ 59.153891] Restarting tasks ... [ 59.154540] done. [ 59.159175] PM: suspend exit [ 59.218724] mtk-msdc 11f60000.mmc: phase: [map:fffffffe] [maxlen:31] [final:16] [ 119.776083] mmc0: cqhci: timeout for tag 9 [ 119.780196] mmc0: cqhci: ============ CQHCI REGISTER DUMP =========== [ 119.786709] mmc0: cqhci: Caps: 0x100020b6 | Version: 0x00000510 [ 119.793225] mmc0: cqhci: Config: 0x00000101 | Control: 0x00000000 [ 119.799706] mmc0: cqhci: Int stat: 0x00000000 | Int enab: 0x00000000 [ 119.806177] mmc0: cqhci: Int sig: 0x00000000 | Int Coal: 0x00000000 [ 119.812670] mmc0: cqhci: TDL base: 0x00000000 | TDL up32: 0x00000000 [ 119.819149] mmc0: cqhci: Doorbell: 0x003ffc00 | TCN: 0x00000200 [ 119.825656] mmc0: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000 [ 119.832155] mmc0: cqhci: Task clr: 0x00000000 | SSC1: 0x00001000 [ 119.838627] mmc0: cqhci: SSC2: 0x00000000 | DCMD rsp: 0x00000000 [ 119.845174] mmc0: cqhci: RED mask: 0xfdf9a080 | TERRI: 0x0000891c [ 119.851654] mmc0: cqhci: Resp idx: 0x00000000 | Resp arg: 0x00000000 [ 119.865773] mmc0: cqhci: : =========================================== [ 119.872358] mmc0: running CQE recovery From these logs, we found TDL base was back to the default value. After suspend, the mmc host is powered off by HW, and bring CQE register to the default value, so we add system suspend/resume interface, then bring CQE to deactivated state before suspend, it will be enabled by CQE first request after resume. Signed-off-by: Wenbin Mei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Fixes: 88bd652 ("mmc: mediatek: command queue support") Cc: [email protected] [Ulf: Renamed functions] Signed-off-by: Ulf Hansson <[email protected]>
1 parent d06d60d commit c0a2074

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

drivers/mmc/host/mtk-sd.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,11 +2681,29 @@ static int msdc_runtime_resume(struct device *dev)
26812681
msdc_restore_reg(host);
26822682
return 0;
26832683
}
2684+
2685+
static int msdc_suspend(struct device *dev)
2686+
{
2687+
struct mmc_host *mmc = dev_get_drvdata(dev);
2688+
int ret;
2689+
2690+
if (mmc->caps2 & MMC_CAP2_CQE) {
2691+
ret = cqhci_suspend(mmc);
2692+
if (ret)
2693+
return ret;
2694+
}
2695+
2696+
return pm_runtime_force_suspend(dev);
2697+
}
2698+
2699+
static int msdc_resume(struct device *dev)
2700+
{
2701+
return pm_runtime_force_resume(dev);
2702+
}
26842703
#endif
26852704

26862705
static const struct dev_pm_ops msdc_dev_pm_ops = {
2687-
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
2688-
pm_runtime_force_resume)
2706+
SET_SYSTEM_SLEEP_PM_OPS(msdc_suspend, msdc_resume)
26892707
SET_RUNTIME_PM_OPS(msdc_runtime_suspend, msdc_runtime_resume, NULL)
26902708
};
26912709

0 commit comments

Comments
 (0)