From: Maxim Levitsky <maximlevitsky@gmail.com>
To: " linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: Philip Langdale <philipl@overt.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 2/2] mmc: fix mmc card disappearence on resume on ricoh mmc controllers
Date: Mon, 7 Jun 2010 00:28:51 +0300 [thread overview]
Message-ID: <1275859731-2898-2-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1275859475.3151.4.camel@maxim-laptop>
The reason was that it takes time for controller to detect the card.
So wait a bit for the card to appear.
In worst case scenario, when you suspend the system with mmc card,
and actually remove it, the resume will be delayed maximum by 2 seconds
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/mmc/host/sdhci-pci.c | 3 ++-
drivers/mmc/host/sdhci.c | 18 ++++++++++++++++++
drivers/mmc/host/sdhci.h | 2 ++
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index c4bcaeb..49d863c 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -115,7 +115,8 @@ static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
.quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
SDHCI_QUIRK_CLOCK_BEFORE_RESET |
SDHCI_QUIRK_NO_CARD_NO_RESET |
- SDHCI_QUIRK_MISSING_CAPS
+ SDHCI_QUIRK_MISSING_CAPS |
+ SDHCI_QUIRK_WAIT_CARD_ON_RESUME
};
static const struct sdhci_pci_fixes sdhci_ene_712 = {
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 483b78e..6cda505 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1612,6 +1612,24 @@ int sdhci_resume_host(struct sdhci_host *host)
{
int ret;
+ /* Some controllers (especialy the ricoh mmc controller) delay
+ card detection on resume (probably since the controller
+ has to poke the card to determine if its MMC or not */
+
+ if (host->mmc->bus_ops && (host->quirks &
+ SDHCI_QUIRK_WAIT_CARD_ON_RESUME)) {
+
+ unsigned long timeout = jiffies + msecs_to_jiffies(2000);
+
+ while (!time_after(jiffies, timeout))
+ if (sdhci_readl(host, SDHCI_PRESENT_STATE)
+ & SDHCI_CARD_PRESENT) {
+ break;
+ }
+ cpu_relax();
+ }
+
+
if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
if (host->ops->enable_dma)
host->ops->enable_dma(host);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index b1839a3..c9d099c 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -242,6 +242,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
/* Controller is missing device caps. Use caps provided by host */
#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
+/* Card doesn't appear immediatly on resume from low power state */
+#define SDHCI_QUIRK_WAIT_CARD_ON_RESUME (1<<28)
int irq; /* Device IRQ */
void __iomem * ioaddr; /* Mapped address */
--
1.7.0.4
next prev parent reply other threads:[~2010-06-06 21:29 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 18:56 strange problem with ricoh-mmc Maxim Levitsky
2010-06-02 19:54 ` Philip Langdale
2010-06-02 20:19 ` Maxim Levitsky
2010-06-02 20:42 ` Philip Langdale
2010-06-02 22:03 ` Maxim Levitsky
2010-06-03 1:16 ` [PATCH] mmc: make sdhci work with ricoh mmc controller Maxim Levitsky
2010-06-03 16:11 ` Philip Langdale
2010-06-03 16:31 ` Maxim Levitsky
2010-06-03 16:39 ` Philip Langdale
2010-06-03 17:05 ` Philip Langdale
2010-06-03 17:35 ` Maxim Levitsky
2010-06-04 4:42 ` Philip Langdale
2010-06-04 10:07 ` Maxim Levitsky
2010-06-04 15:05 ` Philip Langdale
2010-06-04 15:33 ` Maxim Levitsky
2010-06-06 21:24 ` Maxim Levitsky
2010-06-06 21:28 ` [PATCH 1/2] " Maxim Levitsky
2010-06-06 21:28 ` Maxim Levitsky
2010-06-06 23:11 ` Philip Langdale
2010-06-06 23:11 ` Philip Langdale
2010-06-07 0:37 ` Maxim Levitsky
2010-06-07 1:41 ` Philip Langdale
2010-06-11 19:08 ` [PATCH v3] " Maxim Levitsky
2010-06-11 19:15 ` [PATCH v4] " maximlevitsky
2010-06-13 11:29 ` Maxim Levitsky
2010-06-13 16:06 ` Philip Langdale
2010-06-06 21:28 ` Maxim Levitsky [this message]
2010-06-06 23:22 ` [PATCH 2/2] mmc: fix mmc card disappearence on resume on ricoh mmc controllers Philip Langdale
2010-06-06 23:22 ` Philip Langdale
2010-06-08 8:57 ` Maxim Levitsky
2010-06-06 23:23 ` Chris Ball
2010-06-07 0:33 ` Maxim Levitsky
2010-06-07 5:47 ` Chris Ball
2010-06-07 5:47 ` Chris Ball
2010-06-08 8:52 ` Maxim Levitsky
2010-06-03 1:22 ` strange problem with ricoh-mmc Maxim Levitsky
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=1275859731-2898-2-git-send-email-maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=philipl@overt.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 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.