diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2014-01-08 10:09:33 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-02-23 10:40:30 -0500 |
commit | 4509f847751c9d2a724f37fe831393fbac34b80f (patch) | |
tree | 957e20f3ce33a9cc297703159690ec336c42116e /drivers/mmc | |
parent | 1d4d77444bf4212c44585146a2b353ca24c815f9 (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')
-rw-r--r-- | drivers/mmc/core/core.c | 3 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 13 | ||||
-rw-r--r-- | drivers/mmc/core/mmc_ops.c | 19 |
3 files changed, 19 insertions, 16 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 1935812e4215..dc7a5fb81a5c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -285,7 +285,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 287 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
288 | EXT_CSD_BKOPS_START, 1, timeout, use_busy_signal, true); | 288 | EXT_CSD_BKOPS_START, 1, timeout, |
289 | use_busy_signal, true, false); | ||
289 | if (err) { | 290 | if (err) { |
290 | pr_warn("%s: Error %d starting bkops\n", | 291 | pr_warn("%s: Error %d starting bkops\n", |
291 | mmc_hostname(card->host), err); | 292 | mmc_hostname(card->host), err); |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 072171183d5b..c944692f3c4e 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -856,8 +856,8 @@ static int mmc_select_hs200(struct mmc_card *card) | |||
856 | 856 | ||
857 | /* switch to HS200 mode if bus width set successfully */ | 857 | /* switch to HS200 mode if bus width set successfully */ |
858 | if (!err) | 858 | if (!err) |
859 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 859 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
860 | EXT_CSD_HS_TIMING, 2, 0); | 860 | EXT_CSD_HS_TIMING, 2, 0, true, true, true); |
861 | err: | 861 | err: |
862 | return err; | 862 | return err; |
863 | } | 863 | } |
@@ -1074,9 +1074,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1074 | host->caps2 & MMC_CAP2_HS200) | 1074 | host->caps2 & MMC_CAP2_HS200) |
1075 | err = mmc_select_hs200(card); | 1075 | err = mmc_select_hs200(card); |
1076 | else if (host->caps & MMC_CAP_MMC_HIGHSPEED) | 1076 | else if (host->caps & MMC_CAP_MMC_HIGHSPEED) |
1077 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1077 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1078 | EXT_CSD_HS_TIMING, 1, | 1078 | EXT_CSD_HS_TIMING, 1, |
1079 | card->ext_csd.generic_cmd6_time); | 1079 | card->ext_csd.generic_cmd6_time, |
1080 | true, true, true); | ||
1080 | 1081 | ||
1081 | if (err && err != -EBADMSG) | 1082 | if (err && err != -EBADMSG) |
1082 | goto free_card; | 1083 | goto free_card; |
@@ -1400,7 +1401,7 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type) | |||
1400 | 1401 | ||
1401 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1402 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1402 | EXT_CSD_POWER_OFF_NOTIFICATION, | 1403 | EXT_CSD_POWER_OFF_NOTIFICATION, |
1403 | notify_type, timeout, true, false); | 1404 | notify_type, timeout, true, false, false); |
1404 | if (err) | 1405 | if (err) |
1405 | pr_err("%s: Power Off Notification timed out, %u\n", | 1406 | pr_err("%s: Power Off Notification timed out, %u\n", |
1406 | mmc_hostname(card->host), timeout); | 1407 | mmc_hostname(card->host), timeout); |
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 | */ |
411 | int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, | 412 | int __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); | |||
501 | int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, | 501 | int 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 | } |
506 | EXPORT_SYMBOL_GPL(mmc_switch); | 507 | EXPORT_SYMBOL_GPL(mmc_switch); |
507 | 508 | ||