Skip to contentSkip to conversation

dt-bindings: usb: uhci: convert to dt schema

PATCH Superseded Mohammad Shehar Yaar Tausif 2 participants 4 messages Apr 22, 2024 – Apr 23, 2024

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 dt-bindings: usb: uhci: convert to dt schema

Convert USB UHCI bindings to DT schema. Documenting aspeed compatibles and missing properties. Adding aspeed/generic-uhci example and fix previous incorrect example.

---
Changes
v1->v2:
- add aspeed compatible and deprecated platform-uhci compatible v2->v3:
- fix property declaration and if-then-else block
- add generic-uhci example and fix prev incorrect example

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

---
 .../devicetree/bindings/usb/usb-uhci.txt      | 18 -----
 .../devicetree/bindings/usb/usb-uhci.yaml     | 72 +++++++++++++++++++
 2 files changed, 72 insertions(+), 18 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/usb/usb-uhci.txt
 create mode 100644 Documentation/devicetree/bindings/usb/usb-uhci.yaml
Documentation/devicetree/bindings/usb/usb-uhci.txt deleted +0 -18
deleted file mode 100644
index d1702eb2c8bd..000000000000
@@ -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>;
-	};
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.44.0
#1 lore raw
Quoted 9 lines · Mohammad Shehar Yaar Tausif

Convert USB UHCI bindings to DT schema. Documenting aspeed compatibles and missing properties. Adding aspeed/generic-uhci example and fix previous incorrect example.

Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +3 -0
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 49

Quoted 10 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +10 -0
+  - interrupts
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: generic-uhci
+    then:
+      $ref: usb-hcd.yaml

Nothing improved here.

Review

Quoted 2 lines
(quoted diff) +2 -0
+      required:
+        - clocks

And this was not tested.

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 58

Quoted 7 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +7 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    uhci@d8007b00 {
+        compatible = "platform-uhci";

What happened here? This is deprecated!

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 60

Quoted 2 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +2 -0
+        reg = <0xd8007b00 0x200>;
+        interrupts = <43>;

Best regards,
Krzysztof

#2 lore raw
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Mohammad Shehar Yaar Tausif

Convert USB UHCI bindings to DT schema. Documenting aspeed compatibles and missing properties. Adding aspeed/generic-uhci example and fix previous incorrect example.

Quoted 15 lines

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 49

Quoted 13 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +13 -0
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: generic-uhci
+    then:
+      $ref: usb-hcd.yaml

Nothing improved here.

Sorry, I could not understand this, please guide me about the correction required here. I added $ref inside the if-then block because it was raising errors when tested against dts files that used "platform-uhci" as the compatible. Putting it above the if block did not work.

When I ref the usb-hcd.yaml, it also includes usb.yaml which requires the nodename to start with usb*, but the dtsi that use the deprecated compatible (arch/arm/boot/dts/vt8500/wm8505.dtsi) have their nodename with uhci*, which causes the tests to fail.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+      required:
+        - clocks

And this was not tested.

Quoted 9 lines

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 58

Quoted 7 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +7 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    uhci@d8007b00 {
+        compatible = "platform-uhci";

What happened here? This is deprecated!

The original example has the nodename as uhci* which causes the schema to fail as mentioned earlier. Should I just remove the example or should I rename the node here and add clock field to the original example ?

Best Regards,
Shehar

#3 lore raw
Quoted 24 lines · Mohammad Shehar Yaar Tausif
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Mohammad Shehar Yaar Tausif

Convert USB UHCI bindings to DT schema. Documenting aspeed compatibles and missing properties. Adding aspeed/generic-uhci example and fix previous incorrect example.

Quoted 15 lines

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 49

Quoted 13 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +13 -0
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: generic-uhci
+    then:
+      $ref: usb-hcd.yaml

Nothing improved here.

Quoted 7 lines

Sorry, I could not understand this, please guide me about the correction required here.
I added $ref inside the if-then block because it was raising errors when tested against
dts files that used "platform-uhci" as the compatible. Putting it above the if block did
not work.

Where is it explained? The answer to such problem is not make bindings incorrect... I mean, the easiest to understand if you are doing something unusual is to check if you see such pattern. How many bindings reference other schema in if:then:? Is this common?

Quoted 3 lines

When I ref the usb-hcd.yaml, it also includes usb.yaml which requires the nodename to start with usb*,

Yeah, because DTS should be fixed, not bindings made incorrect.

Quoted 3 lines

but the dtsi that use the deprecated compatible (arch/arm/boot/dts/vt8500/wm8505.dtsi) have their nodename with uhci*, which causes the tests to fail.

So fix the DTS.

Quoted 15 lines
Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+      required:
+        - clocks

And this was not tested.

Quoted 9 lines

Documentation/devicetree/bindings/usb/usb-uhci.yaml line 58

Quoted 7 lines
Documentation/devicetree/bindings/usb/usb-uhci.yaml new file +7 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    uhci@d8007b00 {
+        compatible = "platform-uhci";

What happened here? This is deprecated!

Quoted 2 lines

The original example has the nodename as uhci* which causes the schema to fail as mentioned earlier.

So the solution is to correct the name, not use deprecated compatible and incorrect name.

Quoted 2 lines

Should I just remove the example or should I rename the node here and add clock field to the original example ?

I assume you understand the concept of bindings and went briefly through DT specification or some tutorials. So yes, you must fix the node name.

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Best regards,
Krzysztof