diff mbox series

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

Message ID 20240315072455.2481613-5-xu.yang_2@nxp.com (mailing list archive)
State Superseded
Headers show
Series [v9,01/11] dt-bindings: usb: usbmisc-imx: add fsl,imx8ulp-usbmisc compatible | expand

Commit Message

Xu Yang March 15, 2024, 7:24 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
Changes in v9:
 - remove maxItems
 - make clock-names if it's not needed
---
 .../bindings/usb/chipidea,usb2-imx.yaml       | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)

Comments

Rob Herring (Arm) March 17, 2024, 7:55 p.m. UTC | #1
On Fri, Mar 15, 2024 at 03:24:49PM +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>
> 
> ---

[...]

> +  # imx7d Soc need one clock
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: fsl,imx7d-usb
> +            - const: fsl,imx27-usb
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 1
> +        clock-names: false
> +
> +  # 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

Can't you add 'fsl,imx7d-usb' here and drop the previous if/then?

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 1
> +        clock-names: false
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.34.1
>
Xu Yang March 18, 2024, 3:41 a.m. UTC | #2
> 
> On Fri, Mar 15, 2024 at 03:24:49PM +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>
> >
> > ---
> 
> [...]
> 
> > +  # imx7d Soc need one clock
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          items:
> > +            - const: fsl,imx7d-usb
> > +            - const: fsl,imx27-usb
> > +    then:
> > +      properties:
> > +        clocks:
> > +          maxItems: 1
> > +        clock-names: false
> > +
> > +  # 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
> 
> Can't you add 'fsl,imx7d-usb' here and drop the previous if/then?
> 
> With that,

If I do this I need to remove 'fsl,imx7d-usb' again in patch 06/11.
(KK said I'd not better do that)
Because imx93 is compatible with imx7d in non-wakeup case, but
imx93 need one wakeup clock to support wakeup feature. Here 'contains'
'fsl,imx7d-usb' will include both imx7d and imx7d compliant socs.

Thanks,
Xu Yang

> 
> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> > +    then:
> > +      properties:
> > +        clocks:
> > +          maxItems: 1
> > +        clock-names: false
> > +
> >  unevaluatedProperties: false
> >
> >  examples:
> > --
> > 2.34.1
> >
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..e2eb60eaf6fe 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,76 @@  allOf:
             - const: idle
             - const: active
 
+  # imx27 Soc needs three clocks
+  - if:
+      properties:
+        compatible:
+          const: fsl,imx27-usb
+    then:
+      properties:
+        clocks:
+          minItems: 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
+        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: false
+
+  # 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: false
+
 unevaluatedProperties: false
 
 examples: