All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak Saxena <dsaxena@plexity.net>
To: pierre@ossman.eu
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] MMC: Add 400ms to CAFE SD controller resume path
Date: Wed, 13 May 2009 20:05:56 +0000	[thread overview]
Message-ID: <20090513200556.GA7882@plexity.net> (raw)


The CAFE SD controller takes a long time to completely resume
and w/o this patch, we do not redetect an existing card but
instead detect it as a new one. Even with MMC_UNSAFE_RESUME
enabled, this leads to the partition table on the device being
wiped out.
    
See http://dev.laptop.org/ticket/6532 for gory details.

Signed-off-by: Deepak Saxena <dsaxena@laptop.org>

---

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 65be279..9941bb0 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -105,10 +105,26 @@ static const struct sdhci_pci_fixes sdhci_ene_714 = {
 			  SDHCI_QUIRK_BROKEN_DMA,
 };
 
+
+/*
+ * This 400ms timeout is needed to ensure that the chip has proper time to
+ * wake up an redetect an already inserted card. Without this, we end up
+ * corrupting the partition table on the device.
+ *
+ * See http://dev.laptop.org/ticket/6532 for lots of ugly details.
+ */
+static int cafe_resume(struct sdhci_pci_chip *chip)
+{
+	msleep(400);
+
+	return 0;
+}
+
 static const struct sdhci_pci_fixes sdhci_cafe = {
 	.quirks		= SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
 			  SDHCI_QUIRK_NO_BUSY_IRQ |
 			  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
+	.resume		= cafe_resume,
 };
 
 static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)


-- 
In the end, they will not say, "those were dark times,"  they will ask
"why were their poets silent?" - Bertold Brecht


             reply	other threads:[~2009-05-13 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 20:05 Deepak Saxena [this message]
2009-05-22 11:51 ` [PATCH] MMC: Add 400ms to CAFE SD controller resume path Pierre Ossman
2009-05-28  8:36   ` Andrew Morton
2009-05-28  8:48     ` Pierre Ossman
2009-06-04 23:33       ` Deepak Saxena
2009-06-13 10:34         ` Pierre Ossman

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=20090513200556.GA7882@plexity.net \
    --to=dsaxena@plexity.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre@ossman.eu \
    /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.