diff options
author | Subhash Jadavani <subhashj@codeaurora.org> | 2012-06-13 07:40:43 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-06-26 16:10:29 -0400 |
commit | d380443cd0271903bf9516bc04cead81676be034 (patch) | |
tree | 27e5660f45086886fc3679679bb7ada7dfeb860a /drivers/mmc | |
parent | d1346a6cbabf6d377d753f1adc16cb0b305830cc (diff) |
mmc: block: fix the data timeout issue with ACMD22
If multi block write operation fails for SD card, during
error handling we send the SD_APP_SEND_NUM_WR_BLKS (ACMD22)
to know how many blocks were already programmed by card.
But mmc_sd_num_wr_blocks() function which sends the ACMD22
calculates the data timeout value from csd.tacc_ns and
csd.tacc_clks parameters which will be 0 for block addressed
(>2GB cards) SD card. This would result in timeout_ns and
timeout_clks being 0 in the mmc_request passed to host driver.
This means host controller would program its data timeout timer
value with 0 which could result in DATA TIMEOUT errors from
controller.
To fix this issue, mmc_sd_num_wr_blocks() should instead
just call the mmc_set_data_timeout() to calculate the
data timeout value. mmc_set_data_timeout() function
ensures that non zero timeout value is set even for
block addressed SD cards.
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/card/block.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index dd2d374dcc7a..276d21ce6bc1 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -554,7 +554,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
554 | struct mmc_request mrq = {NULL}; | 554 | struct mmc_request mrq = {NULL}; |
555 | struct mmc_command cmd = {0}; | 555 | struct mmc_command cmd = {0}; |
556 | struct mmc_data data = {0}; | 556 | struct mmc_data data = {0}; |
557 | unsigned int timeout_us; | ||
558 | 557 | ||
559 | struct scatterlist sg; | 558 | struct scatterlist sg; |
560 | 559 | ||
@@ -574,23 +573,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
574 | cmd.arg = 0; | 573 | cmd.arg = 0; |
575 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 574 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
576 | 575 | ||
577 | data.timeout_ns = card->csd.tacc_ns * 100; | ||
578 | data.timeout_clks = card->csd.tacc_clks * 100; | ||
579 | |||
580 | timeout_us = data.timeout_ns / 1000; | ||
581 | timeout_us += data.timeout_clks * 1000 / | ||
582 | (card->host->ios.clock / 1000); | ||
583 | |||
584 | if (timeout_us > 100000) { | ||
585 | data.timeout_ns = 100000000; | ||
586 | data.timeout_clks = 0; | ||
587 | } | ||
588 | |||
589 | data.blksz = 4; | 576 | data.blksz = 4; |
590 | data.blocks = 1; | 577 | data.blocks = 1; |
591 | data.flags = MMC_DATA_READ; | 578 | data.flags = MMC_DATA_READ; |
592 | data.sg = &sg; | 579 | data.sg = &sg; |
593 | data.sg_len = 1; | 580 | data.sg_len = 1; |
581 | mmc_set_data_timeout(&data, card); | ||
594 | 582 | ||
595 | mrq.cmd = &cmd; | 583 | mrq.cmd = &cmd; |
596 | mrq.data = &data; | 584 | mrq.data = &data; |