All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH/RFC 2/3] dmaengine: shdmac: Add missing DMA_MEM_TO_MEM direction
Date: Mon, 13 Jul 2015 19:00:43 +0000	[thread overview]
Message-ID: <59869612.fDLAJFKxLR@avalon> (raw)
In-Reply-To: <1436529553-30571-3-git-send-email-geert+renesas@glider.be>

Hi Geert,

Thank you for the patch.

On Friday 10 July 2015 13:59:12 Geert Uytterhoeven wrote:
> If a driver does "dma_cap_set(DMA_MEMCPY), ...)", it should advertise
> DMA_MEM_TO_MEM support in the direction mask.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Is it true that DMA_MEMCPY implies DMA_MEM_TO_MEM?

The directions field is defined as

 * @directions: bit mask of slave direction the channel supported
 *      since the enum dma_transfer_direction is not defined as bits for each
 *      type of direction, the dma controller should fill (1 << <TYPE>) and 
same
 *      should be checked by controller as well

Memory-to-memory transfer isn't a DMA slave capability, so I don't think the 
directions field should report BIT(DMA_MEM_TO_MEM).

> ---
>  drivers/dma/sh/rcar-dmac.c   | 3 ++-
>  drivers/dma/sh/rcar-hpbdma.c | 3 ++-
>  drivers/dma/sh/shdmac.c      | 4 +++-
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
> index 7820d07e7beea7dd..11e5003a6cc27b40 100644
> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -1707,7 +1707,8 @@ static int rcar_dmac_probe(struct platform_device
> *pdev)
> 
>  	engine->src_addr_widths = widths;
>  	engine->dst_addr_widths = widths;
> -	engine->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
> +	engine->directions = BIT(DMA_MEM_TO_MEM) | BIT(DMA_MEM_TO_DEV) |
> +			     BIT(DMA_DEV_TO_MEM);
>  	engine->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
> 
>  	engine->device_alloc_chan_resources = rcar_dmac_alloc_chan_resources;
> diff --git a/drivers/dma/sh/rcar-hpbdma.c b/drivers/dma/sh/rcar-hpbdma.c
> index 2e21c1197769d0c8..29d67277415084b4 100644
> --- a/drivers/dma/sh/rcar-hpbdma.c
> +++ b/drivers/dma/sh/rcar-hpbdma.c
> @@ -599,7 +599,8 @@ static int hpb_dmae_probe(struct platform_device *pdev)
>  	dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);
>  	dma_dev->src_addr_widths = widths;
>  	dma_dev->dst_addr_widths = widths;
> -	dma_dev->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
> +	dma_dev->directions = BIT(DMA_MEM_TO_MEM) | BIT(DMA_MEM_TO_DEV) |
> +			      BIT(DMA_DEV_TO_MEM);
>  	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
> 
>  	hpbdev->shdma_dev.ops = &hpb_dmae_ops;
> diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
> index c9489ae6c0fa7f47..8693fff83d7b3af4 100644
> --- a/drivers/dma/sh/shdmac.c
> +++ b/drivers/dma/sh/shdmac.c
> @@ -750,8 +750,10 @@ static int sh_dmae_probe(struct platform_device *pdev)
>  	dma_dev->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
>  	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
> 
> -	if (!pdata->slave_only)
> +	if (!pdata->slave_only) {
>  		dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask);
> +		dma_dev->directions |= BIT(DMA_MEM_TO_MEM);
> +	}
>  	if (pdata->slave && pdata->slave_num)
>  		dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);

-- 
Regards,

Laurent Pinchart


      reply	other threads:[~2015-07-13 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 11:59 [PATCH/RFC 2/3] dmaengine: shdmac: Add missing DMA_MEM_TO_MEM direction Geert Uytterhoeven
2015-07-13 19:00 ` Laurent Pinchart [this message]

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=59869612.fDLAJFKxLR@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.