linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <Guangyu.Chen@freescale.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>, <vinod.koul@intel.com>,
	<s.hauer@pengutronix.de>
Cc: <broonie@kernel.org>, <robh+dt@kernel.org>, <pawel.moll@arm.com>,
	<mark.rutland@arm.com>, <ijc+devicetree@hellion.org.uk>,
	<galak@codeaurora.org>, <rdunlap@infradead.org>,
	<lgirdwood@gmail.com>, <perex@perex.cz>, <tiwai@suse.de>,
	<timur@tabi.org>, <grant.likely@linaro.org>,
	<devicetree@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>,
	<linuxppc-dev@lists.ozlabs.org>, <dan.j.williams@intel.com>,
	<dmaengine@vger.kernel.org>, <b38343@freescale.com>,
	<b02247@freescale.com>, <b42378@freescale.com>
Subject: Re: [RFC][PATCH 1/2] dma: imx-sdma: Add device to device support
Date: Fri, 27 Jun 2014 18:58:09 +0800	[thread overview]
Message-ID: <20140627105808.GB2506@MrMyself> (raw)
In-Reply-To: <42744e778ce8a4b424d5642f86d18ef047bcc7cd.1402653667.git.nicoleotsuka@gmail.com>

On Fri, Jun 13, 2014 at 06:07:04PM +0800, Nicolin Chen wrote:
> This patch adds DEV_TO_DEV support for i.MX SDMA driver to support data
> tranfer between two peripheral FIFOs. The per_2_per script requires two
> peripheral addresses and two DMA requests. So this patch also adds them
> into private structure.
> 
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>

Excuse me, the patch has been here for two weeks. Could anyone please
give a comment or an Ack on it?

Thank you,
Nicolin

