mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abraham Zukor <abe@maticrobots.com>
To: Jon Hunter <jonathanh@nvidia.com>,
	Mark Brown <broonie@kernel.org>,
	Laxman Dewangan <ldewangan@nvidia.com>
Cc: Abraham Zukor <abe@maticrobots.com>,
	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: Thu, 30 Jul 2026 20:11:11 -0700	[thread overview]
Message-ID: <20260731030827.4186208-1-abe@maticrobots.com> (raw)
In-Reply-To: <0513a557-762e-4390-b5f3-84ac26a38de4@nvidia.com>

On 28/07/2026 22:09, Jon Hunter wrote:
> I am a bit reluctant to make this change after 10+ years of this driver
> being around.

That is fair, and v1 deserved it. I have sent a v2 that only touches
chip selects the device tree describes:

  https://lore.kernel.org/r/20260731030134.4182688-1-abe@maticrobots.com/

The steady state is unchanged - tegra_spi_setup() already programs these
bits for each device, so only the window before that runs changes, and
only for active-low devices. Nothing the device tree does not describe is
touched at all.

> Right. Although this patch is specific to Tegra, I am guessing that
> other devices could also face similar issues and therefore, it would
> seem that having a generic facility to scan the devices would be ideal.

The window exists because __spi_add_device() calls __spi_setup() and then
device_add() per child, so of_register_spi_devices() runs setup(0),
add(0), setup(1), add(1) - device 0's driver can transfer before device
1's chip select has been configured. The comment above that __spi_setup()
call already notes that devices using SPI_CS_HIGH "can't coexist well
otherwise".

Splitting __spi_add_device() into a prepare half and a publish half, and
having of_register_spi_devices() prepare every child before publishing
any, would close it for every controller with a programmable chip select
idle level. The awkward part is that the duplicate chip select check
uses bus_for_each_dev(), so it only sees published devices and would
need to consider the pending ones too.

That is a larger change than I want to put in front of a fix, and it
would not help a chip select that never gets an spi_device at all, such
as a disabled node. So I do not think the two are alternatives - the core
change would subsume the declared sibling half of this patch and leave
the rest.

Thanks,
Abe

      parent reply	other threads:[~2026-07-31  3:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25  4:29 Abraham Zukor
2026-07-27 12:07 ` Jon Hunter
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
2026-07-29 10:14           ` Mark Brown
2026-07-31  3:11           ` Abraham Zukor [this message]

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=20260731030827.4186208-1-abe@maticrobots.com \
    --to=abe@maticrobots.com \
    --cc=broonie@kernel.org \
    --cc=jonathanh@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=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®