aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/atmel-mci.c
diff options
context:
space:
mode:
authorLudovic Desroches <ludovic.desroches@atmel.com>2011-08-11 11:25:42 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 15:43:25 -0400
commit03fc9a7f0c48a05ca548cd277835d7da97ed6936 (patch)
tree2d4500c4379073c4ad3b9f7f1264e9fa0b0b17f9 /drivers/mmc/host/atmel-mci.c
parent2c96a293bbd6b34698c6710ea8607049956247c4 (diff)
mmc: atmel-mci: change atmci_readl and atmci_writel macros
Change atmci_readl and atmci_writel macros: remove string concatenation. We can use these macros with registers which are not prefixed by ATMCI_. This is the case if we want to write PDC registers which are common to several devices so they are not prefixed with ATMCI_. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r--drivers/mmc/host/atmel-mci.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index c2a0949f3257..87eeccc6d9a4 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -499,7 +499,7 @@ static void atmci_set_timeout(struct atmel_mci *host,
499 499
500 dev_vdbg(&slot->mmc->class_dev, "setting timeout to %u cycles\n", 500 dev_vdbg(&slot->mmc->class_dev, "setting timeout to %u cycles\n",
501 dtocyc << dtomul_to_shift[dtomul]); 501 dtocyc << dtomul_to_shift[dtomul]);
502 atmci_writel(host, DTOR, (ATMCI_DTOMUL(dtomul) | ATMCI_DTOCYC(dtocyc))); 502 atmci_writel(host, ATMCI_DTOR, (ATMCI_DTOMUL(dtomul) | ATMCI_DTOCYC(dtocyc)));
503} 503}
504 504
505/* 505/*
@@ -564,14 +564,14 @@ static void atmci_start_command(struct atmel_mci *host,
564 "start command: ARGR=0x%08x CMDR=0x%08x\n", 564 "start command: ARGR=0x%08x CMDR=0x%08x\n",
565 cmd->arg, cmd_flags); 565 cmd->arg, cmd_flags);
566 566
567 atmci_writel(host, ARGR, cmd->arg); 567 atmci_writel(host, ATMCI_ARGR, cmd->arg);
568 atmci_writel(host, CMDR, cmd_flags); 568 atmci_writel(host, ATMCI_CMDR, cmd_flags);
569} 569}
570 570
571static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data) 571static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)
572{ 572{
573 atmci_start_command(host, data->stop, host->stop_cmdr); 573 atmci_start_command(host, data->stop, host->stop_cmdr);
574 atmci_writel(host, IER, ATMCI_CMDRDY); 574 atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY);
575} 575}
576 576
577#ifdef CONFIG_MMC_ATMELMCI_DMA 577#ifdef CONFIG_MMC_ATMELMCI_DMA
@@ -596,7 +596,7 @@ static void atmci_stop_dma(struct atmel_mci *host)
596 } else { 596 } else {
597 /* Data transfer was stopped by the interrupt handler */ 597 /* Data transfer was stopped by the interrupt handler */
598 atmci_set_pending(host, EVENT_XFER_COMPLETE); 598 atmci_set_pending(host, EVENT_XFER_COMPLETE);
599 atmci_writel(host, IER, ATMCI_NOTBUSY); 599 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
600 } 600 }
601} 601}
602 602
@@ -610,7 +610,7 @@ static void atmci_dma_complete(void *arg)
610 610
611 if (atmci_is_mci2()) 611 if (atmci_is_mci2())
612 /* Disable DMA hardware handshaking on MCI */ 612 /* Disable DMA hardware handshaking on MCI */
613 atmci_writel(host, DMA, atmci_readl(host, DMA) & ~ATMCI_DMAEN); 613 atmci_writel(host, ATMCI_DMA, atmci_readl(host, ATMCI_DMA) & ~ATMCI_DMAEN);
614 614
615 atmci_dma_cleanup(host); 615 atmci_dma_cleanup(host);
616 616
@@ -642,7 +642,7 @@ static void atmci_dma_complete(void *arg)
642 * completion callback" rule of the dma engine 642 * completion callback" rule of the dma engine
643 * framework. 643 * framework.
644 */ 644 */
645 atmci_writel(host, IER, ATMCI_NOTBUSY); 645 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
646 } 646 }
647} 647}
648 648
@@ -680,7 +680,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
680 return -ENODEV; 680 return -ENODEV;
681 681
682 if (atmci_is_mci2()) 682 if (atmci_is_mci2())
683 atmci_writel(host, DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); 683 atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
684 684
685 if (data->flags & MMC_DATA_READ) 685 if (data->flags & MMC_DATA_READ)
686 direction = DMA_FROM_DEVICE; 686 direction = DMA_FROM_DEVICE;
@@ -730,7 +730,7 @@ static void atmci_stop_dma(struct atmel_mci *host)
730{ 730{
731 /* Data transfer was stopped by the interrupt handler */ 731 /* Data transfer was stopped by the interrupt handler */
732 atmci_set_pending(host, EVENT_XFER_COMPLETE); 732 atmci_set_pending(host, EVENT_XFER_COMPLETE);
733 atmci_writel(host, IER, ATMCI_NOTBUSY); 733 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
734} 734}
735 735
736#endif /* CONFIG_MMC_ATMELMCI_DMA */ 736#endif /* CONFIG_MMC_ATMELMCI_DMA */
@@ -793,24 +793,24 @@ static void atmci_start_request(struct atmel_mci *host,
793 host->data_status = 0; 793 host->data_status = 0;
794 794
795 if (host->need_reset) { 795 if (host->need_reset) {
796 atmci_writel(host, CR, ATMCI_CR_SWRST); 796 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
797 atmci_writel(host, CR, ATMCI_CR_MCIEN); 797 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
798 atmci_writel(host, MR, host->mode_reg); 798 atmci_writel(host, ATMCI_MR, host->mode_reg);
799 if (atmci_is_mci2()) 799 if (atmci_is_mci2())
800 atmci_writel(host, CFG, host->cfg_reg); 800 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
801 host->need_reset = false; 801 host->need_reset = false;
802 } 802 }
803 atmci_writel(host, SDCR, slot->sdc_reg); 803 atmci_writel(host, ATMCI_SDCR, slot->sdc_reg);
804 804
805 iflags = atmci_readl(host, IMR); 805 iflags = atmci_readl(host, ATMCI_IMR);
806 if (iflags & ~(ATMCI_SDIOIRQA | ATMCI_SDIOIRQB)) 806 if (iflags & ~(ATMCI_SDIOIRQA | ATMCI_SDIOIRQB))
807 dev_warn(&slot->mmc->class_dev, "WARNING: IMR=0x%08x\n", 807 dev_warn(&slot->mmc->class_dev, "WARNING: IMR=0x%08x\n",
808 iflags); 808 iflags);
809 809
810 if (unlikely(test_and_clear_bit(ATMCI_CARD_NEED_INIT, &slot->flags))) { 810 if (unlikely(test_and_clear_bit(ATMCI_CARD_NEED_INIT, &slot->flags))) {
811 /* Send init sequence (74 clock cycles) */ 811 /* Send init sequence (74 clock cycles) */
812 atmci_writel(host, CMDR, ATMCI_CMDR_SPCMD_INIT); 812 atmci_writel(host, ATMCI_CMDR, ATMCI_CMDR_SPCMD_INIT);
813 while (!(atmci_readl(host, SR) & ATMCI_CMDRDY)) 813 while (!(atmci_readl(host, ATMCI_SR) & ATMCI_CMDRDY))
814 cpu_relax(); 814 cpu_relax();
815 } 815 }
816 iflags = 0; 816 iflags = 0;
@@ -819,7 +819,7 @@ static void atmci_start_request(struct atmel_mci *host,
819 atmci_set_timeout(host, slot, data); 819 atmci_set_timeout(host, slot, data);
820 820
821 /* Must set block count/size before sending command */ 821 /* Must set block count/size before sending command */
822 atmci_writel(host, BLKR, ATMCI_BCNT(data->blocks) 822 atmci_writel(host, ATMCI_BLKR, ATMCI_BCNT(data->blocks)
823 | ATMCI_BLKLEN(data->blksz)); 823 | ATMCI_BLKLEN(data->blksz));
824 dev_vdbg(&slot->mmc->class_dev, "BLKR=0x%08x\n", 824 dev_vdbg(&slot->mmc->class_dev, "BLKR=0x%08x\n",
825 ATMCI_BCNT(data->blocks) | ATMCI_BLKLEN(data->blksz)); 825 ATMCI_BCNT(data->blocks) | ATMCI_BLKLEN(data->blksz));
@@ -852,7 +852,7 @@ static void atmci_start_request(struct atmel_mci *host,
852 * conditions (e.g. command and data complete, but stop not 852 * conditions (e.g. command and data complete, but stop not
853 * prepared yet.) 853 * prepared yet.)
854 */ 854 */
855 atmci_writel(host, IER, iflags); 855 atmci_writel(host, ATMCI_IER, iflags);
856} 856}
857 857
858static void atmci_queue_request(struct atmel_mci *host, 858static void atmci_queue_request(struct atmel_mci *host,
@@ -927,10 +927,10 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
927 spin_lock_bh(&host->lock); 927 spin_lock_bh(&host->lock);
928 if (!host->mode_reg) { 928 if (!host->mode_reg) {
929 clk_enable(host->mck); 929 clk_enable(host->mck);
930 atmci_writel(host, CR, ATMCI_CR_SWRST); 930 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
931 atmci_writel(host, CR, ATMCI_CR_MCIEN); 931 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
932 if (atmci_is_mci2()) 932 if (atmci_is_mci2())
933 atmci_writel(host, CFG, host->cfg_reg); 933 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
934 } 934 }
935 935
936 /* 936 /*
@@ -972,9 +972,9 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
972 } 972 }
973 973
974 if (list_empty(&host->queue)) { 974 if (list_empty(&host->queue)) {
975 atmci_writel(host, MR, host->mode_reg); 975 atmci_writel(host, ATMCI_MR, host->mode_reg);
976 if (atmci_is_mci2()) 976 if (atmci_is_mci2())
977 atmci_writel(host, CFG, host->cfg_reg); 977 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
978 } else { 978 } else {
979 host->need_clock_update = true; 979 host->need_clock_update = true;
980 } 980 }
@@ -992,9 +992,9 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
992 } 992 }
993 } 993 }
994 if (!any_slot_active) { 994 if (!any_slot_active) {
995 atmci_writel(host, CR, ATMCI_CR_MCIDIS); 995 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
996 if (host->mode_reg) { 996 if (host->mode_reg) {
997 atmci_readl(host, MR); 997 atmci_readl(host, ATMCI_MR);
998 clk_disable(host->mck); 998 clk_disable(host->mck);
999 } 999 }
1000 host->mode_reg = 0; 1000 host->mode_reg = 0;
@@ -1058,9 +1058,9 @@ static void atmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
1058 struct atmel_mci *host = slot->host; 1058 struct atmel_mci *host = slot->host;
1059 1059
1060 if (enable) 1060 if (enable)
1061 atmci_writel(host, IER, slot->sdio_irq); 1061 atmci_writel(host, ATMCI_IER, slot->sdio_irq);
1062 else 1062 else
1063 atmci_writel(host, IDR, slot->sdio_irq); 1063 atmci_writel(host, ATMCI_IDR, slot->sdio_irq);
1064} 1064}
1065 1065
1066static const struct mmc_host_ops atmci_ops = { 1066static const struct mmc_host_ops atmci_ops = {
@@ -1087,9 +1087,9 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
1087 * busy transferring data. 1087 * busy transferring data.
1088 */ 1088 */
1089 if (host->need_clock_update) { 1089 if (host->need_clock_update) {
1090 atmci_writel(host, MR, host->mode_reg); 1090 atmci_writel(host, ATMCI_MR, host->mode_reg);
1091 if (atmci_is_mci2()) 1091 if (atmci_is_mci2())
1092 atmci_writel(host, CFG, host->cfg_reg); 1092 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
1093 } 1093 }
1094 1094
1095 host->cur_slot->mrq = NULL; 1095 host->cur_slot->mrq = NULL;
@@ -1118,10 +1118,10 @@ static void atmci_command_complete(struct atmel_mci *host,
1118 u32 status = host->cmd_status; 1118 u32 status = host->cmd_status;
1119 1119
1120 /* Read the response from the card (up to 16 bytes) */ 1120 /* Read the response from the card (up to 16 bytes) */
1121 cmd->resp[0] = atmci_readl(host, RSPR); 1121 cmd->resp[0] = atmci_readl(host, ATMCI_RSPR);
1122 cmd->resp[1] = atmci_readl(host, RSPR); 1122 cmd->resp[1] = atmci_readl(host, ATMCI_RSPR);
1123 cmd->resp[2] = atmci_readl(host, RSPR); 1123 cmd->resp[2] = atmci_readl(host, ATMCI_RSPR);
1124 cmd->resp[3] = atmci_readl(host, RSPR); 1124 cmd->resp[3] = atmci_readl(host, ATMCI_RSPR);
1125 1125
1126 if (status & ATMCI_RTOE) 1126 if (status & ATMCI_RTOE)
1127 cmd->error = -ETIMEDOUT; 1127 cmd->error = -ETIMEDOUT;
@@ -1139,7 +1139,7 @@ static void atmci_command_complete(struct atmel_mci *host,
1139 if (cmd->data) { 1139 if (cmd->data) {
1140 atmci_stop_dma(host); 1140 atmci_stop_dma(host);
1141 host->data = NULL; 1141 host->data = NULL;
1142 atmci_writel(host, IDR, ATMCI_NOTBUSY 1142 atmci_writel(host, ATMCI_IDR, ATMCI_NOTBUSY
1143 | ATMCI_TXRDY | ATMCI_RXRDY 1143 | ATMCI_TXRDY | ATMCI_RXRDY
1144 | ATMCI_DATA_ERROR_FLAGS); 1144 | ATMCI_DATA_ERROR_FLAGS);
1145 } 1145 }
@@ -1192,11 +1192,11 @@ static void atmci_detect_change(unsigned long data)
1192 * Reset controller to terminate any ongoing 1192 * Reset controller to terminate any ongoing
1193 * commands or data transfers. 1193 * commands or data transfers.
1194 */ 1194 */
1195 atmci_writel(host, CR, ATMCI_CR_SWRST); 1195 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
1196 atmci_writel(host, CR, ATMCI_CR_MCIEN); 1196 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
1197 atmci_writel(host, MR, host->mode_reg); 1197 atmci_writel(host, ATMCI_MR, host->mode_reg);
1198 if (atmci_is_mci2()) 1198 if (atmci_is_mci2())
1199 atmci_writel(host, CFG, host->cfg_reg); 1199 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
1200 1200
1201 host->data = NULL; 1201 host->data = NULL;
1202 host->cmd = NULL; 1202 host->cmd = NULL;
@@ -1262,7 +1262,7 @@ static void atmci_tasklet_func(unsigned long priv)
1262 dev_vdbg(&host->pdev->dev, 1262 dev_vdbg(&host->pdev->dev,
1263 "tasklet: state %u pending/completed/mask %lx/%lx/%x\n", 1263 "tasklet: state %u pending/completed/mask %lx/%lx/%x\n",
1264 state, host->pending_events, host->completed_events, 1264 state, host->pending_events, host->completed_events,
1265 atmci_readl(host, IMR)); 1265 atmci_readl(host, ATMCI_IMR));
1266 1266
1267 do { 1267 do {
1268 prev_state = state; 1268 prev_state = state;
@@ -1331,7 +1331,7 @@ static void atmci_tasklet_func(unsigned long priv)
1331 } else { 1331 } else {
1332 data->bytes_xfered = data->blocks * data->blksz; 1332 data->bytes_xfered = data->blocks * data->blksz;
1333 data->error = 0; 1333 data->error = 0;
1334 atmci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS); 1334 atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS);
1335 } 1335 }
1336 1336
1337 if (!data->stop) { 1337 if (!data->stop) {
@@ -1381,7 +1381,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
1381 unsigned int nbytes = 0; 1381 unsigned int nbytes = 0;
1382 1382
1383 do { 1383 do {
1384 value = atmci_readl(host, RDR); 1384 value = atmci_readl(host, ATMCI_RDR);
1385 if (likely(offset + 4 <= sg->length)) { 1385 if (likely(offset + 4 <= sg->length)) {
1386 put_unaligned(value, (u32 *)(buf + offset)); 1386 put_unaligned(value, (u32 *)(buf + offset));
1387 1387
@@ -1413,9 +1413,9 @@ static void atmci_read_data_pio(struct atmel_mci *host)
1413 nbytes += offset; 1413 nbytes += offset;
1414 } 1414 }
1415 1415
1416 status = atmci_readl(host, SR); 1416 status = atmci_readl(host, ATMCI_SR);
1417 if (status & ATMCI_DATA_ERROR_FLAGS) { 1417 if (status & ATMCI_DATA_ERROR_FLAGS) {
1418 atmci_writel(host, IDR, (ATMCI_NOTBUSY | ATMCI_RXRDY 1418 atmci_writel(host, ATMCI_IDR, (ATMCI_NOTBUSY | ATMCI_RXRDY
1419 | ATMCI_DATA_ERROR_FLAGS)); 1419 | ATMCI_DATA_ERROR_FLAGS));
1420 host->data_status = status; 1420 host->data_status = status;
1421 data->bytes_xfered += nbytes; 1421 data->bytes_xfered += nbytes;
@@ -1432,8 +1432,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
1432 return; 1432 return;
1433 1433
1434done: 1434done:
1435 atmci_writel(host, IDR, ATMCI_RXRDY); 1435 atmci_writel(host, ATMCI_IDR, ATMCI_RXRDY);
1436 atmci_writel(host, IER, ATMCI_NOTBUSY); 1436 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
1437 data->bytes_xfered += nbytes; 1437 data->bytes_xfered += nbytes;
1438 smp_wmb(); 1438 smp_wmb();
1439 atmci_set_pending(host, EVENT_XFER_COMPLETE); 1439 atmci_set_pending(host, EVENT_XFER_COMPLETE);
@@ -1452,7 +1452,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
1452 do { 1452 do {
1453 if (likely(offset + 4 <= sg->length)) { 1453 if (likely(offset + 4 <= sg->length)) {
1454 value = get_unaligned((u32 *)(buf + offset)); 1454 value = get_unaligned((u32 *)(buf + offset));
1455 atmci_writel(host, TDR, value); 1455 atmci_writel(host, ATMCI_TDR, value);
1456 1456
1457 offset += 4; 1457 offset += 4;
1458 nbytes += 4; 1458 nbytes += 4;
@@ -1473,20 +1473,20 @@ static void atmci_write_data_pio(struct atmel_mci *host)
1473 1473
1474 host->sg = sg = sg_next(sg); 1474 host->sg = sg = sg_next(sg);
1475 if (!sg) { 1475 if (!sg) {
1476 atmci_writel(host, TDR, value); 1476 atmci_writel(host, ATMCI_TDR, value);
1477 goto done; 1477 goto done;
1478 } 1478 }
1479 1479
1480 offset = 4 - remaining; 1480 offset = 4 - remaining;
1481 buf = sg_virt(sg); 1481 buf = sg_virt(sg);
1482 memcpy((u8 *)&value + remaining, buf, offset); 1482 memcpy((u8 *)&value + remaining, buf, offset);
1483 atmci_writel(host, TDR, value); 1483 atmci_writel(host, ATMCI_TDR, value);
1484 nbytes += offset; 1484 nbytes += offset;
1485 } 1485 }
1486 1486
1487 status = atmci_readl(host, SR); 1487 status = atmci_readl(host, ATMCI_SR);
1488 if (status & ATMCI_DATA_ERROR_FLAGS) { 1488 if (status & ATMCI_DATA_ERROR_FLAGS) {
1489 atmci_writel(host, IDR, (ATMCI_NOTBUSY | ATMCI_TXRDY 1489 atmci_writel(host, ATMCI_IDR, (ATMCI_NOTBUSY | ATMCI_TXRDY
1490 | ATMCI_DATA_ERROR_FLAGS)); 1490 | ATMCI_DATA_ERROR_FLAGS));
1491 host->data_status = status; 1491 host->data_status = status;
1492 data->bytes_xfered += nbytes; 1492 data->bytes_xfered += nbytes;
@@ -1503,8 +1503,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
1503 return; 1503 return;
1504 1504
1505done: 1505done:
1506 atmci_writel(host, IDR, ATMCI_TXRDY); 1506 atmci_writel(host, ATMCI_IDR, ATMCI_TXRDY);
1507 atmci_writel(host, IER, ATMCI_NOTBUSY); 1507 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
1508 data->bytes_xfered += nbytes; 1508 data->bytes_xfered += nbytes;
1509 smp_wmb(); 1509 smp_wmb();
1510 atmci_set_pending(host, EVENT_XFER_COMPLETE); 1510 atmci_set_pending(host, EVENT_XFER_COMPLETE);
@@ -1512,7 +1512,7 @@ done:
1512 1512
1513static void atmci_cmd_interrupt(struct atmel_mci *host, u32 status) 1513static void atmci_cmd_interrupt(struct atmel_mci *host, u32 status)
1514{ 1514{
1515 atmci_writel(host, IDR, ATMCI_CMDRDY); 1515 atmci_writel(host, ATMCI_IDR, ATMCI_CMDRDY);
1516 1516
1517 host->cmd_status = status; 1517 host->cmd_status = status;
1518 smp_wmb(); 1518 smp_wmb();
@@ -1540,16 +1540,16 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
1540 unsigned int pass_count = 0; 1540 unsigned int pass_count = 0;
1541 1541
1542 do { 1542 do {
1543 status = atmci_readl(host, SR); 1543 status = atmci_readl(host, ATMCI_SR);
1544 mask = atmci_readl(host, IMR); 1544 mask = atmci_readl(host, ATMCI_IMR);
1545 pending = status & mask; 1545 pending = status & mask;
1546 if (!pending) 1546 if (!pending)
1547 break; 1547 break;
1548 1548
1549 if (pending & ATMCI_DATA_ERROR_FLAGS) { 1549 if (pending & ATMCI_DATA_ERROR_FLAGS) {
1550 atmci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS 1550 atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS
1551 | ATMCI_RXRDY | ATMCI_TXRDY); 1551 | ATMCI_RXRDY | ATMCI_TXRDY);
1552 pending &= atmci_readl(host, IMR); 1552 pending &= atmci_readl(host, ATMCI_IMR);
1553 1553
1554 host->data_status = status; 1554 host->data_status = status;
1555 smp_wmb(); 1555 smp_wmb();
@@ -1557,7 +1557,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
1557 tasklet_schedule(&host->tasklet); 1557 tasklet_schedule(&host->tasklet);
1558 } 1558 }
1559 if (pending & ATMCI_NOTBUSY) { 1559 if (pending & ATMCI_NOTBUSY) {
1560 atmci_writel(host, IDR, 1560 atmci_writel(host, ATMCI_IDR,
1561 ATMCI_DATA_ERROR_FLAGS | ATMCI_NOTBUSY); 1561 ATMCI_DATA_ERROR_FLAGS | ATMCI_NOTBUSY);
1562 if (!host->data_status) 1562 if (!host->data_status)
1563 host->data_status = status; 1563 host->data_status = status;
@@ -1790,7 +1790,7 @@ static int __init atmci_probe(struct platform_device *pdev)
1790 goto err_ioremap; 1790 goto err_ioremap;
1791 1791
1792 clk_enable(host->mck); 1792 clk_enable(host->mck);
1793 atmci_writel(host, CR, ATMCI_CR_SWRST); 1793 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
1794 host->bus_hz = clk_get_rate(host->mck); 1794 host->bus_hz = clk_get_rate(host->mck);
1795 clk_disable(host->mck); 1795 clk_disable(host->mck);
1796 1796
@@ -1861,9 +1861,9 @@ static int __exit atmci_remove(struct platform_device *pdev)
1861 } 1861 }
1862 1862
1863 clk_enable(host->mck); 1863 clk_enable(host->mck);
1864 atmci_writel(host, IDR, ~0UL); 1864 atmci_writel(host, ATMCI_IDR, ~0UL);
1865 atmci_writel(host, CR, ATMCI_CR_MCIDIS); 1865 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
1866 atmci_readl(host, SR); 1866 atmci_readl(host, ATMCI_SR);
1867 clk_disable(host->mck); 1867 clk_disable(host->mck);
1868 1868
1869#ifdef CONFIG_MMC_ATMELMCI_DMA 1869#ifdef CONFIG_MMC_ATMELMCI_DMA