aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-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)