mbox series

[v2,0/3] SPI core CS delay fixes and additions

Message ID 20230113102309.18308-1-marcan@marcan.st
Headers show
Series SPI core CS delay fixes and additions | expand

Message

Hector Martin Jan. 13, 2023, 10:23 a.m. UTC
Commits f6c911f3308c ("spi: dt-bindings: Introduce
spi-cs-setup-ns property") and 33a2fde5f77b ("spi: Introduce
spi-cs-setup-ns property") introduced a new property to represent the
CS setup delay in the device tree, but they have some issues:

- The property is only parsed as a 16-bit integer number of nanoseconds,
  which limits the maximum value to ~65us. This is not a reasonable
  upper limit, as some devices might need a lot more.
- The property name is inconsistent with other delay properties, which
  use a "*-delay-ns" naming scheme.
- Only the setup delay is introduced, but not the related hold and
  inactive delay times.

This series fixes the issues and adds support for the two missing
properties. Please pull in the first 3 patches as fixes for 6.2, to
avoid introducing a problematic DT API in this release. The last two
patches can wait until 6.3, though are probably harmless to throw in
as fixes too, since they're trivial.

v2: Removed a stray variable declaration that was triggering a warning,
and dropped the first two patches which have already been applied.

Janne Grunau (3):
  spi: Use a 32-bit DT property for spi-cs-setup-delay-ns
  spi: dt-bindings: Add hold/inactive CS delay peripheral properties
  spi: Parse hold/inactive CS delay values from the DT

 .../bindings/spi/spi-peripheral-props.yaml    | 10 ++++++++
 drivers/spi/spi.c                             | 25 +++++++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)

--
2.35.1

Comments

Janne Grunau Feb. 16, 2023, 9:04 a.m. UTC | #1
Hej Mark,

On 2023-02-15 03:52:34 +0900, Kazuki wrote:
> On Fri, Jan 13, 2023 at 03:57:26PM +0000, Mark Brown wrote:
> > On Fri, 13 Jan 2023 19:23:07 +0900, Hector Martin wrote:
> > > Commits f6c911f3308c ("spi: dt-bindings: Introduce
> > > spi-cs-setup-ns property") and 33a2fde5f77b ("spi: Introduce
> > > spi-cs-setup-ns property") introduced a new property to represent the
> > > CS setup delay in the device tree, but they have some issues:
> > > 
> > > - The property is only parsed as a 16-bit integer number of nanoseconds,
> > >   which limits the maximum value to ~65us. This is not a reasonable
> > >   upper limit, as some devices might need a lot more.
> > > - The property name is inconsistent with other delay properties, which
> > >   use a "*-delay-ns" naming scheme.
> > > - Only the setup delay is introduced, but not the related hold and
> > >   inactive delay times.
> > > 
> > > [...]
> > 
> > Applied to
> > 
> >    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
> > 
> > Thanks!
> > 
> > [1/3] spi: Use a 32-bit DT property for spi-cs-setup-delay-ns
> >       commit: f276aacf5d2f7fb57e400db44c807ea3b9525fd6
> 
> Shouldn't this be sent to 6.2 before the property becomes a stable ABI?

can we still get "spi: Use a 32-bit DT property for 
spi-cs-setup-delay-ns" into 6.2?

If not I can send a single line patch which switches 
of_property_read_u16() to of_property_read_u32() to avoid defining 
"spi-cs-setup-delay-ns" to u16 as stable devicetree ABI.

sorry this comes so late before 6.2, we missed to track the patches.

Thanks,
Janne
Mark Brown Feb. 16, 2023, 3:55 p.m. UTC | #2
On Thu, Feb 16, 2023 at 10:04:11AM +0100, Janne Grunau wrote:

> can we still get "spi: Use a 32-bit DT property for 
> spi-cs-setup-delay-ns" into 6.2?

I think I sent a pull request for this already.
Janne Grunau Feb. 16, 2023, 4:21 p.m. UTC | #3
On 2023-02-16 15:55:52 +0000, Mark Brown wrote:
> On Thu, Feb 16, 2023 at 10:04:11AM +0100, Janne Grunau wrote:
> 
> > can we still get "spi: Use a 32-bit DT property for 
> > spi-cs-setup-delay-ns" into 6.2?
> 
> I think I sent a pull request for this already.

I see today's "[GIT PULL] SPI updates for v6.2-rc8-abi"
https://lore.kernel.org/lkml/20230216131125.4A6FAC433D2@smtp.kernel.org/ 

but it was neither in "SPI fixes for v6.2-rc3" or "SPI fixes for 
v6.2-rc7" or in Linus' tree as of today.

I think something went wrong with "[GIT PULL] SPI updates for 
v6.2-rc8-abi". The message reads is if you intended to just send
"spi: Use a 32-bit DT property for spi-cs-setup-delay-ns" and not 62 
commits.

Janne
Mark Brown Feb. 16, 2023, 4:25 p.m. UTC | #4
On Thu, Feb 16, 2023 at 05:21:07PM +0100, Janne Grunau wrote:

> I think something went wrong with "[GIT PULL] SPI updates for 
> v6.2-rc8-abi". The message reads is if you intended to just send
> "spi: Use a 32-bit DT property for spi-cs-setup-delay-ns" and not 62 
> commits.

You're right, thanks for noticing.