mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eberhard Stoll <estl@gmx.net>
To: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	Mark Brown <broonie@kernel.org>
Cc: "Eberhard Stoll" <eberhard.stoll@kontron.de>,
	"Frieder Schrempf" <frieder.schrempf@kontron.de>,
	"Amit Kumar Mahapatra" <amit.kumar-mahapatra@amd.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Krishna Yarlagadda" <kyarlagadda@nvidia.com>,
	"Leonard Göhrs" <l.goehrs@pengutronix.de>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Yang Yingliang" <yangyingliang@huawei.com>
Subject: [PATCH 1/4] spi: Add parameter for clock to rx delay
Date: Thu, 26 Oct 2023 17:23:02 +0200	[thread overview]
Message-ID: <20231026152316.2729575-2-estl@gmx.net> (raw)
In-Reply-To: <20231026152316.2729575-1-estl@gmx.net>

From: Eberhard Stoll <eberhard.stoll@kontron.de>

For spi devices the master clock output defines the sampling point
for receive data input stream (rising or falling edge). The receive
data stream from the device is delayed in relation to the master
clock output.

For some devices this delay is larger than one half clock period,
which is normally the sampling point for receive data. In this case
receive data is sampled too early and the device fails to operate.
In consequence the spi clock has to be reduced to match the delay
characteristics and this reduces performance and is therefore not
recommended.

Some spi controllers implement a 'clock to receive data delay'
compensation which shifts the receive sampling point. So we need
a property to set this value for each spi device.

Add a parameter 'rx_sample_delay_ns' to enable setting the clock
to rx data delay for each spi device separately.

The 'clock to receive data delay' value is often referenced as tCLQV
in spi device data sheets.

Signed-off-by: Eberhard Stoll <eberhard.stoll@kontron.de>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 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 7f8b478fdeb3..14622d47f44f 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -166,6 +166,7 @@ extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
  * @cs_inactive: delay to be introduced by the controller after CS is
  *	deasserted. If @cs_change_delay is used from @spi_transfer, then the
  *	two delays will be added up.
+ * @rx_sample_delay_ns: spi clk to spi rx data delay
  * @pcpu_statistics: statistics for the spi_device
  *
  * A @spi_device is used to interchange data between an SPI slave
@@ -219,6 +220,8 @@ struct spi_device {
 	struct spi_delay	cs_setup;
 	struct spi_delay	cs_hold;
 	struct spi_delay	cs_inactive;
+	/* Transfer characteristics */
+	u32			rx_sample_delay_ns; /* Clock to RX data delay */

 	/* The statistics */
 	struct spi_statistics __percpu	*pcpu_statistics;
--
2.25.1


  reply	other threads:[~2023-10-26 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 15:23 [PATCH 0/4] Add tCLQV parameter to tweak SPI timings Eberhard Stoll
2023-10-26 15:23 ` Eberhard Stoll [this message]
2023-10-26 22:56   ` [PATCH 1/4] spi: Add parameter for clock to rx delay Miquel Raynal
2023-10-27  8:38     ` AW: " Stoll, Eberhard
2023-10-27 11:46       ` Andy Shevchenko
     [not found]         ` <ZTvbFc+kFMotVUkh@finisterre.sirena.org.uk>
2023-10-30  8:48           ` Andy Shevchenko
2023-10-30  9:28             ` AW: " Stoll, Eberhard
2023-10-26 15:23 ` [PATCH 2/4] mtd: spinand: Add support for clock to rx delay setting Eberhard Stoll
2023-10-26 15:23 ` [PATCH 3/4] mtd: spinand: winbond: Add rx sample delay for W25N02KV Eberhard Stoll
2023-10-26 15:23 ` [PATCH 4/4] spi: spi-fsl-qspi: Add support for rx data sample point adjustment Eberhard Stoll
2023-10-26 20:03   ` kernel test robot
2023-10-27  6:51     ` Frieder Schrempf

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=20231026152316.2729575-2-estl@gmx.net \
    --to=estl@gmx.net \
    --cc=amit.kumar-mahapatra@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=eberhard.stoll@kontron.de \
    --cc=frieder.schrempf@kontron.de \
    --cc=geert+renesas@glider.be \
    --cc=kyarlagadda@nvidia.com \
    --cc=l.goehrs@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=yangyingliang@huawei.com \
    /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®