diff options
author | Eric Bénard <eric@eukrea.com> | 2010-05-19 12:46:04 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-07-26 08:17:46 -0400 |
commit | 16b3bf8c85a5dc821eea7f9bb48d13b32f42f7ee (patch) | |
tree | 2b7bf9906b26f1995f9beb8b647704e07c7298d6 /drivers/mmc/host/mxcmmc.c | |
parent | ebfc7e6e13ea61d6f9b3e5353e63f4d185a516b9 (diff) |
mxcmmc: add card detect through DAT3 possibility
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mmc/host/mxcmmc.c')
-rw-r--r-- | drivers/mmc/host/mxcmmc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index ec18e3b60342..74c87e023866 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -119,6 +119,7 @@ struct mxcmci_host { | |||
119 | int detect_irq; | 119 | int detect_irq; |
120 | int dma; | 120 | int dma; |
121 | int do_dma; | 121 | int do_dma; |
122 | int default_irq_mask; | ||
122 | int use_sdio; | 123 | int use_sdio; |
123 | unsigned int power_mode; | 124 | unsigned int power_mode; |
124 | struct imxmmc_platform_data *pdata; | 125 | struct imxmmc_platform_data *pdata; |
@@ -228,7 +229,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
228 | static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, | 229 | static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, |
229 | unsigned int cmdat) | 230 | unsigned int cmdat) |
230 | { | 231 | { |
231 | u32 int_cntr; | 232 | u32 int_cntr = host->default_irq_mask; |
232 | unsigned long flags; | 233 | unsigned long flags; |
233 | 234 | ||
234 | WARN_ON(host->cmd != NULL); | 235 | WARN_ON(host->cmd != NULL); |
@@ -275,7 +276,7 @@ static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, | |||
275 | static void mxcmci_finish_request(struct mxcmci_host *host, | 276 | static void mxcmci_finish_request(struct mxcmci_host *host, |
276 | struct mmc_request *req) | 277 | struct mmc_request *req) |
277 | { | 278 | { |
278 | u32 int_cntr = 0; | 279 | u32 int_cntr = host->default_irq_mask; |
279 | unsigned long flags; | 280 | unsigned long flags; |
280 | 281 | ||
281 | spin_lock_irqsave(&host->lock, flags); | 282 | spin_lock_irqsave(&host->lock, flags); |
@@ -585,6 +586,9 @@ static irqreturn_t mxcmci_irq(int irq, void *devid) | |||
585 | (stat & (STATUS_DATA_TRANS_DONE | STATUS_WRITE_OP_DONE))) | 586 | (stat & (STATUS_DATA_TRANS_DONE | STATUS_WRITE_OP_DONE))) |
586 | mxcmci_data_done(host, stat); | 587 | mxcmci_data_done(host, stat); |
587 | #endif | 588 | #endif |
589 | if (host->default_irq_mask && | ||
590 | (stat & (STATUS_CARD_INSERTION | STATUS_CARD_REMOVAL))) | ||
591 | mmc_detect_change(host->mmc, msecs_to_jiffies(200)); | ||
588 | return IRQ_HANDLED; | 592 | return IRQ_HANDLED; |
589 | } | 593 | } |
590 | 594 | ||
@@ -809,6 +813,12 @@ static int mxcmci_probe(struct platform_device *pdev) | |||
809 | else | 813 | else |
810 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 814 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
811 | 815 | ||
816 | if (host->pdata && host->pdata->dat3_card_detect) | ||
817 | host->default_irq_mask = | ||
818 | INT_CARD_INSERTION_EN | INT_CARD_REMOVAL_EN; | ||
819 | else | ||
820 | host->default_irq_mask = 0; | ||
821 | |||
812 | host->res = r; | 822 | host->res = r; |
813 | host->irq = irq; | 823 | host->irq = irq; |
814 | 824 | ||
@@ -835,7 +845,7 @@ static int mxcmci_probe(struct platform_device *pdev) | |||
835 | /* recommended in data sheet */ | 845 | /* recommended in data sheet */ |
836 | writew(0x2db4, host->base + MMC_REG_READ_TO); | 846 | writew(0x2db4, host->base + MMC_REG_READ_TO); |
837 | 847 | ||
838 | writel(0, host->base + MMC_REG_INT_CNTR); | 848 | writel(host->default_irq_mask, host->base + MMC_REG_INT_CNTR); |
839 | 849 | ||
840 | #ifdef HAS_DMA | 850 | #ifdef HAS_DMA |
841 | host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW); | 851 | host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW); |