From: mporter@ti.com (Matt Porter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 12/14] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Date: Fri, 11 Jan 2013 00:48:48 -0500 [thread overview]
Message-ID: <1357883330-5364-13-git-send-email-mporter@ti.com> (raw)
In-Reply-To: <1357883330-5364-1-git-send-email-mporter@ti.com>
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>
---
drivers/spi/spi-omap2-mcspi.c | 65 ++++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index b610f52..2c02c02 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -102,6 +102,9 @@ struct omap2_mcspi_dma {
struct completion dma_tx_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
@@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
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) {
dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
return -EAGAIN;
}
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) {
dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n");
dma_release_channel(mcspi_dma->dma_rx);
@@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
goto free_master;
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;
- sprintf(dma_ch_name, "rx%d", i);
- dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
- dma_ch_name);
- if (!dma_res) {
- dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
- status = -ENODEV;
- break;
- }
+ sprintf(dma_rx_ch_name, "rx%d", i);
+ if (!pdev->dev.of_node) {
+ dma_res =
+ platform_get_resource_byname(pdev,
+ IORESOURCE_DMA,
+ dma_rx_ch_name);
+ if (!dma_res) {
+ dev_dbg(&pdev->dev,
+ "cannot get DMA RX channel\n");
+ status = -ENODEV;
+ break;
+ }
- mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
- sprintf(dma_ch_name, "tx%d", i);
- dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
- dma_ch_name);
- if (!dma_res) {
- dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
- status = -ENODEV;
- break;
+ mcspi->dma_channels[i].dma_rx_sync_dev =
+ dma_res->start;
}
+ 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) {
+ dev_dbg(&pdev->dev,
+ "cannot get DMA TX channel\n");
+ status = -ENODEV;
+ 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)
--
1.7.9.5
next prev parent reply other threads:[~2013-01-11 5:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 5:48 [PATCH v4 00/14] DMA Engine support for AM33XX Matt Porter
2013-01-11 5:48 ` [PATCH v4 01/14] ARM: davinci: move private EDMA API to arm/common Matt Porter
2013-01-11 6:15 ` Hebbar, Gururaja
2013-01-11 14:27 ` Matt Porter
2013-01-11 5:48 ` [PATCH v4 02/14] ARM: edma: remove unused transfer controller handlers Matt Porter
2013-01-11 5:48 ` [PATCH v4 03/14] ARM: edma: add AM33XX support to the private EDMA API Matt Porter
2013-01-11 18:14 ` [PATCH v4, " Lars Poeschel
[not found] ` <9fda86bbbec3444393fd5a2dc5135a5e@DFLE73.ent.ti.com>
2013-01-11 18:21 ` [PATCH v4,03/14] " Matt Porter
2013-01-11 5:48 ` [PATCH v4 04/14] dmaengine: edma: enable build for AM33XX Matt Porter
2013-01-11 5:48 ` [PATCH v4 05/14] dmaengine: edma: Add TI EDMA device tree binding Matt Porter
2013-01-11 7:54 ` Hebbar, Gururaja
[not found] ` <06e6ba0bd8984e1797c84d2926584909@DFLE72.ent.ti.com>
2013-01-11 14:30 ` Matt Porter
2013-01-11 5:48 ` [PATCH v4 06/14] ARM: dts: add AM33XX EDMA support Matt Porter
2013-01-11 5:48 ` [PATCH v4 07/14] dmaengine: add dma_request_slave_channel_compat() Matt Porter
2013-01-11 17:52 ` Tony Lindgren
2013-01-11 5:48 ` [PATCH v4 08/14] mmc: omap_hsmmc: convert to dma_request_slave_channel_compat() Matt Porter
2013-01-11 17:52 ` Tony Lindgren
2013-01-11 5:48 ` [PATCH v4 09/14] mmc: omap_hsmmc: set max_segs based on dma engine limitations Matt Porter
2013-01-11 17:53 ` Tony Lindgren
2013-01-11 5:48 ` [PATCH v4 10/14] mmc: omap_hsmmc: add generic DMA request support to the DT binding Matt Porter
2013-01-11 17:54 ` Tony Lindgren
2013-01-11 5:48 ` [PATCH v4 11/14] ARM: dts: add AM33XX MMC support Matt Porter
2013-01-11 17:55 ` Tony Lindgren
2013-01-11 5:48 ` Matt Porter [this message]
2013-01-11 5:48 ` [PATCH v4 13/14] spi: omap2-mcspi: add generic DMA request support to the DT binding Matt Porter
2013-01-11 5:48 ` [PATCH v4 14/14] ARM: dts: add AM33XX SPI DMA support Matt Porter
2013-01-11 11:40 ` [PATCH v4 00/14] DMA Engine support for AM33XX Arnd Bergmann
2013-01-11 18:33 ` Matt Porter
2013-01-11 20:12 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357883330-5364-13-git-send-email-mporter@ti.com \
--to=mporter@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).