diff mbox series

[RFC,v4,1/5] dt-bindings: usb: Add bindings to support multiport properties

Message ID 20230115114146.12628-2-quic_kriskura@quicinc.com
State New
Headers show
Series Add multiport support for DWC3 controllers | expand

Commit Message

Krishna Kurapati PSSNV Jan. 15, 2023, 11:41 a.m. UTC
Add bindings to indicate properties required to support multiport
on Snps Dwc3 controller.

Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
---
 .../devicetree/bindings/usb/snps,dwc3.yaml    | 53 ++++++++++++++++---
 1 file changed, 47 insertions(+), 6 deletions(-)

Comments

Rob Herring Jan. 15, 2023, 3:11 p.m. UTC | #1
On Sun, 15 Jan 2023 17:11:42 +0530, Krishna Kurapati wrote:
> Add bindings to indicate properties required to support multiport
> on Snps Dwc3 controller.
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> ---
>  .../devicetree/bindings/usb/snps,dwc3.yaml    | 53 ++++++++++++++++---
>  1 file changed, 47 insertions(+), 6 deletions(-)
> 

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:
./Documentation/devicetree/bindings/usb/snps,dwc3.yaml:90:5: [warning] wrong indentation: expected 6 but found 4 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230115114146.12628-2-quic_kriskura@quicinc.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.
Rob Herring Jan. 16, 2023, 4:34 p.m. UTC | #2
On Sun, Jan 15, 2023 at 05:11:42PM +0530, Krishna Kurapati wrote:
> Add bindings to indicate properties required to support multiport
> on Snps Dwc3 controller.
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> ---
>  .../devicetree/bindings/usb/snps,dwc3.yaml    | 53 ++++++++++++++++---
>  1 file changed, 47 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> index 6d78048c4613..3ea051beb2f8 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
> @@ -81,15 +81,26 @@ properties:
>  
>    phys:
>      minItems: 1
> -    maxItems: 2
> +    maxItems: 8
>  
>    phy-names:
>      minItems: 1
> -    maxItems: 2
> -    items:
> -      enum:
> -        - usb2-phy
> -        - usb3-phy
> +    maxItems: 8
> +    oneOf:
> +    - items:
> +        enum:
> +          - usb2-phy
> +          - usb3-phy
> +    - items:
> +        enum:
> +          - usb2-phy_port0
> +          - usb2-phy_port1
> +          - usb2-phy_port2
> +          - usb2-phy_port3
> +          - usb3-phy_port0
> +          - usb3-phy_port1
> +          - usb3-phy_port2
> +          - usb3-phy_port3

usbN-portM

>  
>    resets:
>      minItems: 1
> @@ -360,6 +371,22 @@ properties:
>      description:
>        Enable USB remote wakeup.
>  
> +  num-ports:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      This property indicates the number of ports present on the target that
> +      are to be serviced by the DWC3 controller.
> +    minimum: 1
> +    maximum: 4
> +
> +  num-ss-ports:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      This property indicates the number of SS capable ports present on the
> +      target that are to be serviced by the DWC3 controller.
> +    minimum: 1
> +    maximum: 4

This information is redundant. 'phy-names' tells you how many ports of 
each.

> +
>  unevaluatedProperties: false
>  
>  required:
> @@ -388,4 +415,18 @@ examples:
>        snps,dis_u2_susphy_quirk;
>        snps,dis_enblslpm_quirk;
>      };
> +  - |
> +    usb@4a000000 {
> +      compatible = "snps,dwc3";
> +      reg = <0x4a000000 0xcfff>;
> +      interrupts = <0 92 4>;
> +      clocks = <&clk 1>, <&clk 2>, <&clk 3>;
> +      clock-names = "bus_early", "ref", "suspend";
> +      num-ports = <2>;
> +      num-ss-ports = <1>;
> +      phys = <&usb2_phy0>, <&usb3_phy0>, <&usb2_phy1>;
> +      phy-names = "usb2-phy_port0", "usb3-phy_port0", "usb2-phy_port1";
> +      snps,dis_u2_susphy_quirk;
> +      snps,dis_enblslpm_quirk;
> +    };

Does a different number of phys really need its own example?

Rob
Bjorn Andersson Jan. 18, 2023, 6:20 p.m. UTC | #3
On Sun, Jan 15, 2023 at 05:11:42PM +0530, Krishna Kurapati wrote:
> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
[..]
>    phy-names:
>      minItems: 1
> -    maxItems: 2
> -    items:
> -      enum:
> -        - usb2-phy
> -        - usb3-phy
> +    maxItems: 8
> +    oneOf:
> +    - items:
> +        enum:
> +          - usb2-phy
> +          - usb3-phy
> +    - items:
> +        enum:
> +          - usb2-phy_port0
> +          - usb2-phy_port1
> +          - usb2-phy_port2
> +          - usb2-phy_port3
> +          - usb3-phy_port0
> +          - usb3-phy_port1
> +          - usb3-phy_port2
> +          - usb3-phy_port3

How about expressing this as:

    oneOf:
      - items:
          enum: [ usb2-phy, usb3-phy ]
      - items:
          pattern: "^usb[23]-phy_port[0-3]$"

Regards,
Bjorn
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index 6d78048c4613..3ea051beb2f8 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -81,15 +81,26 @@  properties:
 
   phys:
     minItems: 1
-    maxItems: 2
+    maxItems: 8
 
   phy-names:
     minItems: 1
-    maxItems: 2
-    items:
-      enum:
-        - usb2-phy
-        - usb3-phy
+    maxItems: 8
+    oneOf:
+    - items:
+        enum:
+          - usb2-phy
+          - usb3-phy
+    - items:
+        enum:
+          - usb2-phy_port0
+          - usb2-phy_port1
+          - usb2-phy_port2
+          - usb2-phy_port3
+          - usb3-phy_port0
+          - usb3-phy_port1
+          - usb3-phy_port2
+          - usb3-phy_port3
 
   resets:
     minItems: 1
@@ -360,6 +371,22 @@  properties:
     description:
       Enable USB remote wakeup.
 
+  num-ports:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      This property indicates the number of ports present on the target that
+      are to be serviced by the DWC3 controller.
+    minimum: 1
+    maximum: 4
+
+  num-ss-ports:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      This property indicates the number of SS capable ports present on the
+      target that are to be serviced by the DWC3 controller.
+    minimum: 1
+    maximum: 4
+
 unevaluatedProperties: false
 
 required:
@@ -388,4 +415,18 @@  examples:
       snps,dis_u2_susphy_quirk;
       snps,dis_enblslpm_quirk;
     };
+  - |
+    usb@4a000000 {
+      compatible = "snps,dwc3";
+      reg = <0x4a000000 0xcfff>;
+      interrupts = <0 92 4>;
+      clocks = <&clk 1>, <&clk 2>, <&clk 3>;
+      clock-names = "bus_early", "ref", "suspend";
+      num-ports = <2>;
+      num-ss-ports = <1>;
+      phys = <&usb2_phy0>, <&usb3_phy0>, <&usb2_phy1>;
+      phy-names = "usb2-phy_port0", "usb3-phy_port0", "usb2-phy_port1";
+      snps,dis_u2_susphy_quirk;
+      snps,dis_enblslpm_quirk;
+    };
 ...