16 #include <linux/kernel.h>
17 #include <linux/sched.h>
19 #include <linux/export.h>
20 #include <linux/wait.h>
31 static int process_sdio_pending_irqs(
struct mmc_host *
host)
35 unsigned char pending;
51 pr_debug(
"%s: error %d reading SDIO_CCCR_INTx\n",
57 for (i = 1; i <= 7; i++) {
58 if (pending & (1 << i)) {
62 "non-existent function\n",
69 pr_warning(
"%s: pending IRQ with no handler\n",
82 static int sdio_irq_thread(
void *_host)
86 unsigned long period, idle_period;
101 pr_debug(
"%s: IRQ thread started (poll period = %lu jiffies)\n",
121 ret = process_sdio_pending_irqs(host);
146 if (period > idle_period)
147 period = idle_period;
153 mmc_host_clk_hold(host);
154 host->
ops->enable_sdio_irq(host, 1);
155 mmc_host_clk_release(host);
163 mmc_host_clk_hold(host);
164 host->
ops->enable_sdio_irq(host, 0);
165 mmc_host_clk_release(host);
168 pr_debug(
"%s: IRQ thread exiting with code %d\n",
174 static int sdio_card_irq_get(
struct mmc_card *card)
195 static int sdio_card_irq_put(
struct mmc_card *card)
211 static void sdio_single_irq_set(
struct mmc_card *card)
218 card->
host->sdio_irqs == 1)
257 reg |= 1 << func->
num;
266 ret = sdio_card_irq_get(func->
card);
269 sdio_single_irq_set(func->
card);
293 sdio_card_irq_put(func->
card);
294 sdio_single_irq_set(func->
card);
301 reg &= ~(1 << func->
num);