2023-01-04 09:46:40

by Hector Martin

[permalink] [raw]
Subject: [PATCH 0/5] SPI core CS delay fixes and additions

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.

Hector Martin (2):
spi: dt-bindings: Rename spi-cs-setup-ns to spi-cs-setup-delay-ns
spi: Rename spi-cs-setup-ns property to spi-cs-setup-delay-ns

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 | 14 +++++++++--
drivers/spi/spi.c | 24 +++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)

--
2.35.1


2023-01-04 09:47:42

by Hector Martin

[permalink] [raw]
Subject: [PATCH 4/5] spi: dt-bindings: Add hold/inactive CS delay peripheral properties

From: Janne Grunau <[email protected]>

These two properties complete the bindings for the Linux spi_device cs
model, which includes cs_setup, cs_hold and cs_inactive delay values.

Signed-off-by: Janne Grunau <[email protected]>
Signed-off-by: Hector Martin <[email protected]>
---
.../devicetree/bindings/spi/spi-peripheral-props.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
index 9a60c0664bbe..782a014b63a7 100644
--- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
@@ -49,6 +49,16 @@ properties:
Delay in nanoseconds to be introduced by the controller after CS is
asserted.

+ spi-cs-hold-delay-ns:
+ description:
+ Delay in nanoseconds to be introduced by the controller before CS is
+ de-asserted.
+
+ spi-cs-inactive-delay-ns:
+ description:
+ Delay in nanoseconds to be introduced by the controller after CS is
+ de-asserted.
+
spi-rx-bus-width:
description:
Bus width to the SPI bus used for read transfers.
--
2.35.1

2023-01-04 09:49:33

by Hector Martin

[permalink] [raw]
Subject: [PATCH 1/5] spi: dt-bindings: Rename spi-cs-setup-ns to spi-cs-setup-delay-ns

Other delay values follow the delay-ns naming convention, so unify the
newly introduced spi-cs-setup-ns property for consistency.

Also fix a typo while we're here.

Fixes: f6c911f3308c ("spi: dt-bindings: Introduce spi-cs-setup-ns property")
Signed-off-by: Hector Martin <[email protected]>
---
.../devicetree/bindings/spi/spi-peripheral-props.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
index ead2cccf658f..9a60c0664bbe 100644
--- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
@@ -44,9 +44,9 @@ properties:
description:
Maximum SPI clocking speed of the device in Hz.

- spi-cs-setup-ns:
+ spi-cs-setup-delay-ns:
description:
- Delay in nanosecods to be introduced by the controller after CS is
+ Delay in nanoseconds to be introduced by the controller after CS is
asserted.

spi-rx-bus-width:
--
2.35.1

2023-01-04 10:05:05

by Hector Martin

[permalink] [raw]
Subject: [PATCH 5/5] spi: Parse hold/inactive CS delay values from the DT

From: Janne Grunau <[email protected]>

Now that we support parsing the setup time from the Device Tree, we can
also easily support the remaining hold and inactive time delay values.

Signed-off-by: Janne Grunau <[email protected]>
Signed-off-by: Hector Martin <[email protected]>
---
drivers/spi/spi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 370e4c85dc54..0d84f90ab218 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2328,6 +2328,8 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,

/* Device CS delays */
of_spi_parse_dt_cs_delay(nc, &spi->cs_setup, "spi-cs-setup-delay-ns");
+ of_spi_parse_dt_cs_delay(nc, &spi->cs_hold, "spi-cs-hold-delay-ns");
+ of_spi_parse_dt_cs_delay(nc, &spi->cs_inactive, "spi-cs-inactive-delay-ns");

return 0;
}
--
2.35.1

2023-01-06 16:57:45

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/5] SPI core CS delay fixes and additions

On Wed, 04 Jan 2023 18:36:26 +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/5] spi: dt-bindings: Rename spi-cs-setup-ns to spi-cs-setup-delay-ns
commit: 38892ea4cefbb6ed3a91e76d3af84a1f8077d2d4
[2/5] spi: Rename spi-cs-setup-ns property to spi-cs-setup-delay-ns
commit: e0fe6a31cac84735939c29d1e05055d58325c6c0
[3/5] spi: Use a 32-bit DT property for spi-cs-setup-delay-ns
(no commit info)
[4/5] spi: dt-bindings: Add hold/inactive CS delay peripheral properties
(no commit info)
[5/5] spi: Parse hold/inactive CS delay values from the DT
(no commit info)

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

2023-01-08 21:58:04

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 4/5] spi: dt-bindings: Add hold/inactive CS delay peripheral properties


On Wed, 04 Jan 2023 18:36:30 +0900, Hector Martin wrote:
> From: Janne Grunau <[email protected]>
>
> These two properties complete the bindings for the Linux spi_device cs
> model, which includes cs_setup, cs_hold and cs_inactive delay values.
>
> Signed-off-by: Janne Grunau <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> .../devicetree/bindings/spi/spi-peripheral-props.yaml | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>

Reviewed-by: Rob Herring <[email protected]>