aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/dw_mmc.c
diff options
context:
space:
mode:
authorGirish K S <girish.shivananjappa@linaro.org>2012-06-12 05:58:22 -0400
committerChris Ball <cjb@laptop.org>2012-07-21 00:02:06 -0400
commit94c6cee91bebfc17596243b6a5f4fe910feec426 (patch)
tree483b6ecc1a637eb58935d769c2ad42ba2057a37c /drivers/mmc/host/dw_mmc.c
parentb650352dd3df36164e3427bff3f33bc06ac47642 (diff)
mmc: dw_mmc: Add check for IDMAC configuration
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 the hardware configuration register's DMA_INTERFACE field is 0, the driver will still 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. This patch adds a check for existence of the DMA IP to allow the DMA initialization. Signed-off-by: Girish K S <girish.shivananjappa@linaro.org> Acked-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/dw_mmc.c')
-rw-r--r--drivers/mmc/host/dw_mmc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1ca5e72ceb65..5a600b3b3199 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -405,11 +405,23 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len)
405static int dw_mci_idmac_init(struct dw_mci *host) 405static int dw_mci_idmac_init(struct dw_mci *host)
406{ 406{
407 struct idmac_desc *p; 407 struct idmac_desc *p;
408 int i; 408 int i, dma_support;
409 409
410 /* Number of descriptors in the ring buffer */ 410 /* Number of descriptors in the ring buffer */
411 host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc); 411 host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
412 412
413 /* Check if Hardware Configuration Register has support for DMA */
414 dma_support = (mci_readl(host, HCON) >> 16) & 0x3;
415
416 if (!dma_support || dma_support > 2) {
417 dev_err(&host->dev,
418 "Host Controller does not support IDMA Tx.\n");
419 host->dma_ops = NULL;
420 return -ENODEV;
421 }
422
423 dev_info(&host->dev, "Using internal DMA controller.\n");
424
413 /* Forward link the descriptor list */ 425 /* Forward link the descriptor list */
414 for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) 426 for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
415 p->des3 = host->sg_dma + (sizeof(struct idmac_desc) * (i + 1)); 427 p->des3 = host->sg_dma + (sizeof(struct idmac_desc) * (i + 1));
@@ -1876,7 +1888,6 @@ static void dw_mci_init_dma(struct dw_mci *host)
1876 /* Determine which DMA interface to use */ 1888 /* Determine which DMA interface to use */
1877#ifdef CONFIG_MMC_DW_IDMAC 1889#ifdef CONFIG_MMC_DW_IDMAC
1878 host->dma_ops = &dw_mci_idmac_ops; 1890 host->dma_ops = &dw_mci_idmac_ops;
1879 dev_info(&host->dev, "Using internal DMA controller.\n");
1880#endif 1891#endif
1881 1892
1882 if (!host->dma_ops) 1893 if (!host->dma_ops)