All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
To: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sagar Dharia <sdharia-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Daniel Sneddon <dsneddon-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Bjorn Andersson
	<bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] spi: qup: Add DMA capabilities
Date: Wed, 02 Jul 2014 17:26:31 +0300	[thread overview]
Message-ID: <1404311191.3622.22.camel@iivanov-dev> (raw)
In-Reply-To: <1403816781-31008-1-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>


Hi Andy,

Just few comments.

On Thu, 2014-06-26 at 16:06 -0500, Andy Gross wrote:
> This patch adds DMA capabilities to the spi-qup driver.  If DMA channels are
> present, the QUP will use DMA instead of block mode for transfers to/from SPI
> peripherals for transactions larger than the length of a block.
> 
> Signed-off-by: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>  .../devicetree/bindings/spi/qcom,spi-qup.txt       |   10 +
>  drivers/spi/spi-qup.c                              |  361 ++++++++++++++++++--
>  2 files changed, 350 insertions(+), 21 deletions(-)
> 

<snip>
 
> diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
> index fc1de86..9b01db5 100644
> --- a/drivers/spi/spi-qup.c
> +++ b/drivers/spi/spi-qup.c
> @@ -22,6 +22,8 @@
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/spi/spi.h>
> +#include <linux/dmaengine.h>
> +#include <linux/dma-mapping.h>
>  
>  #define QUP_CONFIG			0x0000
>  #define QUP_STATE			0x0004
> @@ -116,6 +118,8 @@
>  
>  #define SPI_NUM_CHIPSELECTS		4
>  
> +#define SPI_MAX_XFER			(SZ_64K - 64)
> +
>  /* high speed mode is when bus rate is greater then 26MHz */
>  #define SPI_HS_MIN_RATE			26000000
>  #define SPI_MAX_RATE			50000000
> @@ -142,6 +146,17 @@ struct spi_qup {
>  	int			w_size;	/* bytes per SPI word */
>  	int			tx_bytes;
>  	int			rx_bytes;
> +
> +	int			use_dma;
> +
> +	struct dma_chan		*rx_chan;
> +	struct dma_slave_config	rx_conf;
> +	struct dma_chan		*tx_chan;
> +	struct dma_slave_config tx_conf;
> +	dma_addr_t		rx_dma;
> +	dma_addr_t		tx_dma;

DMA addresses seems unused.

> +	void			*dummy;

This is not so dummy, probably 'spare'.

> +	atomic_t		dma_outstanding;
>  };

<snip>

>  
>  
> @@ -632,6 +896,56 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
>  		       base + SPI_ERROR_FLAGS_EN);
>  
> +	/* allocate dma resources, if available */
> +	controller->rx_chan = dma_request_slave_channel(&pdev->dev, "rx");
> +	if (controller->rx_chan) {
> +		controller->tx_chan =
> +			dma_request_slave_channel(&pdev->dev, "tx");
> +
> +		if (!controller->tx_chan) {
> +			dev_err(&pdev->dev, "Failed to allocate dma tx chan");
> +			dma_release_channel(controller->rx_chan);


There is no point to go further with DMA configuration
if there are no channels, right?

> +		}
> +
> +		/* set DMA parameters */
> +		controller->rx_conf.device_fc = 1;
> +		controller->rx_conf.src_addr = res->start + QUP_INPUT_FIFO;
> +		controller->rx_conf.src_maxburst = controller->in_blk_sz;
> +
> +		controller->tx_conf.device_fc = 1;
> +		controller->tx_conf.dst_addr = res->start + QUP_OUTPUT_FIFO;
> +		controller->tx_conf.dst_maxburst = controller->out_blk_sz;
> +


Please, could you share blsp2_bam device node configuration? 
I would like to test these changes.

Regards,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
To: Andy Gross <agross@codeaurora.org>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, Sagar Dharia <sdharia@codeaurora.org>,
	Daniel Sneddon <dsneddon@codeaurora.org>,
	Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] spi: qup: Add DMA capabilities
Date: Wed, 02 Jul 2014 17:26:31 +0300	[thread overview]
Message-ID: <1404311191.3622.22.camel@iivanov-dev> (raw)
In-Reply-To: <1403816781-31008-1-git-send-email-agross@codeaurora.org>


