From: Viswanath Puttagunta <vishp@ti.com>
To: Linux-mmc <linux-mmc@vger.kernel.org>
Cc: T Krishnamoorthy Balaji <balajitk@ti.com>,
Venkatraman S <svenkatr@ti.com>,
Semen Protsenko <semen.protsenko@ti.com>,
Volodymyr Riazantsev <v.riazantsev@ti.com>,
Viswanath Puttagunta <vishp@ti.com>
Subject: [PATCH 2/3] mmc: omap_hsmmc: Errata: Fix SD card removal detection
Date: Thu, 24 May 2012 15:14:26 -0500 [thread overview]
Message-ID: <1337890467-32573-3-git-send-email-vishp@ti.com> (raw)
In-Reply-To: <1337890467-32573-1-git-send-email-vishp@ti.com>
Because of OMAP4 Silicon errata (i705), we have to turn off the
PBIAS and VMMC for SD card as soon as we get card disconnect
interrupt. Because of this, we don't wait for all higher layer
structures to be dismantled before turning off power. As a side
effect of this, we might end up getting a mmc_request
even after SD is removed and VMMC and PBIAS are turned off.
In that case, just fail the mmc_request and return immediately
Signed-off-by: Viswanath Puttagunta <vishp@ti.com>
Signed-off-by: Semen Protsenko <semen.protsenko@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 61d830f..49a1a03 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1180,12 +1180,20 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)
if (carddetect) {
mmc_detect_change(host->mmc, (HZ * 200) / 1000);
} else {
+ /*
+ * Because of OMAP4 Silicon errata (i705), we have to turn off the
+ * PBIAS and VMMC for SD card as soon as we get card disconnect
+ * interrupt. Because of this, we don't wait for all higher layer
+ * structures to be dismantled before turning off power
+ */
+ mmc_claim_host(host->mmc);
if ((MMC_POWER_OFF != host->power_mode) &&
(mmc_slot(host).set_power != NULL)) {
mmc_slot(host).set_power(host->dev, host->slot_id,
0, 0);
host->power_mode = MMC_POWER_OFF;
}
+ mmc_release_host(host->mmc);
mmc_detect_change(host->mmc, 0);
}
return IRQ_HANDLED;
@@ -1500,6 +1508,26 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
} else if (host->reqs_blocked)
host->reqs_blocked = 0;
WARN_ON(host->mrq != NULL);
+
+ /*
+ * Because of OMAP4 Silicon errata (i705), we have to turn off the
+ * PBIAS and VMMC for SD card as soon as we get card disconnect
+ * interrupt. Because of this, we don't wait for all higher layer
+ * structures to be dismantled before turning off power. Because
+ * of this, we might end up here even after SD card is removed
+ * and VMMC and PBIAS are turned off. In that case, just fail
+ * the commands immediately
+ */
+ if (host->power_mode == MMC_POWER_OFF) {
+ req->cmd->error = EIO;
+ if (req->data)
+ req->data->error = -EIO;
+ dev_warn(mmc_dev(host->mmc),
+ "Card is no longer present\n");
+ mmc_request_done(mmc, req);
+ return;
+ }
+
host->mrq = req;
err = omap_hsmmc_prepare_data(host, req);
if (err) {
--
1.7.4.1
next prev parent reply other threads:[~2012-05-24 20:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-24 20:14 [PATCH 0/3] mmc:sd hotplug fixes for omap Viswanath Puttagunta
2012-05-24 20:14 ` [PATCH 1/3] mmc: omap_hsmmc: Errata i705: SD hot unplug Viswanath Puttagunta
2012-05-25 8:37 ` S, Venkatraman
2012-05-31 16:39 ` Puttagunta, Viswanath
2012-05-24 20:14 ` Viswanath Puttagunta [this message]
2012-05-24 20:14 ` [PATCH 3/3] mfd: Enable Debounce logic for SD hotplug detection Viswanath Puttagunta
2012-05-25 8:22 ` S, Venkatraman
2012-05-25 7:20 ` [PATCH 0/3] mmc:sd hotplug fixes for omap S, Venkatraman
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=1337890467-32573-3-git-send-email-vishp@ti.com \
--to=vishp@ti.com \
--cc=balajitk@ti.com \
--cc=linux-mmc@vger.kernel.org \
--cc=semen.protsenko@ti.com \
--cc=svenkatr@ti.com \
--cc=v.riazantsev@ti.com \
/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).