All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
	drivers@analog.com,
	David Brownell <dbrownell@users.sourceforge.net>,
	linux-iio@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	matthias <mensch0815@googlemail.com>,
	spi-devel-general@lists.sourceforge.net, kernel@avr32linux.org
Subject: Re: [Patch] atmel_spi.c - let transfers through if not changing bits_per_word
Date: Wed, 13 Oct 2010 23:16:06 -0600	[thread overview]
Message-ID: <20101014051606.GA2248@angua.secretlab.ca> (raw)
In-Reply-To: <4CB5D566.2040301@gmail.com>

On Wed, Oct 13, 2010 at 05:51:02PM +0200, Matthias Brugger wrote:
> - bits_per_word option in spi_transfer are allowed if it does not change
> the csr register.
> 
> This is necessary for the driver in
> drivers/staging/iio/adis16260_core.c, as it uses this option.
> 
> Signed-off-by: Matthias Brugger <mensch0815@gmail.com>

Applied, thanks.

However, the patch is line-wrap damaged and I needed to fix it up by
hand.  Please check your email client configuration.

g.

> ---
>  drivers/spi/atmel_spi.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> index c4e0442..5c03a5b 100644
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -654,6 +654,8 @@ static int atmel_spi_transfer(struct spi_device
> *spi, struct spi_message *msg)
>  	struct spi_transfer	*xfer;
>  	unsigned long		flags;
>  	struct device		*controller = spi->master->dev.parent;
> +	u8			bits;
> +	struct atmel_spi_device	*asd;
> 
>  	as = spi_master_get_devdata(spi->master);
> 
> @@ -672,8 +674,18 @@ static int atmel_spi_transfer(struct spi_device
> *spi, struct spi_message *msg)
>  			return -EINVAL;
>  		}
> 
> +		if (xfer->bits_per_word) {
> +			asd = spi->controller_state;
> +			bits = (asd->csr >> 4) & 0xf;
> +			if (bits != xfer->bits_per_word - 8) {
> +				dev_dbg(&spi->dev, "you can't yet change "
> +					 "bit_per_word in transfers\n");
> +				return -ENOPROTOOPT;
> +			}
> +		}
> +
>  		/* FIXME implement these protocol options!! */
> -		if (xfer->bits_per_word || xfer->speed_hz) {
> +		if (xfer->speed_hz) {
>  			dev_dbg(&spi->dev, "no protocol options yet\n");
>  			return -ENOPROTOOPT;
>  		}
> -- 
> 1.5.6.5

WARNING: multiple messages have this Message-ID (diff)
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: drivers-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org,
	David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	kernel-o2ulR9ObcgE/ohRxsw7f2g@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	matthias <mensch0815-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
	Nicolas Ferre
	<nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>,
	Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [Patch] atmel_spi.c - let transfers through if not changing bits_per_word
Date: Wed, 13 Oct 2010 23:16:06 -0600	[thread overview]
Message-ID: <20101014051606.GA2248@angua.secretlab.ca> (raw)
In-Reply-To: <4CB5D566.2040301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Wed, Oct 13, 2010 at 05:51:02PM +0200, Matthias Brugger wrote:
> - bits_per_word option in spi_transfer are allowed if it does not change
> the csr register.
> 
> This is necessary for the driver in
> drivers/staging/iio/adis16260_core.c, as it uses this option.
> 
> Signed-off-by: Matthias Brugger <mensch0815-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied, thanks.

However, the patch is line-wrap damaged and I needed to fix it up by
hand.  Please check your email client configuration.

g.

> ---
>  drivers/spi/atmel_spi.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> index c4e0442..5c03a5b 100644
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -654,6 +654,8 @@ static int atmel_spi_transfer(struct spi_device
> *spi, struct spi_message *msg)
>  	struct spi_transfer	*xfer;
>  	unsigned long		flags;
>  	struct device		*controller = spi->master->dev.parent;
> +	u8			bits;
> +	struct atmel_spi_device	*asd;
> 
>  	as = spi_master_get_devdata(spi->master);
> 
> @@ -672,8 +674,18 @@ static int atmel_spi_transfer(struct spi_device
> *spi, struct spi_message *msg)
>  			return -EINVAL;
>  		}
> 
> +		if (xfer->bits_per_word) {
> +			asd = spi->controller_state;
> +			bits = (asd->csr >> 4) & 0xf;
> +			if (bits != xfer->bits_per_word - 8) {
> +				dev_dbg(&spi->dev, "you can't yet change "
> +					 "bit_per_word in transfers\n");
> +				return -ENOPROTOOPT;
> +			}
> +		}
> +
>  		/* FIXME implement these protocol options!! */
> -		if (xfer->bits_per_word || xfer->speed_hz) {
> +		if (xfer->speed_hz) {
>  			dev_dbg(&spi->dev, "no protocol options yet\n");
>  			return -ENOPROTOOPT;
>  		}
> -- 
> 1.5.6.5

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

  reply	other threads:[~2010-10-14  5:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-13 15:51 [Patch] atmel_spi.c - let transfers through if not changing bits_per_word Matthias Brugger
2010-10-13 15:51 ` Matthias Brugger
2010-10-14  5:16 ` Grant Likely [this message]
2010-10-14  5:16   ` Grant Likely

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=20101014051606.GA2248@angua.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=dbrownell@users.sourceforge.net \
    --cc=drivers@analog.com \
    --cc=jic23@cam.ac.uk \
    --cc=kernel@avr32linux.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mensch0815@googlemail.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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.