diff mbox series

[v2,3/8] dt-bindings: PCI: renesas-pci-usb: Allow multiple clocks

Message ID 20220414074011.500533-4-herve.codina@bootlin.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series RZN1 USB Host support | expand

Commit Message

Herve Codina April 14, 2022, 7:40 a.m. UTC
Define that multiple clocks can be present at clocks property.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven April 14, 2022, 8:35 a.m. UTC | #1
Hi Hervé,

On Thu, Apr 14, 2022 at 9:40 AM Herve Codina <herve.codina@bootlin.com> wrote:
> Define that multiple clocks can be present at clocks property.
>
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> +++ b/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> @@ -54,7 +54,8 @@ properties:
>        Standard property that helps to define the interrupt mapping.
>
>    clocks:
> -    description: The reference to the device clock.
> +    description:
> +      The references to the device clocks (several clocks can be referenced).

Please describe the clocks, and add the missing "clock-names" property.

>
>    bus-range:
>      description: |

I think it would be better to combine this with [PATCH v2 4/8], as the
additional clocks are only present on RZ/N1.

Then you can easily add json-schema logic to enforce the correct
number of clocks, depending on the compatible value.

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
Herve Codina April 20, 2022, 1:07 p.m. UTC | #2
Hi Geert, Rob,

On Thu, 14 Apr 2022 10:35:07 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Hi Hervé,
> 
> On Thu, Apr 14, 2022 at 9:40 AM Herve Codina <herve.codina@bootlin.com> wrote:
> > Define that multiple clocks can be present at clocks property.
> >
> > Signed-off-by: Herve Codina <herve.codina@bootlin.com>  
> 
> Thanks for your patch!
> 
> > --- a/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> > +++ b/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> > @@ -54,7 +54,8 @@ properties:
> >        Standard property that helps to define the interrupt mapping.
> >
> >    clocks:
> > -    description: The reference to the device clock.
> > +    description:
> > +      The references to the device clocks (several clocks can be referenced).  
> 
> Please describe the clocks, and add the missing "clock-names" property.
> 
> >
> >    bus-range:
> >      description: |  
> 
> I think it would be better to combine this with [PATCH v2 4/8], as the
> additional clocks are only present on RZ/N1.
> 
> Then you can easily add json-schema logic to enforce the correct
> number of clocks, depending on the compatible value.

Sure.

Is there a way to have the clocks description depending on the compatible value.
I mean something like:
--- 8< ---
properties:
  clocks:
    maxItems: 1

if:
  properties:
    compatible:
      contains:
        enum:
          - renesas,pci-r9a06g032
          - renesas,pci-rzn1

then:
  properties:
    clocks:
      items:
        - description: Internal bus clock (AHB) for HOST
        - description: Internal bus clock (AHB) Power Management
        - description: PCI clock for USB subsystem
      minItems: 3
      maxItems: 3

else:
  properties:
    items:
       - description: Device clock
    clocks:
      minItems: 1
      maxItems: 1
--- 8< ---

In fact, I would like to describe the 3 clocks only for the r9a06g032 SOC
and the rzn1 family and have an other description for the other 'compatible'.

I cannot succeed to do it.

The only thing I can do is to leave the description of the 3 clocks out of the
conditional part. This leads to :

--- 8< ---
properties:
  clocks:
    items:
      - description: Internal bus clock (AHB) for HOST
      - description: Internal bus clock (AHB) Power Management
      - description: PCI clock for USB subsystem
    minItems: 1

if:
  properties:
    compatible:
      contains:
        enum:
          - renesas,pci-r9a06g032
          - renesas,pci-rzn1

then:
  properties:
    clocks:
      minItems: 3
      maxItems: 3

else:
  properties:
    clocks:
      minItems: 1
      maxItems: 1
--- 8< ---

Also the clock-names items can be different depending on the
compatible value.

Regards,
Hervé
Rob Herring (Arm) April 20, 2022, 1:24 p.m. UTC | #3
On Wed, Apr 20, 2022 at 03:07:59PM +0200, Herve Codina wrote:
> Hi Geert, Rob,
> 
> On Thu, 14 Apr 2022 10:35:07 +0200
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> > Hi Hervé,
> > 
> > On Thu, Apr 14, 2022 at 9:40 AM Herve Codina <herve.codina@bootlin.com> wrote:
> > > Define that multiple clocks can be present at clocks property.
> > >
> > > Signed-off-by: Herve Codina <herve.codina@bootlin.com>  
> > 
> > Thanks for your patch!
> > 
> > > --- a/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> > > +++ b/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
> > > @@ -54,7 +54,8 @@ properties:
> > >        Standard property that helps to define the interrupt mapping.
> > >
> > >    clocks:
> > > -    description: The reference to the device clock.
> > > +    description:
> > > +      The references to the device clocks (several clocks can be referenced).  
> > 
> > Please describe the clocks, and add the missing "clock-names" property.
> > 
> > >
> > >    bus-range:
> > >      description: |  
> > 
> > I think it would be better to combine this with [PATCH v2 4/8], as the
> > additional clocks are only present on RZ/N1.
> > 
> > Then you can easily add json-schema logic to enforce the correct
> > number of clocks, depending on the compatible value.
> 
> Sure.
> 
> Is there a way to have the clocks description depending on the compatible value.
> I mean something like:
> --- 8< ---
> properties:
>   clocks:
>     maxItems: 1

This would need to cover both cases:

minItems: 1
maxItems: 3

> 
> if:
>   properties:
>     compatible:
>       contains:
>         enum:
>           - renesas,pci-r9a06g032
>           - renesas,pci-rzn1
> 
> then:
>   properties:
>     clocks:
>       items:
>         - description: Internal bus clock (AHB) for HOST
>         - description: Internal bus clock (AHB) Power Management
>         - description: PCI clock for USB subsystem
>       minItems: 3
>       maxItems: 3

Don't need minItems or maxItems here. 3 is the default size based on 
'items' length.

> 
> else:
>   properties:
>     items:

I think you meant for this to be under 'clocks'.

>        - description: Device clock
>     clocks:
>       minItems: 1
>       maxItems: 1

Just 'maxItems' is enough.

> --- 8< ---
> 
> In fact, I would like to describe the 3 clocks only for the r9a06g032 SOC
> and the rzn1 family and have an other description for the other 'compatible'.
> 
> I cannot succeed to do it.
> 
> The only thing I can do is to leave the description of the 3 clocks out of the
> conditional part. This leads to :
> 
> --- 8< ---
> properties:
>   clocks:
>     items:
>       - description: Internal bus clock (AHB) for HOST
>       - description: Internal bus clock (AHB) Power Management
>       - description: PCI clock for USB subsystem
>     minItems: 1
> 
> if:
>   properties:
>     compatible:
>       contains:
>         enum:
>           - renesas,pci-r9a06g032
>           - renesas,pci-rzn1
> 
> then:
>   properties:
>     clocks:
>       minItems: 3
>       maxItems: 3

minItems is enough.

> 
> else:
>   properties:
>     clocks:
>       minItems: 1
>       maxItems: 1

This doesn't seem right as the description of the first clock is wrong 
for this case.

I would go with the first way.

Rob
Geert Uytterhoeven April 20, 2022, 1:32 p.m. UTC | #4
Hi Hervé,

On Wed, Apr 20, 2022 at 3:08 PM Herve Codina <herve.codina@bootlin.com> wrote:
> Is there a way to have the clocks description depending on the compatible value.

Rob already replied.
For an example, check out the various bindings for RZ/G2L devices,
e.g. Documentation/devicetree/bindings/net/renesas,etheravb.yaml

> I mean something like:
> --- 8< ---
> properties:
>   clocks:
>     maxItems: 1
>
> if:
>   properties:
>     compatible:
>       contains:
>         enum:
>           - renesas,pci-r9a06g032
>           - renesas,pci-rzn1

Checking only for the second compatible value should be sufficient.

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
Herve Codina April 20, 2022, 2:55 p.m. UTC | #5
Hi Rob, Geert,

On Wed, 20 Apr 2022 08:24:59 -0500
Rob Herring <robh@kernel.org> wrote:

...
> > Is there a way to have the clocks description depending on the compatible value.
> > I mean something like:
> > --- 8< ---
> > properties:
> >   clocks:
> >     maxItems: 1  
> 
> This would need to cover both cases:
> 
> minItems: 1
> maxItems: 3
> 
> > 
> > if:
> >   properties:
> >     compatible:
> >       contains:
> >         enum:
> >           - renesas,pci-r9a06g032
> >           - renesas,pci-rzn1
> > 
> > then:
> >   properties:
> >     clocks:
> >       items:
> >         - description: Internal bus clock (AHB) for HOST
> >         - description: Internal bus clock (AHB) Power Management
> >         - description: PCI clock for USB subsystem
> >       minItems: 3
> >       maxItems: 3  
> 
> Don't need minItems or maxItems here. 3 is the default size based on 
> 'items' length.
> 
> > 
> > else:
> >   properties:
> >     items:  
> 
> I think you meant for this to be under 'clocks'.
> 
> >        - description: Device clock
> >     clocks:
> >       minItems: 1
> >       maxItems: 1  
> 
> Just 'maxItems' is enough.
> 
> > --- 8< ---
> > 

Thanks to your details and Geert's binding examples,

I have the clocks description and clock-names set depending
on compatible value.

This will be present in v3 series.

Regards,
Hervé
Herve Codina April 20, 2022, 2:56 p.m. UTC | #6
Hi Geert,

On Wed, 20 Apr 2022 15:32:27 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Hi Hervé,
> 
> On Wed, Apr 20, 2022 at 3:08 PM Herve Codina <herve.codina@bootlin.com> wrote:
> > Is there a way to have the clocks description depending on the compatible value.  
> 
> Rob already replied.
> For an example, check out the various bindings for RZ/G2L devices,
> e.g. Documentation/devicetree/bindings/net/renesas,etheravb.yaml

Yes, thanks.

> 
> > I mean something like:
> > --- 8< ---
> > properties:
> >   clocks:
> >     maxItems: 1
> >
> > if:
> >   properties:
> >     compatible:
> >       contains:
> >         enum:
> >           - renesas,pci-r9a06g032
> >           - renesas,pci-rzn1  
> 
> Checking only for the second compatible value should be sufficient.

Ok, changed.

Regards,
Hervé
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml b/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
index 3f8d79b746c7..5b85be751b88 100644
--- a/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
+++ b/Documentation/devicetree/bindings/pci/renesas,pci-usb.yaml
@@ -54,7 +54,8 @@  properties:
       Standard property that helps to define the interrupt mapping.
 
   clocks:
-    description: The reference to the device clock.
+    description:
+      The references to the device clocks (several clocks can be referenced).
 
   bus-range:
     description: |