Hi Andy,

Just few comments.

On Thu, 2014-06-26 at 16:06 -0500, Andy Gross wrote:
> This patch adds DMA capabilities to the spi-qup driver.  If DMA channels are
> present, the QUP will use DMA instead of block mode for transfers to/from SPI
> peripherals for transactions larger than the length of a block.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>
> ---
>  .../devicetree/bindings/spi/qcom,spi-qup.txt       |   10 +
>  drivers/spi/spi-qup.c                              |  361 ++++++++++++++++++--
>  2 files changed, 350 insertions(+), 21 deletions(-)
> 

<snip>
 
> diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
> index fc1de86..9b01db5 100644
> --- a/drivers/spi/spi-qup.c
> +++ b/drivers/spi/spi-qup.c
> @@ -22,6 +22,8 @@
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/spi/spi.h>
> +#include <linux/dmaengine.h>
> +#include <linux/dma-mapping.h>
>  
>  #define QUP_CONFIG			0x0000
>  #define QUP_STATE			0x0004
> @@ -116,6 +118,8 @@
>  
>  #define SPI_NUM_CHIPSELECTS		4
>  
> +#define SPI_MAX_XFER			(SZ_64K - 64)
> +
>  /* high speed mode is when bus rate is greater then 26MHz */
>  #define SPI_HS_MIN_RATE			26000000
>  #define SPI_MAX_RATE			50000000
> @@ -142,6 +146,17 @@ struct spi_qup {
>  	int			w_size;	/* bytes per SPI word */
>  	int			tx_bytes;
>  	int			rx_bytes;
> +
> +	int			use_dma;
> +
> +	struct dma_chan		*rx_chan;
> +	struct dma_slave_config	rx_conf;
> +	struct dma_chan		*tx_chan;
> +	struct dma_slave_config tx_conf;
> +	dma_addr_t		rx_dma;
> +	dma_addr_t		tx_dma;

DMA addresses seems unused.

> +	void			*dummy;

This is not so dummy, probably 'spare'.

> +	atomic_t		dma_outstanding;
>  };

<snip>

