diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2011-01-27 11:44:34 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-27 17:06:12 -0500 |
commit | f5a106d9e2a5d947e106c3caace373ded1a695ed (patch) | |
tree | 495864e9dccb92ea383e2d6608c4f291989d8c29 /drivers | |
parent | bffb276fffc93000e05a19ee0bdee844dff6a88d (diff) |
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')
-rw-r--r-- | drivers/mmc/host/mmci.c | 4 |
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, | |||
283 | u32 remain, success; | 283 | u32 remain, success; |
284 | 284 | ||
285 | /* Calculate how far we are into the transfer */ | 285 | /* Calculate how far we are into the transfer */ |
286 | remain = readl(host->base + MMCIDATACNT) << 2; | 286 | remain = readl(host->base + MMCIDATACNT); |
287 | success = data->blksz * data->blocks - remain; | 287 | success = data->blksz * data->blocks - remain; |
288 | 288 | ||
289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | 289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); |
290 | if (status & MCI_DATACRCFAIL) { | 290 | if (status & MCI_DATACRCFAIL) { |
291 | /* Last block was not successful */ | 291 | /* Last block was not successful */ |
292 | host->data_xfered = ((success / data->blksz) - 1 * data->blksz); | 292 | host->data_xfered = ((success - 1) / data->blksz) * data->blksz; |
293 | data->error = -EILSEQ; | 293 | data->error = -EILSEQ; |
294 | } else if (status & MCI_DATATIMEOUT) { | 294 | } else if (status & MCI_DATATIMEOUT) { |
295 | host->data_xfered = success; | 295 | host->data_xfered = success; |