From: Vishwaroop A <va@nvidia.com>
To: Mark Brown <broonie@kernel.org>, <linux-spi@vger.kernel.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
"Sowjanya Komatineni" <skomatineni@nvidia.com>,
Rhyland Klein <rklein@nvidia.com>,
Suresh Mangipudi <smangipudi@nvidia.com>,
Krishna Yarlagadda <kyarlagadda@nvidia.com>,
Vishwaroop A <va@nvidia.com>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 3/5] spi: tegra114: Assert CS between transfers when cs_change is set
Date: Tue, 29 Sep 2026 09:41:56 +0000 [thread overview]
Message-ID: <179258895296.403962.8889609503901872860@nvidia.com> (raw)
In-Reply-To: <179258895296.403962.3492255118456900623@nvidia.com>
A spi_message may set cs_change on a non-final transfer to toggle CS
before the next transfer of the same message. The driver deasserts
CS in tegra_spi_transfer_end() and, until now, never drove it active
again, so the following transfer in the same message ran with CS
inactive and clients received garbage.
After ending the current transfer, run the CS-off gap through
spi_transfer_cs_change_delay_exec() so that the core's default
minimum applies when the client leaves cs_change_delay unset, then
reassert CS for the following transfer for both GPIO CS and native
software CS.
Fixes: f4fade12d506 ("spi/tegra114: Correct support for cs_change")
Signed-off-by: Vishwaroop A <va@nvidia.com>
---
drivers/spi/spi-tegra114.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index d1118f1f2cb3..bd7b13c7f5df 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -1110,6 +1110,17 @@ static int tegra_spi_transfer_one_message(struct spi_controller *host,
} else if (xfer->cs_change) {
spi_transfer_delay_exec(xfer);
tegra_spi_transfer_end(spi);
+ spi_transfer_cs_change_delay_exec(msg, xfer);
+ if (spi_get_csgpiod(spi, 0))
+ gpiod_set_value(spi_get_csgpiod(spi, 0), 1);
+ if (!tspi->use_hw_based_cs) {
+ if (spi->mode & SPI_CS_HIGH)
+ tspi->command1_reg |= SPI_CS_SW_VAL;
+ else
+ tspi->command1_reg &= ~SPI_CS_SW_VAL;
+ tegra_spi_writel(tspi, tspi->command1_reg,
+ SPI_COMMAND1);
+ }
}
}
--
2.17.1
next prev parent reply other threads:[~2026-10-21 13:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 10:14 [PATCH 0/5] spi: tegra114: chip-select fixes and PIO-only probe Vishwaroop A
2026-08-18 14:34 ` [PATCH 1/5] spi: tegra114: Allow PIO fallback when DMA is unavailable Vishwaroop A
2026-08-18 14:54 ` [PATCH 2/5] spi: tegra114: Run per-transfer delay before ending the transfer Vishwaroop A
2026-08-18 14:55 ` [PATCH 4/5] spi: tegra114: Decide the chip-select mode once per message Vishwaroop A
2026-08-18 14:56 ` [PATCH 5/5] spi: tegra114: Keep software CS across bus-locked messages Vishwaroop A
2026-09-29 9:41 ` Vishwaroop A [this message]
2026-10-27 6:57 ` [PATCH 0/5] spi: tegra114: chip-select fixes and PIO-only probe Karl Mehltretter
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=179258895296.403962.8889609503901872860@nvidia.com \
--to=va@nvidia.com \
--cc=broonie@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kyarlagadda@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rklein@nvidia.com \
--cc=skomatineni@nvidia.com \
--cc=smangipudi@nvidia.com \
--cc=thierry.reding@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®