Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1526234
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Sekhar Nori <nsekhar@ti.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] spi: davinci: Allow device tree devices to use DMA |
| Date | Sun, 20 Nov 2016 14:10:03 +0100 |
| Message-ID | <sFA2D-2VT-29@gated-at.bofh.it> (permalink) |
| References | <sF5Lb-8vM-3@gated-at.bofh.it> |
| X-Original-To | David Lechner <david@lechnology.com>, Mark Brown <broonie@kernel.org> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="windows-1252" |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 49 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | <khilman@kernel.org>, <linux-spi@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> |
| X-Original-Date | Sun, 20 Nov 2016 18:29:02 +0530 |
| X-Original-Message-ID | <79f186b5-ac71-189f-c19f-977670395043@ti.com> |
| X-Original-References | <1479530464-12538-1-git-send-email-david@lechnology.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1526234 |
Show key headers only | View raw
On Saturday 19 November 2016 10:11 AM, David Lechner wrote:
> This makes SPI devices specified in a device tree use DMA when the master
> controller has DMA configured.
>
> Since device tree is supposed to only describe the hardware, adding a
> configuration option to device tree to enable DMA per-device would not be
> acceptable. So, this is the best we can do for now to get SPI devices
> working with DMA when using device tree.
>
> Unfortunately, this excludes the possibility of using one SPI device with
> DMA and one without on the same master.
>
> I have tested this on LEGO MINDSTORMS EV3 using the NOR flash. Reading the
> flash memory would fail with -EIO when DMA is not enabled for the device.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
> 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)
This should be
if (!(IS_ERR(dpsi->dma_rx) || IS_ERR(dspi->dma_tx))
> + spicfg->io_type = SPI_IO_TYPE_DMA;
Otherwise looks good to me.
Thanks,
Sekhar
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] spi: davinci: Allow device tree devices to use DMA David Lechner <david@lechnology.com> - 2016-11-19 05:50 +0100
Re: [PATCH] spi: davinci: Allow device tree devices to use DMA Sekhar Nori <nsekhar@ti.com> - 2016-11-20 14:10 +0100
Re: [PATCH] spi: davinci: Allow device tree devices to use DMA David Lechner <david@lechnology.com> - 2016-11-20 18:10 +0100
Re: [PATCH] spi: davinci: Allow device tree devices to use DMA Sekhar Nori <nsekhar@ti.com> - 2016-11-21 09:40 +0100
csiph-web