From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] spi:fsl-dspi:add dspi dma transfer support
Date: Tue, 25 Feb 2014 09:15:08 +0000 [thread overview]
Message-ID: <20140225091508.GP28555@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <1393311258-14380-3-git-send-email-b44548@freescale.com>
On Tue, Feb 25, 2014 at 06:54:18AM +0000, Chao Fu wrote:
> From: Chao Fu <B44548@freescale.com>
>
> DSPI can transfer data in DMA mode or PIO mode.This patch will add the DMA
> transfer driver support. Add DMA reference functions and variables to form DMA
> transfer process.
> DSPI DMA mode need work with Freescale eDMA module together.
>
> The software will be changed in two transfer methods as followwing:
> DMA PIO
> trigger write: dspi_tx_dma dspi_tx_pio
> write complete: dspi_dma_tx_complete irq_handle
> trigger read: dspi_receive_dma dspi_rx_pio
> read complete: dspi_rx_dma none
>
> Remove bitbang:
> Add DMA funtions, DSPI module need get cs change information in a spi transfer.
> According cs change, DSPI will give last data the right flag. Bitbang provide
> cs change behind the last data in a transfer. DSPI can not deal the last data in
> every transfer properly, so remove the bitbang in driver.
>
> Signed-off-by: Chao Fu <b44548@freescale.com>
> ---
> drivers/spi/Kconfig | 1 -
> drivers/spi/spi-fsl-dspi.c | 425 ++++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 360 insertions(+), 66 deletions(-)
[...]
> @@ -529,10 +816,18 @@ static int dspi_probe(struct platform_device *pdev)
> }
> clk_prepare_enable(dspi->clk);
>
> + dspi->use_dma = of_property_read_bool(np, "use-dma");
> + if (dspi->use_dma)
> + if (dspi_request_dma(dspi)) {
> + dspi->use_dma = 0;
> + dev_err(&pdev->dev, "request dma channel fail\n");
> + dspi_release_dma(dspi);
> + }
Why have the use-dma property at all? You already fall back to PIO mode
if the DMAs are not present, so it's clearly not a requirement to use
DMA.
Why not always try to request he dmas you need? You already have the
fallback logic, the only difference would be changing the dev_err to
better describe the situation:
dev_info(&pdev->dev, "No 'tx' and/or 'rx' DMA(s), using PIO mode\n");
Cheers,
Mark.
next prev parent reply other threads:[~2014-02-25 9:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-25 6:54 [PATCH 1/3] Documentation:spi:fsl-dspi:add DSPI dma transfer support Chao Fu
2014-02-25 6:54 ` [PATCH 2/3] arm:dts:vf-610:add vybrid DSPI DMA " Chao Fu
2014-02-25 6:54 ` [PATCH 3/3] spi:fsl-dspi:add dspi dma " Chao Fu
2014-02-25 9:15 ` Mark Rutland [this message]
2014-02-25 9:08 ` [PATCH 1/3] Documentation:spi:fsl-dspi:add DSPI " Mark Rutland
2014-02-26 14:19 ` Shawn Guo
2014-02-26 15:38 ` Mark Brown
2014-02-27 7:42 ` Shawn Guo
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=20140225091508.GP28555@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.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).