diff mbox series

[RFC,v2,3/3] dt-bindings: usb: snps,dwc3: add generic-xhci as child

Message ID 1672307866-25839-4-git-send-email-dh10.jung@samsung.com (mailing list archive)
State New, archived
Headers show
Series support Samsung Exynos xHCI Controller | expand

Commit Message

Jung Daehwan Dec. 29, 2022, 9:57 a.m. UTC
Currently, dwc3 invokes just xhci platform driver(generic-xhci) without
DT schema even though xhci works as child of dwc3. It makes sense to add
xhci as child of dwc3 with DT schema. It also supports to use another
compatible in xhci platform driver.

Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
---
 .../devicetree/bindings/usb/snps,dwc3.yaml    | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Krzysztof Kozlowski Dec. 29, 2022, 10:23 a.m. UTC | #1
On 29/12/2022 10:57, Daehwan Jung wrote:
> Currently, dwc3 invokes just xhci platform driver(generic-xhci) without
> DT schema even though xhci works as child of dwc3. It makes sense to add
> xhci as child of dwc3 with DT schema. It also supports to use another
> compatible in xhci platform driver.

You use some driver as an argument for hardware description, which is
not what we need. Describe the hardware.

> 
> Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
> ---
>  .../devicetree/bindings/usb/snps,dwc3.yaml    | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> index 6d78048c4613..83ed7c526dba 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> @@ -360,8 +360,22 @@ properties:
>      description:
>        Enable USB remote wakeup.
>  
> +  "#address-cells":
> +    enum: [ 1, 2 ]
> +
> +  "#size-cells":
> +    enum: [ 1, 2 ]
> +
> +  ranges: true
> +
>  unevaluatedProperties: false
>  
> +# Required child node:
> +patternProperties:
> +  "^usb@[0-9a-f]+$":
> +    $ref: generic-xhci.yaml#
> +    description: Required child node

DWC does not have another piece of controller as child... DWC is the
controller. Not mentioning that you now affect several other devices
without describing the total hardware picture (just some drivers which
is not that relevant).

> +
>  required:
>    - compatible
>    - reg
> @@ -388,4 +402,19 @@ examples:
>        snps,dis_u2_susphy_quirk;
>        snps,dis_enblslpm_quirk;
>      };
> +  - |
> +    usb@4a200000 {
> +      compatible = "snps,dwc3";
> +      reg = <0x4a200000 0xcfff>;
> +      interrupts = <0 92 4>;
> +      #address-cells = <1>;
> +      #size-cells = <1>;
> +      ranges;
> +
> +      xhci: usb@4a200000 {
> +        compatible = "generic-xhci";

There are no such device...

> +        reg = <0x4a200000 0x7fff>;
> +        interrupts = <0 92 4>;
> +      };
> +    };
>  ...

Best regards,
Krzysztof
Rob Herring (Arm) Dec. 30, 2022, 4:34 p.m. UTC | #2
On Thu, 29 Dec 2022 18:57:46 +0900, Daehwan Jung wrote:
> Currently, dwc3 invokes just xhci platform driver(generic-xhci) without
> DT schema even though xhci works as child of dwc3. It makes sense to add
> xhci as child of dwc3 with DT schema. It also supports to use another
> compatible in xhci platform driver.
> 
> Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
> ---
>  .../devicetree/bindings/usb/snps,dwc3.yaml    | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/snps,dwc3.example.dtb: usb@4a200000: #size-cells:0:0: 0 was expected
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/snps,dwc3.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/1672307866-25839-4-git-send-email-dh10.jung@samsung.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Jung Daehwan Jan. 2, 2023, 5:45 a.m. UTC | #3
On Thu, Dec 29, 2022 at 11:23:02AM +0100, Krzysztof Kozlowski wrote:
> On 29/12/2022 10:57, Daehwan Jung wrote:
> > Currently, dwc3 invokes just xhci platform driver(generic-xhci) without
> > DT schema even though xhci works as child of dwc3. It makes sense to add
> > xhci as child of dwc3 with DT schema. It also supports to use another
> > compatible in xhci platform driver.
> 
> You use some driver as an argument for hardware description, which is
> not what we need. Describe the hardware.
> 

OK. I will it on next submission.

> > 
> > Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
> > ---
> >  .../devicetree/bindings/usb/snps,dwc3.yaml    | 29 +++++++++++++++++++
> >  1 file changed, 29 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > index 6d78048c4613..83ed7c526dba 100644
> > --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > @@ -360,8 +360,22 @@ properties:
> >      description:
> >        Enable USB remote wakeup.
> >  
> > +  "#address-cells":
> > +    enum: [ 1, 2 ]
> > +
> > +  "#size-cells":
> > +    enum: [ 1, 2 ]
> > +
> > +  ranges: true
> > +
> >  unevaluatedProperties: false
> >  
> > +# Required child node:
> > +patternProperties:
> > +  "^usb@[0-9a-f]+$":
> > +    $ref: generic-xhci.yaml#
> > +    description: Required child node
> 
> DWC does not have another piece of controller as child... DWC is the
> controller. Not mentioning that you now affect several other devices
> without describing the total hardware picture (just some drivers which
> is not that relevant).
> 

