aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/tmio_mmc_pio.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-10-24 09:58:45 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-09-09 07:59:08 -0400
commit7501c4315faf46b088ed4de4d8695a91d7d63869 (patch)
tree2e377486f7ff322a5b10e4fa4d5f89347125b1be /drivers/mmc/host/tmio_mmc_pio.c
parent215ba3995ae89866a58b8df41136811c665a22b9 (diff)
mmc: tmio: Keep host active while SDIO IRQ is enabled
The host must be kept active to be able to serve SDIO IRQs, thus let's prevent it from going inactive while SDIO IRQ is enabled. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Diffstat (limited to 'drivers/mmc/host/tmio_mmc_pio.c')
-rw-r--r--drivers/mmc/host/tmio_mmc_pio.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index faf0924e71cb..5c2e5a36258a 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -129,15 +129,22 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
129{ 129{
130 struct tmio_mmc_host *host = mmc_priv(mmc); 130 struct tmio_mmc_host *host = mmc_priv(mmc);
131 131
132 if (enable) { 132 if (enable && !host->sdio_irq_enabled) {
133 /* Keep device active while SDIO irq is enabled */
134 pm_runtime_get_sync(mmc_dev(mmc));
135 host->sdio_irq_enabled = true;
136
133 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL & 137 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL &
134 ~TMIO_SDIO_STAT_IOIRQ; 138 ~TMIO_SDIO_STAT_IOIRQ;
135 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); 139 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);
136 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); 140 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
137 } else { 141 } else if (!enable && host->sdio_irq_enabled) {
138 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; 142 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
139 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); 143 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
140 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000); 144 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);
145
146 host->sdio_irq_enabled = false;
147 pm_runtime_put(mmc_dev(mmc));
141 } 148 }
142} 149}
143 150
@@ -1074,8 +1081,12 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
1074 1081
1075 _host->sdcard_irq_mask &= ~irq_mask; 1082 _host->sdcard_irq_mask &= ~irq_mask;
1076 1083
1077 if (pdata->flags & TMIO_MMC_SDIO_IRQ) 1084 _host->sdio_irq_enabled = false;
1078 tmio_mmc_enable_sdio_irq(mmc, 0); 1085 if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
1086 _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
1087 sd_ctrl_write16(_host, CTL_SDIO_IRQ_MASK, _host->sdio_irq_mask);
1088 sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0000);
1089 }
1079 1090
1080 spin_lock_init(&_host->lock); 1091 spin_lock_init(&_host->lock);
1081 mutex_init(&_host->ios_lock); 1092 mutex_init(&_host->ios_lock);