aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-07-22 16:18:46 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 02:46:48 -0400
commit17b0429dde9ab60f9cee8e07ab28c7dc6cfe6efd (patch)
tree9f87df1ffbeca4c6f828b7979f2e45ef898a3ef0 /drivers/mmc/host
parentb7e113dc9d52c4a37d2da6fafe77959f3a28eccf (diff)
mmc: remove custom error codes
Convert the MMC layer to use standard error codes and not its own, incompatible values. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/at91_mci.c12
-rw-r--r--drivers/mmc/host/au1xmmc.c32
-rw-r--r--drivers/mmc/host/imxmmc.c14
-rw-r--r--drivers/mmc/host/mmci.c12
-rw-r--r--drivers/mmc/host/omap.c12
-rw-r--r--drivers/mmc/host/pxamci.c12
-rw-r--r--drivers/mmc/host/sdhci.c51
-rw-r--r--drivers/mmc/host/tifm_sd.c20
-rw-r--r--drivers/mmc/host/wbsd.c41
9 files changed, 100 insertions, 106 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 955ea60583b5..810a433ce532 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -577,24 +577,22 @@ static void at91_mci_completed_command(struct at91mci_host *host)
577 AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | 577 AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
578 AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { 578 AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
579 if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { 579 if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
580 cmd->error = MMC_ERR_NONE; 580 cmd->error = 0;
581 } 581 }
582 else { 582 else {
583 if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) 583 if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE))
584 cmd->error = MMC_ERR_TIMEOUT; 584 cmd->error = -ETIMEDOUT;
585 else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) 585 else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE))
586 cmd->error = MMC_ERR_BADCRC; 586 cmd->error = -EILSEQ;
587 else if (status & (AT91_MCI_OVRE | AT91_MCI_UNRE))
588 cmd->error = MMC_ERR_FIFO;
589 else 587 else
590 cmd->error = MMC_ERR_FAILED; 588 cmd->error = -EIO;
591 589
592 pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", 590 pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n",
593 cmd->error, cmd->opcode, cmd->retries); 591 cmd->error, cmd->opcode, cmd->retries);
594 } 592 }
595 } 593 }
596 else 594 else
597 cmd->error = MMC_ERR_NONE; 595 cmd->error = 0;
598 596
599 at91_mci_process_next(host); 597 at91_mci_process_next(host);
600} 598}
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 34c99d4ea041..49b0367e57c8 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -208,7 +208,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
208 default: 208 default:
209 printk(KERN_INFO "au1xmmc: unhandled response type %02x\n", 209 printk(KERN_INFO "au1xmmc: unhandled response type %02x\n",
210 mmc_resp_type(cmd)); 210 mmc_resp_type(cmd));
211 return MMC_ERR_INVALID; 211 return -EINVAL;
212 } 212 }
213 213
214 if (flags & MMC_DATA_READ) { 214 if (flags & MMC_DATA_READ) {
@@ -253,7 +253,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
253 IRQ_ON(host, SD_CONFIG_CR); 253 IRQ_ON(host, SD_CONFIG_CR);
254 } 254 }
255 255
256 return MMC_ERR_NONE; 256 return 0;
257} 257}
258 258
259static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) 259static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
@@ -278,7 +278,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
278 while((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB)) 278 while((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB))
279 status = au_readl(HOST_STATUS(host)); 279 status = au_readl(HOST_STATUS(host));
280 280
281 data->error = MMC_ERR_NONE; 281 data->error = 0;
282 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir); 282 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir);
283 283
284 /* Process any errors */ 284 /* Process any errors */
@@ -288,14 +288,14 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
288 crc |= ((status & 0x07) == 0x02) ? 0 : 1; 288 crc |= ((status & 0x07) == 0x02) ? 0 : 1;
289 289
290 if (crc) 290 if (crc)
291 data->error = MMC_ERR_BADCRC; 291 data->error = -EILSEQ;
292 292
293 /* Clear the CRC bits */ 293 /* Clear the CRC bits */
294 au_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host)); 294 au_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host));
295 295
296 data->bytes_xfered = 0; 296 data->bytes_xfered = 0;
297 297
298 if (data->error == MMC_ERR_NONE) { 298 if (!data->error) {
299 if (host->flags & HOST_F_DMA) { 299 if (host->flags & HOST_F_DMA) {
300 u32 chan = DMA_CHANNEL(host); 300 u32 chan = DMA_CHANNEL(host);
301 301
@@ -475,7 +475,7 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
475 return; 475 return;
476 476
477 cmd = mrq->cmd; 477 cmd = mrq->cmd;
478 cmd->error = MMC_ERR_NONE; 478 cmd->error = 0;
479 479
480 if (cmd->flags & MMC_RSP_PRESENT) { 480 if (cmd->flags & MMC_RSP_PRESENT) {
481 if (cmd->flags & MMC_RSP_136) { 481 if (cmd->flags & MMC_RSP_136) {
@@ -512,11 +512,11 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
512 /* Figure out errors */ 512 /* Figure out errors */
513 513
514 if (status & (SD_STATUS_SC | SD_STATUS_WC | SD_STATUS_RC)) 514 if (status & (SD_STATUS_SC | SD_STATUS_WC | SD_STATUS_RC))
515 cmd->error = MMC_ERR_BADCRC; 515 cmd->error = -EILSEQ;
516 516
517 trans = host->flags & (HOST_F_XMIT | HOST_F_RECV); 517 trans = host->flags & (HOST_F_XMIT | HOST_F_RECV);
518 518
519 if (!trans || cmd->error != MMC_ERR_NONE) { 519 if (!trans || cmd->error) {
520 520
521 IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA|SD_CONFIG_RF); 521 IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA|SD_CONFIG_RF);
522 tasklet_schedule(&host->finish_task); 522 tasklet_schedule(&host->finish_task);
@@ -589,7 +589,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
589 data->sg_len, host->dma.dir); 589 data->sg_len, host->dma.dir);
590 590
591 if (host->dma.len == 0) 591 if (host->dma.len == 0)
592 return MMC_ERR_TIMEOUT; 592 return -ETIMEDOUT;
593 593
594 au_writel(data->blksz - 1, HOST_BLKSIZE(host)); 594 au_writel(data->blksz - 1, HOST_BLKSIZE(host));
595 595
@@ -640,11 +640,11 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
640 //IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF); 640 //IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF);
641 } 641 }
642 642
643 return MMC_ERR_NONE; 643 return 0;
644 644
645 dataerr: 645 dataerr:
646 dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir); 646 dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir);
647 return MMC_ERR_TIMEOUT; 647 return -ETIMEDOUT;
648} 648}
649 649
650/* static void au1xmmc_request 650/* static void au1xmmc_request
@@ -656,7 +656,7 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)
656 656
657 struct au1xmmc_host *host = mmc_priv(mmc); 657 struct au1xmmc_host *host = mmc_priv(mmc);
658 unsigned int flags = 0; 658 unsigned int flags = 0;
659 int ret = MMC_ERR_NONE; 659 int ret = 0;
660 660
661 WARN_ON(irqs_disabled()); 661 WARN_ON(irqs_disabled());
662 WARN_ON(host->status != HOST_S_IDLE); 662 WARN_ON(host->status != HOST_S_IDLE);
@@ -672,10 +672,10 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq)
672 ret = au1xmmc_prepare_data(host, mrq->data); 672 ret = au1xmmc_prepare_data(host, mrq->data);
673 } 673 }
674 674
675 if (ret == MMC_ERR_NONE) 675 if (!ret)
676 ret = au1xmmc_send_command(host, 0, mrq->cmd, flags); 676 ret = au1xmmc_send_command(host, 0, mrq->cmd, flags);
677 677
678 if (ret != MMC_ERR_NONE) { 678 if (ret) {
679 mrq->cmd->error = ret; 679 mrq->cmd->error = ret;
680 au1xmmc_finish_request(host); 680 au1xmmc_finish_request(host);
681 } 681 }
@@ -764,10 +764,10 @@ static irqreturn_t au1xmmc_irq(int irq, void *dev_id)
764 764
765 if (host->mrq && (status & STATUS_TIMEOUT)) { 765 if (host->mrq && (status & STATUS_TIMEOUT)) {
766 if (status & SD_STATUS_RAT) 766 if (status & SD_STATUS_RAT)
767 host->mrq->cmd->error = MMC_ERR_TIMEOUT; 767 host->mrq->cmd->error = -ETIMEDOUT;
768 768
769 else if (status & SD_STATUS_DT) 769 else if (status & SD_STATUS_DT)
770 host->mrq->data->error = MMC_ERR_TIMEOUT; 770 host->mrq->data->error = -ETIMEDOUT;
771 771
772 /* In PIO mode, interrupts might still be enabled */ 772 /* In PIO mode, interrupts might still be enabled */
773 IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH); 773 IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH);
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index 54bfc9f25596..04458c342812 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -428,11 +428,11 @@ static int imxmci_finish_data(struct imxmci_host *host, unsigned int stat)
428 if ( stat & STATUS_ERR_MASK ) { 428 if ( stat & STATUS_ERR_MASK ) {
429 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n",stat); 429 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n",stat);
430 if(stat & (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR)) 430 if(stat & (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR))
431 data->error = MMC_ERR_BADCRC; 431 data->error = -EILSEQ;
432 else if(stat & STATUS_TIME_OUT_READ) 432 else if(stat & STATUS_TIME_OUT_READ)
433 data->error = MMC_ERR_TIMEOUT; 433 data->error = -ETIMEDOUT;
434 else 434 else
435 data->error = MMC_ERR_FAILED; 435 data->error = -EIO;
436 } else { 436 } else {
437 data->bytes_xfered = host->dma_size; 437 data->bytes_xfered = host->dma_size;
438 } 438 }
@@ -458,10 +458,10 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat)
458 458
459 if (stat & STATUS_TIME_OUT_RESP) { 459 if (stat & STATUS_TIME_OUT_RESP) {
460 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); 460 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n");
461 cmd->error = MMC_ERR_TIMEOUT; 461 cmd->error = -ETIMEDOUT;
462 } else if (stat & STATUS_RESP_CRC_ERR && cmd->flags & MMC_RSP_CRC) { 462 } else if (stat & STATUS_RESP_CRC_ERR && cmd->flags & MMC_RSP_CRC) {
463 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); 463 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n");
464 cmd->error = MMC_ERR_BADCRC; 464 cmd->error = -EILSEQ;
465 } 465 }
466 466
467 if(cmd->flags & MMC_RSP_PRESENT) { 467 if(cmd->flags & MMC_RSP_PRESENT) {
@@ -482,7 +482,7 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat)
482 dev_dbg(mmc_dev(host->mmc), "RESP 0x%08x, 0x%08x, 0x%08x, 0x%08x, error %d\n", 482 dev_dbg(mmc_dev(host->mmc), "RESP 0x%08x, 0x%08x, 0x%08x, 0x%08x, error %d\n",
483 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], cmd->error); 483 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], cmd->error);
484 484
485 if (data && (cmd->error == MMC_ERR_NONE) && !(stat & STATUS_ERR_MASK)) { 485 if (data && !cmd->error && !(stat & STATUS_ERR_MASK)) {
486 if (host->req->data->flags & MMC_DATA_WRITE) { 486 if (host->req->data->flags & MMC_DATA_WRITE) {
487 487
488 /* Wait for FIFO to be empty before starting DMA write */ 488 /* Wait for FIFO to be empty before starting DMA write */
@@ -491,7 +491,7 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat)
491 if(imxmci_busy_wait_for_status(host, &stat, 491 if(imxmci_busy_wait_for_status(host, &stat,
492 STATUS_APPL_BUFF_FE, 492 STATUS_APPL_BUFF_FE,
493 40, "imxmci_cmd_done DMA WR") < 0) { 493 40, "imxmci_cmd_done DMA WR") < 0) {
494 cmd->error = MMC_ERR_FIFO; 494 cmd->error = -EIO;
495 imxmci_finish_data(host, stat); 495 imxmci_finish_data(host, stat);
496 if(host->req) 496 if(host->req)
497 imxmci_finish_request(host, host->req); 497 imxmci_finish_request(host, host->req);
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index be730c0a0352..d53e9a8bdaa2 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -154,11 +154,11 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
154 } 154 }
155 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 155 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
156 if (status & MCI_DATACRCFAIL) 156 if (status & MCI_DATACRCFAIL)
157 data->error = MMC_ERR_BADCRC; 157 data->error = -EILSEQ;
158 else if (status & MCI_DATATIMEOUT) 158 else if (status & MCI_DATATIMEOUT)
159 data->error = MMC_ERR_TIMEOUT; 159 data->error = -ETIMEDOUT;
160 else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) 160 else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN))
161 data->error = MMC_ERR_FIFO; 161 data->error = -EIO;
162 status |= MCI_DATAEND; 162 status |= MCI_DATAEND;
163 163
164 /* 164 /*
@@ -193,12 +193,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
193 cmd->resp[3] = readl(base + MMCIRESPONSE3); 193 cmd->resp[3] = readl(base + MMCIRESPONSE3);
194 194
195 if (status & MCI_CMDTIMEOUT) { 195 if (status & MCI_CMDTIMEOUT) {
196 cmd->error = MMC_ERR_TIMEOUT; 196 cmd->error = -ETIMEDOUT;
197 } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { 197 } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) {
198 cmd->error = MMC_ERR_BADCRC; 198 cmd->error = -EILSEQ;
199 } 199 }
200 200
201 if (!cmd->data || cmd->error != MMC_ERR_NONE) { 201 if (!cmd->data || cmd->error) {
202 if (host->data) 202 if (host->data)
203 mmci_stop_data(host); 203 mmci_stop_data(host);
204 mmci_request_end(host, cmd->mrq); 204 mmci_request_end(host, cmd->mrq);
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0cf97edc5f58..60a67dfcda6a 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -263,7 +263,7 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data)
263 enum dma_data_direction dma_data_dir; 263 enum dma_data_direction dma_data_dir;
264 264
265 BUG_ON(host->dma_ch < 0); 265 BUG_ON(host->dma_ch < 0);
266 if (data->error != MMC_ERR_NONE) 266 if (data->error)
267 omap_stop_dma(host->dma_ch); 267 omap_stop_dma(host->dma_ch);
268 /* Release DMA channel lazily */ 268 /* Release DMA channel lazily */
269 mod_timer(&host->dma_timer, jiffies + HZ); 269 mod_timer(&host->dma_timer, jiffies + HZ);
@@ -368,7 +368,7 @@ mmc_omap_cmd_done(struct mmc_omap_host *host, struct mmc_command *cmd)
368 } 368 }
369 } 369 }
370 370
371 if (host->data == NULL || cmd->error != MMC_ERR_NONE) { 371 if (host->data == NULL || cmd->error) {
372 host->mrq = NULL; 372 host->mrq = NULL;
373 clk_disable(host->fclk); 373 clk_disable(host->fclk);
374 mmc_request_done(host->mmc, cmd->mrq); 374 mmc_request_done(host->mmc, cmd->mrq);
@@ -475,14 +475,14 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
475 if (status & OMAP_MMC_STAT_DATA_TOUT) { 475 if (status & OMAP_MMC_STAT_DATA_TOUT) {
476 dev_dbg(mmc_dev(host->mmc), "data timeout\n"); 476 dev_dbg(mmc_dev(host->mmc), "data timeout\n");
477 if (host->data) { 477 if (host->data) {
478 host->data->error |= MMC_ERR_TIMEOUT; 478 host->data->error = -ETIMEDOUT;
479 transfer_error = 1; 479 transfer_error = 1;
480 } 480 }
481 } 481 }
482 482
483 if (status & OMAP_MMC_STAT_DATA_CRC) { 483 if (status & OMAP_MMC_STAT_DATA_CRC) {
484 if (host->data) { 484 if (host->data) {
485 host->data->error |= MMC_ERR_BADCRC; 485 host->data->error = -EILSEQ;
486 dev_dbg(mmc_dev(host->mmc), 486 dev_dbg(mmc_dev(host->mmc),
487 "data CRC error, bytes left %d\n", 487 "data CRC error, bytes left %d\n",
488 host->total_bytes_left); 488 host->total_bytes_left);
@@ -504,7 +504,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
504 dev_err(mmc_dev(host->mmc), 504 dev_err(mmc_dev(host->mmc),
505 "command timeout, CMD %d\n", 505 "command timeout, CMD %d\n",
506 host->cmd->opcode); 506 host->cmd->opcode);
507 host->cmd->error = MMC_ERR_TIMEOUT; 507 host->cmd->error = -ETIMEDOUT;
508 end_command = 1; 508 end_command = 1;
509 } 509 }
510 } 510 }
@@ -514,7 +514,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
514 dev_err(mmc_dev(host->mmc), 514 dev_err(mmc_dev(host->mmc),
515 "command CRC error (CMD%d, arg 0x%08x)\n", 515 "command CRC error (CMD%d, arg 0x%08x)\n",
516 host->cmd->opcode, host->cmd->arg); 516 host->cmd->opcode, host->cmd->arg);
517 host->cmd->error = MMC_ERR_BADCRC; 517 host->cmd->error = -EILSEQ;
518 end_command = 1; 518 end_command = 1;
519 } else 519 } else
520 dev_err(mmc_dev(host->mmc), 520 dev_err(mmc_dev(host->mmc),
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index ff960334b337..b89e32d1e9b5 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -226,7 +226,7 @@ static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat)
226 } 226 }
227 227
228 if (stat & STAT_TIME_OUT_RESPONSE) { 228 if (stat & STAT_TIME_OUT_RESPONSE) {
229 cmd->error = MMC_ERR_TIMEOUT; 229 cmd->error = -ETIMEDOUT;
230 } else if (stat & STAT_RES_CRC_ERR && cmd->flags & MMC_RSP_CRC) { 230 } else if (stat & STAT_RES_CRC_ERR && cmd->flags & MMC_RSP_CRC) {
231#ifdef CONFIG_PXA27x 231#ifdef CONFIG_PXA27x
232 /* 232 /*
@@ -239,11 +239,11 @@ static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat)
239 pr_debug("ignoring CRC from command %d - *risky*\n", cmd->opcode); 239 pr_debug("ignoring CRC from command %d - *risky*\n", cmd->opcode);
240 } else 240 } else
241#endif 241#endif
242 cmd->error = MMC_ERR_BADCRC; 242 cmd->error = -EILSEQ;
243 } 243 }
244 244
245 pxamci_disable_irq(host, END_CMD_RES); 245 pxamci_disable_irq(host, END_CMD_RES);
246 if (host->data && cmd->error == MMC_ERR_NONE) { 246 if (host->data && !cmd->error) {
247 pxamci_enable_irq(host, DATA_TRAN_DONE); 247 pxamci_enable_irq(host, DATA_TRAN_DONE);
248 } else { 248 } else {
249 pxamci_finish_request(host, host->mrq); 249 pxamci_finish_request(host, host->mrq);
@@ -264,9 +264,9 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
264 host->dma_dir); 264 host->dma_dir);
265 265
266 if (stat & STAT_READ_TIME_OUT) 266 if (stat & STAT_READ_TIME_OUT)
267 data->error = MMC_ERR_TIMEOUT; 267 data->error = -ETIMEDOUT;
268 else if (stat & (STAT_CRC_READ_ERROR|STAT_CRC_WRITE_ERROR)) 268 else if (stat & (STAT_CRC_READ_ERROR|STAT_CRC_WRITE_ERROR))
269 data->error = MMC_ERR_BADCRC; 269 data->error = -EILSEQ;
270 270
271 /* 271 /*
272 * There appears to be a hardware design bug here. There seems to 272 * There appears to be a hardware design bug here. There seems to
@@ -274,7 +274,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
274 * This means that if there was an error on any block, we mark all 274 * This means that if there was an error on any block, we mark all
275 * data blocks as being in error. 275 * data blocks as being in error.
276 */ 276 */
277 if (data->error == MMC_ERR_NONE) 277 if (!data->error)
278 data->bytes_xfered = data->blocks * data->blksz; 278 data->bytes_xfered = data->blocks * data->blksz;
279 else 279 else
280 data->bytes_xfered = 0; 280 data->bytes_xfered = 0;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 20a7d89e01ba..479d6a265dd1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -481,16 +481,16 @@ static void sdhci_finish_data(struct sdhci_host *host)
481 * Controller doesn't count down when in single block mode. 481 * Controller doesn't count down when in single block mode.
482 */ 482 */
483 if (data->blocks == 1) 483 if (data->blocks == 1)
484 blocks = (data->error == MMC_ERR_NONE) ? 0 : 1; 484 blocks = (data->error == 0) ? 0 : 1;
485 else 485 else
486 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); 486 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
487 data->bytes_xfered = data->blksz * (data->blocks - blocks); 487 data->bytes_xfered = data->blksz * (data->blocks - blocks);
488 488
489 if ((data->error == MMC_ERR_NONE) && blocks) { 489 if (!data->error && blocks) {
490 printk(KERN_ERR "%s: Controller signalled completion even " 490 printk(KERN_ERR "%s: Controller signalled completion even "
491 "though there were blocks left.\n", 491 "though there were blocks left.\n",
492 mmc_hostname(host->mmc)); 492 mmc_hostname(host->mmc));
493 data->error = MMC_ERR_FAILED; 493 data->error = -EIO;
494 } 494 }
495 495
496 if (data->stop) { 496 if (data->stop) {
@@ -498,7 +498,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
498 * The controller needs a reset of internal state machines 498 * The controller needs a reset of internal state machines
499 * upon error conditions. 499 * upon error conditions.
500 */ 500 */
501 if (data->error != MMC_ERR_NONE) { 501 if (data->error) {
502 sdhci_reset(host, SDHCI_RESET_CMD); 502 sdhci_reset(host, SDHCI_RESET_CMD);
503 sdhci_reset(host, SDHCI_RESET_DATA); 503 sdhci_reset(host, SDHCI_RESET_DATA);
504 } 504 }
@@ -533,7 +533,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
533 printk(KERN_ERR "%s: Controller never released " 533 printk(KERN_ERR "%s: Controller never released "
534 "inhibit bit(s).\n", mmc_hostname(host->mmc)); 534 "inhibit bit(s).\n", mmc_hostname(host->mmc));
535 sdhci_dumpregs(host); 535 sdhci_dumpregs(host);
536 cmd->error = MMC_ERR_FAILED; 536 cmd->error = -EIO;
537 tasklet_schedule(&host->finish_tasklet); 537 tasklet_schedule(&host->finish_tasklet);
538 return; 538 return;
539 } 539 }
@@ -554,7 +554,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
554 if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { 554 if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
555 printk(KERN_ERR "%s: Unsupported response type!\n", 555 printk(KERN_ERR "%s: Unsupported response type!\n",
556 mmc_hostname(host->mmc)); 556 mmc_hostname(host->mmc));
557 cmd->error = MMC_ERR_INVALID; 557 cmd->error = -EINVAL;
558 tasklet_schedule(&host->finish_tasklet); 558 tasklet_schedule(&host->finish_tasklet);
559 return; 559 return;
560 } 560 }
@@ -601,7 +601,7 @@ static void sdhci_finish_command(struct sdhci_host *host)
601 } 601 }
602 } 602 }
603 603
604 host->cmd->error = MMC_ERR_NONE; 604 host->cmd->error = 0;
605 605
606 if (host->data && host->data_early) 606 if (host->data && host->data_early)
607 sdhci_finish_data(host); 607 sdhci_finish_data(host);
@@ -722,7 +722,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
722 host->mrq = mrq; 722 host->mrq = mrq;
723 723
724 if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { 724 if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
725 host->mrq->cmd->error = MMC_ERR_TIMEOUT; 725 host->mrq->cmd->error = -ENOMEDIUM;
726 tasklet_schedule(&host->finish_tasklet); 726 tasklet_schedule(&host->finish_tasklet);
727 } else 727 } else
728 sdhci_send_command(host, mrq->cmd); 728 sdhci_send_command(host, mrq->cmd);
@@ -831,7 +831,7 @@ static void sdhci_tasklet_card(unsigned long param)
831 sdhci_reset(host, SDHCI_RESET_CMD); 831 sdhci_reset(host, SDHCI_RESET_CMD);
832 sdhci_reset(host, SDHCI_RESET_DATA); 832 sdhci_reset(host, SDHCI_RESET_DATA);
833 833
834 host->mrq->cmd->error = MMC_ERR_FAILED; 834 host->mrq->cmd->error = -ENOMEDIUM;
835 tasklet_schedule(&host->finish_tasklet); 835 tasklet_schedule(&host->finish_tasklet);
836 } 836 }
837 } 837 }
@@ -859,9 +859,9 @@ static void sdhci_tasklet_finish(unsigned long param)
859 * The controller needs a reset of internal state machines 859 * The controller needs a reset of internal state machines
860 * upon error conditions. 860 * upon error conditions.
861 */ 861 */
862 if ((mrq->cmd->error != MMC_ERR_NONE) || 862 if (mrq->cmd->error ||
863 (mrq->data && ((mrq->data->error != MMC_ERR_NONE) || 863 (mrq->data && (mrq->data->error ||
864 (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) { 864 (mrq->data->stop && mrq->data->stop->error)))) {
865 865
866 /* Some controllers need this kick or reset won't work here */ 866 /* Some controllers need this kick or reset won't work here */
867 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { 867 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
@@ -906,13 +906,13 @@ static void sdhci_timeout_timer(unsigned long data)
906 sdhci_dumpregs(host); 906 sdhci_dumpregs(host);
907 907
908 if (host->data) { 908 if (host->data) {
909 host->data->error = MMC_ERR_TIMEOUT; 909 host->data->error = -ETIMEDOUT;
910 sdhci_finish_data(host); 910 sdhci_finish_data(host);
911 } else { 911 } else {
912 if (host->cmd) 912 if (host->cmd)
913 host->cmd->error = MMC_ERR_TIMEOUT; 913 host->cmd->error = -ETIMEDOUT;
914 else 914 else
915 host->mrq->cmd->error = MMC_ERR_TIMEOUT; 915 host->mrq->cmd->error = -ETIMEDOUT;
916 916
917 tasklet_schedule(&host->finish_tasklet); 917 tasklet_schedule(&host->finish_tasklet);
918 } 918 }
@@ -941,13 +941,12 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
941 } 941 }
942 942
943 if (intmask & SDHCI_INT_TIMEOUT) 943 if (intmask & SDHCI_INT_TIMEOUT)
944 host->cmd->error = MMC_ERR_TIMEOUT; 944 host->cmd->error = -ETIMEDOUT;
945 else if (intmask & SDHCI_INT_CRC) 945 else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT |
946 host->cmd->error = MMC_ERR_BADCRC; 946 SDHCI_INT_INDEX))
947 else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX)) 947 host->cmd->error = -EILSEQ;
948 host->cmd->error = MMC_ERR_FAILED;
949 948
950 if (host->cmd->error != MMC_ERR_NONE) 949 if (host->cmd->error)
951 tasklet_schedule(&host->finish_tasklet); 950 tasklet_schedule(&host->finish_tasklet);
952 else if (intmask & SDHCI_INT_RESPONSE) 951 else if (intmask & SDHCI_INT_RESPONSE)
953 sdhci_finish_command(host); 952 sdhci_finish_command(host);
@@ -974,13 +973,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
974 } 973 }
975 974
976 if (intmask & SDHCI_INT_DATA_TIMEOUT) 975 if (intmask & SDHCI_INT_DATA_TIMEOUT)
977 host->data->error = MMC_ERR_TIMEOUT; 976 host->data->error = -ETIMEDOUT;
978 else if (intmask & SDHCI_INT_DATA_CRC) 977 else if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT))
979 host->data->error = MMC_ERR_BADCRC; 978 host->data->error = -EILSEQ;
980 else if (intmask & SDHCI_INT_DATA_END_BIT)
981 host->data->error = MMC_ERR_FAILED;
982 979
983 if (host->data->error != MMC_ERR_NONE) 980 if (host->data->error)
984 sdhci_finish_data(host); 981 sdhci_finish_data(host);
985 else { 982 else {
986 if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) 983 if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 8b736e968447..b4a56e5e5132 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -404,14 +404,14 @@ static void tifm_sd_check_status(struct tifm_sd *host)
404 struct tifm_dev *sock = host->dev; 404 struct tifm_dev *sock = host->dev;
405 struct mmc_command *cmd = host->req->cmd; 405 struct mmc_command *cmd = host->req->cmd;
406 406
407 if (cmd->error != MMC_ERR_NONE) 407 if (cmd->error)
408 goto finish_request; 408 goto finish_request;
409 409
410 if (!(host->cmd_flags & CMD_READY)) 410 if (!(host->cmd_flags & CMD_READY))
411 return; 411 return;
412 412
413 if (cmd->data) { 413 if (cmd->data) {
414 if (cmd->data->error != MMC_ERR_NONE) { 414 if (cmd->data->error) {
415 if ((host->cmd_flags & SCMD_ACTIVE) 415 if ((host->cmd_flags & SCMD_ACTIVE)
416 && !(host->cmd_flags & SCMD_READY)) 416 && !(host->cmd_flags & SCMD_READY))
417 return; 417 return;
@@ -504,7 +504,7 @@ static void tifm_sd_card_event(struct tifm_dev *sock)
504{ 504{
505 struct tifm_sd *host; 505 struct tifm_sd *host;
506 unsigned int host_status = 0; 506 unsigned int host_status = 0;
507 int cmd_error = MMC_ERR_NONE; 507 int cmd_error = 0;
508 struct mmc_command *cmd = NULL; 508 struct mmc_command *cmd = NULL;
509 unsigned long flags; 509 unsigned long flags;
510 510
@@ -521,15 +521,15 @@ static void tifm_sd_card_event(struct tifm_dev *sock)
521 writel(host_status & TIFM_MMCSD_ERRMASK, 521 writel(host_status & TIFM_MMCSD_ERRMASK,
522 sock->addr + SOCK_MMCSD_STATUS); 522 sock->addr + SOCK_MMCSD_STATUS);
523 if (host_status & TIFM_MMCSD_CTO) 523 if (host_status & TIFM_MMCSD_CTO)
524 cmd_error = MMC_ERR_TIMEOUT; 524 cmd_error = -ETIMEDOUT;
525 else if (host_status & TIFM_MMCSD_CCRC) 525 else if (host_status & TIFM_MMCSD_CCRC)
526 cmd_error = MMC_ERR_BADCRC; 526 cmd_error = -EILSEQ;
527 527
528 if (cmd->data) { 528 if (cmd->data) {
529 if (host_status & TIFM_MMCSD_DTO) 529 if (host_status & TIFM_MMCSD_DTO)
530 cmd->data->error = MMC_ERR_TIMEOUT; 530 cmd->data->error = -ETIMEDOUT;
531 else if (host_status & TIFM_MMCSD_DCRC) 531 else if (host_status & TIFM_MMCSD_DCRC)
532 cmd->data->error = MMC_ERR_BADCRC; 532 cmd->data->error = -EILSEQ;
533 } 533 }
534 534
535 writel(TIFM_FIFO_INT_SETALL, 535 writel(TIFM_FIFO_INT_SETALL,
@@ -722,7 +722,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
722 return; 722 return;
723 723
724err_out: 724err_out:
725 mrq->cmd->error = MMC_ERR_TIMEOUT; 725 mrq->cmd->error = -ETIMEDOUT;
726 mmc_request_done(mmc, mrq); 726 mmc_request_done(mmc, mrq);
727} 727}
728 728
@@ -1012,9 +1012,9 @@ static void tifm_sd_remove(struct tifm_dev *sock)
1012 writel(TIFM_FIFO_INT_SETALL, 1012 writel(TIFM_FIFO_INT_SETALL,
1013 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); 1013 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
1014 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); 1014 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
1015 host->req->cmd->error = MMC_ERR_TIMEOUT; 1015 host->req->cmd->error = -ENOMEDIUM;
1016 if (host->req->stop) 1016 if (host->req->stop)
1017 host->req->stop->error = MMC_ERR_TIMEOUT; 1017 host->req->stop->error = -ENOMEDIUM;
1018 tasklet_schedule(&host->finish_tasklet); 1018 tasklet_schedule(&host->finish_tasklet);
1019 } 1019 }
1020 spin_unlock_irqrestore(&sock->lock, flags); 1020 spin_unlock_irqrestore(&sock->lock, flags);
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 9bf2a877113b..44968c2279e1 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -317,7 +317,7 @@ static inline void wbsd_get_short_reply(struct wbsd_host *host,
317 * Correct response type? 317 * Correct response type?
318 */ 318 */
319 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) { 319 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) {
320 cmd->error = MMC_ERR_INVALID; 320 cmd->error = -EILSEQ;
321 return; 321 return;
322 } 322 }
323 323
@@ -337,7 +337,7 @@ static inline void wbsd_get_long_reply(struct wbsd_host *host,
337 * Correct response type? 337 * Correct response type?
338 */ 338 */
339 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) { 339 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) {
340 cmd->error = MMC_ERR_INVALID; 340 cmd->error = -EILSEQ;
341 return; 341 return;
342 } 342 }
343 343
@@ -372,7 +372,7 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
372 for (i = 3; i >= 0; i--) 372 for (i = 3; i >= 0; i--)
373 outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); 373 outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR);
374 374
375 cmd->error = MMC_ERR_NONE; 375 cmd->error = 0;
376 376
377 /* 377 /*
378 * Wait for the request to complete. 378 * Wait for the request to complete.
@@ -392,13 +392,13 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
392 392
393 /* Card removed? */ 393 /* Card removed? */
394 if (isr & WBSD_INT_CARD) 394 if (isr & WBSD_INT_CARD)
395 cmd->error = MMC_ERR_TIMEOUT; 395 cmd->error = -ENOMEDIUM;
396 /* Timeout? */ 396 /* Timeout? */
397 else if (isr & WBSD_INT_TIMEOUT) 397 else if (isr & WBSD_INT_TIMEOUT)
398 cmd->error = MMC_ERR_TIMEOUT; 398 cmd->error = -ETIMEDOUT;
399 /* CRC? */ 399 /* CRC? */
400 else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) 400 else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC))
401 cmd->error = MMC_ERR_BADCRC; 401 cmd->error = -EILSEQ;
402 /* All ok */ 402 /* All ok */
403 else { 403 else {
404 if (cmd->flags & MMC_RSP_136) 404 if (cmd->flags & MMC_RSP_136)
@@ -585,7 +585,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
585 ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); 585 ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH);
586 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); 586 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF);
587 } else { 587 } else {
588 data->error = MMC_ERR_INVALID; 588 data->error = -EINVAL;
589 return; 589 return;
590 } 590 }
591 591
@@ -607,7 +607,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
607 */ 607 */
608 BUG_ON(size > 0x10000); 608 BUG_ON(size > 0x10000);
609 if (size > 0x10000) { 609 if (size > 0x10000) {
610 data->error = MMC_ERR_INVALID; 610 data->error = -EINVAL;
611 return; 611 return;
612 } 612 }
613 613
@@ -669,7 +669,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
669 } 669 }
670 } 670 }
671 671
672 data->error = MMC_ERR_NONE; 672 data->error = 0;
673} 673}
674 674
675static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) 675static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
@@ -724,8 +724,8 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
724 "%d bytes left.\n", 724 "%d bytes left.\n",
725 mmc_hostname(host->mmc), count); 725 mmc_hostname(host->mmc), count);
726 726
727 if (data->error == MMC_ERR_NONE) 727 if (!data->error)
728 data->error = MMC_ERR_FAILED; 728 data->error = -EIO;
729 } else { 729 } else {
730 /* 730 /*
731 * Transfer data from DMA buffer to 731 * Transfer data from DMA buffer to
@@ -735,7 +735,7 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
735 wbsd_dma_to_sg(host, data); 735 wbsd_dma_to_sg(host, data);
736 } 736 }
737 737
738 if (data->error != MMC_ERR_NONE) { 738 if (data->error) {
739 if (data->bytes_xfered) 739 if (data->bytes_xfered)
740 data->bytes_xfered -= data->blksz; 740 data->bytes_xfered -= data->blksz;
741 } 741 }
@@ -767,11 +767,10 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
767 host->mrq = mrq; 767 host->mrq = mrq;
768 768
769 /* 769 /*
770 * If there is no card in the slot then 770 * Check that there is actually a card in the slot.
771 * timeout immediatly.
772 */ 771 */
773 if (!(host->flags & WBSD_FCARD_PRESENT)) { 772 if (!(host->flags & WBSD_FCARD_PRESENT)) {
774 cmd->error = MMC_ERR_TIMEOUT; 773 cmd->error = -ENOMEDIUM;
775 goto done; 774 goto done;
776 } 775 }
777 776
@@ -807,7 +806,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
807 "supported by this controller.\n", 806 "supported by this controller.\n",
808 mmc_hostname(host->mmc), cmd->opcode); 807 mmc_hostname(host->mmc), cmd->opcode);
809#endif 808#endif
810 cmd->error = MMC_ERR_INVALID; 809 cmd->error = -EINVAL;
811 810
812 goto done; 811 goto done;
813 }; 812 };
@@ -819,7 +818,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
819 if (cmd->data) { 818 if (cmd->data) {
820 wbsd_prepare_data(host, cmd->data); 819 wbsd_prepare_data(host, cmd->data);
821 820
822 if (cmd->data->error != MMC_ERR_NONE) 821 if (cmd->data->error)
823 goto done; 822 goto done;
824 } 823 }
825 824
@@ -830,7 +829,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
830 * will be finished after the data has 829 * will be finished after the data has
831 * transfered. 830 * transfered.
832 */ 831 */
833 if (cmd->data && (cmd->error == MMC_ERR_NONE)) { 832 if (cmd->data && !cmd->error) {
834 /* 833 /*
835 * Dirty fix for hardware bug. 834 * Dirty fix for hardware bug.
836 */ 835 */
@@ -1033,7 +1032,7 @@ static void wbsd_tasklet_card(unsigned long param)
1033 mmc_hostname(host->mmc)); 1032 mmc_hostname(host->mmc));
1034 wbsd_reset(host); 1033 wbsd_reset(host);
1035 1034
1036 host->mrq->cmd->error = MMC_ERR_FAILED; 1035 host->mrq->cmd->error = -ENOMEDIUM;
1037 tasklet_schedule(&host->finish_tasklet); 1036 tasklet_schedule(&host->finish_tasklet);
1038 } 1037 }
1039 1038
@@ -1097,7 +1096,7 @@ static void wbsd_tasklet_crc(unsigned long param)
1097 1096
1098 DBGF("CRC error\n"); 1097 DBGF("CRC error\n");
1099 1098
1100 data->error = MMC_ERR_BADCRC; 1099 data->error = -EILSEQ;
1101 1100
1102 tasklet_schedule(&host->finish_tasklet); 1101 tasklet_schedule(&host->finish_tasklet);
1103 1102
@@ -1121,7 +1120,7 @@ static void wbsd_tasklet_timeout(unsigned long param)
1121 1120
1122 DBGF("Timeout\n"); 1121 DBGF("Timeout\n");
1123 1122
1124 data->error = MMC_ERR_TIMEOUT; 1123 data->error = -ETIMEDOUT;
1125 1124
1126 tasklet_schedule(&host->finish_tasklet); 1125 tasklet_schedule(&host->finish_tasklet);
1127 1126