[v2,1/6] dt-bindings: i2c: qcom,i2c-cci: Fall back to common compatibles

Message ID 20221213183305.544644-1-konrad.dybcio@linaro.org
State New
Headers
Series [v2,1/6] dt-bindings: i2c: qcom,i2c-cci: Fall back to common compatibles |

Commit Message

Konrad Dybcio Dec. 13, 2022, 6:33 p.m. UTC
  Almost every compatible string in the CCI driver is a duplicate. Adjust
the bindings to include a common (first-soc-implementing-vX) compatible
to remove the need to keep adding superfluous compatible strings.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Changes in v2:
- make sure the actual patch contests are tested..
- resolve errors

 .../devicetree/bindings/i2c/qcom,i2c-cci.yaml | 47 ++++++++++++-------
 1 file changed, 30 insertions(+), 17 deletions(-)
  

Comments

Krzysztof Kozlowski Dec. 13, 2022, 7:16 p.m. UTC | #1
On 13/12/2022 19:33, Konrad Dybcio wrote:
> Almost every compatible string in the CCI driver is a duplicate. Adjust
> the bindings to include a common (first-soc-implementing-vX) compatible
> to remove the need to keep adding superfluous compatible strings.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
> Changes in v2:
> - make sure the actual patch contests are tested..
> - resolve errors
> 
>  .../devicetree/bindings/i2c/qcom,i2c-cci.yaml | 47 ++++++++++++-------
>  1 file changed, 30 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
> index cf9f8fda595f..87e414f0c39c 100644
> --- a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
> +++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
> @@ -12,14 +12,23 @@ maintainers:
>  
>  properties:
>    compatible:
> -    enum:
> -      - qcom,msm8226-cci
> -      - qcom,msm8916-cci
> -      - qcom,msm8974-cci
> -      - qcom,msm8996-cci
> -      - qcom,sdm845-cci
> -      - qcom,sm8250-cci
> -      - qcom,sm8450-cci
> +    oneOf:
> +      - enum:
> +          - qcom,msm8226-cci
> +          - qcom,msm8974-cci
> +          - qcom,msm8996-cci
> +
> +      - items:
> +          - enum:
> +              - qcom,msm8916-cci
> +          - const: qcom,msm8226-cci # CCI v1
> +
> +      - items:
> +          - enum:
> +              - qcom,sdm845-cci
> +              - qcom,sm8250-cci
> +              - qcom,sm8450-cci
> +          - const: qcom,msm8996-cci # CCI v2
>  
>    "#address-cells":
>      const: 1
> @@ -88,10 +97,12 @@ allOf:
>    - if:
>        properties:
>          compatible:
> -          contains:
> -            enum:
> -              - qcom,msm8226-cci
> -              - qcom,msm8974-cci
> +          oneOf:
> +            - contains:
> +                enum:
> +                  - qcom,msm8974-cci
> +
> +            - const: qcom,msm8226-cci

The old version is here also correct and simpler. I don't think you need
to change it this way.

>      then:
>        properties:
>          clocks:
> @@ -105,10 +116,12 @@ allOf:
>    - if:
>        properties:
>          compatible:
> -          contains:
> -            enum:
> -              - qcom,msm8916-cci
> -              - qcom,msm8996-cci
> +          oneOf:
> +            - contains:
> +                enum:
> +                  - qcom,msm8916-cci
> +
> +            - const: qcom,msm8996-cci

The same comment.

