mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
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>
This commit is contained in:
parent
b650352dd3
commit
94c6cee91b
1 changed files with 13 additions and 2 deletions
|
@ -405,11 +405,23 @@ 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;
|
||||
|
||||
/* Number of descriptors in the ring buffer */
|
||||
host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
|
||||
|
||||
/* 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 IDMA Tx.\n");
|
||||
host->dma_ops = NULL;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dev_info(&host->dev, "Using internal DMA controller.\n");
|
||||
|
||||
/* Forward link the descriptor list */
|
||||
for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
|
||||
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)
|
|||
/* Determine which DMA interface to use */
|
||||
#ifdef CONFIG_MMC_DW_IDMAC
|
||||
host->dma_ops = &dw_mci_idmac_ops;
|
||||
dev_info(&host->dev, "Using internal DMA controller.\n");
|
||||
#endif
|
||||
|
||||
if (!host->dma_ops)
|
||||
|
|
Loading…
Reference in a new issue