> ---
>  drivers/dma/imx-sdma.c                | 40 ++++++++++++++++++++++++++++++-----
>  include/linux/platform_data/dma-imx.h |  1 +
>  2 files changed, 36 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 85561dc..5af1a69 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -258,8 +258,9 @@ struct sdma_channel {
>  	struct sdma_buffer_descriptor	*bd;
>  	dma_addr_t			bd_phys;
>  	unsigned int			pc_from_device, pc_to_device;
> +	unsigned int			device_to_device;
>  	unsigned long			flags;
> -	dma_addr_t			per_address;
> +	dma_addr_t			per_address, per_address2;
>  	unsigned long			event_mask[2];
>  	unsigned long			watermark_level;
>  	u32				shp_addr, per_addr;
> @@ -696,6 +697,7 @@ static void sdma_get_pc(struct sdma_channel *sdmac,
>  
>  	sdmac->pc_from_device = 0;
>  	sdmac->pc_to_device = 0;
> +	sdmac->device_to_device = 0;
>  
>  	switch (peripheral_type) {
>  	case IMX_DMATYPE_MEMORY:
> @@ -770,6 +772,7 @@ static void sdma_get_pc(struct sdma_channel *sdmac,
>  
>  	sdmac->pc_from_device = per_2_emi;
>  	sdmac->pc_to_device = emi_2_per;
> +	sdmac->device_to_device = per_2_per;
>  }
>  
>  static int sdma_load_context(struct sdma_channel *sdmac)
> @@ -782,11 +785,12 @@ static int sdma_load_context(struct sdma_channel *sdmac)
>  	int ret;
>  	unsigned long flags;
>  
> -	if (sdmac->direction == DMA_DEV_TO_MEM) {
> +	if (sdmac->direction == DMA_DEV_TO_MEM)
>  		load_address = sdmac->pc_from_device;
> -	} else {
> +	else if (sdmac->direction == DMA_DEV_TO_DEV)
> +		load_address = sdmac->device_to_device;
> +	else
>  		load_address = sdmac->pc_to_device;
> -	}
>  
>  	if (load_address < 0)
>  		return load_address;
> @@ -850,6 +854,12 @@ static int sdma_config_channel(struct sdma_channel *sdmac)
>  		sdma_event_enable(sdmac, sdmac->event_id0);
>  	}
>  
> +	if (sdmac->event_id1) {
> +		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
> +			return -EINVAL;
> +		sdma_event_enable(sdmac, sdmac->event_id1);
> +	}
> +
>  	switch (sdmac->peripheral_type) {
>  	case IMX_DMATYPE_DSP:
>  		sdma_config_ownership(sdmac, false, true, true);
> @@ -880,7 +890,12 @@ static int sdma_config_channel(struct sdma_channel *sdmac)
>  		/* Watermark Level */
>  		sdmac->watermark_level |= sdmac->watermark_level;
>  		/* Address */
> -		sdmac->shp_addr = sdmac->per_address;
> +		if (sdmac->direction == DMA_DEV_TO_DEV) {
> +			sdmac->shp_addr = sdmac->per_address2;
> +			sdmac->per_addr = sdmac->per_address;
> +		} else {
> +			sdmac->shp_addr = sdmac->per_address;
> +		}
>  	} else {
>  		sdmac->watermark_level = 0; /* FIXME: M3_BASE_ADDRESS */
>  	}
> @@ -974,6 +989,7 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
>  
>  	sdmac->peripheral_type = data->peripheral_type;
>  	sdmac->event_id0 = data->dma_request;
> +	sdmac->event_id1 = data->dma_request2;
>  
>  	clk_enable(sdmac->sdma->clk_ipg);
>  	clk_enable(sdmac->sdma->clk_ahb);
> @@ -1213,6 +1229,19 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
>  			sdmac->watermark_level = dmaengine_cfg->src_maxburst *
>  						dmaengine_cfg->src_addr_width;
>  			sdmac->word_size = dmaengine_cfg->src_addr_width;
> +		} else if (dmaengine_cfg->direction == DMA_DEV_TO_DEV) {
> +			sdmac->per_address = dmaengine_cfg->src_addr;
> +			sdmac->per_address2 = dmaengine_cfg->dst_addr;
> +			/*
> +			 * For per_2_per sciprt, register r7 requires two
> +			 * watermark levels: the lower placed at bits [0-7]
> +			 * and the higher one placed at bits [16-23].
> +			 */
> +			sdmac->watermark_level =
> +				dmaengine_cfg->src_maxburst & 0xff;
> +			sdmac->watermark_level |=
> +				(dmaengine_cfg->dst_maxburst & 0xff) << 16;
> +			sdmac->word_size = dmaengine_cfg->dst_addr_width;
>  		} else {
>  			sdmac->per_address = dmaengine_cfg->dst_addr;
>  			sdmac->watermark_level = dmaengine_cfg->dst_maxburst *
> @@ -1433,6 +1462,7 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
>  	data.dma_request = dma_spec->args[0];
>  	data.peripheral_type = dma_spec->args[1];
>  	data.priority = dma_spec->args[2];
> +	data.dma_request2 = 0;
>  
>  	return dma_request_channel(mask, sdma_filter_fn, &data);
>  }
> diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
> index 7aa0e89..6a1357d 100644
> --- a/include/linux/platform_data/dma-imx.h
> +++ b/include/linux/platform_data/dma-imx.h
> @@ -51,6 +51,7 @@ enum imx_dma_prio {
>  
>  struct imx_dma_data {
>  	int dma_request; /* DMA request line */
> +	int dma_request2; /* secondary DMA request line */
>  	enum sdma_peripheral_type peripheral_type;
>  	int priority;
>  };
> -- 
> 1.8.4
> 

  reply	other threads:[~2014-06-27 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 10:07 [RFC][PATCH 0/2] Add ASRC Peripheral to Peripheral driver Nicolin Chen
2014-06-13 10:07 ` [RFC][PATCH 1/2] dma: imx-sdma: Add device to device support Nicolin Chen
2014-06-27 10:58   ` Nicolin Chen [this message]
2014-07-11 10:11   ` Nicolin Chen
2014-06-13 10:07 ` [RFC][PATCH 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers Nicolin Chen
2014-07-24  8:25 ` [RFC][PATCH 0/2] Add ASRC Peripheral to Peripheral driver Nicolin Chen

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=20140627105808.GB2506@MrMyself \
    --to=guangyu.chen@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b02247@freescale.com \
    --cc=b38343@freescale.com \
    --cc=b42378@freescale.com \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lgirdwood@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=timur@tabi.org \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).