>      then:
>        properties:
>          clocks:
> @@ -169,7 +182,7 @@ examples:
>  
>      cci@ac4a000 {
>          reg = <0x0ac4a000 0x4000>;
> -        compatible = "qcom,sdm845-cci";
> +        compatible = "qcom,sdm845-cci", "qcom,msm8996-cci";
>          #address-cells = <1>;
>          #size-cells = <0>;
>  

Best regards,
Krzysztof
  
Konrad Dybcio Dec. 13, 2022, 7:20 p.m. UTC | #2
On 13.12.2022 20:16, Krzysztof Kozlowski wrote:
> On 13/12/2022 19:33, Konrad Dybcio wrote:
>> Almost every compatible string in the CCI driver is a duplicate. Adjust
>> the bindings to include a common (first-soc-implementing-vX) compatible
>> to remove the need to keep adding superfluous compatible strings.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>> Changes in v2:
>> - make sure the actual patch contests are tested..
>> - resolve errors
>>
>>  .../devicetree/bindings/i2c/qcom,i2c-cci.yaml | 47 ++++++++++++-------
>>  1 file changed, 30 insertions(+), 17 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
>> index cf9f8fda595f..87e414f0c39c 100644
>> --- a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
>> +++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
>> @@ -12,14 +12,23 @@ maintainers:
>>  
>>  properties:
>>    compatible:
>> -    enum:
>> -      - qcom,msm8226-cci
>> -      - qcom,msm8916-cci
>> -      - qcom,msm8974-cci
>> -      - qcom,msm8996-cci
>> -      - qcom,sdm845-cci
>> -      - qcom,sm8250-cci
>> -      - qcom,sm8450-cci
>> +    oneOf:
>> +      - enum:
>> +          - qcom,msm8226-cci
>> +          - qcom,msm8974-cci
>> +          - qcom,msm8996-cci
>> +
>> +      - items:
>> +          - enum:
>> +              - qcom,msm8916-cci
>> +          - const: qcom,msm8226-cci # CCI v1
>> +
>> +      - items:
>> +          - enum:
>> +              - qcom,sdm845-cci
>> +              - qcom,sm8250-cci
>> +              - qcom,sm8450-cci
>> +          - const: qcom,msm8996-cci # CCI v2
>>  
>>    "#address-cells":
>>      const: 1
>> @@ -88,10 +97,12 @@ allOf:
>>    - if:
>>        properties:
>>          compatible:
>> -          contains:
>> -            enum:
>> -              - qcom,msm8226-cci
>> -              - qcom,msm8974-cci
>> +          oneOf:
>> +            - contains:
>> +                enum:
>> +                  - qcom,msm8974-cci
>> +
>> +            - const: qcom,msm8226-cci
> 
> The old version is here also correct and simpler. I don't think you need
> to change it this way.
> 
>>      then:
>>        properties:
>>          clocks:
>> @@ -105,10 +116,12 @@ allOf:
>>    - if:
>>        properties:
>>          compatible:
>> -          contains:
>> -            enum:
>> -              - qcom,msm8916-cci
>> -              - qcom,msm8996-cci
>> +          oneOf:
>> +            - contains:
>> +                enum:
>> +                  - qcom,msm8916-cci
>> +
>> +            - const: qcom,msm8996-cci
> 
> The same comment.
e.g. the 845 example contains 8996 but does not fall in this category,
reverting this change causes errors.

Konrad
> 
>>      then:
>>        properties:
>>          clocks:
>> @@ -169,7 +182,7 @@ examples:
>>  
>>      cci@ac4a000 {
>>          reg = <0x0ac4a000 0x4000>;
>> -        compatible = "qcom,sdm845-cci";
>> +        compatible = "qcom,sdm845-cci", "qcom,msm8996-cci";
>>          #address-cells = <1>;
>>          #size-cells = <0>;
>>  
> 
> Best regards,
> Krzysztof
>
  
Krzysztof Kozlowski Dec. 13, 2022, 7:28 p.m. UTC | #3
On 13/12/2022 20:20, Konrad Dybcio wrote:
> 
>>
>>>      then:
>>>        properties:
>>>          clocks:
>>> @@ -105,10 +116,12 @@ allOf:
>>>    - if:
>>>        properties:
>>>          compatible:
>>> -          contains:
>>> -            enum:
>>> -              - qcom,msm8916-cci
>>> -              - qcom,msm8996-cci
>>> +          oneOf:
>>> +            - contains:
>>> +                enum:
>>> +                  - qcom,msm8916-cci
>>> +
>>> +            - const: qcom,msm8996-cci
>>
>> The same comment.
> e.g. the 845 example contains 8996 but does not fall in this category,
> reverting this change causes errors.

Ah, I see, indeed. Looks reasonable:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
  
Wolfram Sang Jan. 9, 2023, 12:06 p.m. UTC | #4
On Tue, Dec 13, 2022 at 07:33:00PM +0100, Konrad Dybcio wrote:
> Almost every compatible string in the CCI driver is a duplicate. Adjust
> the bindings to include a common (first-soc-implementing-vX) compatible
> to remove the need to keep adding superfluous compatible strings.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Applied to for-next, thanks!
  
Bjorn Andersson Jan. 11, 2023, 5:09 a.m. UTC | #5
On Tue, 13 Dec 2022 19:33:00 +0100, Konrad Dybcio wrote:
> Almost every compatible string in the CCI driver is a duplicate. Adjust
> the bindings to include a common (first-soc-implementing-vX) compatible
> to remove the need to keep adding superfluous compatible strings.
> 
> 

Applied, thanks!

[2/6] arm64: dts: qcom: msm8916: Add fallback CCI compatible
      commit: 6d88aafa6fdded2a76f60060ea50f7b8e98a2705
[3/6] arm64: dts: qcom: sdm845: Add fallback CCI compatible
      commit: 84c611c5bca41f584a990a041daf31bf73ba9b99
[4/6] arm64: dts: qcom: sm8250: Add fallback CCI compatible
      commit: dd45008b74e4ca28bbacf0d249dac821624a88b0
[5/6] arm64: dts: qcom: sm8450: Add fallback CCI compatible
      commit: 71b7c2df3109ee62e875b16fcb5654e626bf7cc7

Best regards,
  

Patch

diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
index cf9f8fda595f..87e414f0c39c 100644
--- a/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
+++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml
@@ -12,14 +12,23 @@  maintainers:
 
 properties:
   compatible:
-    enum:
-      - qcom,msm8226-cci
-      - qcom,msm8916-cci
-      - qcom,msm8974-cci
-      - qcom,msm8996-cci
-      - qcom,sdm845-cci
-      - qcom,sm8250-cci
-      - qcom,sm8450-cci
+    oneOf:
+      - enum:
+          - qcom,msm8226-cci
+          - qcom,msm8974-cci
+          - qcom,msm8996-cci
+
+      - items:
+          - enum:
+              - qcom,msm8916-cci
+          - const: qcom,msm8226-cci # CCI v1
+
+      - items:
+          - enum:
+              - qcom,sdm845-cci
+              - qcom,sm8250-cci
+              - qcom,sm8450-cci
+          - const: qcom,msm8996-cci # CCI v2
 
   "#address-cells":
     const: 1
@@ -88,10 +97,12 @@  allOf:
   - if:
       properties:
         compatible:
-          contains:
-            enum:
-              - qcom,msm8226-cci
-              - qcom,msm8974-cci
+          oneOf:
+            - contains:
+                enum:
+                  - qcom,msm8974-cci
+
+            - const: qcom,msm8226-cci
     then:
       properties:
         clocks:
@@ -105,10 +116,12 @@  allOf:
   - if:
       properties:
         compatible:
-          contains:
-            enum:
-              - qcom,msm8916-cci
-              - qcom,msm8996-cci
+          oneOf:
+            - contains:
+                enum:
+                  - qcom,msm8916-cci
+
+            - const: qcom,msm8996-cci
     then:
       properties:
         clocks:
@@ -169,7 +182,7 @@  examples:
 
     cci@ac4a000 {
         reg = <0x0ac4a000 0x4000>;
-        compatible = "qcom,sdm845-cci";
+        compatible = "qcom,sdm845-cci", "qcom,msm8996-cci";
         #address-cells = <1>;
         #size-cells = <0>;