[PATCH] mmc: dw_mmc: Add check for IDMAC configuration

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

 



In the Current dwmmc driver there is support for selecting IDMAC from
the menu config option. If the support for IDMAC is enabled in the menu
config and Hardware configuration register's DMA_INTERFACE field is 0.
Still the driver will try to do the DMA initialization.

The dw_mci_idmac_init function currently implemented returns only success
indicating that the DMA initialization is always successful. The current
patch will add a ciheck for existance of the DMA IP and allow the
DMA initialization.

Signed-off-by: Girish K S <girish.shivananjappa@xxxxxxxxxx>
---
 drivers/mmc/host/dw_mmc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index cbd8f3d..9821293 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -405,7 +405,16 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len)
 static int dw_mci_idmac_init(struct dw_mci *host)
 {
 	struct idmac_desc *p;
-	int i;
+	int i, dma_support;
+
+	/* Check if Hardware Configuration Register has support for DMA */
+	dma_support = (mci_readl(host, HCON) >> 16) & 0x3;
+
+	if (!dma_support || dma_support > 2) {
+		dev_err(&host->dev,
+			"Host Controller does not support DMA Tx.\n");
+		return -ENODEV;
+	}
 
 	/* Number of descriptors in the ring buffer */
 	host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
-- 
1.7.4.1

--
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