From: David Lechner <david@lechnology.com>
To: Mark Brown <broonie@kernel.org>
Cc: David Lechner <david@lechnology.com>,
nsekhar@ti.com, khilman@kernel.org, linux-spi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [RESEND] spi: davinci: Allow device tree devices to use DMA
Date: Thu, 5 Jan 2017 21:26:17 -0600 [thread overview]
Message-ID: <1483673177-31516-1-git-send-email-david@lechnology.com> (raw)
This allows SPI devices specified in a device tree to use DMA when the
master controller.
Since device tree is supposed to only describe the hardware, adding such
a configuration option to device tree would not be acceptable. So, this
is the best we can do for now to get SPI devices working with DMA.
Unfortunately, this excludes the possibility of using one SPI device with
DMA and one without on the same master.
Signed-off-by: David Lechner <david@lechnology.com>
---
When I originally submitted this patch, there was some discussion as to whether
dspi->dma_rx should be changed to return an error rather than being null.
However, I prefer it the way it is and don't see a compelling reason to change
it.
drivers/spi/spi-davinci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index d36c11b..c6cf73a 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -388,6 +388,7 @@ static int davinci_spi_setup_transfer(struct spi_device *spi,
static int davinci_spi_of_setup(struct spi_device *spi)
{
struct davinci_spi_config *spicfg = spi->controller_data;
+ struct davinci_spi *dspi = spi_master_get_devdata(spi->master);
struct device_node *np = spi->dev.of_node;
u32 prop;
@@ -400,6 +401,9 @@ static int davinci_spi_of_setup(struct spi_device *spi)
if (!of_property_read_u32(np, "ti,spi-wdelay", &prop))
spicfg->wdelay = (u8)prop;
spi->controller_data = spicfg;
+ /* Use DMA for device if master supports it */
+ if (dspi->dma_rx)
+ spicfg->io_type = SPI_IO_TYPE_DMA;
}
return 0;
--
2.7.4
next reply other threads:[~2017-01-06 3:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 3:26 David Lechner [this message]
2017-01-09 19:48 ` [RESEND] spi: davinci: Allow device tree devices to use DMA Mark Brown
2017-01-09 20:40 ` David Lechner
2017-01-10 16:51 ` Mark Brown
2017-01-12 21:34 ` Kevin Hilman
2017-01-13 12:04 ` Mark Brown
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=1483673177-31516-1-git-send-email-david@lechnology.com \
--to=david@lechnology.com \
--cc=broonie@kernel.org \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nsekhar@ti.com \
/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).