devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Illia Smyrnov <illia.smyrnov@ti.com>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>, Daniel Mack <zonque@gmail.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net
Subject: Re: [PATCH 2/2] spi: omap2-mcspi: Add FIFO buffer support
Date: Wed, 5 Jun 2013 13:03:46 +0100	[thread overview]
Message-ID: <20130605120346.GZ31367@sirena.org.uk> (raw)
In-Reply-To: <1370432398-7796-3-git-send-email-illia.smyrnov@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

On Wed, Jun 05, 2013 at 02:39:58PM +0300, Illia Smyrnov wrote:

>  - The spi slave nodes can provide the following information which is used
>    by the spi controller:
>    - ti,spi-turbo-mode: Set turbo mode for this device.
> +  - ti,spi-fifo-depth: Enable FIFO and set up buffer depth.

Why is this defined for slaves?  Surely the size of the FIFO in the
controller is a property of the controller not the slave?

> +		bytes_per_word = (cs->word_len <= 8) ? 1 :
> +				(cs->word_len <= 16) ? 2 :
> +				/* cs->word_len <= 32 */ 4;

This isn't legible.  Use a switch statement, or better yet just divide.

> +		level = (t->len < mcspi->fifo_depth ? t->len :
> +			mcspi->fifo_depth) - 1;
> +
> +		mcspi_write_reg(master, OMAP2_MCSPI_XFERLEVEL,
> +			((wcnt << 16) | (level << (is_read ? 8 : 0))));
> +
> +		chconf |= is_read ? OMAP2_MCSPI_CHCONF_FFER :
> +			OMAP2_MCSPI_CHCONF_FFET;

Please avoid such extensive use of the ternery operator, it's not good
for legibility.

> +	} else {
> +		mcspi->fifo_depth = 0;
> +		chconf &= ~(is_read ? OMAP2_MCSPI_CHCONF_FFER :
> +			OMAP2_MCSPI_CHCONF_FFET);
> +	}
> +
> +	mcspi_write_chconf0(spi, chconf);

We have a bunch of return statements further up the function in cases
where the FIFO can't be used which means that if we're in FIFO mode then
hit one of those we'll not disable FIFO mode as far as I can tell?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-06-05 12:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 11:39 [PATCH 0/2] spi: omap2-mcspi: add FIFO buffer support Illia Smyrnov
2013-06-05 11:39 ` [PATCH 1/2] spi: spi-omap2-mcspi.c: Add dts for slave device configuration Illia Smyrnov
     [not found]   ` <1370432398-7796-2-git-send-email-illia.smyrnov-l0cyMroinI0@public.gmane.org>
2013-06-05 11:57     ` Mark Brown
     [not found]       ` <20130605115734.GY31367-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-06-06 10:08         ` Illia Smyrnov
2013-06-06 10:19           ` Mark Brown
     [not found] ` <1370432398-7796-1-git-send-email-illia.smyrnov-l0cyMroinI0@public.gmane.org>
2013-06-05 11:39   ` [PATCH 2/2] spi: omap2-mcspi: Add FIFO buffer support Illia Smyrnov
2013-06-05 12:03     ` Mark Brown [this message]
     [not found]       ` <20130605120346.GZ31367-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-06-06 10:08         ` Illia Smyrnov
     [not found]           ` <51B05FB8.6050903-l0cyMroinI0@public.gmane.org>
2013-06-06 10:30             ` Mark Brown
     [not found]               ` <20130606103032.GR31367-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-06-11 17:09                 ` Illia Smyrnov

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=20130605120346.GZ31367@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=illia.smyrnov@ti.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=tony@atomide.com \
    --cc=zonque@gmail.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).