aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorMaya Erez <merez@codeaurora.org>2013-04-18 08:41:55 -0400
committerChris Ball <cjb@laptop.org>2013-05-26 14:23:13 -0400
commit775a9362b5d7e006ff6bbec5cb9c9c9d5a751696 (patch)
tree78d66b7a04b5e339c2e0faa24290f72eb8f8bae4 /drivers/mmc/core
parentb689167984bc14ed06c8bcff52ef5eb1fd9cf83b (diff)
mmc: card: Adding support for sanitize in eMMC 4.5
The sanitize support is added as a user-app ioctl call, and was removed from the block-device request, since its purpose is to be invoked not via File-System but by a user. This feature deletes the unmap memory region of the eMMC card, by writing to a specific register in the EXT_CSD. unmap region is the memory region that was previously deleted (by erase, trim or discard operation). In order to avoid timeout when sanitizing large-scale cards, the timeout for sanitize operation is 240 seconds. Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/core.c19
-rw-r--r--drivers/mmc/core/mmc_ops.c2
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 6e4d04df37e0..48b9fec34737 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -402,6 +402,7 @@ static int mmc_wait_for_data_req_done(struct mmc_host *host,
402 context_info->is_done_rcv = false; 402 context_info->is_done_rcv = false;
403 context_info->is_new_req = false; 403 context_info->is_new_req = false;
404 cmd = mrq->cmd; 404 cmd = mrq->cmd;
405
405 if (!cmd->error || !cmd->retries || 406 if (!cmd->error || !cmd->retries ||
406 mmc_card_removed(host->card)) { 407 mmc_card_removed(host->card)) {
407 err = host->areq->err_check(host->card, 408 err = host->areq->err_check(host->card,
@@ -436,6 +437,24 @@ static void mmc_wait_for_req_done(struct mmc_host *host,
436 wait_for_completion(&mrq->completion); 437 wait_for_completion(&mrq->completion);
437 438
438 cmd = mrq->cmd; 439 cmd = mrq->cmd;
440
441 /*
442 * If host has timed out waiting for the sanitize
443 * to complete, card might be still in programming state
444 * so let's try to bring the card out of programming
445 * state.
446 */
447 if (cmd->sanitize_busy && cmd->error == -ETIMEDOUT) {
448 if (!mmc_interrupt_hpi(host->card)) {
449 pr_warning("%s: %s: Interrupted sanitize\n",
450 mmc_hostname(host), __func__);
451 cmd->error = 0;
452 break;
453 } else {
454 pr_err("%s: %s: Failed to interrupt sanitize\n",
455 mmc_hostname(host), __func__);
456 }
457 }
439 if (!cmd->error || !cmd->retries || 458 if (!cmd->error || !cmd->retries ||
440 mmc_card_removed(host->card)) 459 mmc_card_removed(host->card))
441 break; 460 break;
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 49f04bc9d0eb..124af5238d0a 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -431,6 +431,8 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
431 431
432 432
433 cmd.cmd_timeout_ms = timeout_ms; 433 cmd.cmd_timeout_ms = timeout_ms;
434 if (index == EXT_CSD_SANITIZE_START)
435 cmd.sanitize_busy = true;
434 436
435 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); 437 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES);
436 if (err) 438 if (err)