diff mbox series

[v8,05/10] dt-bindings: usb: ci-hdrc-usb2-imx: add restrictions for reg, interrupts, clock and clock-names properties

Message ID 20240312091703.1220649-5-xu.yang_2@nxp.com
State Changes Requested, archived
Headers show
Series [v8,01/10] dt-bindings: usb: usbmisc-imx: add fsl,imx8ulp-usbmisc compatible | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied fail build log

Commit Message

Xu Yang March 12, 2024, 9:16 a.m. UTC
Add restrictions for reg, interrupts, clock and clock-names properties
for imx Socs.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v4:
 - new patch since v3's discussion
 - split the reg, interrupts, clock and clock-names properties into
   common part and device-specific
Changes in v5:
 - keep common property unchanged
 - make if-then more readable
 - remove non imx part
Changes in v6:
 - new patch based on ci-hdrc-usb2-imx.yaml
Changes in v7:
 - no changes
Changes in v8:
 - remove if:else:if:else:if:else block
---
 .../bindings/usb/chipidea,usb2-imx.yaml       | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)

Comments

Rob Herring March 12, 2024, 2:50 p.m. UTC | #1
On Tue, Mar 12, 2024 at 05:16:58PM +0800, Xu Yang wrote:
> Add restrictions for reg, interrupts, clock and clock-names properties
> for imx Socs.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v4:
>  - new patch since v3's discussion
>  - split the reg, interrupts, clock and clock-names properties into
>    common part and device-specific
> Changes in v5:
>  - keep common property unchanged
>  - make if-then more readable
>  - remove non imx part
> Changes in v6:
>  - new patch based on ci-hdrc-usb2-imx.yaml
> Changes in v7:
>  - no changes
> Changes in v8:
>  - remove if:else:if:else:if:else block
> ---
>  .../bindings/usb/chipidea,usb2-imx.yaml       | 80 +++++++++++++++++++
>  1 file changed, 80 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> index cdbb224e9f68..fb1c378dfe88 100644
> --- a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> +++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> @@ -49,6 +49,12 @@ properties:
>            - const: fsl,imx6ul-usb
>            - const: fsl,imx27-usb
>  
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
>    clocks:
>      minItems: 1
>      maxItems: 3
> @@ -144,6 +150,80 @@ allOf:
>              - const: idle
>              - const: active
>  
> +  # imx27 Soc needs three clocks
> +  - if:
> +      properties:
> +        compatible:
> +          const: fsl,imx27-usb
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 3
> +          maxItems: 3

The max is already 3, so drop maxItems.

> +        clock-names:
> +          items:
> +            - const: ipg
> +            - const: ahb
> +            - const: per
> +
> +  # imx25 and imx35 Soc need three clocks
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - fsl,imx25-usb
> +              - fsl,imx35-usb
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 3
> +          maxItems: 3

Same here.

> +        clock-names:
> +          items:
> +            - const: ipg
> +            - const: ahb
> +            - const: per
> +
> +  # imx7d Soc need one clock
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: fsl,imx7d-usb
> +            - const: fsl,imx27-usb
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 1
> +        clock-names:
> +          maxItems: 1

What's the name?

> +
> +  # other Soc need one clock
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - fsl,imx23-usb
> +              - fsl,imx28-usb
> +              - fsl,imx50-usb
> +              - fsl,imx51-usb
> +              - fsl,imx53-usb
> +              - fsl,imx6q-usb
> +              - fsl,imx6sl-usb
> +              - fsl,imx6sx-usb
> +              - fsl,imx6ul-usb
> +              - fsl,imx8mm-usb
> +              - fsl,imx8mn-usb
> +              - fsl,vf610-usb
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 1
> +        clock-names:
> +          maxItems: 1
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.34.1
>
Xu Yang March 13, 2024, 2:48 a.m. UTC | #2
> 
> On Tue, Mar 12, 2024 at 05:16:58PM +0800, Xu Yang wrote:
> > Add restrictions for reg, interrupts, clock and clock-names properties
> > for imx Socs.
> >
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> >
> > ---
> > Changes in v4:
> >  - new patch since v3's discussion
> >  - split the reg, interrupts, clock and clock-names properties into
> >    common part and device-specific
> > Changes in v5:
> >  - keep common property unchanged
> >  - make if-then more readable
> >  - remove non imx part
> > Changes in v6:
> >  - new patch based on ci-hdrc-usb2-imx.yaml
> > Changes in v7:
> >  - no changes
> > Changes in v8:
> >  - remove if:else:if:else:if:else block
> > ---
> >  .../bindings/usb/chipidea,usb2-imx.yaml       | 80 +++++++++++++++++++
> >  1 file changed, 80 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > index cdbb224e9f68..fb1c378dfe88 100644
> > --- a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > +++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > @@ -49,6 +49,12 @@ properties:
> >            - const: fsl,imx6ul-usb
> >            - const: fsl,imx27-usb
> >
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> >    clocks:
> >      minItems: 1
> >      maxItems: 3
> > @@ -144,6 +150,80 @@ allOf:
> >              - const: idle
> >              - const: active
> >
> > +  # imx27 Soc needs three clocks
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          const: fsl,imx27-usb
> > +    then:
> > +      properties:
> > +        clocks:
> > +          minItems: 3
> > +          maxItems: 3
> 
> The max is already 3, so drop maxItems.

