public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel•com (Nicolas Ferre)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 3/3] at_hdmac: add FIFO configuration parameter to DMA DT binding
Date: Thu, 30 May 2013 18:32:16 +0200	[thread overview]
Message-ID: <51A77F10.8020808@atmel.com> (raw)
In-Reply-To: <1369930103-11963-4-git-send-email-ludovic.desroches@atmel.com>

On 30/05/2013 18:08, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel•com>
>
> For most devices the FIFO configuration is the same i.e. when half FIFO size is
> available/filled, a source/destination request is serviced. But USART devices
> have to do it when there is enough space/data available to perform a single
> AHB access so the ASAP configuration.
>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft•com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel•com>

Clear and neat: thanks Ludo.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel•com>

> ---
>   .../devicetree/bindings/dma/atmel-dma.txt          |  7 ++++--
>   drivers/dma/at_hdmac.c                             | 25 ++++++++++++++++++----
>   2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> index c80e8a3..c280a0e 100644
> --- a/Documentation/devicetree/bindings/dma/atmel-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> @@ -24,8 +24,11 @@ The three cells in order are:
>   1. A phandle pointing to the DMA controller.
>   2. The memory interface (16 most significant bits), the peripheral interface
>   (16 less significant bits).
> -3. The peripheral identifier for the hardware handshaking interface. The
> -identifier can be different for tx and rx.
> +3. Parameters for the at91 DMA configuration register which are device
> +dependant:
> +  - bit 7-0: peripheral identifier for the hardware handshaking interface. The
> +  identifier can be different for tx and rx.
> +  - bit 11-8: FIFO configuration. 0 for half FIFO, 1 for ALAP, 1 for ASAP.
>
>   Example:
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e923cda..bfd73e1 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -14,6 +14,7 @@
>    * found on AT91SAM9263.
>    */
>
> +#include <dt-bindings/dma/at91.h>
>   #include <linux/clk.h>
>   #include <linux/dmaengine.h>
>   #include <linux/dma-mapping.h>
> @@ -1223,14 +1224,30 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
>   	atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL);
>   	if (!atslave)
>   		return NULL;
> +
> +	atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW;
>   	/*
>   	 * We can fill both SRC_PER and DST_PER, one of these fields will be
>   	 * ignored depending on DMA transfer direction.
>   	 */
> -	per_id = dma_spec->args[1];
> -	atslave->cfg = ATC_FIFOCFG_HALFFIFO | ATC_DST_H2SEL_HW
> -		      | ATC_SRC_H2SEL_HW | ATC_DST_PER(per_id)
> -		      | ATC_SRC_PER(per_id);
> +	per_id = dma_spec->args[1] & AT91_DMA_CFG_PER_ID_MASK;
> +	atslave->cfg |= ATC_DST_PER(per_id) | ATC_SRC_PER(per_id);
> +	/*
> +	 * We have to translate the value we get from the device tree since
> +	 * the half FIFO configuration value had to be 0 to keep backward
> +	 * compatibility.
> +	 */
> +	switch(dma_spec->args[1] & AT91_DMA_CFG_FIFOCFG_MASK) {
> +		case AT91_DMA_CFG_FIFOCFG_ALAP:
> +			atslave->cfg |= ATC_FIFOCFG_LARGESTBURST;
> +			break;
> +		case AT91_DMA_CFG_FIFOCFG_ASAP:
> +			atslave->cfg |= ATC_FIFOCFG_ENOUGHSPACE;
> +			break;
> +		case AT91_DMA_CFG_FIFOCFG_HALF:
> +		default:
> +			atslave->cfg |= ATC_FIFOCFG_HALFFIFO;
> +	}
>   	atslave->dma_dev = &dmac_pdev->dev;
>
>   	chan = dma_request_channel(mask, at_dma_filter, atslave);
>


-- 
Nicolas Ferre

  reply	other threads:[~2013-05-30 16:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 16:08 [PATCH 0/3] at_hdmac: dt dma bindings update ludovic.desroches at atmel.com
2013-05-30 16:08 ` [PATCH 1/3] ARM: at91: dt: add header to define at_hdmac configuration ludovic.desroches at atmel.com
2013-05-31 21:30   ` Arnd Bergmann
2013-06-03  7:32     ` Ludovic Desroches
2013-06-04 13:17       ` Nicolas Ferre
2013-05-30 16:08 ` [PATCH 2/3] ARM: at91: dt: switch DMA DT bindings to pre-processor ludovic.desroches at atmel.com
2013-05-30 16:08 ` [PATCH 3/3] at_hdmac: add FIFO configuration parameter to DMA DT binding ludovic.desroches at atmel.com
2013-05-30 16:32   ` Nicolas Ferre [this message]
2013-05-30 16:39     ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31  9:16       ` Ludovic Desroches
2013-05-31  9:31         ` Nicolas Ferre
2013-05-31 15:11           ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31 23:11           ` Olof Johansson
2013-06-03  7:39             ` Ludovic Desroches
2013-05-30 16:37 ` [PATCH 0/3] at_hdmac: dt dma bindings update Jean-Christophe PLAGNIOL-VILLARD
2013-05-30 17:26 ` Vinod Koul
2013-05-30 20:13   ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31  8:04     ` Nicolas Ferre

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=51A77F10.8020808@atmel.com \
    --to=nicolas.ferre@atmel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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