[PATCH 2/4] mmc: tmio, sdhi: Split card interrupts based on source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SDHI hardware allows for two different card interrupt sources;
one for access and one for detect.

As preparation for wiring the sources up to separate interrupt handlers
this patch splits the card interrupt handler in two.

Cc: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
Cc: Magnus Damm <magnus.damm@xxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 drivers/mmc/host/tmio_mmc_pio.c |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index e658cb4..3880750 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -543,17 +543,21 @@ out:
 	spin_unlock(&host->lock);
 }
 
-static void __tmio_mmc_card_irq(struct tmio_mmc_host *host)
+static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host,
+				     int *ireg, int *irq_mask, int *status)
 {
-	struct mmc_host *mmc = host->mmc;
-	unsigned int ireg, irq_mask, status;
+	*status = sd_ctrl_read32(host, CTL_STATUS);
+	*irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);
+	*ireg = *status & TMIO_MASK_IRQ & ~*irq_mask;
 
-	status = sd_ctrl_read32(host, CTL_STATUS);
-	irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);
-	ireg = status & TMIO_MASK_IRQ & ~irq_mask;
+	pr_debug_status(*status);
+	pr_debug_status(*ireg);
+}
 
-	pr_debug_status(status);
-	pr_debug_status(ireg);
+static void __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
+				       int ireg, int irq_mask, int status)
+{
+	struct mmc_host *mmc = host->mmc;
 
 	/* Card insert / remove attempts */
 	if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {
@@ -564,7 +568,11 @@ static void __tmio_mmc_card_irq(struct tmio_mmc_host *host)
 		    !work_pending(&mmc->detect.work))
 			mmc_detect_change(host->mmc, msecs_to_jiffies(100));
 	}
+}
 
+void __tmio_mmc_card_access_irq(struct tmio_mmc_host *host,
+				int ireg, int irq_mask, int status)
+{
 	/* Command completion */
 	if (ireg & (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT)) {
 		tmio_mmc_ack_mmc_irqs(host,
@@ -586,6 +594,16 @@ static void __tmio_mmc_card_irq(struct tmio_mmc_host *host)
 	}
 }
 
+static void __tmio_mmc_card_irq(struct tmio_mmc_host *host)
+{
+	unsigned int ireg, irq_mask, status;
+
+	tmio_mmc_card_irq_status(host, &ireg, &irq_mask, &status);
+
+	__tmio_mmc_card_detect_irq(host, ireg, irq_mask, status);
+	__tmio_mmc_card_access_irq(host, ireg, irq_mask, status);
+}
+
 static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
 {
 	struct mmc_host *mmc = host->mmc;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux