aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc_ops.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-01-08 10:09:33 -0500
committerChris Ball <chris@printf.net>2014-02-23 10:40:30 -0500
commit4509f847751c9d2a724f37fe831393fbac34b80f (patch)
tree957e20f3ce33a9cc297703159690ec336c42116e /drivers/mmc/core/mmc_ops.c
parent1d4d77444bf4212c44585146a2b353ca24c815f9 (diff)
mmc: core: Add ignore_crc flag to __mmc_switch
Instead of handle specific adaptations, releated to certain switch operations, inside __mmc_switch, push this to be handled by the caller instead. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc/core/mmc_ops.c')
-rw-r--r--drivers/mmc/core/mmc_ops.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 3377bbfc3585..5e1a2cbdc229 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -405,17 +405,18 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc)
405 * timeout of zero implies maximum possible timeout 405 * timeout of zero implies maximum possible timeout
406 * @use_busy_signal: use the busy signal as response type 406 * @use_busy_signal: use the busy signal as response type
407 * @send_status: send status cmd to poll for busy 407 * @send_status: send status cmd to poll for busy
408 * @ignore_crc: ignore CRC errors when sending status cmd to poll for busy
408 * 409 *
409 * Modifies the EXT_CSD register for selected card. 410 * Modifies the EXT_CSD register for selected card.
410 */ 411 */
411int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, 412int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
412 unsigned int timeout_ms, bool use_busy_signal, bool send_status) 413 unsigned int timeout_ms, bool use_busy_signal, bool send_status,
414 bool ignore_crc)
413{ 415{
414 int err; 416 int err;
415 struct mmc_command cmd = {0}; 417 struct mmc_command cmd = {0};
416 unsigned long timeout; 418 unsigned long timeout;
417 u32 status = 0; 419 u32 status = 0;
418 bool ignore_crc = false;
419 420
420 BUG_ON(!card); 421 BUG_ON(!card);
421 BUG_ON(!card->host); 422 BUG_ON(!card->host);
@@ -445,14 +446,13 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
445 return 0; 446 return 0;
446 447
447 /* 448 /*
448 * Must check status to be sure of no errors 449 * CRC errors shall only be ignored in cases were CMD13 is used to poll
449 * If CMD13 is to check the busy completion of the timing change, 450 * to detect busy completion.
450 * disable the check of CRC error.
451 */ 451 */
452 if (index == EXT_CSD_HS_TIMING && 452 if (card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
453 !(card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)) 453 ignore_crc = false;
454 ignore_crc = true;
455 454
455 /* Must check status to be sure of no errors. */
456 timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); 456 timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS);
457 do { 457 do {
458 if (send_status) { 458 if (send_status) {
@@ -501,7 +501,8 @@ EXPORT_SYMBOL_GPL(__mmc_switch);
501int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, 501int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
502 unsigned int timeout_ms) 502 unsigned int timeout_ms)
503{ 503{
504 return __mmc_switch(card, set, index, value, timeout_ms, true, true); 504 return __mmc_switch(card, set, index, value, timeout_ms, true, true,
505 false);
505} 506}
506EXPORT_SYMBOL_GPL(mmc_switch); 507EXPORT_SYMBOL_GPL(mmc_switch);
507 508