diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-04-26 11:47:19 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-05-26 14:23:21 -0400 |
commit | 87ae7bbebd9c9b32ad49dde1742aa68b5a86caf8 (patch) | |
tree | 9ecb5f53bf34f342631db33ed2d4d307f48d3ff4 /drivers/mmc/host/tmio_mmc_dma.c | |
parent | eec95ee22611f2207bd991d63a07884de28e6f56 (diff) |
mmc: sdhi/tmio: add DT DMA support
Add support for initialising DMA from the Device Tree.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/tmio_mmc_dma.c')
-rw-r--r-- | drivers/mmc/host/tmio_mmc_dma.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 5fcf14f21d20..47bdb8fa341b 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c | |||
@@ -264,7 +264,8 @@ out: | |||
264 | void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata) | 264 | void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata) |
265 | { | 265 | { |
266 | /* We can only either use DMA for both Tx and Rx or not use it at all */ | 266 | /* We can only either use DMA for both Tx and Rx or not use it at all */ |
267 | if (!pdata->dma) | 267 | if (!pdata->dma || (!host->pdev->dev.of_node && |
268 | (!pdata->dma->chan_priv_tx || !pdata->dma->chan_priv_rx))) | ||
268 | return; | 269 | return; |
269 | 270 | ||
270 | if (!host->chan_tx && !host->chan_rx) { | 271 | if (!host->chan_tx && !host->chan_rx) { |
@@ -280,15 +281,17 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat | |||
280 | dma_cap_zero(mask); | 281 | dma_cap_zero(mask); |
281 | dma_cap_set(DMA_SLAVE, mask); | 282 | dma_cap_set(DMA_SLAVE, mask); |
282 | 283 | ||
283 | host->chan_tx = dma_request_channel(mask, pdata->dma->filter, | 284 | host->chan_tx = dma_request_slave_channel_compat(mask, |
284 | pdata->dma->chan_priv_tx); | 285 | pdata->dma->filter, pdata->dma->chan_priv_tx, |
286 | &host->pdev->dev, "tx"); | ||
285 | dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__, | 287 | dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__, |
286 | host->chan_tx); | 288 | host->chan_tx); |
287 | 289 | ||
288 | if (!host->chan_tx) | 290 | if (!host->chan_tx) |
289 | return; | 291 | return; |
290 | 292 | ||
291 | cfg.slave_id = pdata->dma->slave_id_tx; | 293 | if (pdata->dma->chan_priv_tx) |
294 | cfg.slave_id = pdata->dma->slave_id_tx; | ||
292 | cfg.direction = DMA_MEM_TO_DEV; | 295 | cfg.direction = DMA_MEM_TO_DEV; |
293 | cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); | 296 | cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); |
294 | cfg.src_addr = 0; | 297 | cfg.src_addr = 0; |
@@ -296,15 +299,17 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat | |||
296 | if (ret < 0) | 299 | if (ret < 0) |
297 | goto ecfgtx; | 300 | goto ecfgtx; |
298 | 301 | ||
299 | host->chan_rx = dma_request_channel(mask, pdata->dma->filter, | 302 | host->chan_rx = dma_request_slave_channel_compat(mask, |
300 | pdata->dma->chan_priv_rx); | 303 | pdata->dma->filter, pdata->dma->chan_priv_rx, |
304 | &host->pdev->dev, "rx"); | ||
301 | dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, | 305 | dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, |
302 | host->chan_rx); | 306 | host->chan_rx); |
303 | 307 | ||
304 | if (!host->chan_rx) | 308 | if (!host->chan_rx) |
305 | goto ereqrx; | 309 | goto ereqrx; |
306 | 310 | ||
307 | cfg.slave_id = pdata->dma->slave_id_rx; | 311 | if (pdata->dma->chan_priv_rx) |
312 | cfg.slave_id = pdata->dma->slave_id_rx; | ||
308 | cfg.direction = DMA_DEV_TO_MEM; | 313 | cfg.direction = DMA_DEV_TO_MEM; |
309 | cfg.src_addr = cfg.dst_addr; | 314 | cfg.src_addr = cfg.dst_addr; |
310 | cfg.dst_addr = 0; | 315 | cfg.dst_addr = 0; |