From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Richard Genoud <richard.genoud@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Mark Brown <broonie@kernel.org>,
Grant Likely <grant.likely@linaro.org>,
Ludovic Desroches <ludovic.desroches@atmel.com>,
linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] spi: atmel: convert to dma_request_slave_channel_compat()
Date: Fri, 31 May 2013 17:08:33 +0200 [thread overview]
Message-ID: <20130531150833.GF23653@game.jcrosoft.org> (raw)
In-Reply-To: <1370012520-30539-1-git-send-email-richard.genoud@gmail.com>
On 17:01 Fri 31 May , Richard Genoud wrote:
> Use generic DMA DT helper.
> Platforms booting with or without DT populated are both supported.
>
> Based on Ludovic Desroches <ludovic.desroches@atmel.com> patchset
> "ARM: at91: move to generic DMA device tree binding"
>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Ludo please take a look but this looks ok to me
Best Regards,
J.
> ---
> drivers/spi/spi-atmel.c | 42 +++++++++++++++++++++++++++---------------
> 1 file changed, 27 insertions(+), 15 deletions(-)
>
> rebased on linux-next next-20130531
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 31cfc87..ea1ec00 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -424,10 +424,15 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
> return err;
> }
>
> -static bool filter(struct dma_chan *chan, void *slave)
> +static bool filter(struct dma_chan *chan, void *pdata)
> {
> - struct at_dma_slave *sl = slave;
> + struct atmel_spi_dma *sl_pdata = pdata;
> + struct at_dma_slave *sl;
>
> + if (!sl_pdata)
> + return false;
> +
> + sl = &sl_pdata->dma_slave;
> if (sl->dma_dev == chan->device->dev) {
> chan->private = sl;
> return true;
> @@ -438,24 +443,31 @@ static bool filter(struct dma_chan *chan, void *slave)
>
> static int atmel_spi_configure_dma(struct atmel_spi *as)
> {
> - struct at_dma_slave *sdata = &as->dma.dma_slave;
> struct dma_slave_config slave_config;
> + struct device *dev = &as->pdev->dev;
> int err;
>
> - if (sdata && sdata->dma_dev) {
> - dma_cap_mask_t mask;
> + dma_cap_mask_t mask;
> + dma_cap_zero(mask);
> + dma_cap_set(DMA_SLAVE, mask);
>
> - /* Try to grab two DMA channels */
> - dma_cap_zero(mask);
> - dma_cap_set(DMA_SLAVE, mask);
> - as->dma.chan_tx = dma_request_channel(mask, filter, sdata);
> - if (as->dma.chan_tx)
> - as->dma.chan_rx =
> - dma_request_channel(mask, filter, sdata);
> + as->dma.chan_tx = dma_request_slave_channel_compat(mask, filter,
> + &as->dma,
> + dev, "tx");
> + if (!as->dma.chan_tx) {
> + dev_err(dev,
> + "DMA TX channel not available, SPI unable to use DMA\n");
> + err = -EBUSY;
> + goto error;
> }
> - if (!as->dma.chan_rx || !as->dma.chan_tx) {
> - dev_err(&as->pdev->dev,
> - "DMA channel not available, SPI unable to use DMA\n");
> +
> + as->dma.chan_rx = dma_request_slave_channel_compat(mask, filter,
> + &as->dma,
> + dev, "rx");
> +
> + if (!as->dma.chan_rx) {
> + dev_err(dev,
> + "DMA RX channel not available, SPI unable to use DMA\n");
> err = -EBUSY;
> goto error;
> }
> --
> 1.7.10.4
>
next prev parent reply other threads:[~2013-05-31 15:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 15:01 [PATCH 1/2] spi: atmel: convert to dma_request_slave_channel_compat() Richard Genoud
2013-05-31 15:02 ` [PATCH 2/2] ARM: at91: dt: at91sam9x5: add SPI DMA client infos Richard Genoud
2013-05-31 15:08 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
[not found] ` <51ac5610.87ebc20a.4198.ffffdc38SMTPIN_ADDED_BROKEN@mx.google.com>
2013-06-03 10:31 ` [PATCH 1/2] spi: atmel: convert to dma_request_slave_channel_compat() Richard Genoud
2013-06-03 15:22 ` Mark Brown
2013-06-04 2:43 ` Yang Wenyou
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=20130531150833.GF23653@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=broonie@kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=nicolas.ferre@atmel.com \
--cc=richard.genoud@gmail.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