Okay.

> 
> > +        clock-names:
> > +          items:
> > +            - const: ipg
> > +            - const: ahb
> > +            - const: per
> > +
> > +  # imx25 and imx35 Soc need three clocks
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - fsl,imx25-usb
> > +              - fsl,imx35-usb
> > +    then:
> > +      properties:
> > +        clocks:
> > +          minItems: 3
> > +          maxItems: 3
> 
> Same here.

Okay.

> 
> > +        clock-names:
> > +          items:
> > +            - const: ipg
> > +            - const: ahb
> > +            - const: per
> > +
> > +  # imx7d Soc need one clock
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          items:
> > +            - const: fsl,imx7d-usb
> > +            - const: fsl,imx27-usb
> > +    then:
> > +      properties:
> > +        clocks:
> > +          maxItems: 1
> > +        clock-names:
> > +          maxItems: 1
> 
> What's the name?

Can I not specify the name since the macro definition for USB
controller clock in clock.h is recognizable and the driver doesn't
get this clock by name rather index?

Thanks,
Xu Yang
Frank Li March 13, 2024, 3:07 a.m. UTC | #3
On Wed, Mar 13, 2024 at 02:48:00AM +0000, Xu Yang wrote:
> 
> > 
> > On Tue, Mar 12, 2024 at 05:16:58PM +0800, Xu Yang wrote:
> > > Add restrictions for reg, interrupts, clock and clock-names properties
> > > for imx Socs.
> > >
> > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > >
> > > ---
> > > Changes in v4:
> > >  - new patch since v3's discussion
> > >  - split the reg, interrupts, clock and clock-names properties into
> > >    common part and device-specific
> > > Changes in v5:
> > >  - keep common property unchanged
> > >  - make if-then more readable
> > >  - remove non imx part
> > > Changes in v6:
> > >  - new patch based on ci-hdrc-usb2-imx.yaml
> > > Changes in v7:
> > >  - no changes
> > > Changes in v8:
> > >  - remove if:else:if:else:if:else block
> > > ---
> > >  .../bindings/usb/chipidea,usb2-imx.yaml       | 80 +++++++++++++++++++
> > >  1 file changed, 80 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > index cdbb224e9f68..fb1c378dfe88 100644
> > > --- a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > +++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > @@ -49,6 +49,12 @@ properties:
> > >            - const: fsl,imx6ul-usb
> > >            - const: fsl,imx27-usb
> > >
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > >    clocks:
> > >      minItems: 1
> > >      maxItems: 3
> > > @@ -144,6 +150,80 @@ allOf:
> > >              - const: idle
> > >              - const: active
> > >
> > > +  # imx27 Soc needs three clocks
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          const: fsl,imx27-usb
> > > +    then:
> > > +      properties:
> > > +        clocks:
> > > +          minItems: 3
> > > +          maxItems: 3
> > 
> > The max is already 3, so drop maxItems.
> 
> Okay.
> 
> > 
> > > +        clock-names:
> > > +          items:
> > > +            - const: ipg
> > > +            - const: ahb
> > > +            - const: per
> > > +
> > > +  # imx25 and imx35 Soc need three clocks
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            enum:
> > > +              - fsl,imx25-usb
> > > +              - fsl,imx35-usb
> > > +    then:
> > > +      properties:
> > > +        clocks:
> > > +          minItems: 3
> > > +          maxItems: 3
> > 
> > Same here.
> 
> Okay.
> 
> > 
> > > +        clock-names:
> > > +          items:
> > > +            - const: ipg
> > > +            - const: ahb
> > > +            - const: per
> > > +
> > > +  # imx7d Soc need one clock
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          items:
> > > +            - const: fsl,imx7d-usb
> > > +            - const: fsl,imx27-usb
> > > +    then:
> > > +      properties:
> > > +        clocks:
> > > +          maxItems: 1
> > > +        clock-names:
> > > +          maxItems: 1
> > 
> > What's the name?
> 
> Can I not specify the name since the macro definition for USB
> controller clock in clock.h is recognizable and the driver doesn't
> get this clock by name rather index?

