summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2011-01-27 19:44:34 +0300
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-01-28 01:06:12 +0300
commitf5a106d9e2a5d947e106c3caace373ded1a695ed (patch)
tree495864e9dccb92ea383e2d6608c4f291989d8c29 /drivers/mmc
parentbffb276fffc93000e05a19ee0bdee844dff6a88d (diff)
downloadlinux-f5a106d9e2a5d947e106c3caace373ded1a695ed.tar.xz
ARM: 6642/1: mmci: calculate remaining bytes at error correctly
The MMCIDATACNT register contain the number of byte left at error not the number of words, so loose the << 2 thing. Further if CRC fails on the first block, we may end up with a negative number of transferred bytes which is not good, and the formula was in wrong order. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 4b8dcd5b2a01..b6fd6dcb41e7 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -283,13 +283,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
u32 remain, success;
/* Calculate how far we are into the transfer */
- remain = readl(host->base + MMCIDATACNT) << 2;
+ remain = readl(host->base + MMCIDATACNT);
success = data->blksz * data->blocks - remain;
dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status);
if (status & MCI_DATACRCFAIL) {
/* Last block was not successful */
- host->data_xfered = ((success / data->blksz) - 1 * data->blksz);
+ host->data_xfered = ((success - 1) / data->blksz) * data->blksz;
data->error = -EILSEQ;
} else if (status & MCI_DATATIMEOUT) {
host->data_xfered = success;