aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorEric Benard <ebenard@free.fr>2008-05-30 08:26:05 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 08:14:42 -0400
commit7a6588ba20aed4505da912f9dd73616e9bd9ba67 (patch)
treefed9ddbfce1527ea26541e306e488223246c4359 /drivers/mmc
parent3eb99a7bff3d7459a695f45124a6bbabf31cb4b5 (diff)
mmc: at91_mci: add sdio irq management
Enable SDIO interrupt handling. Signed-off-by: Eric Benard <ebenard@free.fr> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/at91_mci.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index b2bb79e74eaa..9b546a97aa44 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -665,7 +665,7 @@ static void at91_mci_completed_command(struct at91mci_host *host)
665 struct mmc_command *cmd = host->cmd; 665 struct mmc_command *cmd = host->cmd;
666 unsigned int status; 666 unsigned int status;
667 667
668 at91_mci_write(host, AT91_MCI_IDR, 0xffffffff); 668 at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
669 669
670 cmd->resp[0] = at91_mci_read(host, AT91_MCI_RSPR(0)); 670 cmd->resp[0] = at91_mci_read(host, AT91_MCI_RSPR(0));
671 cmd->resp[1] = at91_mci_read(host, AT91_MCI_RSPR(1)); 671 cmd->resp[1] = at91_mci_read(host, AT91_MCI_RSPR(1));
@@ -856,6 +856,12 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
856 } 856 }
857 } 857 }
858 858
859 if (int_status & AT91_MCI_SDIOIRQA)
860 mmc_signal_sdio_irq(host->mmc);
861
862 if (int_status & AT91_MCI_SDIOIRQB)
863 mmc_signal_sdio_irq(host->mmc);
864
859 if (int_status & AT91_MCI_TXRDY) 865 if (int_status & AT91_MCI_TXRDY)
860 pr_debug("Ready to transmit\n"); 866 pr_debug("Ready to transmit\n");
861 867
@@ -870,10 +876,10 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
870 876
871 if (completed) { 877 if (completed) {
872 pr_debug("Completed command\n"); 878 pr_debug("Completed command\n");
873 at91_mci_write(host, AT91_MCI_IDR, 0xffffffff); 879 at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
874 at91_mci_completed_command(host); 880 at91_mci_completed_command(host);
875 } else 881 } else
876 at91_mci_write(host, AT91_MCI_IDR, int_status); 882 at91_mci_write(host, AT91_MCI_IDR, int_status & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
877 883
878 return IRQ_HANDLED; 884 return IRQ_HANDLED;
879} 885}
@@ -913,10 +919,22 @@ static int at91_mci_get_ro(struct mmc_host *mmc)
913 return -ENOSYS; 919 return -ENOSYS;
914} 920}
915 921
922static void at91_mci_enable_sdio_irq(struct mmc_host *mmc, int enable)
923{
924 struct at91mci_host *host = mmc_priv(mmc);
925
926 pr_debug("%s: sdio_irq %c : %s\n", mmc_hostname(host->mmc),
927 host->board->slot_b ? 'B':'A', enable ? "enable" : "disable");
928 at91_mci_write(host, enable ? AT91_MCI_IER : AT91_MCI_IDR,
929 host->board->slot_b ? AT91_MCI_SDIOIRQB : AT91_MCI_SDIOIRQA);
930
931}
932
916static const struct mmc_host_ops at91_mci_ops = { 933static const struct mmc_host_ops at91_mci_ops = {
917 .request = at91_mci_request, 934 .request = at91_mci_request,
918 .set_ios = at91_mci_set_ios, 935 .set_ios = at91_mci_set_ios,
919 .get_ro = at91_mci_get_ro, 936 .get_ro = at91_mci_get_ro,
937 .enable_sdio_irq = at91_mci_enable_sdio_irq,
920}; 938};
921 939
922/* 940/*
@@ -947,7 +965,7 @@ static int __init at91_mci_probe(struct platform_device *pdev)
947 mmc->f_min = 375000; 965 mmc->f_min = 375000;
948 mmc->f_max = 25000000; 966 mmc->f_max = 25000000;
949 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 967 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
950 mmc->caps = MMC_CAP_MULTIWRITE; 968 mmc->caps = MMC_CAP_MULTIWRITE | MMC_CAP_SDIO_IRQ;
951 969
952 mmc->max_blk_size = 4095; 970 mmc->max_blk_size = 4095;
953 mmc->max_blk_count = mmc->max_req_size; 971 mmc->max_blk_count = mmc->max_req_size;