diff mbox series

[v2,2/4] dt-bindings: usb: add properties for hard wired devices

Message ID bd71ed260efd162d25e0491988d61fcf1e589bc0.1602318869.git.chunfeng.yun@mediatek.com
State New
Headers show
Series [v2,1/4] dt-bindings: usb: convert usb-device.txt to YAML schema | expand

Commit Message

Chunfeng Yun (云春峰) Oct. 10, 2020, 8:43 a.m. UTC
Add some optional properties which are needed for hard wired devices

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

---
v2 changes suggested by Rob:
   1. modify pattern to support any USB class
   2. refer to usb-device.yaml instead of usb-device.txt
---
 .../devicetree/bindings/usb/usb-hcd.yaml      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

-- 
2.18.0

Comments

Rob Herring (Arm) Oct. 12, 2020, 4 p.m. UTC | #1
On Sat, Oct 10, 2020 at 04:43:12PM +0800, Chunfeng Yun wrote:
> Add some optional properties which are needed for hard wired devices
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> v2 changes suggested by Rob:
>    1. modify pattern to support any USB class
>    2. refer to usb-device.yaml instead of usb-device.txt
> ---
>  .../devicetree/bindings/usb/usb-hcd.yaml      | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

You can fold this into the first patch. While not explicit before, it 
was implied.

Rob

> 
> diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> index 7263b7f2b510..42b295afdf32 100644
> --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> @@ -22,9 +22,28 @@ properties:
>      description:
>        Name specifier for the USB PHY
>  
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +patternProperties:
> +  "^[a-f]+@[0-9a-f]+$":

Just define the unit-address here: "@[0-9a-f]+$"
> +    type: object
> +    $ref: /usb/usb-device.yaml
> +    description: The hard wired USB devices

Need to also define 'reg' and 'compatible' here.

> +
>  examples:
>    - |
>      usb {
>          phys = <&usb2_phy1>, <&usb3_phy1>;
>          phy-names = "usb";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        hub@1 {
> +            compatible = "usb5e3,610";
> +            reg = <1>;
> +        };
>      };
> -- 
> 2.18.0
Chunfeng Yun (云春峰) Oct. 13, 2020, 7:34 a.m. UTC | #2
On Mon, 2020-10-12 at 11:00 -0500, Rob Herring wrote:
> On Sat, Oct 10, 2020 at 04:43:12PM +0800, Chunfeng Yun wrote:

> > Add some optional properties which are needed for hard wired devices

> > 

> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

> > ---

> > v2 changes suggested by Rob:

> >    1. modify pattern to support any USB class

> >    2. refer to usb-device.yaml instead of usb-device.txt

> > ---

> >  .../devicetree/bindings/usb/usb-hcd.yaml      | 19 +++++++++++++++++++

> >  1 file changed, 19 insertions(+)

> 

> You can fold this into the first patch. While not explicit before, it 

> was implied.

Ok

> 

> Rob

> 

> > 

> > diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml

> > index 7263b7f2b510..42b295afdf32 100644

> > --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml

> > +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml

> > @@ -22,9 +22,28 @@ properties:

> >      description:

> >        Name specifier for the USB PHY

> >  

> > +  "#address-cells":

> > +    const: 1

> > +

> > +  "#size-cells":

> > +    const: 0

> > +

> > +patternProperties:

> > +  "^[a-f]+@[0-9a-f]+$":

> 

> Just define the unit-address here: "@[0-9a-f]+$"

When I define it as "@[0-9a-f]+$", there is error:
"usb-hcd.example.dt.yaml: usb: hub@1: 'compatile' is a required
property"

> > +    type: object

> > +    $ref: /usb/usb-device.yaml

> > +    description: The hard wired USB devices

> 

> Need to also define 'reg' and 'compatible' here.

'reg' and 'compatible' are already defined in usb-device.yaml

> 

> > +

> >  examples:

> >    - |

> >      usb {

> >          phys = <&usb2_phy1>, <&usb3_phy1>;

> >          phy-names = "usb";

> > +        #address-cells = <1>;

> > +        #size-cells = <0>;

> > +

> > +        hub@1 {

> > +            compatible = "usb5e3,610";

> > +            reg = <1>;

> > +        };

> >      };

> > -- 

> > 2.18.0
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
index 7263b7f2b510..42b295afdf32 100644
--- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
+++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
@@ -22,9 +22,28 @@  properties:
     description:
       Name specifier for the USB PHY
 
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^[a-f]+@[0-9a-f]+$":
+    type: object
+    $ref: /usb/usb-device.yaml
+    description: The hard wired USB devices
+
 examples:
   - |
     usb {
         phys = <&usb2_phy1>, <&usb3_phy1>;
         phy-names = "usb";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hub@1 {
+            compatible = "usb5e3,610";
+            reg = <1>;
+        };
     };