Commit acd6d772 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Chris Ball

mmc: sh_mmcif: add support for Device Tree DMA bindings

To use DMA in the Device Tree case the driver has to be modified
to use suitable API to obtain DMA channels.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent d00cadac
...@@ -387,25 +387,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, ...@@ -387,25 +387,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
host->dma_active = false; host->dma_active = false;
if (!pdata) if (pdata) {
return; if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0)
return;
if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0) } else if (!host->pd->dev.of_node) {
return; return;
}
/* We can only either use DMA for both Tx and Rx or not use it at all */ /* We can only either use DMA for both Tx and Rx or not use it at all */
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_SLAVE, mask);
host->chan_tx = dma_request_channel(mask, shdma_chan_filter, host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
(void *)pdata->slave_id_tx); pdata ? (void *)pdata->slave_id_tx : NULL,
&host->pd->dev, "tx");
dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
host->chan_tx); host->chan_tx);
if (!host->chan_tx) if (!host->chan_tx)
return; return;
cfg.slave_id = pdata->slave_id_tx; /* In the OF case the driver will get the slave ID from the DT */
if (pdata)
cfg.slave_id = pdata->slave_id_tx;
cfg.direction = DMA_MEM_TO_DEV; cfg.direction = DMA_MEM_TO_DEV;
cfg.dst_addr = res->start + MMCIF_CE_DATA; cfg.dst_addr = res->start + MMCIF_CE_DATA;
cfg.src_addr = 0; cfg.src_addr = 0;
...@@ -413,15 +417,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, ...@@ -413,15 +417,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
if (ret < 0) if (ret < 0)
goto ecfgtx; goto ecfgtx;
host->chan_rx = dma_request_channel(mask, shdma_chan_filter, host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter,
(void *)pdata->slave_id_rx); pdata ? (void *)pdata->slave_id_rx : NULL,
&host->pd->dev, "rx");
dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
host->chan_rx); host->chan_rx);
if (!host->chan_rx) if (!host->chan_rx)
goto erqrx; goto erqrx;
cfg.slave_id = pdata->slave_id_rx; if (pdata)
cfg.slave_id = pdata->slave_id_rx;
cfg.direction = DMA_DEV_TO_MEM; cfg.direction = DMA_DEV_TO_MEM;
cfg.dst_addr = 0; cfg.dst_addr = 0;
cfg.src_addr = res->start + MMCIF_CE_DATA; cfg.src_addr = res->start + MMCIF_CE_DATA;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment