All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "mmc: sdhci-pci: Fix card detect race for Intel BXT/APL" has been added to the 4.4-stable tree
@ 2016-03-01 19:10 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-03-01 19:10 UTC (permalink / raw)
  To: adrian.hunter, gregkh, ulf.hansson; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    mmc: sdhci-pci: Fix card detect race for Intel BXT/APL

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mmc-sdhci-pci-fix-card-detect-race-for-intel-bxt-apl.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 163cbe31e5163459908a41a2b4e0d33a28fd557a Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@intel.com>
Date: Tue, 9 Feb 2016 16:12:37 +0200
Subject: mmc: sdhci-pci: Fix card detect race for Intel BXT/APL

From: Adrian Hunter <adrian.hunter@intel.com>

commit 163cbe31e5163459908a41a2b4e0d33a28fd557a upstream.

Intel BXT/APL use a card detect GPIO however the host controller
will not enable bus power unless it's card detect also reflects
the presence of a card.  Unfortunately those 2 things race which
can result in commands not starting, after which the controller
does nothing and there is a 10 second wait for the driver's
10-second timer to timeout.

That is fixed by having the driver look also at the present state
register to determine if the card is present.  Consequently, provide
a 'get_cd' mmc host operation for BXT/APL that does that.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci-pci-core.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -330,6 +330,33 @@ static void spt_read_drive_strength(stru
 	sdhci_pci_spt_drive_strength = 0x10 | ((val >> 12) & 0xf);
 }
 
+static int bxt_get_cd(struct mmc_host *mmc)
+{
+	int gpio_cd = mmc_gpio_get_cd(mmc);
+	struct sdhci_host *host = mmc_priv(mmc);
+	unsigned long flags;
+	int ret = 0;
+
+	if (!gpio_cd)
+		return 0;
+
+	pm_runtime_get_sync(mmc->parent);
+
+	spin_lock_irqsave(&host->lock, flags);
+
+	if (host->flags & SDHCI_DEVICE_DEAD)
+		goto out;
+
+	ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
+out:
+	spin_unlock_irqrestore(&host->lock, flags);
+
+	pm_runtime_mark_last_busy(mmc->parent);
+	pm_runtime_put_autosuspend(mmc->parent);
+
+	return ret;
+}
+
 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
 {
 	slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
@@ -362,6 +389,10 @@ static int byt_sd_probe_slot(struct sdhc
 	slot->cd_con_id = NULL;
 	slot->cd_idx = 0;
 	slot->cd_override_level = true;
+	if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD ||
+	    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD)
+		slot->host->mmc_host_ops.get_cd = bxt_get_cd;
+
 	return 0;
 }
 


Patches currently in stable-queue which might be from adrian.hunter@intel.com are

queue-4.4/mmc-sdhci-acpi-fix-card-detect-race-for-intel-bxt-apl.patch
queue-4.4/mmc-mmc-fix-incorrect-use-of-driver-strength-switching-hs200-and-hs400.patch
queue-4.4/mmc-sdhci-allow-override-of-get_cd-called-from-sdhci_request.patch
queue-4.4/mmc-sdhci-pci-do-not-default-to-33-ohm-driver-strength-for-intel-spt.patch
queue-4.4/mmc-sdio-fix-invalid-vdd-in-voltage-switch-power-cycle.patch
queue-4.4/mmc-sdhci-fix-sdhci_runtime_pm_bus_on-off.patch
queue-4.4/mmc-sdhci-allow-override-of-mmc-host-operations.patch
queue-4.4/mmc-sdhci-fix-dma-descriptor-with-zero-data-length.patch
queue-4.4/mmc-sdhci-pci-fix-card-detect-race-for-intel-bxt-apl.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-01 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 19:10 Patch "mmc: sdhci-pci: Fix card detect race for Intel BXT/APL" has been added to the 4.4-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.