diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2013-09-16 06:06:15 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-10-30 20:26:31 -0400 |
commit | 726d6f2374410d980341bfeb49399614e689e702 (patch) | |
tree | 5bf34c9ed06f802ef468a0af8cfb945ff0f7fe70 /drivers/mmc/core | |
parent | ce69d37b7d8fa692c45d71d94aa0c921859b82ce (diff) |
mmc: core: Collect common code for card ocr validation
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>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/core.c | 10 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 11 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 19 | ||||
-rw-r--r-- | 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 63672aba0e98..bcb507771eeb 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1357,6 +1357,16 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | |||
1357 | { | 1357 | { |
1358 | int bit; | 1358 | int bit; |
1359 | 1359 | ||
1360 | /* | ||
1361 | * Sanity check the voltages that the card claims to | ||
1362 | * support. | ||
1363 | */ | ||
1364 | if (ocr & 0x7F) { | ||
1365 | dev_warn(mmc_dev(host), | ||
1366 | "card claims to support voltages below defined range\n"); | ||
1367 | ocr &= ~0x7F; | ||
1368 | } | ||
1369 | |||
1360 | ocr &= host->ocr_avail; | 1370 | ocr &= host->ocr_avail; |
1361 | if (!ocr) { | 1371 | if (!ocr) { |
1362 | dev_warn(mmc_dev(host), "no support for card's volts\n"); | 1372 | 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 18ce81a85c9b..0d060227cfc1 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) | |||
1666 | goto err; | 1666 | goto err; |
1667 | } | 1667 | } |
1668 | 1668 | ||
1669 | /* | ||
1670 | * Sanity check the voltages that the card claims to | ||
1671 | * support. | ||
1672 | */ | ||
1673 | if (ocr & 0x7F) { | ||
1674 | pr_warning("%s: card claims to support voltages " | ||
1675 | "below the defined range. These will be ignored.\n", | ||
1676 | mmc_hostname(host)); | ||
1677 | ocr &= ~0x7F; | ||
1678 | } | ||
1679 | |||
1680 | rocr = mmc_select_voltage(host, ocr); | 1669 | rocr = mmc_select_voltage(host, ocr); |
1681 | 1670 | ||
1682 | /* | 1671 | /* |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 53db60a76dae..6ef84d0ca178 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) | |||
1231 | goto err; | 1231 | goto err; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | /* | ||
1235 | * Sanity check the voltages that the card claims to | ||
1236 | * support. | ||
1237 | */ | ||
1238 | if (ocr & 0x7F) { | ||
1239 | pr_warning("%s: card claims to support voltages " | ||
1240 | "below the defined range. These will be ignored.\n", | ||
1241 | mmc_hostname(host)); | ||
1242 | ocr &= ~0x7F; | ||
1243 | } | ||
1244 | |||
1245 | if ((ocr & MMC_VDD_165_195) && | ||
1246 | !(host->ocr_avail_sd & MMC_VDD_165_195)) { | ||
1247 | pr_warning("%s: SD card claims to support the " | ||
1248 | "incompletely defined 'low voltage range'. This " | ||
1249 | "will be ignored.\n", mmc_hostname(host)); | ||
1250 | ocr &= ~MMC_VDD_165_195; | ||
1251 | } | ||
1252 | |||
1253 | rocr = mmc_select_voltage(host, ocr); | 1234 | rocr = mmc_select_voltage(host, ocr); |
1254 | 1235 | ||
1255 | /* | 1236 | /* |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index b7c19e894dd3..4d721c6e2af0 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) | |||
1133 | if (host->ocr_avail_sdio) | 1133 | if (host->ocr_avail_sdio) |
1134 | host->ocr_avail = host->ocr_avail_sdio; | 1134 | host->ocr_avail = host->ocr_avail_sdio; |
1135 | 1135 | ||
1136 | /* | ||
1137 | * Sanity check the voltages that the card claims to | ||
1138 | * support. | ||
1139 | */ | ||
1140 | if (ocr & 0x7F) { | ||
1141 | pr_warning("%s: card claims to support voltages " | ||
1142 | "below the defined range. These will be ignored.\n", | ||
1143 | mmc_hostname(host)); | ||
1144 | ocr &= ~0x7F; | ||
1145 | } | ||
1146 | 1136 | ||
1147 | rocr = mmc_select_voltage(host, ocr); | 1137 | rocr = mmc_select_voltage(host, ocr); |
1148 | 1138 | ||