From: Jon Hunter <jonathanh@nvidia.com>
To: Abraham Zukor <abe@maticrobots.com>,
Mark Brown <broonie@kernel.org>,
Laxman Dewangan <ldewangan@nvidia.com>
Cc: Thierry Reding <thierry.reding@kernel.org>,
linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: tegra114: initialize native chip selects inactive
Date: Mon, 27 Jul 2026 13:07:31 +0100 [thread overview]
Message-ID: <b2a3d65c-d3ef-499d-b56a-82018804f4d3@nvidia.com> (raw)
In-Reply-To: <20260725042944.1204409-1-abe@maticrobots.com>
On 25/07/2026 05:29, Abraham Zukor wrote:
> tegra_spi_probe() initializes SPI_COMMAND1 with only SPI_M_S, leaving
> CS_POL_INACTIVE clear for every chip select. This drives every native
> active-low chip select low until tegra_spi_setup() runs for that device.
>
> SPI children are registered and probed one at a time. A synchronous
> probe of an earlier child can therefore transfer while a later child's
> chip select is still asserted. On a Tegra234 system with active-low devices
> on CS0 and CS1, this caused both devices to be selected when the CS1
> device probed first. Its initialization then intermittently failed. A
> logic analyzer showed CS0 remained low throughout the CS1 transfer and
> went high only after the CS1 probe failed.
What about the case where the SPI devices CS is active high or a mixture
of the two?
> The Tegra234 TRM also documents all CS_POL_INACTIVE bits as one after
> reset, so the existing probe code replaces the hardware's safe reset
> polarity with zeros on that SoC.
>
> Set CS_POL_INACTIVE for all native chip selects during controller probe.
> This matches SPI's default active-low polarity and the documented
> Tegra234 reset polarity. tegra_spi_setup() continues to configure the
> inactive polarity of SPI_CS_HIGH devices before their drivers probe.
>
> Fixes: f333a331adfa ("spi/tegra114: add spi driver")
> Assisted-by: Codex:GPT-5
> Signed-off-by: Abraham Zukor <abe@maticrobots.com>
> ---
> drivers/spi/spi-tegra114.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
> index aa44ffd09e61..c28aae093d57 100644
> --- a/drivers/spi/spi-tegra114.c
> +++ b/drivers/spi/spi-tegra114.c
> @@ -1394,7 +1394,7 @@ static int tegra_spi_probe(struct platform_device *pdev)
> reset_control_assert(tspi->rst);
> udelay(2);
> reset_control_deassert(tspi->rst);
> - tspi->def_command1_reg = SPI_M_S;
> + tspi->def_command1_reg = SPI_M_S | SPI_CS_POL_INACTIVE_MASK;
> tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1);
> tspi->spi_cs_timing1 = tegra_spi_readl(tspi, SPI_CS_TIMING1);
> tspi->spi_cs_timing2 = tegra_spi_readl(tspi, SPI_CS_TIMING2);
--
nvpublic
next prev parent reply other threads:[~2026-07-27 12:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 4:29 [PATCH] spi: tegra114: initialize native chip selects inactive Abraham Zukor
2026-07-27 12:07 ` Jon Hunter [this message]
2026-07-28 2:53 ` Abraham Zukor
2026-07-28 9:34 ` Jon Hunter
2026-07-28 20:03 ` Abraham Zukor
2026-07-28 21:09 ` Jon Hunter
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=b2a3d65c-d3ef-499d-b56a-82018804f4d3@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=abe@maticrobots.com \
--cc=broonie@kernel.org \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.