devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
@ 2023-02-14 14:26 Geert Uytterhoeven
  2023-02-14 14:44 ` Miquel Raynal
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2023-02-14 14:26 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Rob Herring,
	Krzysztof Kozlowski, Mark Brown
  Cc: linux-mtd, devicetree, linux-renesas-soc, Geert Uytterhoeven

SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
(CPOL=CPHA=1).  However, using the latter is currently flagged as an
error by "make dtbs_check", e.g.:

    arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
	    From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml

Fix this by documenting support for CPOL=CPHA=1.

Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
index f86255ce13af0871..bb62ac4585822982 100644
--- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
+++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
@@ -76,6 +76,13 @@ properties:
       If "broken-flash-reset" is present then having this property does not
       make any difference.
 
+  spi-cpol: true
+  spi-cpha: true
+
+dependencies:
+  spi-cpol: [ spi-cpha ]
+  spi-cpha: [ spi-cpol ]
+
 unevaluatedProperties: false
 
 examples:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 14:26 [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support Geert Uytterhoeven
@ 2023-02-14 14:44 ` Miquel Raynal
  2023-02-14 15:22   ` Geert Uytterhoeven
  2023-02-16 10:38 ` Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2023-02-14 14:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski, Mark Brown,
	linux-mtd, devicetree, linux-renesas-soc

Hi Geert, Krzysztof, Rob,

geert+renesas@glider.be wrote on Tue, 14 Feb 2023 15:26:43 +0100:

> SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> error by "make dtbs_check", e.g.:
> 
>     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> 	    From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> 
> Fix this by documenting support for CPOL=CPHA=1.
> 
> Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> index f86255ce13af0871..bb62ac4585822982 100644
> --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> @@ -76,6 +76,13 @@ properties:
>        If "broken-flash-reset" is present then having this property does not
>        make any difference.
>  
> +  spi-cpol: true
> +  spi-cpha: true

I see that spi-cpol and spi-cpha are described in spi-controller.yaml
which references spi-peripheral-props.yaml, but jedec,spi-nor.yaml
only references spi-peripheral-props.yaml leading to spi-cpol and
spi-cpha not being recognized as valid properties.

Wouldn't it be cleaner to to have these two properties defined in
spi-peripheral-props.yaml instead?

> +
> +dependencies:
> +  spi-cpol: [ spi-cpha ]
> +  spi-cpha: [ spi-cpol ]
> +
>  unevaluatedProperties: false
>  
>  examples:


Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 14:44 ` Miquel Raynal
@ 2023-02-14 15:22   ` Geert Uytterhoeven
  2023-02-14 15:56     ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2023-02-14 15:22 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski, Mark Brown,
	linux-mtd, devicetree, linux-renesas-soc

Hi Miquel,

