diff mbox series

dt-bindings: phy: imx8mq-usb: optionally refer to usb-switch.yaml

Message ID 20241114102203.4065533-1-xu.yang_2@nxp.com (mailing list archive)
State New
Headers show
Series dt-bindings: phy: imx8mq-usb: optionally refer to usb-switch.yaml | expand

Commit Message

Xu Yang Nov. 14, 2024, 10:22 a.m. UTC
The i.MX95 usb-phy can work with or without orientation-switch. With
current setting, if usb-phy works without orientation-switch, the
dt-schema check will show below error:

phy@4c1f0040: 'oneOf' conditional failed, one must be fixed:
        'port' is a required property
        'ports' is a required property
        from schema $id: http://devicetree.org/schemas/phy/fsl,imx8mq-usb-phy.yaml#

This will add a condition to optionally refer to usb-switch.yaml.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml | 2 ++
 1 file changed, 2 insertions(+)

Comments

Conor Dooley Nov. 14, 2024, 5:45 p.m. UTC | #1
On Thu, Nov 14, 2024 at 06:22:03PM +0800, Xu Yang wrote:
> The i.MX95 usb-phy can work with or without orientation-switch. With
> current setting, if usb-phy works without orientation-switch, the
> dt-schema check will show below error:
> 
> phy@4c1f0040: 'oneOf' conditional failed, one must be fixed:
>         'port' is a required property
>         'ports' is a required property
>         from schema $id: http://devicetree.org/schemas/phy/fsl,imx8mq-usb-phy.yaml#
> 
> This will add a condition to optionally refer to usb-switch.yaml.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

$subject is not what the patch does.

> ---
>  Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> index 6d6d211883ae..1238792157f8 100644
> --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> @@ -118,6 +118,8 @@ allOf:
>            contains:
>              enum:
>                - fsl,imx95-usb-phy
> +      required:
> +        - orientation-switch
>      then:
>        $ref: /schemas/usb/usb-switch.yaml#
>  
> -- 
> 2.34.1
>
Xu Yang Nov. 15, 2024, 2 a.m. UTC | #2
Hi Conor,

On Thu, Nov 14, 2024 at 05:45:07PM +0000, Conor Dooley wrote:
> On Thu, Nov 14, 2024 at 06:22:03PM +0800, Xu Yang wrote:
> > The i.MX95 usb-phy can work with or without orientation-switch. With
> > current setting, if usb-phy works without orientation-switch, the
> > dt-schema check will show below error:
> > 
> > phy@4c1f0040: 'oneOf' conditional failed, one must be fixed:
> >         'port' is a required property
> >         'ports' is a required property
> >         from schema $id: http://devicetree.org/schemas/phy/fsl,imx8mq-usb-phy.yaml#
> > 
> > This will add a condition to optionally refer to usb-switch.yaml.
> > 
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> $subject is not what the patch does.

I look through other yaml and find below format could achieve the
restriction on one property:

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/tree/Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml?h=usb-testing#n54

  - if:
      required:
        - mode-switch
    then:
      required:
        - enable-gpios

If mode-switch is present, then enable-gpios is required. If not, then
enable-gpios is not required.

For my case, if compatible contains "fsl,imx95-usb-phy" and orientation-switch
is present, then this schema needs to refer to usb-switch.yaml. If not. then
this schema will not refer to usb-switch.yaml. So the subject could reflect
the thing this patch does.

Is this feasible? If not, could you give some advices? 

Thanks,
Xu Yang

> 
> > ---
> >  Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > index 6d6d211883ae..1238792157f8 100644
> > --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> > @@ -118,6 +118,8 @@ allOf:
> >            contains:
> >              enum:
> >                - fsl,imx95-usb-phy
> > +      required:
> > +        - orientation-switch
> >      then:
> >        $ref: /schemas/usb/usb-switch.yaml#
> >  
> > -- 
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
index 6d6d211883ae..1238792157f8 100644
--- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
@@ -118,6 +118,8 @@  allOf:
           contains:
             enum:
               - fsl,imx95-usb-phy
+      required:
+        - orientation-switch
     then:
       $ref: /schemas/usb/usb-switch.yaml#