mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@norrbonn.se>
To: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Cc: Jonas Bonn <jonas@norrbonn.se>, Mark Brown <broonie@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org
Subject: [PATCH v3 1/2] spi: support inter-word delay requirement for devices
Date: Sat, 26 Jan 2019 17:32:19 +0100	[thread overview]
Message-ID: <20190126163220.26421-2-jonas@norrbonn.se> (raw)
In-Reply-To: <20190126163220.26421-1-jonas@norrbonn.se>

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


  reply	other threads:[~2019-01-26 16:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-26 16:32 [PATCH v3 0/2] spi: support inter-word delays Jonas Bonn
2019-01-26 16:32 ` Jonas Bonn [this message]
2019-01-28 18:10   ` [PATCH v3 1/2] spi: support inter-word delay requirement for devices Mark Brown
2019-01-28 21:28     ` Jonas Bonn
2019-01-29  9:04       ` Baolin Wang
2019-01-29  9:14         ` Jonas Bonn
2019-01-29  9:35           ` Baolin Wang
2019-01-29  9:49             ` Jonas Bonn
2019-01-29 10:07               ` Geert Uytterhoeven
2019-01-29 16:41                 ` Mark Brown
2019-01-26 16:32 ` [PATCH v3 2/2] spi-atmel: support inter-word delay Jonas Bonn

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=20190126163220.26421-2-jonas@norrbonn.se \
    --to=jonas@norrbonn.se \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@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

all inboxes | Powered by JetHome®