aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-31 17:30:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-31 17:30:31 -0500
commit7921127e297ea203b794c4a1c3ef3eb0ee52acbf (patch)
treeb7497bc5cf17f8c833d1d535e2f235dace25f069 /drivers
parent35a8524ffe84667e805b9249316e729e050c83b2 (diff)
parente98ff0f55a0232b578c9aa7f1c245868277ac7bc (diff)
Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm: ARM: smp_on_up: allow non-ARM SMP processors ARM: io: ensure inb/outb() et.al. are properly ordered on ARMv6+ ARM: initrd: disable initrd if passed address overlaps reserved region ARM: footbridge: fix debug macros ARM: mmci: round down the bytes transferred on error ARM: mmci: complete the transaction on error ARM: 6642/1: mmci: calculate remaining bytes at error correctly
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/mmci.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 4b8dcd5b2a01..2d6de3e03e2d 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -14,6 +14,7 @@
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/kernel.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/err.h> 19#include <linux/err.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
@@ -283,19 +284,19 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
283 u32 remain, success; 284 u32 remain, success;
284 285
285 /* Calculate how far we are into the transfer */ 286 /* Calculate how far we are into the transfer */
286 remain = readl(host->base + MMCIDATACNT) << 2; 287 remain = readl(host->base + MMCIDATACNT);
287 success = data->blksz * data->blocks - remain; 288 success = data->blksz * data->blocks - remain;
288 289
289 dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); 290 dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status);
290 if (status & MCI_DATACRCFAIL) { 291 if (status & MCI_DATACRCFAIL) {
291 /* Last block was not successful */ 292 /* Last block was not successful */
292 host->data_xfered = ((success / data->blksz) - 1 * data->blksz); 293 host->data_xfered = round_down(success - 1, data->blksz);
293 data->error = -EILSEQ; 294 data->error = -EILSEQ;
294 } else if (status & MCI_DATATIMEOUT) { 295 } else if (status & MCI_DATATIMEOUT) {
295 host->data_xfered = success; 296 host->data_xfered = round_down(success, data->blksz);
296 data->error = -ETIMEDOUT; 297 data->error = -ETIMEDOUT;
297 } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 298 } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
298 host->data_xfered = success; 299 host->data_xfered = round_down(success, data->blksz);
299 data->error = -EIO; 300 data->error = -EIO;
300 } 301 }
301 302
@@ -319,7 +320,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
319 if (status & MCI_DATABLOCKEND) 320 if (status & MCI_DATABLOCKEND)
320 dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); 321 dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n");
321 322
322 if (status & MCI_DATAEND) { 323 if (status & MCI_DATAEND || data->error) {
323 mmci_stop_data(host); 324 mmci_stop_data(host);
324 325
325 if (!data->error) 326 if (!data->error)