[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221116-s905x_spi_ili9486-v1-3-630401cb62d5@baylibre.com>
Date: Thu, 17 Nov 2022 09:47:41 +0100
From: Carlo Caione <ccaione@...libre.com>
To: Kamlesh Gurudasani <kamlesh.gurudasani@...il.com>,
Mark Brown <broonie@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
Jerome Brunet <jbrunet@...libre.com>,
David Airlie <airlied@...il.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Kevin Hilman <khilman@...libre.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: linux-arm-kernel@...ts.infradead.org,
linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-spi@...r.kernel.org, dri-devel@...ts.freedesktop.org,
Carlo Caione <ccaione@...libre.com>
Subject: [PATCH 3/3] spi: meson-spicc: Lower CS between bursts
On some hardware (reproduced on S905X) when a large payload is
transmitted over SPI in bursts at the end of each burst, the clock line
briefly fluctuates creating spurious clock transitions that are being
recognised by the connected device as a genuine pulses, creating an
offset in the data being transmitted.
Lower the GPIO CS between bursts to avoid the clock being interpreted as
valid.
Signed-off-by: Carlo Caione <ccaione@...libre.com>
---
drivers/spi/spi-meson-spicc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index d47f2623a60f..af8d74b53519 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -291,6 +291,10 @@ static inline void meson_spicc_setup_burst(struct meson_spicc_device *spicc)
static irqreturn_t meson_spicc_irq(int irq, void *data)
{
struct meson_spicc_device *spicc = (void *) data;
+ struct spi_device *spi_dev;
+
+ spi_dev = spicc->message->spi;
+ gpiod_set_value(spi_dev->cs_gpiod, 0);
writel_bits_relaxed(SPICC_TC, SPICC_TC, spicc->base + SPICC_STATREG);
@@ -309,6 +313,8 @@ static irqreturn_t meson_spicc_irq(int irq, void *data)
/* Setup burst */
meson_spicc_setup_burst(spicc);
+ gpiod_set_value(spi_dev->cs_gpiod, 1);
+
/* Start burst */
writel_bits_relaxed(SPICC_XCH, SPICC_XCH, spicc->base + SPICC_CONREG);
--
b4 0.10.1
Powered by blists - more mailing lists