[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130605120346.GZ31367@sirena.org.uk>
Date: Wed, 5 Jun 2013 13:03:46 +0100
From: Mark Brown <broonie@...nel.org>
To: Illia Smyrnov <illia.smyrnov@...com>
Cc: Grant Likely <grant.likely@...aro.org>,
Rob Herring <rob.herring@...xeda.com>,
Rob Landley <rob@...dley.net>, Daniel Mack <zonque@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Tony Lindgren <tony@...mide.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devicetree-discuss@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
spi-devel-general@...ts.sourceforge.net
Subject: Re: [PATCH 2/2] spi: omap2-mcspi: Add FIFO buffer support
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?
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists