aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/wbsd.c
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/wbsd.c
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/wbsd.c')
-rw-r--r--drivers/mmc/host/wbsd.c41
1 files changed, 20 insertions, 21 deletions
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