>  
>  
> @@ -632,6 +896,56 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
>  		       base + SPI_ERROR_FLAGS_EN);
>  
> +	/* allocate dma resources, if available */
> +	controller->rx_chan = dma_request_slave_channel(&pdev->dev, "rx");
> +	if (controller->rx_chan) {
> +		controller->tx_chan =
> +			dma_request_slave_channel(&pdev->dev, "tx");
> +
> +		if (!controller->tx_chan) {
> +			dev_err(&pdev->dev, "Failed to allocate dma tx chan");
> +			dma_release_channel(controller->rx_chan);


There is no point to go further with DMA configuration
if there are no channels, right?

> +		}
> +
> +		/* set DMA parameters */
> +		controller->rx_conf.device_fc = 1;
> +		controller->rx_conf.src_addr = res->start + QUP_INPUT_FIFO;
> +		controller->rx_conf.src_maxburst = controller->in_blk_sz;
> +
> +		controller->tx_conf.device_fc = 1;
> +		controller->tx_conf.dst_addr = res->start + QUP_OUTPUT_FIFO;
> +		controller->tx_conf.dst_maxburst = controller->out_blk_sz;
> +


Please, could you share blsp2_bam device node configuration? 
I would like to test these changes.

Regards,
Ivan


WARNING: multiple messages have this Message-ID (diff)
From: iivanov@mm-sol.com (Ivan T. Ivanov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi: qup: Add DMA capabilities
Date: Wed, 02 Jul 2014 17:26:31 +0300	[thread overview]
Message-ID: <1404311191.3622.22.camel@iivanov-dev> (raw)
In-Reply-To: <1403816781-31008-1-git-send-email-agross@codeaurora.org>


Hi Andy,

Just few comments.

On Thu, 2014-06-26 at 16:06 -0500, Andy Gross wrote:
> This patch adds DMA capabilities to the spi-qup driver.  If DMA channels are
> present, the QUP will use DMA instead of block mode for transfers to/from SPI
> peripherals for transactions larger than the length of a block.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>
> ---
>  .../devicetree/bindings/spi/qcom,spi-qup.txt       |   10 +
>  drivers/spi/spi-qup.c                              |  361 ++++++++++++++++++--
>  2 files changed, 350 insertions(+), 21 deletions(-)
> 

<snip>
 
> diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
> index fc1de86..9b01db5 100644
> --- a/drivers/spi/spi-qup.c
> +++ b/drivers/spi/spi-qup.c
> @@ -22,6 +22,8 @@
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/spi/spi.h>
> +#include <linux/dmaengine.h>
> +#include <linux/dma-mapping.h>
>  
>  #define QUP_CONFIG			0x0000
>  #define QUP_STATE			0x0004
> @@ -116,6 +118,8 @@
>  
>  #define SPI_NUM_CHIPSELECTS		4
>  
> +#define SPI_MAX_XFER			(SZ_64K - 64)
> +
>  /* high speed mode is when bus rate is greater then 26MHz */
>  #define SPI_HS_MIN_RATE			26000000
>  #define SPI_MAX_RATE			50000000
> @@ -142,6 +146,17 @@ struct spi_qup {
>  	int			w_size;	/* bytes per SPI word */
>  	int			tx_bytes;
>  	int			rx_bytes;
> +
> +	int			use_dma;
> +
> +	struct dma_chan		*rx_chan;
> +	struct dma_slave_config	rx_conf;
> +	struct dma_chan		*tx_chan;
> +	struct dma_slave_config tx_conf;
> +	dma_addr_t		rx_dma;
> +	dma_addr_t		tx_dma;

DMA addresses seems unused.

> +	void			*dummy;

This is not so dummy, probably 'spare'.

> +	atomic_t		dma_outstanding;
>  };

<snip>

>  
>  
> @@ -632,6 +896,56 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
>  		       base + SPI_ERROR_FLAGS_EN);
>  
> +	/* allocate dma resources, if available */
> +	controller->rx_chan = dma_request_slave_channel(&pdev->dev, "rx");
> +	if (controller->rx_chan) {
> +		controller->tx_chan =
> +			dma_request_slave_channel(&pdev->dev, "tx");
> +
> +		if (!controller->tx_chan) {
> +			dev_err(&pdev->dev, "Failed to allocate dma tx chan");
> +			dma_release_channel(controller->rx_chan);


There is no point to go further with DMA configuration
if there are no channels, right?

> +		}
> +
> +		/* set DMA parameters */
> +		controller->rx_conf.device_fc = 1;
> +		controller->rx_conf.src_addr = res->start + QUP_INPUT_FIFO;
> +		controller->rx_conf.src_maxburst = controller->in_blk_sz;
> +
> +		controller->tx_conf.device_fc = 1;
> +		controller->tx_conf.dst_addr = res->start + QUP_OUTPUT_FIFO;
> +		controller->tx_conf.dst_maxburst = controller->out_blk_sz;
> +


Please, could you share blsp2_bam device node configuration? 
I would like to test these changes.

Regards,
Ivan

  parent reply	other threads:[~2014-07-02 14:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 21:06 [PATCH] spi: qup: Add DMA capabilities Andy Gross
2014-06-26 21:06 ` Andy Gross
2014-06-27 10:50 ` Mark Brown
2014-06-27 10:50   ` Mark Brown
2014-06-27 15:54   ` Andy Gross
2014-06-27 15:54     ` Andy Gross
2014-06-27 16:24     ` Russell King - ARM Linux
2014-06-27 16:24       ` Russell King - ARM Linux
     [not found]       ` <20140627162411.GO32514-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-06-27 18:58         ` Andy Gross
2014-06-27 18:58           ` Andy Gross
2014-06-27 18:58           ` Andy Gross
     [not found] ` <1403816781-31008-1-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-07-02 14:26   ` Ivan T. Ivanov [this message]
2014-07-02 14:26     ` Ivan T. Ivanov
2014-07-02 14:26     ` Ivan T. Ivanov

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=1404311191.3622.22.camel@iivanov-dev \
    --to=iivanov-neyub+7iv8pqt0dzr+alfa@public.gmane.org \
    --cc=agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=dsneddon-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sdharia-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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.