Skip to content

Commit df57d73

Browse files
ahunter6Ulf Hansson
authored andcommitted
mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
For Intel controllers, SDHCI_RESET_ALL resets also CQHCI registers. Normally, SDHCI_RESET_ALL is not used while CQHCI is enabled, but that can happen on the error path. e.g. if mmc_cqe_recovery() fails, mmc_blk_reset() is called which, for a eMMC that does not support HW Reset, will cycle the bus power and the driver will perform SDHCI_RESET_ALL. So whenever performing SDHCI_RESET_ALL ensure CQHCI is deactivated. That will force the driver to reinitialize CQHCI when it is next used. A similar change was done already for sdhci-msm, and other drivers using CQHCI might benefit from a similar change, if they also have CQHCI reset by SDHCI_RESET_ALL. Fixes: 8ee82bd ("mmc: sdhci-pci: Add CQHCI support for Intel GLK") Cc: stable@vger.kernel.org # 5.4.x: 0ffa6cf: mmc: cqhci: Add cqhci_deactivate() Cc: stable@vger.kernel.org # 5.4+ Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20200819121848.16967-1-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 61d7437 commit df57d73

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmc_host *mmc)
232232
sdhci_dumpregs(mmc_priv(mmc));
233233
}
234234

235+
static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask)
236+
{
237+
if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) &&
238+
host->mmc->cqe_private)
239+
cqhci_deactivate(host->mmc);
240+
sdhci_reset(host, mask);
241+
}
242+
235243
/*****************************************************************************\
236244
* *
237245
* Hardware specific quirk handling *
@@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = {
718726
.set_power = sdhci_intel_set_power,
719727
.enable_dma = sdhci_pci_enable_dma,
720728
.set_bus_width = sdhci_set_bus_width,
721-
.reset = sdhci_reset,
729+
.reset = sdhci_cqhci_reset,
722730
.set_uhs_signaling = sdhci_set_uhs_signaling,
723731
.hw_reset = sdhci_pci_hw_reset,
724732
.irq = sdhci_cqhci_irq,

0 commit comments

Comments
 (0)