aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-omap2-mcspi.c
diff options
context:
space:
mode:
authorMatt Porter <mporter@ti.com>2013-06-22 13:37:38 -0400
committerMark Brown <broonie@linaro.org>2013-06-24 05:18:40 -0400
commit74f3aaad21660c91ea13136ea8c41f5183e421fd (patch)
tree8cad0c899a86a4bd9c587f063c1eee9e88f2e186 /drivers/spi/spi-omap2-mcspi.c
parentd33f473dcd8e69321f001ba330d648f475b504c9 (diff)
spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter <mporter@ti.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Joel A Fernandes <joelagnel@ti.com> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c64
1 files changed, 44 insertions, 20 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 6802806d1f18..bb9afc3f043b 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -109,6 +109,9 @@ struct omap2_mcspi_dma {
109 109
110 struct completion dma_tx_completion; 110 struct completion dma_tx_completion;
111 struct completion dma_rx_completion; 111 struct completion dma_rx_completion;
112
113 char dma_rx_ch_name[14];
114 char dma_tx_ch_name[14];
112}; 115};
113 116
114/* use PIO for small transfers, avoiding DMA setup/teardown overhead and 117/* use PIO for small transfers, avoiding DMA setup/teardown overhead and
@@ -936,12 +939,20 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
936 dma_cap_zero(mask); 939 dma_cap_zero(mask);
937 dma_cap_set(DMA_SLAVE, mask); 940 dma_cap_set(DMA_SLAVE, mask);
938 sig = mcspi_dma->dma_rx_sync_dev; 941 sig = mcspi_dma->dma_rx_sync_dev;
939 mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); 942
943 mcspi_dma->dma_rx =
944 dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
945 &sig, &master->dev,
946 mcspi_dma->dma_rx_ch_name);
940 if (!mcspi_dma->dma_rx) 947 if (!mcspi_dma->dma_rx)
941 goto no_dma; 948 goto no_dma;
942 949
943 sig = mcspi_dma->dma_tx_sync_dev; 950 sig = mcspi_dma->dma_tx_sync_dev;
944 mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); 951 mcspi_dma->dma_tx =
952 dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
953 &sig, &master->dev,
954 mcspi_dma->dma_tx_ch_name);
955
945 if (!mcspi_dma->dma_tx) { 956 if (!mcspi_dma->dma_tx) {
946 dma_release_channel(mcspi_dma->dma_rx); 957 dma_release_channel(mcspi_dma->dma_rx);
947 mcspi_dma->dma_rx = NULL; 958 mcspi_dma->dma_rx = NULL;
@@ -1374,29 +1385,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
1374 goto free_master; 1385 goto free_master;
1375 1386
1376 for (i = 0; i < master->num_chipselect; i++) { 1387 for (i = 0; i < master->num_chipselect; i++) {
1377 char dma_ch_name[14]; 1388 char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
1389 char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
1378 struct resource *dma_res; 1390 struct resource *dma_res;
1379 1391
1380 sprintf(dma_ch_name, "rx%d", i); 1392 sprintf(dma_rx_ch_name, "rx%d", i);
1381 dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, 1393 if (!pdev->dev.of_node) {
1382 dma_ch_name); 1394 dma_res =
1383 if (!dma_res) { 1395 platform_get_resource_byname(pdev,
1384 dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); 1396 IORESOURCE_DMA,
1385 status = -ENODEV; 1397 dma_rx_ch_name);
1386 break; 1398 if (!dma_res) {
1387 } 1399 dev_dbg(&pdev->dev,
1400 "cannot get DMA RX channel\n");
1401 status = -ENODEV;
1402 break;
1403 }
1388 1404
1389 mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; 1405 mcspi->dma_channels[i].dma_rx_sync_dev =
1390 sprintf(dma_ch_name, "tx%d", i); 1406 dma_res->start;
1391 dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
1392 dma_ch_name);
1393 if (!dma_res) {
1394 dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
1395 status = -ENODEV;
1396 break;
1397 } 1407 }
1408 sprintf(dma_tx_ch_name, "tx%d", i);
1409 if (!pdev->dev.of_node) {
1410 dma_res =
1411 platform_get_resource_byname(pdev,
1412 IORESOURCE_DMA,
1413 dma_tx_ch_name);
1414 if (!dma_res) {
1415 dev_dbg(&pdev->dev,
1416 "cannot get DMA TX channel\n");
1417 status = -ENODEV;
1418 break;
1419 }
1398 1420
1399 mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; 1421 mcspi->dma_channels[i].dma_tx_sync_dev =
1422 dma_res->start;
1423 }
1400 } 1424 }
1401 1425
1402 if (status < 0) 1426 if (status < 0)