On Tue, Feb 14, 2023 at 3:44 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> geert+renesas@glider.be wrote on Tue, 14 Feb 2023 15:26:43 +0100:
> > SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> > (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> > error by "make dtbs_check", e.g.:
> >
> >     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> >           From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> >
> > Fix this by documenting support for CPOL=CPHA=1.
> >
> > Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> >  Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > index f86255ce13af0871..bb62ac4585822982 100644
> > --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > @@ -76,6 +76,13 @@ properties:
> >        If "broken-flash-reset" is present then having this property does not
> >        make any difference.
> >
> > +  spi-cpol: true
> > +  spi-cpha: true
>
> I see that spi-cpol and spi-cpha are described in spi-controller.yaml
> which references spi-peripheral-props.yaml, but jedec,spi-nor.yaml
> only references spi-peripheral-props.yaml leading to spi-cpol and
> spi-cpha not being recognized as valid properties.
>
> Wouldn't it be cleaner to to have these two properties defined in
> spi-peripheral-props.yaml instead?

They were moved out of that file by the commit referenced in the
Fixes: tag above, because they are not supported by all SPI targets.
It's the responsibility of the SPI target bindings to list what is supported.

>
> > +
> > +dependencies:
> > +  spi-cpol: [ spi-cpha ]
> > +  spi-cpha: [ spi-cpol ]
> > +
> >  unevaluatedProperties: false
> >
> >  examples:

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 15:22   ` Geert Uytterhoeven
@ 2023-02-14 15:56     ` Miquel Raynal
  2023-02-17 23:27       ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2023-02-14 15:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski, Mark Brown,
	linux-mtd, devicetree, linux-renesas-soc

Hi Geert,

geert@linux-m68k.org wrote on Tue, 14 Feb 2023 16:22:15 +0100:

> Hi Miquel,
> 
> On Tue, Feb 14, 2023 at 3:44 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > geert+renesas@glider.be wrote on Tue, 14 Feb 2023 15:26:43 +0100:  
> > > SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> > > (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> > > error by "make dtbs_check", e.g.:
> > >
> > >     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> > >           From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > >
> > > Fix this by documenting support for CPOL=CPHA=1.
> > >
> > > Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > >  Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > index f86255ce13af0871..bb62ac4585822982 100644
> > > --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > @@ -76,6 +76,13 @@ properties:
> > >        If "broken-flash-reset" is present then having this property does not
> > >        make any difference.
> > >
> > > +  spi-cpol: true
> > > +  spi-cpha: true  
> >
> > I see that spi-cpol and spi-cpha are described in spi-controller.yaml
> > which references spi-peripheral-props.yaml, but jedec,spi-nor.yaml
> > only references spi-peripheral-props.yaml leading to spi-cpol and
> > spi-cpha not being recognized as valid properties.
> >
> > Wouldn't it be cleaner to to have these two properties defined in
> > spi-peripheral-props.yaml instead?  
> 
> They were moved out of that file by the commit referenced in the
> Fixes: tag above, because they are not supported by all SPI targets.
> It's the responsibility of the SPI target bindings to list what is supported.

Oops, I overlooked that line.

I actually see no point in constraining device trees on that regard,
but, well, Krzysztof is the author, I believe he knows his stuff, so
let's go for it.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 14:26 [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support Geert Uytterhoeven
  2023-02-14 14:44 ` Miquel Raynal
@ 2023-02-16 10:38 ` Krzysztof Kozlowski
  2023-03-17  8:55 ` Tudor Ambarus
  2023-03-22 16:08 ` Miquel Raynal
  3 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-16 10:38 UTC (permalink / raw)
  To: Geert Uytterhoeven, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Rob Herring, Krzysztof Kozlowski, Mark Brown
  Cc: linux-mtd, devicetree, linux-renesas-soc

On 14/02/2023 15:26, Geert Uytterhoeven wrote:
> SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> error by "make dtbs_check", e.g.:
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 15:56     ` Miquel Raynal
@ 2023-02-17 23:27       ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2023-02-17 23:27 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Geert Uytterhoeven, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Richard Weinberger, Vignesh Raghavendra, Krzysztof Kozlowski,
	Mark Brown, linux-mtd, devicetree, linux-renesas-soc

On Tue, Feb 14, 2023 at 04:56:37PM +0100, Miquel Raynal wrote:
> Hi Geert,
> 
> geert@linux-m68k.org wrote on Tue, 14 Feb 2023 16:22:15 +0100:
> 
> > Hi Miquel,
> > 
> > On Tue, Feb 14, 2023 at 3:44 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > > geert+renesas@glider.be wrote on Tue, 14 Feb 2023 15:26:43 +0100:  
> > > > SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> > > > (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> > > > error by "make dtbs_check", e.g.:
> > > >
> > > >     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> > > >           From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > >
> > > > Fix this by documenting support for CPOL=CPHA=1.
> > > >
> > > > Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > ---
> > > >  Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > > index f86255ce13af0871..bb62ac4585822982 100644
> > > > --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > > +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> > > > @@ -76,6 +76,13 @@ properties:
> > > >        If "broken-flash-reset" is present then having this property does not
> > > >        make any difference.
> > > >
> > > > +  spi-cpol: true
> > > > +  spi-cpha: true  
> > >
> > > I see that spi-cpol and spi-cpha are described in spi-controller.yaml
> > > which references spi-peripheral-props.yaml, but jedec,spi-nor.yaml
> > > only references spi-peripheral-props.yaml leading to spi-cpol and
> > > spi-cpha not being recognized as valid properties.
> > >
> > > Wouldn't it be cleaner to to have these two properties defined in
> > > spi-peripheral-props.yaml instead?  
> > 
> > They were moved out of that file by the commit referenced in the
> > Fixes: tag above, because they are not supported by all SPI targets.
> > It's the responsibility of the SPI target bindings to list what is supported.
> 
> Oops, I overlooked that line.
> 
> I actually see no point in constraining device trees on that regard,
> but, well, Krzysztof is the author, I believe he knows his stuff, so
> let's go for it.

It's a feature of the specific device as to what modes it supports. For 
most cases where there is only one choice it should be implied from the 
compatible, but there's some exceptions like this one. 

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 14:26 [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support Geert Uytterhoeven
  2023-02-14 14:44 ` Miquel Raynal
  2023-02-16 10:38 ` Krzysztof Kozlowski
@ 2023-03-17  8:55 ` Tudor Ambarus
  2023-03-22 16:08 ` Miquel Raynal
  3 siblings, 0 replies; 8+ messages in thread
From: Tudor Ambarus @ 2023-03-17  8:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Rob Herring,
	Krzysztof Kozlowski, Mark Brown
  Cc: linux-mtd, devicetree, linux-renesas-soc

Miquel,

Would you please take this through mtd/fixes?

On 14.02.2023 16:26, Geert Uytterhoeven wrote:
> SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> error by "make dtbs_check", e.g.:
> 
>     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> 	    From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> 
> Fix this by documenting support for CPOL=CPHA=1.
>

Would be good if you can amend the commit message to Cc stable:
Cc: <stable@vger.kernel.org>

> Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Cheers,
ta

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support
  2023-02-14 14:26 [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2023-03-17  8:55 ` Tudor Ambarus
@ 2023-03-22 16:08 ` Miquel Raynal
  3 siblings, 0 replies; 8+ messages in thread
From: Miquel Raynal @ 2023-03-22 16:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Rob Herring, Krzysztof Kozlowski, Mark Brown
  Cc: linux-mtd, devicetree, linux-renesas-soc

On Tue, 2023-02-14 at 14:26:43 UTC, Geert Uytterhoeven wrote:
> SPI EEPROMs typically support both SPI Mode 0 (CPOL=CPHA=0) and Mode 3
> (CPOL=CPHA=1).  However, using the latter is currently flagged as an
> error by "make dtbs_check", e.g.:
> 
>     arch/arm/boot/dts/r8a7791-koelsch.dtb: flash@0: Unevaluated properties are not allowed ('spi-cpha', 'spi-cpol' were unexpected)
> 	    From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> 
> Fix this by documenting support for CPOL=CPHA=1.
> 
> Fixes: 233363aba72ac638 ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-22 16:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 14:26 [PATCH] dt-bindings: mtd: jedec,spi-nor: Document CPOL/CPHA support Geert Uytterhoeven
2023-02-14 14:44 ` Miquel Raynal
2023-02-14 15:22   ` Geert Uytterhoeven
2023-02-14 15:56     ` Miquel Raynal
2023-02-17 23:27       ` Rob Herring
2023-02-16 10:38 ` Krzysztof Kozlowski
2023-03-17  8:55 ` Tudor Ambarus
2023-03-22 16:08 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).