diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2016-05-04 04:23:08 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-05-04 07:12:00 -0400 |
commit | d15b08fb2246fa28b4cf01337951026177641af4 (patch) | |
tree | c8481feb27e58a604253d49507237b6ef3f32be4 /drivers/mmc/host/omap.c | |
parent | 437db4c6e79881d33aca521987188c728df350a8 (diff) |
mmc: omap: Use dma_request_chan() for requesting DMA channel
With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/omap.c')
-rw-r--r-- | drivers/mmc/host/omap.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index b9958a123594..f23d65eb070d 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
26 | #include <linux/omap-dma.h> | ||
27 | #include <linux/mmc/host.h> | 26 | #include <linux/mmc/host.h> |
28 | #include <linux/mmc/card.h> | 27 | #include <linux/mmc/card.h> |
29 | #include <linux/mmc/mmc.h> | 28 | #include <linux/mmc/mmc.h> |
@@ -1321,8 +1320,6 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
1321 | struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; | 1320 | struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; |
1322 | struct mmc_omap_host *host = NULL; | 1321 | struct mmc_omap_host *host = NULL; |
1323 | struct resource *res; | 1322 | struct resource *res; |
1324 | dma_cap_mask_t mask; | ||
1325 | unsigned sig = 0; | ||
1326 | int i, ret = 0; | 1323 | int i, ret = 0; |
1327 | int irq; | 1324 | int irq; |
1328 | 1325 | ||
@@ -1382,29 +1379,34 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
1382 | goto err_free_iclk; | 1379 | goto err_free_iclk; |
1383 | } | 1380 | } |
1384 | 1381 | ||
1385 | dma_cap_zero(mask); | ||
1386 | dma_cap_set(DMA_SLAVE, mask); | ||
1387 | |||
1388 | host->dma_tx_burst = -1; | 1382 | host->dma_tx_burst = -1; |
1389 | host->dma_rx_burst = -1; | 1383 | host->dma_rx_burst = -1; |
1390 | 1384 | ||
1391 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | 1385 | host->dma_tx = dma_request_chan(&pdev->dev, "tx"); |
1392 | if (res) | 1386 | if (IS_ERR(host->dma_tx)) { |
1393 | sig = res->start; | 1387 | ret = PTR_ERR(host->dma_tx); |
1394 | host->dma_tx = dma_request_slave_channel_compat(mask, | 1388 | if (ret == -EPROBE_DEFER) { |
1395 | omap_dma_filter_fn, &sig, &pdev->dev, "tx"); | 1389 | clk_put(host->fclk); |
1396 | if (!host->dma_tx) | 1390 | goto err_free_iclk; |
1397 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", | 1391 | } |
1398 | sig); | 1392 | |
1399 | 1393 | host->dma_tx = NULL; | |
1400 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | 1394 | dev_warn(host->dev, "TX DMA channel request failed\n"); |
1401 | if (res) | 1395 | } |
1402 | sig = res->start; | 1396 | |
1403 | host->dma_rx = dma_request_slave_channel_compat(mask, | 1397 | host->dma_rx = dma_request_chan(&pdev->dev, "rx"); |
1404 | omap_dma_filter_fn, &sig, &pdev->dev, "rx"); | 1398 | if (IS_ERR(host->dma_rx)) { |
1405 | if (!host->dma_rx) | 1399 | ret = PTR_ERR(host->dma_rx); |
1406 | dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", | 1400 | if (ret == -EPROBE_DEFER) { |
1407 | sig); | 1401 | if (host->dma_tx) |
1402 | dma_release_channel(host->dma_tx); | ||
1403 | clk_put(host->fclk); | ||
1404 | goto err_free_iclk; | ||
1405 | } | ||
1406 | |||
1407 | host->dma_rx = NULL; | ||
1408 | dev_warn(host->dev, "RX DMA channel request failed\n"); | ||
1409 | } | ||
1408 | 1410 | ||
1409 | ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host); | 1411 | ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host); |
1410 | if (ret) | 1412 | if (ret) |