[linux-yocto] [PATCH 18/22] valleyisland-io: fix SD card stuck in runtime suspend

boon.leong.ong at intel.com boon.leong.ong at intel.com
Wed Jan 29 10:41:43 PST 2014


From: Ong Boon Leong <boon.leong.ong at intel.com>

A host controller for a SD card may need a GPIO
for card detect in order to wake up from runtime
suspend when a card is inserted.  If that GPIO is
not configured, then the host controller will not
wake up.  Fix that for the affected devices by not
enabling runtime PM unless the GPIO is successfully
set up.

Signed-off-by: Ong Boon Leong <boon.leong.ong at intel.com>
---
 ...-sdhci-pci-Fix-BYT-sd-card-getting-stuck-.patch |   81 ++++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 meta/cfg/kernel-cache/features/valleyisland-io/0016-PENDING-mmc-sdhci-pci-Fix-BYT-sd-card-getting-stuck-.patch

diff --git a/meta/cfg/kernel-cache/features/valleyisland-io/0016-PENDING-mmc-sdhci-pci-Fix-BYT-sd-card-getting-stuck-.patch b/meta/cfg/kernel-cache/features/valleyisland-io/0016-PENDING-mmc-sdhci-pci-Fix-BYT-sd-card-getting-stuck-.patch
new file mode 100644
index 0000000..a48beb7
--- /dev/null
+++ b/meta/cfg/kernel-cache/features/valleyisland-io/0016-PENDING-mmc-sdhci-pci-Fix-BYT-sd-card-getting-stuck-.patch
@@ -0,0 +1,81 @@
+From 57aaf73b2785f9bbe4642c6f06c0ecc27bf5520a Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter at intel.com>
+Date: Fri, 13 Dec 2013 13:57:34 -0800
+Subject: [PATCH 16/17] mmc: sdhci-pci: Fix BYT sd card getting stuck
+ in runtime suspend
+
+A host controller for a SD card may need a GPIO for card detect in order
+to wake up from runtime suspend when a card is inserted.  If that GPIO is
+not configured, then the host controller will not wake up.  Fix that for
+the affected devices by not enabling runtime PM unless the GPIO is
+successfully set up.
+
+This affects BYT sd card host controller which had runtime PM enabled from
+v3.11.  For completeness, the MFD sd card host controller is flagged also.
+
+The original patch before rebasing (see link below) was tested on v3.11.10
+and v3.12.4 although the patch applied with some offsets and fuzz.  The
+original patch is here:
+
+    http://marc.info/?l=linux-mmc&m=138676702327057
+
+Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>
+
+    Patch for BYT is derived based on the following upstream commit
+    77a0122e0838663795651aa0beb2325156f98c09.
+    - the upstream commit is not cherry-picked into machine branch
+      because it touched an extra file drivers/mmc/host/sdhci-pci.h
+      which is not available in v3.8 branch. 
+
+Signed-off-by: Chew, Chiau Ee <chiau.ee.chew at intel.com>
+Signed-off-by: Ong Boon Leong <boon.leong.ong at intel.com>
+---
+ drivers/mmc/host/sdhci-pci.c |   11 +++++++++++
+ 1 files changed, 11 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
+index d7d6bc8..33593e7 100644
+--- a/drivers/mmc/host/sdhci-pci.c
++++ b/drivers/mmc/host/sdhci-pci.c
+@@ -59,6 +59,7 @@ struct sdhci_pci_fixes {
+ 	unsigned int		quirks;
+ 	unsigned int		quirks2;
+ 	bool			allow_runtime_pm;
++	bool			own_cd_for_runtime_pm;
+
+ 	int			(*probe) (struct sdhci_pci_chip *);
+
+@@ -290,6 +291,7 @@ static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
+ static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
+ 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+ 	.allow_runtime_pm = true,
++	.own_cd_for_runtime_pm = true,
+ };
+
+ static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
+@@ -354,6 +356,7 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
+ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
+ 	.quirks2	= SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON,
+ 	.allow_runtime_pm = true,
++	.own_cd_for_runtime_pm = true,
+ };
+
+ /* O2Micro extra registers */
+@@ -1381,6 +1384,14 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
+
+ 	sdhci_pci_add_own_cd(slot);
+
++	/*
++	 * Check if the chip needs a separate GPIO for card detect to wake up
++	 * from runtime suspend.  If it is not there, don't allow runtime PM.
++	 * Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
++	 */
++	if (chip->fixes->own_cd_for_runtime_pm && !gpio_is_valid(slot->cd_gpio))
++		chip->allow_runtime_pm = false;
++
+ 	return slot;
+
+ remove:
+--
+1.7.4.4
+
-- 
1.7.10.4



More information about the linux-yocto mailing list