diff mbox series

[v6,1/5] dt-bindings: usb: Add binding for Realtek RTS5411 hub controller

Message ID 20210405124900.v6.1.I248292623d3d0f6a4f0c5bc58478ca3c0062b49a@changeid
State Superseded
Headers show
Series USB: misc: Add onboard_usb_hub driver | expand

Commit Message

Matthias Kaehlcke April 5, 2021, 8:18 p.m. UTC
The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports.

This initial version of the binding only describes USB related
aspects of the RTS5411, it does not cover the option of
connecting the controller as an i2c slave.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

Changes in v7:
- added type ref for 'companion-hub' property

Changes in v6:
- Realtek binding instead of generic onboard_usb_hub
- added 'companion-hub' property
- added reference to 'usb-device.yaml'
- 'fixed' indentation of compatible entries to keep yamllint happy
- added 'additionalProperties' entry
- updated commit message

Changes in v5:
- updated 'title'
- only use standard USB compatible strings
- deleted 'usb_hub' node
- renamed 'usb_controller' node to 'usb-controller'
- removed labels from USB nodes
- added 'vdd-supply' to USB nodes

Changes in v4:
- none

Changes in v3:
- updated commit message
- removed recursive reference to $self
- adjusted 'compatible' definition to support multiple entries
- changed USB controller phandle to be a node

Changes in v2:
- removed 'wakeup-source' and 'power-off-in-suspend' properties
- consistently use spaces for indentation in example

 .../bindings/usb/realtek,rts5411.yaml         | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

Comments

Matthias Kaehlcke April 8, 2021, 10:49 p.m. UTC | #1
On Tue, Apr 06, 2021 at 11:30:01AM -0500, Rob Herring wrote:
> On Mon, Apr 05, 2021 at 01:18:13PM -0700, Matthias Kaehlcke wrote:

> > The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports.

> > 

> > This initial version of the binding only describes USB related

> > aspects of the RTS5411, it does not cover the option of

> > connecting the controller as an i2c slave.

> > 

> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>

> > ---

> > 

> > Changes in v7:

> > - added type ref for 'companion-hub' property

> > 

> > Changes in v6:

> > - Realtek binding instead of generic onboard_usb_hub

> > - added 'companion-hub' property

> > - added reference to 'usb-device.yaml'

> > - 'fixed' indentation of compatible entries to keep yamllint happy

> > - added 'additionalProperties' entry

> > - updated commit message

> > 

> > Changes in v5:

> > - updated 'title'

> > - only use standard USB compatible strings

> > - deleted 'usb_hub' node

> > - renamed 'usb_controller' node to 'usb-controller'

> > - removed labels from USB nodes

> > - added 'vdd-supply' to USB nodes

> > 

> > Changes in v4:

> > - none

> > 

> > Changes in v3:

> > - updated commit message

> > - removed recursive reference to $self

> > - adjusted 'compatible' definition to support multiple entries

> > - changed USB controller phandle to be a node

> > 

> > Changes in v2:

> > - removed 'wakeup-source' and 'power-off-in-suspend' properties

> > - consistently use spaces for indentation in example

> > 

> >  .../bindings/usb/realtek,rts5411.yaml         | 59 +++++++++++++++++++

> >  1 file changed, 59 insertions(+)

> >  create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

> > 

> > diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

> > new file mode 100644

> > index 000000000000..b59001972749

> > --- /dev/null

> > +++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

> > @@ -0,0 +1,59 @@

> > +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause

> > +%YAML 1.2

> > +---

> > +$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml#

> > +$schema: http://devicetree.org/meta-schemas/core.yaml#

> > +

> > +title: Binding for the Realtek RTS5411 USB 3.0 hub controller

> > +

> > +maintainers:

> > +  - Matthias Kaehlcke <mka@chromium.org>

> > +

> > +allOf:

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

> > +

> > +properties:

> > +  compatible:

> > +    items:

> > +      - enum:

> > +          - usbbda,5411

> > +          - usbbda,411

> > +

> 

> reg: true

> 

> to fix the error.


Will fix in v8 (this is v7, even though the subject says otherwise,
I forgot to increment the version number when sending).

> > +  vdd-supply:

> > +    description:

> > +      phandle to the regulator that provides power to the hub.

> > +

> > +  companion-hub:

> > +    $ref: '/schemas/types.yaml#/definitions/phandle'

> > +    description:

> > +      phandle to the companion hub on the controller.

> 

> This should be required I think. I suppose you could only hook up 2.0

> ports, but why. And 3.0 only wouldn't be USB compliant, would it?


Agreed, that makes sense now that this is a specific binding for the
RTS5411. It seems unlikely that a system would use a USB 3.0 capable
hub on a USB 2.0 controller, and as you said 3.0 only wouldn't be USB
compliant.

I made the attribute initially optional because the binding was
intended to be generic (bad idea), and for certain hubs a required
'companion-hub' wouldn't make sense (e.g. USB 2.0 only).

> > +

> > +required:

> > +  - compatible

> > +  - reg

> > +

> > +additionalProperties: false

> > +

> > +examples:

> > +  - |

> > +    usb-controller {

> 

> 'usb' is the standard name.


ack

Thanks for your comments!

m.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
new file mode 100644
index 000000000000..b59001972749
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
@@ -0,0 +1,59 @@ 
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for the Realtek RTS5411 USB 3.0 hub controller
+
+maintainers:
+  - Matthias Kaehlcke <mka@chromium.org>
+
+allOf:
+  - $ref: usb-device.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - usbbda,5411
+          - usbbda,411
+
+  vdd-supply:
+    description:
+      phandle to the regulator that provides power to the hub.
+
+  companion-hub:
+    $ref: '/schemas/types.yaml#/definitions/phandle'
+    description:
+      phandle to the companion hub on the controller.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    usb-controller {
+        dr_mode = "host";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        /* 2.0 hub on port 1 */
+        hub_2_0: hub@1 {
+            compatible = "usbbda,5411";
+            reg = <1>;
+            vdd-supply = <&pp3300_hub>;
+            companion-hub = <&hub_3_0>;
+        };
+
+        /* 3.0 hub on port 2 */
+        hub_3_0: hub@2 {
+            compatible = "usbbda,411";
+            reg = <2>;
+            vdd-supply = <&pp3300_hub>;
+            companion-hub = <&hub_2_0>;
+        };
+    };