diff mbox series

[04/16] dt-bindings: fpga: machxo2-slave: add lattice,machxo2-slave-i2c compatible

Message ID 20220825141343.1375690-5-j.zink@pengutronix.de (mailing list archive)
State New
Headers show
Series Add support for Lattice MachXO2 programming via I2C | expand

Commit Message

Johannes Zink Aug. 25, 2022, 2:13 p.m. UTC
Lattice MachXO2 FPGAs allow reconfiguration over I2C as well as over
SPI. Add the I2C option to the binding as well.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
 .../bindings/fpga/lattice,machxo2-slave.yaml         | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Rob Herring (Arm) Aug. 30, 2022, 8:40 p.m. UTC | #1
On Thu, Aug 25, 2022 at 04:13:31PM +0200, Johannes Zink wrote:
> Lattice MachXO2 FPGAs allow reconfiguration over I2C as well as over
> SPI. Add the I2C option to the binding as well.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
>  .../bindings/fpga/lattice,machxo2-slave.yaml         | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml b/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
> index 03dc134ec7b8..d48d92f27c92 100644
> --- a/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
> +++ b/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
> @@ -21,10 +21,22 @@ allOf:
>              const: lattice,machxo2-slave-spi
>      then:
>        $ref: /schemas/spi/spi-peripheral-props.yaml#

Okay, I guess you do need the if/then. Technically, you don't need it 
til this patch, but that's fine.

The allOf/if part should go after 'required' section though.

> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: lattice,machxo2-slave-i2c
> +    then:
> +      properties:
> +        reg:
> +          description: I2C address
> +          maxItems: 1

'reg' is needed in either case. The only conditional part is the 
description which you don't need. So this can be dropped.

> +
>  properties:
>    compatible:
>      enum:
>        - lattice,machxo2-slave-spi
> +      - lattice,machxo2-slave-i2c
>  
>    program-gpios:
>      maxItems: 1
> -- 
> 2.30.2
> 
>
Johannes Zink Aug. 31, 2022, 7:10 a.m. UTC | #2
Hi Rob,

On Tue, 2022-08-30 at 15:40 -0500, Rob Herring wrote:
> On Thu, Aug 25, 2022 at 04:13:31PM +0200, Johannes Zink wrote:
> > Lattice MachXO2 FPGAs allow reconfiguration over I2C as well as
> > over
> > SPI. Add the I2C option to the binding as well.
> > 
> > Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> > ---
> >  .../bindings/fpga/lattice,machxo2-slave.yaml         | 12
> > ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
> > b/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
> > index 03dc134ec7b8..d48d92f27c92 100644
> > --- a/Documentation/devicetree/bindings/fpga/lattice,machxo2-
> > slave.yaml
> > +++ b/Documentation/devicetree/bindings/fpga/lattice,machxo2-
> > slave.yaml
> > @@ -21,10 +21,22 @@ allOf:
> >              const: lattice,machxo2-slave-spi
> >      then:
> >        $ref: /schemas/spi/spi-peripheral-props.yaml#
> 
> Okay, I guess you do need the if/then. Technically, you don't need it
> til this patch, but that's fine.
> 
> The allOf/if part should go after 'required' section though.

ack.
> 
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: lattice,machxo2-slave-i2c
> > +    then:
> > +      properties:
> > +        reg:
> > +          description: I2C address
> > +          maxItems: 1
> 
> 'reg' is needed in either case. The only conditional part is the 
> description which you don't need. So this can be dropped.

ack. I will revisit both for v2.

Best regards
Johannes
> 
> > +
> >  properties:
> >    compatible:
> >      enum:
> >        - lattice,machxo2-slave-spi
> > +      - lattice,machxo2-slave-i2c
> >  
> >    program-gpios:
> >      maxItems: 1
> > -- 
> > 2.30.2
> > 
> > 
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml b/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
index 03dc134ec7b8..d48d92f27c92 100644
--- a/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
+++ b/Documentation/devicetree/bindings/fpga/lattice,machxo2-slave.yaml
@@ -21,10 +21,22 @@  allOf:
             const: lattice,machxo2-slave-spi
     then:
       $ref: /schemas/spi/spi-peripheral-props.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: lattice,machxo2-slave-i2c
+    then:
+      properties:
+        reg:
+          description: I2C address
+          maxItems: 1
+
 properties:
   compatible:
     enum:
       - lattice,machxo2-slave-spi
+      - lattice,machxo2-slave-i2c
 
   program-gpios:
     maxItems: 1