aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/au1xmmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/au1xmmc.c')
-rw-r--r--drivers/mmc/host/au1xmmc.c32
1 files changed, 16 insertions, 16 deletions
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);