From: Ulf Hansson <ulf.hansson@linaro.org>
To: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Cc: Prasanna NAVARATNA <prasanna.navaratna@gmail.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Subject: [PATCH 7/7] mmc: core: Collect common code for card ocr validation
Date: Mon, 16 Sep 2013 16:17:48 +0200 [thread overview]
Message-ID: <1379341068-27097-8-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1379341068-27097-1-git-send-email-ulf.hansson@linaro.org>
Since mmc_select_voltage now only gets called from the attach sequence,
it makes sense to move the out of spec validations of the card ocr into
this function.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/core/core.c | 10 ++++++++++
drivers/mmc/core/mmc.c | 11 -----------
drivers/mmc/core/sd.c | 19 -------------------
drivers/mmc/core/sdio.c | 10 ----------
4 files changed, 10 insertions(+), 40 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 0d89ccc..5806bfc 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1382,6 +1382,16 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
{
int bit;
+ /*
+ * Sanity check the voltages that the card claims to
+ * support.
+ */
+ if (ocr & 0x7F) {
+ dev_warn(mmc_dev(host),
+ "card claims to support voltages below defined range\n");
+ ocr &= ~0x7F;
+ }
+
ocr &= host->ocr_avail;
if (!ocr) {
dev_warn(mmc_dev(host), "no support for card's volts\n");
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 9149eab..69398f4 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1666,17 +1666,6 @@ int mmc_attach_mmc(struct mmc_host *host)
goto err;
}
- /*
- * Sanity check the voltages that the card claims to
- * support.
- */
- if (ocr & 0x7F) {
- pr_warning("%s: card claims to support voltages "
- "below the defined range. These will be ignored.\n",
- mmc_hostname(host));
- ocr &= ~0x7F;
- }
-
rocr = mmc_select_voltage(host, ocr);
/*
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 53db60a..6ef84d0 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1231,25 +1231,6 @@ int mmc_attach_sd(struct mmc_host *host)
goto err;
}
- /*
- * Sanity check the voltages that the card claims to
- * support.
- */
- if (ocr & 0x7F) {
- pr_warning("%s: card claims to support voltages "
- "below the defined range. These will be ignored.\n",
- mmc_hostname(host));
- ocr &= ~0x7F;
- }
-
- if ((ocr & MMC_VDD_165_195) &&
- !(host->ocr_avail_sd & MMC_VDD_165_195)) {
- pr_warning("%s: SD card claims to support the "
- "incompletely defined 'low voltage range'. This "
- "will be ignored.\n", mmc_hostname(host));
- ocr &= ~MMC_VDD_165_195;
- }
-
rocr = mmc_select_voltage(host, ocr);
/*
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index b7c19e8..4d721c6 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1133,16 +1133,6 @@ int mmc_attach_sdio(struct mmc_host *host)
if (host->ocr_avail_sdio)
host->ocr_avail = host->ocr_avail_sdio;
- /*
- * Sanity check the voltages that the card claims to
- * support.
- */
- if (ocr & 0x7F) {
- pr_warning("%s: card claims to support voltages "
- "below the defined range. These will be ignored.\n",
- mmc_hostname(host));
- ocr &= ~0x7F;
- }
rocr = mmc_select_voltage(host, ocr);
--
1.7.9.5
next prev parent reply other threads:[~2013-09-16 14:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 14:17 [PATCH 0/7] mmc: core: Fixup ocr mask setup to prevent spec violation Ulf Hansson
2013-09-16 14:17 ` [PATCH 1/7] mmc: core: Let mmc_power_up|cycle take ocr as parameter Ulf Hansson
2013-09-16 14:17 ` [PATCH 2/7] mmc: core: Let mmc_set_signal_voltage " Ulf Hansson
2013-09-16 14:17 ` [PATCH 3/7] mmc: core: Remove unnecessary retry mechanism at SDIO attach Ulf Hansson
2013-09-16 14:17 ` [PATCH 4/7] mmc: core: Cleanup code for setting ocr mask for SDIO Ulf Hansson
2013-09-16 14:17 ` [PATCH 5/7] mmc: core: Move cached value of the negotiated ocr mask to card struct Ulf Hansson
2013-09-16 14:17 ` [PATCH 6/7] mmc: core: Prevent violation of specs while initializing cards Ulf Hansson
2013-09-16 14:17 ` Ulf Hansson [this message]
2013-09-16 20:57 ` [PATCH 0/7] mmc: core: Fixup ocr mask setup to prevent spec violation Guennadi Liakhovetski
2013-09-17 8:00 ` Ulf Hansson
2013-09-17 8:16 ` Guennadi Liakhovetski
2013-09-17 9:29 ` Ulf Hansson
2013-09-17 11:04 ` Mark Brown
2013-09-17 12:50 ` Ulf Hansson
2013-09-27 9:56 ` Ulf Hansson
2013-09-27 10:44 ` Mark Brown
2013-09-17 11:00 ` Mark Brown
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=1379341068-27097-8-git-send-email-ulf.hansson@linaro.org \
--to=ulf.hansson@linaro.org \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=prasanna.navaratna@gmail.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).