2024-02-28 11:38:32

by Xu Yang

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

Add restrictions for reg, interrupts, clock and clock-names properties
for imx Socs.

Signed-off-by: Xu Yang <[email protected]>

---
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
---
.../bindings/usb/ci-hdrc-usb2-imx.yaml | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
index 50494ce06d07..a4730a2393e6 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-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
@@ -145,8 +151,54 @@ 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
+ else:
+ # 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
+ else:
+ # other imx Socs only need one clock
+ properties:
+ clocks:
+ minItems: 1
+ maxItems: 1
+ clock-names:
+ minItems: 1
+ maxItems: 1
+
required:
- compatible
+ - reg
+ - interrupts

unevaluatedProperties: false

--
2.34.1



2024-02-29 15:19:15

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v7 05/11] dt-bindings: usb: ci-hdrc-usb2-imx: add restrictions for reg, interrupts, clock and clock-names properties

On 28/02/2024 12:29, Xu Yang wrote:
> Add restrictions for reg, interrupts, clock and clock-names properties
> for imx Socs.
>
> Signed-off-by: Xu Yang <[email protected]>
>
> ---
> 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
> ---
> .../bindings/usb/ci-hdrc-usb2-imx.yaml | 52 +++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> index 50494ce06d07..a4730a2393e6 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> @@ -49,6 +49,12 @@ properties:
> - const: fsl,imx6ul-usb
> - const: fsl,imx27-usb
>
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1

This kind of proves that your previous patch does not make sense. Why
common IMX schema allows two items, but IMX allows only one? So the
common is not only for IMX, right?

Best regards,
Krzysztof


2024-03-08 08:47:25

by Xu Yang

[permalink] [raw]
Subject: RE: [EXT] Re: [PATCH v7 05/11] dt-bindings: usb: ci-hdrc-usb2-imx: add restrictions for reg, interrupts, clock and clock-names properties


>
>
> On 28/02/2024 12:29, Xu Yang wrote:
> > Add restrictions for reg, interrupts, clock and clock-names properties
> > for imx Socs.
> >
> > Signed-off-by: Xu Yang <[email protected]>
> >
> > ---
> > 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
> > ---
> > .../bindings/usb/ci-hdrc-usb2-imx.yaml | 52 +++++++++++++++++++
> > 1 file changed, 52 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > index 50494ce06d07..a4730a2393e6 100644
> > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2-imx.yaml
> > @@ -49,6 +49,12 @@ properties:
> > - const: fsl,imx6ul-usb
> > - const: fsl,imx27-usb
> >
> > + reg:
> > + maxItems: 1
> > +
> > + interrupts:
> > + maxItems: 1
>
> This kind of proves that your previous patch does not make sense. Why
> common IMX schema allows two items, but IMX allows only one? So the
> common is not only for IMX, right?

Yes, the common yaml is not only for IMX. In next version, the old ci-hdrc-usb2.yaml
will also refer to chipidea,usb2-common.yaml. So chipidea,usb2-imx.yaml needs to
constrain these properties.

Thanks,
Xu Yang

>
> Best regards,
> Krzysztof