Skip to contentSkip to conversation

dt-bindings: usb: add USB controller port

PATCH In review Rafał Miłecki 2 participants 2 messages Mar 9, 2021 – Mar 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: usb: add USB controller port

From: Rafał Miłecki <[email protected]>

USB bindings already allow specifying USB device hard wired to a specific controller port but they don't allow describing port on its own.

This fixes:
arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml: usb@23000: port@1: 'compatible' is a required property
From schema: Documentation/devicetree/bindings/usb/generic-xhci.yaml

---
Please check if I got the $nodename part right. Somehow I don't see any errors / warnings when using:

something@1 {
	reg = <1>;
};
---
 .../devicetree/bindings/usb/usb-hcd.yaml      |  4 +-
 .../devicetree/bindings/usb/usb-port.yaml     | 39 +++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-port.yaml
Documentation/devicetree/bindings/usb/usb-hcd.yaml +3 -1
index 56853c17af66..b0c6a79cad57 100644
@@ -33,7 +33,9 @@ patternProperties:
   "^.*@[0-9a-f]{1,2}$":
     description: The hard wired USB devices
     type: object
-    $ref: /usb/usb-device.yaml
+    oneOf:
+      - $ref: /usb/usb-port.yaml
+      - $ref: /usb/usb-device.yaml
 
 additionalProperties: true
 
Documentation/devicetree/bindings/usb/usb-port.yaml new file +39 -0
new file mode 100644
index 000000000000..68fe16c8703e
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/usb-port.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: USB port on USB controller
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+description: |
+  This binding describes a single USB controller port that doesn't have any
+  device hard wired.
+
+properties:
+  $nodename:
+    pattern: "^port@[0-9a-f]{1,2}$"
+
+  reg:
+    description: number of USB controller port
+    maxItems: 1
+
+required:
+  - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    usb@11270000 {
+        reg = <0x11270000 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@1 {
+            reg = <1>;
+        };
+    };
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 10 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

USB bindings already allow specifying USB device hard wired to a specific controller port but they don't allow describing port on its own.

This fixes:
arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml: usb@23000: port@1: 'compatible' is a required property
From schema: Documentation/devicetree/bindings/usb/generic-xhci.yaml

Quoted 8 lines

---
Please check if I got the $nodename part right. Somehow I don't see any errors / warnings when using:

something@1 {
	reg = <1>;
};

$nodename may not work in child nodes of a schema.

Quoted 35 lines
---
 .../devicetree/bindings/usb/usb-hcd.yaml      |  4 +-
 .../devicetree/bindings/usb/usb-port.yaml     | 39 +++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-port.yaml
Documentation/devicetree/bindings/usb/usb-hcd.yaml +3 -1
index 56853c17af66..b0c6a79cad57 100644
@@ -33,7 +33,9 @@ patternProperties:
   "^.*@[0-9a-f]{1,2}$":
     description: The hard wired USB devices
     type: object
-    $ref: /usb/usb-device.yaml
+    oneOf:
+      - $ref: /usb/usb-port.yaml
+      - $ref: /usb/usb-device.yaml
 
 additionalProperties: true
 
Documentation/devicetree/bindings/usb/usb-port.yaml new file +8 -0
new file mode 100644
index 000000000000..68fe16c8703e
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/usb-port.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: USB port on USB controller
+

Documentation/devicetree/bindings/usb/usb-port.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/usb/usb-port.yaml new file +10 -0
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+description: |
+  This binding describes a single USB controller port that doesn't have any
+  device hard wired.
+
+properties:
+  $nodename:
+    pattern: "^port@[0-9a-f]{1,2}$"

Unfortunately, 'port' is used elsewhere, so this would be applied any node that matches. That's not really a problem as this is simple enough, but then what does it buy us?

I'd be fine just dropping 'compatible' as required in usb-device.yaml.

Quoted 24 lines
Documentation/devicetree/bindings/usb/usb-port.yaml new file +21 -0
+
+  reg:
+    description: number of USB controller port
+    maxItems: 1
+
+required:
+  - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    usb@11270000 {
+        reg = <0x11270000 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@1 {
+            reg = <1>;
+        };
+    };
Signature · 1 line
2.26.2