From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Jonas Bonn <jonas@norrbonn.se>
Cc: Nicolas.Ferre@microchip.com, linux-kernel@vger.kernel.org,
broonie@kernel.org, Ludovic.Desroches@microchip.com,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Tudor.Ambarus@microchip.com
Subject: Re: [PATCH v4 2/2] spi-atmel: support inter-word delay
Date: Tue, 29 Jan 2019 16:05:49 +0100 [thread overview]
Message-ID: <20190129150549.GA19959@piout.net> (raw)
In-Reply-To: <7a6efd1a-5920-60e5-bc68-dfbe6866e522@norrbonn.se>
Hi,
On 29/01/2019 15:56:31+0100, Jonas Bonn wrote:
> On 29/01/2019 15:27, Nicolas.Ferre@microchip.com wrote:
> > On 29/01/2019 at 09:38, Jonas Bonn wrote:
> > >
> > > + /* DLYBCT adds delays between words. This is useful for slow devices
> > > + * that need a bit of time to setup the next transfer.
> > > + */
> > > + if (spi->word_delay_us) {
> >
> > Well...
> >
> > > + csr |= SPI_BF(DLYBCT,
> > > + clamp_t(u8,
> > > + (as->spi_clk/1000000*spi->word_delay_us)>>5,
> > > + 1, 255));
> >
> > ... why not simplifying to:
> > + 0, 255));
> > and remove the test altogether, after all?
>
> Hmm... that seemed too easy! This started out as something else and looking
> at it now I think even the clamp_t() is unnecessary. The value is already
> 0-255 and the way SPI_BF works any overflow is already truncated... I'll
> rework this and resubmit once I get some feedback on the word_delay_us bits.
>
While at it, note that you need to add spaces around the operators.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2019-01-29 15:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190129083844.20572-1-jonas@norrbonn.se>
2019-01-29 8:38 ` [PATCH v4 1/2] spi: support inter-word delay requirement for devices Jonas Bonn
2019-01-29 18:06 ` Mark Brown
2019-01-29 8:38 ` [PATCH v4 2/2] spi-atmel: support inter-word delay Jonas Bonn
2019-01-29 14:27 ` Nicolas.Ferre
2019-01-29 14:56 ` Jonas Bonn
2019-01-29 15:05 ` Alexandre Belloni [this message]
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=20190129150549.GA19959@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=Ludovic.Desroches@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=Tudor.Ambarus@microchip.com \
--cc=broonie@kernel.org \
--cc=jonas@norrbonn.se \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.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 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).