[PATCH] dt-bindings: usb: qcom,snps-dwc3: Add missing clock constraints

Krzysztof Kozlowski posted 1 patch 2 weeks, 4 days ago
Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH] dt-bindings: usb: qcom,snps-dwc3: Add missing clock constraints
Posted by Krzysztof Kozlowski 2 weeks, 4 days ago
The top-level part defines variable number of clocks and each "if:then:"
block narrows them.  It however narrows only the maxItems leaving
minItems undefined, which then takes different values depending on
dtschema being used.

Recommended style is to avoid ambiguity in such case, thus if top-level
part has broad constraints, then each "if:then:" must specify both upper
and lower limits.

Add missing constraints, mostly minItems but also maxItems for one
variant.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

---

Apologies for sending two patches for the same file one after another as
independent work. I do drive-by fixes when doing reviews and usually
post such fix immediately.
---
 Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml b/Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml
index 2b6a0939d98d..cddc88e2bad2 100644
--- a/Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml
@@ -173,6 +173,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 3
           maxItems: 3
         clock-names:
           items:
@@ -220,6 +221,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 5
           maxItems: 5
         clock-names:
           items:
@@ -262,6 +264,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 4
           maxItems: 4
         clock-names:
           items:
@@ -281,6 +284,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 4
           maxItems: 4
         clock-names:
           items:
@@ -301,6 +305,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 9
           maxItems: 9
         clock-names:
           items:
@@ -361,6 +366,7 @@ allOf:
       properties:
         clocks:
           minItems: 6
+          maxItems: 6
         clock-names:
           items:
             - const: cfg_noc
@@ -402,6 +408,7 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 7
           maxItems: 7
         clock-names:
           items:
-- 
2.51.0
Re: [PATCH] dt-bindings: usb: qcom,snps-dwc3: Add missing clock constraints
Posted by Krzysztof Kozlowski 2 weeks ago
On 19/03/2026 10:23, Krzysztof Kozlowski wrote:
> The top-level part defines variable number of clocks and each "if:then:"
> block narrows them.  It however narrows only the maxItems leaving
> minItems undefined, which then takes different values depending on
> dtschema being used.
> 
> Recommended style is to avoid ambiguity in such case, thus if top-level
> part has broad constraints, then each "if:then:" must specify both upper
> and lower limits.
> 
> Add missing constraints, mostly minItems but also maxItems for one
> variant.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> 
> ---
> 
> Apologies for sending two patches for the same file one after another as
> independent work. I do drive-by fixes when doing reviews and usually
> post such fix immediately.

I looked at Sashiko review of this patch and it nicely spotted more
issues in the original code (not my patch), so I will have more patches.
I will organize all of them into one patchset, so there will be v2 of this.

Best regards,
Krzysztof