Commit 74f3aaad authored by Matt Porter's avatar Matt Porter Committed by Mark Brown

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: default avatarMatt Porter <mporter@ti.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarJoel A Fernandes <joelagnel@ti.com>
Signed-off-by: default avatarSourav Poddar <sourav.poddar@ti.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent d33f473d
...@@ -109,6 +109,9 @@ struct omap2_mcspi_dma { ...@@ -109,6 +109,9 @@ struct omap2_mcspi_dma {
struct completion dma_tx_completion; struct completion dma_tx_completion;
struct completion dma_rx_completion; struct completion dma_rx_completion;
char dma_rx_ch_name[14];
char dma_tx_ch_name[14];
}; };
/* use PIO for small transfers, avoiding DMA setup/teardown overhead and /* 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,12 +939,20 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_SLAVE, mask);
sig = mcspi_dma->dma_rx_sync_dev; sig = mcspi_dma->dma_rx_sync_dev;
mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
mcspi_dma->dma_rx =
dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
&sig, &master->dev,
mcspi_dma->dma_rx_ch_name);
if (!mcspi_dma->dma_rx) if (!mcspi_dma->dma_rx)
goto no_dma; goto no_dma;
sig = mcspi_dma->dma_tx_sync_dev; sig = mcspi_dma->dma_tx_sync_dev;
mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); mcspi_dma->dma_tx =
dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
&sig, &master->dev,
mcspi_dma->dma_tx_ch_name);
if (!mcspi_dma->dma_tx) { if (!mcspi_dma->dma_tx) {
dma_release_channel(mcspi_dma->dma_rx); dma_release_channel(mcspi_dma->dma_rx);
mcspi_dma->dma_rx = NULL; mcspi_dma->dma_rx = NULL;
...@@ -1374,29 +1385,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1374,29 +1385,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
goto free_master; goto free_master;
for (i = 0; i < master->num_chipselect; i++) { for (i = 0; i < master->num_chipselect; i++) {
char dma_ch_name[14]; char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
struct resource *dma_res; struct resource *dma_res;
sprintf(dma_ch_name, "rx%d", i); sprintf(dma_rx_ch_name, "rx%d", i);
dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, if (!pdev->dev.of_node) {
dma_ch_name); dma_res =
platform_get_resource_byname(pdev,
IORESOURCE_DMA,
dma_rx_ch_name);
if (!dma_res) { if (!dma_res) {
dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); dev_dbg(&pdev->dev,
"cannot get DMA RX channel\n");
status = -ENODEV; status = -ENODEV;
break; break;
} }
mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; mcspi->dma_channels[i].dma_rx_sync_dev =
sprintf(dma_ch_name, "tx%d", i); dma_res->start;
dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, }
dma_ch_name); sprintf(dma_tx_ch_name, "tx%d", i);
if (!pdev->dev.of_node) {
dma_res =
platform_get_resource_byname(pdev,
IORESOURCE_DMA,
dma_tx_ch_name);
if (!dma_res) { if (!dma_res) {
dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); dev_dbg(&pdev->dev,
"cannot get DMA TX channel\n");
status = -ENODEV; status = -ENODEV;
break; break;
} }
mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; mcspi->dma_channels[i].dma_tx_sync_dev =
dma_res->start;
}
} }
if (status < 0) if (status < 0)
......
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