From: Simon Horman <horms@verge.net.au>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>,
linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] mmc: sh-mmcif: add DMA SG synchronisation
Date: Tue, 4 Feb 2014 09:57:53 +0900 [thread overview]
Message-ID: <20140204005752.GD24787@verge.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.1401311249070.3234@axis700.grange>
On Fri, Jan 31, 2014 at 12:54:29PM +0100, Guennadi Liakhovetski wrote:
> According to the DMA API data has to be synchronised before starting
> a DMA transfer to device and after completing a DMA transfer from device.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> drivers/mmc/host/sh_mmcif.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index d032b08..902780c 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -345,6 +345,8 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
> DMA_TO_DEVICE);
> if (ret > 0) {
> host->dma_active = true;
> + dma_sync_sg_for_device(chan->device->dev, sg, data->sg_len,
> + DMA_TO_DEVICE);
> desc = dmaengine_prep_slave_sg(chan, sg, ret,
> DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> }
> @@ -1118,14 +1120,14 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
> time = wait_for_completion_interruptible_timeout(&host->dma_complete,
> host->timeout);
>
> - if (data->flags & MMC_DATA_READ)
> - dma_unmap_sg(host->chan_rx->device->dev,
> - data->sg, data->sg_len,
> - DMA_FROM_DEVICE);
> - else
> - dma_unmap_sg(host->chan_tx->device->dev,
> - data->sg, data->sg_len,
> - DMA_TO_DEVICE);
> + if (data->flags & MMC_DATA_READ) {
> + struct device *dev = host->chan_rx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + dma_sync_sg_for_cpu(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + } else {
> + struct device *dev = host->chan_tx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_TO_DEVICE);
> + }
>
> if (host->sd_error) {
> dev_err(host->mmc->parent,
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@verge.net.au>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] mmc: sh-mmcif: add DMA SG synchronisation
Date: Tue, 04 Feb 2014 00:57:53 +0000 [thread overview]
Message-ID: <20140204005752.GD24787@verge.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.1401311249070.3234@axis700.grange>
On Fri, Jan 31, 2014 at 12:54:29PM +0100, Guennadi Liakhovetski wrote:
> According to the DMA API data has to be synchronised before starting
> a DMA transfer to device and after completing a DMA transfer from device.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> drivers/mmc/host/sh_mmcif.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index d032b08..902780c 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -345,6 +345,8 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
> DMA_TO_DEVICE);
> if (ret > 0) {
> host->dma_active = true;
> + dma_sync_sg_for_device(chan->device->dev, sg, data->sg_len,
> + DMA_TO_DEVICE);
> desc = dmaengine_prep_slave_sg(chan, sg, ret,
> DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> }
> @@ -1118,14 +1120,14 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
> time = wait_for_completion_interruptible_timeout(&host->dma_complete,
> host->timeout);
>
> - if (data->flags & MMC_DATA_READ)
> - dma_unmap_sg(host->chan_rx->device->dev,
> - data->sg, data->sg_len,
> - DMA_FROM_DEVICE);
> - else
> - dma_unmap_sg(host->chan_tx->device->dev,
> - data->sg, data->sg_len,
> - DMA_TO_DEVICE);
> + if (data->flags & MMC_DATA_READ) {
> + struct device *dev = host->chan_rx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + dma_sync_sg_for_cpu(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + } else {
> + struct device *dev = host->chan_tx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_TO_DEVICE);
> + }
>
> if (host->sd_error) {
> dev_err(host->mmc->parent,
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: horms@verge.net.au (Simon Horman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] mmc: sh-mmcif: add DMA SG synchronisation
Date: Tue, 4 Feb 2014 09:57:53 +0900 [thread overview]
Message-ID: <20140204005752.GD24787@verge.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.1401311249070.3234@axis700.grange>
On Fri, Jan 31, 2014 at 12:54:29PM +0100, Guennadi Liakhovetski wrote:
> According to the DMA API data has to be synchronised before starting
> a DMA transfer to device and after completing a DMA transfer from device.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
> ---
> drivers/mmc/host/sh_mmcif.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index d032b08..902780c 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -345,6 +345,8 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
> DMA_TO_DEVICE);
> if (ret > 0) {
> host->dma_active = true;
> + dma_sync_sg_for_device(chan->device->dev, sg, data->sg_len,
> + DMA_TO_DEVICE);
> desc = dmaengine_prep_slave_sg(chan, sg, ret,
> DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> }
> @@ -1118,14 +1120,14 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
> time = wait_for_completion_interruptible_timeout(&host->dma_complete,
> host->timeout);
>
> - if (data->flags & MMC_DATA_READ)
> - dma_unmap_sg(host->chan_rx->device->dev,
> - data->sg, data->sg_len,
> - DMA_FROM_DEVICE);
> - else
> - dma_unmap_sg(host->chan_tx->device->dev,
> - data->sg, data->sg_len,
> - DMA_TO_DEVICE);
> + if (data->flags & MMC_DATA_READ) {
> + struct device *dev = host->chan_rx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + dma_sync_sg_for_cpu(dev, data->sg, data->sg_len, DMA_FROM_DEVICE);
> + } else {
> + struct device *dev = host->chan_tx->device->dev;
> + dma_unmap_sg(dev, data->sg, data->sg_len, DMA_TO_DEVICE);
> + }
>
> if (host->sd_error) {
> dev_err(host->mmc->parent,
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-02-04 0:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-31 11:54 [PATCH 0/3] mmc: add DMA SG synchronisation Guennadi Liakhovetski
2014-01-31 11:54 ` [PATCH 1/3] mmc: tmio-mmc: " Guennadi Liakhovetski
2014-01-31 11:54 ` Guennadi Liakhovetski
2014-02-04 0:57 ` Simon Horman
2014-02-04 0:57 ` Simon Horman
2014-02-04 0:57 ` Simon Horman
2014-02-06 12:01 ` Ben Dooks
2014-02-06 12:01 ` Ben Dooks
2014-02-06 12:01 ` Ben Dooks
2014-02-06 12:06 ` Guennadi Liakhovetski
2014-02-06 12:06 ` Guennadi Liakhovetski
2014-01-31 11:54 ` [PATCH 2/3] mmc: sh-mmcif: " Guennadi Liakhovetski
2014-01-31 11:54 ` Guennadi Liakhovetski
2014-02-04 0:57 ` Simon Horman [this message]
2014-02-04 0:57 ` Simon Horman
2014-02-04 0:57 ` Simon Horman
2014-01-31 11:54 ` [PATCH 3/3] mmc: mxcmmc: " Guennadi Liakhovetski
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=20140204005752.GD24787@verge.net.au \
--to=horms@verge.net.au \
--cc=cjb@laptop.org \
--cc=g.liakhovetski@gmx.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--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.