diff mbox series

[v7,06/11] dt-bindings: usb: ci-hdrc-usb2-imx: add compatible and clock-names restriction for imx93

Message ID 20240228113004.918205-6-xu.yang_2@nxp.com
State New
Headers show
Series [v7,01/11] dt-bindings: usb: usbmisc-imx: add fsl,imx8ulp-usbmisc compatible | expand

Commit Message

Xu Yang Feb. 28, 2024, 11:29 a.m. UTC
The i.MX93 needs a wakup clock to work properly. This will add compatible
and restriction for i.MX93 platform.

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

---
Changes in v2:
 - no changes
Changes in v3:
 - add clocks restriction
Changes in v4:
 - use 'contains' rather 'items'
Changes in v5:
 - rename clock name
Changes in v6:
 - new patch based on ci-hdrc-usb2-imx.yaml
Changes in v7:
 - no changes
---
 .../bindings/usb/ci-hdrc-usb2-imx.yaml        | 34 ++++++++++++++-----
 1 file changed, 26 insertions(+), 8 deletions(-)

Comments

Krzysztof Kozlowski Feb. 29, 2024, 3:14 p.m. UTC | #1
On 28/02/2024 12:29, Xu Yang wrote:
> The i.MX93 needs a wakup clock to work properly. This will add compatible
> and restriction for i.MX93 platform.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v2:
>  - no changes
> Changes in v3:
>  - add clocks restriction
> Changes in v4:
>  - use 'contains' rather 'items'
> Changes in v5:
>  - rename clock name
> Changes in v6:
>  - new patch based on ci-hdrc-usb2-imx.yaml
> Changes in v7:
>  - no changes
> ---
>  .../bindings/usb/ci-hdrc-usb2-imx.yaml        | 34 ++++++++++++++-----
>  1 file changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> index a4730a2393e6..a2932af2c09b 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> @@ -40,6 +40,7 @@ properties:
>            - enum:
>                - fsl,imx8mm-usb
>                - fsl,imx8mn-usb
> +              - fsl,imx93-usb
>            - const: fsl,imx7d-usb
>            - const: fsl,imx27-usb
>        - items:
> @@ -186,14 +187,31 @@ allOf:
>                - const: ahb
>                - const: per
>        else:
> -        # other imx Socs only need one clock
> -        properties:
> -          clocks:
> -            minItems: 1
> -            maxItems: 1
> -          clock-names:
> -            minItems: 1
> -            maxItems: 1

Just make the list explicit in the first place. Don't add lines in one
patch which is immediately fixed/dropped/replaced.

> +        # imx93 Soc needs two clocks
> +        if:

No, no. No if:else:if:else:if:else. Unreadable and unmaintainable.


Best regards,
Krzysztof
Krzysztof Kozlowski Feb. 29, 2024, 3:14 p.m. UTC | #2
On 28/02/2024 12:29, Xu Yang wrote:
> +        # imx93 Soc needs two clocks
> +        if:
> +          properties:
> +            compatible:
> +              contains:
> +                enum:
> +                  - fsl,imx93-usb
> +        then:
> +          properties:
> +            clocks:
> +              minItems: 2
> +              maxItems: 2
> +            clock-names:
> +              items:
> +                - const: usb_ctrl_root
> +                - const: usb_wakeup
> +        else:
> +          # other imx Socs only need one clock
> +          properties:
> +            clocks:
> +              minItems: 1

Drop minItems:1 if it equals to max. Everywhere.

Best regards,
Krzysztof
Xu Yang March 12, 2024, 6:36 a.m. UTC | #3
> 
> On 28/02/2024 12:29, Xu Yang wrote:
> > The i.MX93 needs a wakup clock to work properly. This will add compatible
> > and restriction for i.MX93 platform.
> >
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> >
> > ---
> > Changes in v2:
> >  - no changes
> > Changes in v3:
> >  - add clocks restriction
> > Changes in v4:
> >  - use 'contains' rather 'items'
> > Changes in v5:
> >  - rename clock name
> > Changes in v6:
> >  - new patch based on ci-hdrc-usb2-imx.yaml
> > Changes in v7:
> >  - no changes
> > ---
> >  .../bindings/usb/ci-hdrc-usb2-imx.yaml        | 34 ++++++++++++++-----
> >  1 file changed, 26 insertions(+), 8 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > index a4730a2393e6..a2932af2c09b 100644
> > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > @@ -40,6 +40,7 @@ properties:
> >            - enum:
> >                - fsl,imx8mm-usb
> >                - fsl,imx8mn-usb
> > +              - fsl,imx93-usb
> >            - const: fsl,imx7d-usb
> >            - const: fsl,imx27-usb
> >        - items:
> > @@ -186,14 +187,31 @@ allOf:
> >                - const: ahb
> >                - const: per
> >        else:
> > -        # other imx Socs only need one clock
> > -        properties:
> > -          clocks:
> > -            minItems: 1
> > -            maxItems: 1
> > -          clock-names:
> > -            minItems: 1
> > -            maxItems: 1
> 
> Just make the list explicit in the first place. Don't add lines in one
> patch which is immediately fixed/dropped/replaced.

Okay.

> 
> > +        # imx93 Soc needs two clocks
> > +        if:
> 
> No, no. No if:else:if:else:if:else. Unreadable and unmaintainable.

Okay.  I'll rewrite it.

Thanks,
Xu Yang

> 
> 
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
index a4730a2393e6..a2932af2c09b 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
@@ -40,6 +40,7 @@  properties:
           - enum:
               - fsl,imx8mm-usb
               - fsl,imx8mn-usb
+              - fsl,imx93-usb
           - const: fsl,imx7d-usb
           - const: fsl,imx27-usb
       - items:
@@ -186,14 +187,31 @@  allOf:
               - const: ahb
               - const: per
       else:
-        # other imx Socs only need one clock
-        properties:
-          clocks:
-            minItems: 1
-            maxItems: 1
-          clock-names:
-            minItems: 1
-            maxItems: 1
+        # imx93 Soc needs two clocks
+        if:
+          properties:
+            compatible:
+              contains:
+                enum:
+                  - fsl,imx93-usb
+        then:
+          properties:
+            clocks:
+              minItems: 2
+              maxItems: 2
+            clock-names:
+              items:
+                - const: usb_ctrl_root
+                - const: usb_wakeup
+        else:
+          # other imx Socs only need one clock
+          properties:
+            clocks:
+              minItems: 1
+              maxItems: 1
+            clock-names:
+              minItems: 1
+              maxItems: 1
 
 required:
   - compatible