If clock-names is not required for fsl,imx7d-usb, 

clock-names: false

If driver use index to get clock, why need clock-names at other platform?
I supposed these should be the same for all chips.

Frank

> 
> Thanks,
> Xu Yang
>
Xu Yang March 13, 2024, 3:26 a.m. UTC | #4
> 
> On Wed, Mar 13, 2024 at 02:48:00AM +0000, Xu Yang wrote:
> >
> > >
> > > On Tue, Mar 12, 2024 at 05:16:58PM +0800, Xu Yang wrote:
> > > > Add restrictions for reg, interrupts, clock and clock-names properties
> > > > for imx Socs.
> > > >
> > > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > >
> > > > ---
> > > > Changes in v4:
> > > >  - new patch since v3's discussion
> > > >  - split the reg, interrupts, clock and clock-names properties into
> > > >    common part and device-specific
> > > > Changes in v5:
> > > >  - keep common property unchanged
> > > >  - make if-then more readable
> > > >  - remove non imx part
> > > > Changes in v6:
> > > >  - new patch based on ci-hdrc-usb2-imx.yaml
> > > > Changes in v7:
> > > >  - no changes
> > > > Changes in v8:
> > > >  - remove if:else:if:else:if:else block
> > > > ---
> > > >  .../bindings/usb/chipidea,usb2-imx.yaml       | 80 +++++++++++++++++++
> > > >  1 file changed, 80 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > > index cdbb224e9f68..fb1c378dfe88 100644
> > > > --- a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > > +++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
> > > > @@ -49,6 +49,12 @@ properties:
> > > >            - const: fsl,imx6ul-usb
> > > >            - const: fsl,imx27-usb
> > > >
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +  interrupts:
> > > > +    maxItems: 1
> > > > +
> > > >    clocks:
> > > >      minItems: 1
> > > >      maxItems: 3
> > > > @@ -144,6 +150,80 @@ allOf:
> > > >              - const: idle
> > > >              - const: active
> > > >
> > > > +  # imx27 Soc needs three clocks
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          const: fsl,imx27-usb
> > > > +    then:
> > > > +      properties:
> > > > +        clocks:
> > > > +          minItems: 3
> > > > +          maxItems: 3
> > >
> > > The max is already 3, so drop maxItems.
> >
> > Okay.
> >
> > >
> > > > +        clock-names:
> > > > +          items:
> > > > +            - const: ipg
> > > > +            - const: ahb
> > > > +            - const: per
> > > > +
> > > > +  # imx25 and imx35 Soc need three clocks
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          contains:
> > > > +            enum:
> > > > +              - fsl,imx25-usb
> > > > +              - fsl,imx35-usb
> > > > +    then:
> > > > +      properties:
> > > > +        clocks:
> > > > +          minItems: 3
> > > > +          maxItems: 3
> > >
> > > Same here.
> >
> > Okay.
> >
> > >
> > > > +        clock-names:
> > > > +          items:
> > > > +            - const: ipg
> > > > +            - const: ahb
> > > > +            - const: per
> > > > +
> > > > +  # imx7d Soc need one clock
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          items:
> > > > +            - const: fsl,imx7d-usb
> > > > +            - const: fsl,imx27-usb
> > > > +    then:
> > > > +      properties:
> > > > +        clocks:
> > > > +          maxItems: 1
> > > > +        clock-names:
> > > > +          maxItems: 1
> > >
> > > What's the name?
> >
> > Can I not specify the name since the macro definition for USB
> > controller clock in clock.h is recognizable and the driver doesn't
> > get this clock by name rather index?
> 
> If clock-names is not required for fsl,imx7d-usb,
> 
> clock-names: false

Set it to false make sense to me.

> 
> If driver use index to get clock, why need clock-names at other platform?
> I supposed these should be the same for all chips.

Yes, they are same. I add clock-names because some dts already have
clock-names in the usb node. 
If I set it to false, I should remove clock-names from these platforms in
next version.

Thanks,
Xu Yang
Krzysztof Kozlowski March 13, 2024, 7:25 a.m. UTC | #5
On 13/03/2024 03:48, Xu Yang wrote:
>>> +
>>> +  # imx7d Soc need one clock
>>> +  - if:
>>> +      properties:
>>> +        compatible:
>>> +          items:
>>> +            - const: fsl,imx7d-usb
>>> +            - const: fsl,imx27-usb
>>> +    then:
>>> +      properties:
>>> +        clocks:
>>> +          maxItems: 1
>>> +        clock-names:
>>> +          maxItems: 1
>>
>> What's the name?
> 
> Can I not specify the name since the macro definition for USB

But you must specify name or disallow names (: false).

> controller clock in clock.h is recognizable and the driver doesn't

header has nothing to do with it

> get this clock by name rather index?

Driver does not have to take clocks by names, it does not really matter
to such discussion. If you provide clock-names, then the name should be
defined/fixed.


Best regards,
Krzysztof
Xu Yang March 13, 2024, 10:31 a.m. UTC | #6
> 
> On 13/03/2024 03:48, Xu Yang wrote:
> >>> +
> >>> +  # imx7d Soc need one clock
> >>> +  - if:
> >>> +      properties:
> >>> +        compatible:
> >>> +          items:
> >>> +            - const: fsl,imx7d-usb
> >>> +            - const: fsl,imx27-usb
> >>> +    then:
> >>> +      properties:
> >>> +        clocks:
> >>> +          maxItems: 1
> >>> +        clock-names:
> >>> +          maxItems: 1
> >>
> >> What's the name?
> >
> > Can I not specify the name since the macro definition for USB
> 
> But you must specify name or disallow names (: false).
> 
> > controller clock in clock.h is recognizable and the driver doesn't
> 
> header has nothing to do with it
> 
> > get this clock by name rather index?
> 
> Driver does not have to take clocks by names, it does not really matter
> to such discussion. If you provide clock-names, then the name should be
> defined/fixed.

Okay. I get it.

Thanks, 
Xu Yang

> 
> 
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
index cdbb224e9f68..fb1c378dfe88 100644
--- a/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
+++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-imx.yaml
@@ -49,6 +49,12 @@  properties:
           - const: fsl,imx6ul-usb
           - const: fsl,imx27-usb
 
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
   clocks:
     minItems: 1
     maxItems: 3
@@ -144,6 +150,80 @@  allOf:
             - const: idle
             - const: active
 
+  # imx27 Soc needs three clocks
+  - if:
+      properties:
+        compatible:
+          const: fsl,imx27-usb
+    then:
+      properties:
+        clocks:
+          minItems: 3
+          maxItems: 3
+        clock-names:
+          items:
+            - const: ipg
+            - const: ahb
+            - const: per
+
+  # imx25 and imx35 Soc need three clocks
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,imx25-usb
+              - fsl,imx35-usb
+    then:
+      properties:
+        clocks:
+          minItems: 3
+          maxItems: 3
+        clock-names:
+          items:
+            - const: ipg
+            - const: ahb
+            - const: per
+
+  # imx7d Soc need one clock
+  - if:
+      properties:
+        compatible:
+          items:
+            - const: fsl,imx7d-usb
+            - const: fsl,imx27-usb
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
+
+  # other Soc need one clock
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,imx23-usb
+              - fsl,imx28-usb
+              - fsl,imx50-usb
+              - fsl,imx51-usb
+              - fsl,imx53-usb
+              - fsl,imx6q-usb
+              - fsl,imx6sl-usb
+              - fsl,imx6sx-usb
+              - fsl,imx6ul-usb
+              - fsl,imx8mm-usb
+              - fsl,imx8mn-usb
+              - fsl,vf610-usb
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
+
 unevaluatedProperties: false
 
 examples: