Subject: [PATCH v2] dt-bindings: usb: uhci: convert to dt schema

Convert USB UHCI bindings to DT schema.

Signed-off-by: Mohammad Shehar Yaar Tausif <[email protected]>
---

Changes v1->v2:
- add aspeed compatible and deprecated platform-uhci compatible

v1 patch : https://lore.kernel.org/all/[email protected]/

---
.../devicetree/bindings/usb/usb-uhci.txt | 18 -----
.../devicetree/bindings/usb/usb-uhci.yaml | 70 +++++++++++++++++++
2 files changed, 70 insertions(+), 18 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/usb/usb-uhci.txt
create mode 100644 Documentation/devicetree/bindings/usb/usb-uhci.yaml

diff --git a/Documentation/devicetree/bindings/usb/usb-uhci.txt b/Documentation/devicetree/bindings/usb/usb-uhci.txt
deleted file mode 100644
index d1702eb2c8bd..000000000000
--- a/Documentation/devicetree/bindings/usb/usb-uhci.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Generic Platform UHCI Controller
------------------------------------------------------
-
-Required properties:
-- compatible : "generic-uhci" (deprecated: "platform-uhci")
-- reg : Should contain 1 register ranges(address and length)
-- interrupts : UHCI controller interrupt
-
-additionally the properties from usb-hcd.yaml (in the current directory) are
-supported.
-
-Example:
-
- uhci@d8007b00 {
- compatible = "generic-uhci";
- reg = <0xd8007b00 0x200>;
- interrupts = <43>;
- };
diff --git a/Documentation/devicetree/bindings/usb/usb-uhci.yaml b/Documentation/devicetree/bindings/usb/usb-uhci.yaml
new file mode 100644
index 000000000000..c5cbcc0a820a
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-uhci.yaml
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/usb-uhci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic Platform UHCI Controller
+
+maintainers:
+ - Greg Kroah-Hartman <[email protected]>
+
+properties:
+ compatible:
+ oneOf:
+ - const: generic-uhci
+ - const: platform-uhci
+ deprecated: true
+ - items:
+ - enum:
+ - aspeed,ast2400-uhci
+ - aspeed,ast2500-uhci
+ - aspeed,ast2600-uhci
+ - const: generic-uhci
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+if:
+ properties:
+ compatible:
+ contains:
+ const: generic-uhci
+then:
+ allOf:
+ - $ref: usb-hcd.yaml
+ if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - aspeed,ast2400-uhci
+ - aspeed,ast2500-uhci
+ - aspeed,ast2600-uhci
+ then:
+ properties:
+ '#ports':
+ $ref: /schemas/types.yaml#/definitions/uint32
+ clocks:
+ maxItems: 1
+ required:
+ - clocks
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ usb@d8007b00 {
+ compatible = "generic-uhci";
+ reg = <0xd8007b00 0x200>;
+ interrupts = <43>;
+ };
+...
--
2.44.0



2024-04-22 12:04:10

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2] dt-bindings: usb: uhci: convert to dt schema

On 22/04/2024 11:37, Mohammad Shehar Yaar Tausif wrote:
> Convert USB UHCI bindings to DT schema.

Please mention changes from pure conversion, so documenting aspeed
compatibles and missing properties.

>
> Signed-off-by: Mohammad Shehar Yaar Tausif <[email protected]>
> ---

..

..

> +
> + interrupts:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> +
> +if:

This should be under allOf

> + properties:
> + compatible:
> + contains:
> + const: generic-uhci
> +then:
> + allOf:
> + - $ref: usb-hcd.yaml

This is confusing. Aspeed is not different here.

> + if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - aspeed,ast2400-uhci
> + - aspeed,ast2500-uhci
> + - aspeed,ast2600-uhci
> + then:
> + properties:
> + '#ports':
> + $ref: /schemas/types.yaml#/definitions/uint32

And the #ports property looks valid for generic-ahci. Why do you think
it is not valid?


> + clocks:
> + maxItems: 1

Define properties top-level.

> + required:
> + - clocks

This looks required for generic-uhci as well. Why did you put it only
for aspeed?


Best regards,
Krzysztof