* [PATCH v3 1/2] spi: support inter-word delay requirement for devices
[not found] <20190126163220.26421-1-jonas@norrbonn.se>
@ 2019-01-26 16:32 ` Jonas Bonn
2019-01-28 18:10 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bonn @ 2019-01-26 16:32 UTC (permalink / raw)
To: linux-kernel, linux-spi
Cc: Jonas Bonn, Mark Brown, Rob Herring, Mark Rutland, devicetree
Some devices are slow and cannot keep up with the SPI bus and therefore
require a short delay between words of the SPI transfer.
The example of this that I'm looking at is a SAMA5D2 with a minimum SPI
clock of 400kHz talking to an AVR-based SPI slave. The AVR cannot put
bytes on the bus fast enough to keep up with the SoC's SPI controller
even at the lowest bus speed.
This patch introduces the ability to specify a required inter-word
delay for SPI devices. It is up to the controller driver to configure
itself accordingly in order to introduce the requested delay.
Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
CC: Mark Brown <broonie@kernel.org>
CC: Rob Herring <robh+dt@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: linux-spi@vger.kernel.org
CC: devicetree@vger.kernel.org
---
include/linux/spi/spi.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 314d922ca607..8e410de02af4 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -118,6 +118,8 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
* for driver coldplugging, and in uevents used for hotplugging
* @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when
* not using a GPIO line)
+ * @word_delay: microsecond delay to be inserted between consecutive words
+ * of a transfer
*
* @statistics: statistics for the spi_device
*
@@ -164,6 +166,7 @@ struct spi_device {
char modalias[SPI_NAME_SIZE];
const char *driver_override;
int cs_gpio; /* chip select gpio */
+ uint16_t word_delay; /* inter-word delay (us) */
/* the statistics */
struct spi_statistics statistics;
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3 1/2] spi: support inter-word delay requirement for devices
2019-01-26 16:32 ` [PATCH v3 1/2] spi: support inter-word delay requirement for devices Jonas Bonn
@ 2019-01-28 18:10 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2019-01-28 18:10 UTC (permalink / raw)
To: Jonas Bonn; +Cc: linux-kernel, linux-spi, Rob Herring, Mark Rutland, devicetree
[-- Attachment #1: Type: text/plain, Size: 547 bytes --]
On Sat, Jan 26, 2019 at 05:32:19PM +0100, Jonas Bonn wrote:
> @@ -164,6 +166,7 @@ struct spi_device {
> char modalias[SPI_NAME_SIZE];
> const char *driver_override;
> int cs_gpio; /* chip select gpio */
> + uint16_t word_delay; /* inter-word delay (us) */
This needs some code in the core joining it up with the per-transfer
word delay similar to what we have for speed_hz and bits_per_word in
__spi_validate(). Then the controller drivers can just look at the
per-transfer value and support both without having to duplicate logic.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-28 18:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190126163220.26421-1-jonas@norrbonn.se>
2019-01-26 16:32 ` [PATCH v3 1/2] spi: support inter-word delay requirement for devices Jonas Bonn
2019-01-28 18:10 ` Mark Brown
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).