linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	linux-pm <linux-pm@vger.kernel.org>,
	linux-acpi <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan
Date: Fri, 21 Apr 2017 13:08:06 +0300	[thread overview]
Message-ID: <1492769288-7474-3-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com>

The SDIO card state might be being preserved during hibernation, for
example a SDIO wifi card supporting WOWLAN. That state will be lost if an
SDIO reset is done. One way to avoid that would be to build mmc core as a
module and simply not load it until after attempting to restore the
hibernation image. However that won't work if the hibernation image is
stored on eMMC which, of course, requires mmc core.

It is assumed on such systems that the platform will power cycle the SDIO
card or not as necessary so that the SDIO reset is not needed. Add a
capability flag to reflect that and use it to skip the SDIO reset at scan
time.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/core.c  | 6 +++++-
 include/linux/mmc/host.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 6987976252ad..178e23bf0c30 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2639,8 +2639,12 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
 	 * if the card is being re-initialized, just send it.  CMD52
 	 * should be ignored by SD/eMMC cards.
 	 * Skip it if we already know that we do not support SDIO commands
+	 * Also skip it if we know this host controller has a SDIO card that
+	 * needs to be able to restore from hibernation without losing the card
+	 * state e.g. an SDIO wifi card supporting WOWLAN.
 	 */
-	if (!(host->caps2 & MMC_CAP2_NO_SDIO))
+	if (!(host->caps2 & MMC_CAP2_NO_SDIO) &&
+	    !(host->caps2 & MMC_CAP2_NO_SDIO_RESET))
 		sdio_reset(host);
 
 	mmc_go_idle(host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 78c544e296cd..187a7ba41364 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -281,6 +281,7 @@ struct mmc_host {
 	u32			caps2;		/* More host capabilities */
 
 #define MMC_CAP2_BOOTPART_NOACC	(1 << 0)	/* Boot partition no access */
+#define MMC_CAP2_NO_SDIO_RESET	(1 << 1)	/* Do not SDIO reset at scan */
 #define MMC_CAP2_FULL_PWR_CYCLE	(1 << 2)	/* Can do full power cycle */
 #define MMC_CAP2_HS200_1_8V_SDR	(1 << 5)        /* can support */
 #define MMC_CAP2_HS200_1_2V_SDR	(1 << 6)        /* can support */
-- 
1.9.1


  parent reply	other threads:[~2017-04-21 10:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 10:08 [PATCH RFC 0/4] mmc: sdio: To support hibernation add capability to skip SDIO reset at scan Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 1/4] mmc: sdio: Keep card runtime resumed while adding function devices Adrian Hunter
2017-04-24 21:03   ` Ulf Hansson
2017-04-25  6:41     ` Adrian Hunter
2017-04-21 10:08 ` Adrian Hunter [this message]
2017-04-24 20:33   ` [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan Ulf Hansson
2017-04-25  6:21     ` Adrian Hunter
2017-04-25  7:52       ` Ulf Hansson
2017-04-25  7:57         ` Adrian Hunter
2017-04-25 10:46           ` Ulf Hansson
2017-04-25 11:20             ` Adrian Hunter
2017-04-25 12:24               ` Ulf Hansson
2017-04-25 12:45                 ` Adrian Hunter
2017-04-25 18:51                   ` Grygorii Strashko
2017-04-25 19:11                     ` Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 3/4] mmc: sdhci-acpi: Set MMC_CAP2_NO_SDIO_RESET if child has wake from S4 (hibernate) Adrian Hunter
2017-04-24 21:52   ` Rafael J. Wysocki
2017-04-25  7:28     ` Adrian Hunter
2017-04-25 11:05       ` Rafael J. Wysocki
2017-04-21 10:08 ` [PATCH RFC 4/4] mmc: sdhci-pci: " Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492769288-7474-3-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).