All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH robh next] dt-bindings: usb: add USB controller port
@ 2021-03-09 12:13 Rafał Miłecki
  2021-03-16 22:19 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2021-03-09 12:13 UTC (permalink / raw)
  To: Rob Herring
  Cc: Greg Kroah-Hartman, linux-usb, devicetree, linux-kernel,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
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

diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
index 56853c17af66..b0c6a79cad57 100644
--- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
+++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
@@ -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
 
diff --git a/Documentation/devicetree/bindings/usb/usb-port.yaml b/Documentation/devicetree/bindings/usb/usb-port.yaml
new file mode 100644
index 000000000000..68fe16c8703e
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-port.yaml
@@ -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 <rafal@milecki.pl>
+
+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>;
+        };
+    };
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH robh next] dt-bindings: usb: add USB controller port
  2021-03-09 12:13 [PATCH robh next] dt-bindings: usb: add USB controller port Rafał Miłecki
@ 2021-03-16 22:19 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2021-03-16 22:19 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Greg Kroah-Hartman, linux-usb, devicetree, linux-kernel,
	Rafał Miłecki

On Tue, Mar 09, 2021 at 01:13:11PM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> 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.

> ---
>  .../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
> 
> diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> index 56853c17af66..b0c6a79cad57 100644
> --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> @@ -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
>  
> diff --git a/Documentation/devicetree/bindings/usb/usb-port.yaml b/Documentation/devicetree/bindings/usb/usb-port.yaml
> new file mode 100644
> index 000000000000..68fe16c8703e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/usb-port.yaml
> @@ -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 <rafal@milecki.pl>
> +
> +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.

> +
> +  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>;
> +        };
> +    };
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-16 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 12:13 [PATCH robh next] dt-bindings: usb: add USB controller port Rafał Miłecki
2021-03-16 22:19 ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.