From: Mark Brown <broonie@kernel.org>
To: David Lechner <david@lechnology.com>
Cc: linux-spi@vger.kernel.org, linux-iio@vger.kernel.org,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] spi: add new SPI_CS_WORD flag
Date: Wed, 18 Jul 2018 18:19:21 +0100 [thread overview]
Message-ID: <20180718171921.GB20360@sirena.org.uk> (raw)
In-Reply-To: <a183973d-e648-c7e6-d65b-1479f7e32bb5@lechnology.com>
[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]
On Wed, Jul 18, 2018 at 11:47:30AM -0500, David Lechner wrote:
> On 7/18/18 10:04 AM, Mark Brown wrote:
> > This feels like it should have a soft implementation if it is going to
> > be truly usable, the vast majority of SPI controllers don't do this and
> This occurred to me as well. Another possibility, though, would be to leave
> it up to the client device drivers to support both cases, e.g.:
> if (master has SPI_CS_WORD support)
> setup message as single transfer
> else
> setup message as multiple one-word transfers
> This seems like that would be more efficient than having a generic
> implementation for masters that says:
That then requires every single user to open code this which immediately
suggests that there should be a helper which is going to look a lot like
any generic implementation.
> if (master does not have SPI_CS_WORD support)
> allocate enough transfers for each word of each
> each transfer of the message
> allocate and setup a new message for these transfers
> loop through the original transfers of the original
> message and copy them to the new transfers
> send the new message
> free allocated message and transfers
I'd imagine that the much bigger problem is that you end up with
enormous numbers of operations for any non-trivial transfers which is
going to happen anyway. It's really only the copying bit that's at all
an overhead here.
> > I can only think of a few that have the hardware feature. I'd also
> > expect to see some validation added to the core spi_setup() since at
> > present a client driver could set the mode option but then have it
> > ignored by the controller which would presumably break things, we
> > currently only have checks for specific modes and nothing that'd catch
> > an unknown flag like this.
> There is already a generic mode flags check in spi_setup() that will catch
> this and return an error if the device has the SPI_CS_WORD flag set and the
> controller does not. (I know this works because I ran into it during
> development.)
Ah, good - I'd forgotten it was there and didn't spot it when I went to
check.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-07-18 17:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 3:20 [PATCH 0/4] spi: introduce SPI_CS_WORD mode flag David Lechner
2018-07-17 3:20 ` [PATCH 1/4] spi: spi-bitbang: change flags from u8 to u16 David Lechner
2018-07-18 15:17 ` Applied "spi: spi-bitbang: change flags from u8 to u16" to the spi tree Mark Brown
2018-07-17 3:20 ` [PATCH 2/4] spi: add new SPI_CS_WORD flag David Lechner
2018-07-18 15:04 ` Mark Brown
2018-07-18 16:47 ` David Lechner
2018-07-18 17:19 ` Mark Brown [this message]
2018-07-17 3:20 ` [PATCH 3/4] spi: spi-davinci: Add support for SPI_CS_WORD David Lechner
2018-07-17 3:20 ` [PATCH 4/4] iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage David Lechner
2018-07-21 17:51 ` Jonathan Cameron
2018-07-21 19:05 ` David Lechner
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=20180718171921.GB20360@sirena.org.uk \
--to=broonie@kernel.org \
--cc=david@lechnology.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=pmeerw@pmeerw.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox