aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-08-12 07:13:24 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-08-23 00:27:44 -0400
commit2b061973404802fb87db93175b856ee0dfbe38e4 (patch)
tree9d44303c71725ec80da3b90c2e33f0fc8d22741b
parentbe760a9de881d84994403bb93177bcb95319c4cb (diff)
sdhci: be more cautious about block count register
The block count register shouldn't be trusted for single block transfers, so avoid using it completely when calculating transferred bytes. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r--drivers/mmc/host/sdhci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f2bc87ac24f7..7181e867863e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -477,8 +477,8 @@ static void sdhci_finish_data(struct sdhci_host *host)
477 /* 477 /*
478 * Controller doesn't count down when in single block mode. 478 * Controller doesn't count down when in single block mode.
479 */ 479 */
480 if ((data->blocks == 1) && (data->error == MMC_ERR_NONE)) 480 if (data->blocks == 1)
481 blocks = 0; 481 blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
482 else 482 else
483 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); 483 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
484 data->bytes_xfered = data->blksz * (data->blocks - blocks); 484 data->bytes_xfered = data->blksz * (data->blocks - blocks);