DWC controller supports USB Host mode and it uses same resource and
really works as a child. I guess it's same on many SOCs, especially
mobile..

I just want to modify it to work with DT schema (dwc3 -> xhci-plat).
I think it needs to dicuss more..

Best Regards,
Jung Daehwan.

> > +
> >  required:
> >    - compatible
> >    - reg
> > @@ -388,4 +402,19 @@ examples:
> >        snps,dis_u2_susphy_quirk;
> >        snps,dis_enblslpm_quirk;
> >      };
> > +  - |
> > +    usb@4a200000 {
> > +      compatible = "snps,dwc3";
> > +      reg = <0x4a200000 0xcfff>;
> > +      interrupts = <0 92 4>;
> > +      #address-cells = <1>;
> > +      #size-cells = <1>;
> > +      ranges;
> > +
> > +      xhci: usb@4a200000 {
> > +        compatible = "generic-xhci";
> 
> There are no such device...
> 

> > +        reg = <0x4a200000 0x7fff>;
> > +        interrupts = <0 92 4>;
> > +      };
> > +    };
> >  ...
> 
> Best regards,
> Krzysztof
> 
>
Rob Herring (Arm) Jan. 3, 2023, 6:52 p.m. UTC | #4
On Mon, Jan 02, 2023 at 02:45:17PM +0900, Jung Daehwan wrote:
> On Thu, Dec 29, 2022 at 11:23:02AM +0100, Krzysztof Kozlowski wrote:
> > On 29/12/2022 10:57, Daehwan Jung wrote:
> > > Currently, dwc3 invokes just xhci platform driver(generic-xhci) without
> > > DT schema even though xhci works as child of dwc3. It makes sense to add
> > > xhci as child of dwc3 with DT schema. It also supports to use another
> > > compatible in xhci platform driver.
> > 
> > You use some driver as an argument for hardware description, which is
> > not what we need. Describe the hardware.
> > 
> 
> OK. I will it on next submission.
> 
> > > 
> > > Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
> > > ---
> > >  .../devicetree/bindings/usb/snps,dwc3.yaml    | 29 +++++++++++++++++++
> > >  1 file changed, 29 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > > index 6d78048c4613..83ed7c526dba 100644
> > > --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > > +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> > > @@ -360,8 +360,22 @@ properties:
> > >      description:
> > >        Enable USB remote wakeup.
> > >  
> > > +  "#address-cells":
> > > +    enum: [ 1, 2 ]
> > > +
> > > +  "#size-cells":
> > > +    enum: [ 1, 2 ]
> > > +
> > > +  ranges: true
> > > +
> > >  unevaluatedProperties: false
> > >  
> > > +# Required child node:
> > > +patternProperties:
> > > +  "^usb@[0-9a-f]+$":
> > > +    $ref: generic-xhci.yaml#
> > > +    description: Required child node
> > 
> > DWC does not have another piece of controller as child... DWC is the
> > controller. Not mentioning that you now affect several other devices
> > without describing the total hardware picture (just some drivers which
> > is not that relevant).
> > 
> 
> DWC controller supports USB Host mode and it uses same resource and
> really works as a child. I guess it's same on many SOCs, especially
> mobile..

Yes, and we already support all those platforms just fine without this 
child node. Adding it means we have to then support *both* ways in the 
driver.


> I just want to modify it to work with DT schema (dwc3 -> xhci-plat).
> I think it needs to dicuss more..

Why doesn't it work with the schema?

It's convenient when DT nodes == device drivers, but hardware is messy 
sometimes. Linux (and other OSs) have to deal with that. We can't write 
the DT to reflect the current (and evolving) needs of a particular OS. 

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index 6d78048c4613..83ed7c526dba 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -360,8 +360,22 @@  properties:
     description:
       Enable USB remote wakeup.
 
+  "#address-cells":
+    enum: [ 1, 2 ]
+
+  "#size-cells":
+    enum: [ 1, 2 ]
+
+  ranges: true
+
 unevaluatedProperties: false
 
+# Required child node:
+patternProperties:
+  "^usb@[0-9a-f]+$":
+    $ref: generic-xhci.yaml#
+    description: Required child node
+
 required:
   - compatible
   - reg
@@ -388,4 +402,19 @@  examples:
       snps,dis_u2_susphy_quirk;
       snps,dis_enblslpm_quirk;
     };
+  - |
+    usb@4a200000 {
+      compatible = "snps,dwc3";
+      reg = <0x4a200000 0xcfff>;
+      interrupts = <0 92 4>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      ranges;
+
+      xhci: usb@4a200000 {
+        compatible = "generic-xhci";
+        reg = <0x4a200000 0x7fff>;
+        interrupts = <0 92 4>;
+      };
+    };
 ...