devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible
@ 2022-06-23 15:40 Nícolas F. R. A. Prado
  2022-06-24  2:13 ` Wenbin Mei
  2022-06-24 10:02 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-06-23 15:40 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: kernel, AngeloGioacchino Del Regno, Nícolas F. R. A. Prado,
	Chaotian Jing, Krzysztof Kozlowski, Matthias Brugger, Rob Herring,
	Wenbin Mei, devicetree, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-mmc

The binding was describing a single clock list for all platforms, but
that's not really suitable: mt2712 requires an extra 'bus_clk' on some
of its controllers, while mt8192 requires four different extra clocks.
The rest of the platforms can share the same 3 clocks, with the third
being optional as it's not present on all platforms.

Move the clock definitions inside if blocks that match on the
compatibles. In practice this gets rid of dtbs_check warnings on mt8192,
since the 'bus_clk' clock from mt2712 is no longer expected on this
platform.

Fixes: 59a23395d8aa ("dt-bindings: mmc: Add support for MT8192 SoC")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---
v1: https://lore.kernel.org/all/20220617230114.2438875-1-nfraprado@collabora.com

Changes in v2:
- Kept widest minItems/maxItems outside the if blocks

 .../devicetree/bindings/mmc/mtk-sd.yaml       | 111 +++++++++++++-----
 1 file changed, 81 insertions(+), 30 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
index 2a2e9fa8c188..5e73218d2e6e 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
@@ -10,9 +10,6 @@ maintainers:
   - Chaotian Jing <chaotian.jing@mediatek.com>
   - Wenbin Mei <wenbin.mei@mediatek.com>
 
-allOf:
-  - $ref: mmc-controller.yaml#
-
 properties:
   compatible:
     oneOf:
@@ -49,27 +46,11 @@ properties:
     description:
       Should contain phandle for the clock feeding the MMC controller.
     minItems: 2
-    items:
-      - description: source clock (required).
-      - description: HCLK which used for host (required).
-      - description: independent source clock gate (required for MT2712).
-      - description: bus clock used for internal register access (required for MT2712 MSDC0/3).
-      - description: msdc subsys clock gate (required for MT8192).
-      - description: peripheral bus clock gate (required for MT8192).
-      - description: AXI bus clock gate (required for MT8192).
-      - description: AHB bus clock gate (required for MT8192).
+    maxItems: 7
 
   clock-names:
     minItems: 2
-    items:
-      - const: source
-      - const: hclk
-      - const: source_cg
-      - const: bus_clk
-      - const: sys_cg
-      - const: pclk_cg
-      - const: axi_cg
-      - const: ahb_cg
+    maxItems: 7
 
   interrupts:
     maxItems: 1
@@ -171,15 +152,85 @@ required:
   - vmmc-supply
   - vqmmc-supply
 
-if:
-  properties:
-    compatible:
-      contains:
-        const: mediatek,mt8183-mmc
-then:
-  properties:
-    reg:
-      minItems: 2
+allOf:
+  - $ref: mmc-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8183-mmc
+    then:
+      properties:
+        reg:
+          minItems: 2
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8192-mmc
+    then:
+      properties:
+        clocks:
+          items:
+            - description: source clock
+            - description: HCLK which used for host
+            - description: independent source clock gate
+            - description: msdc subsys clock gate
+            - description: peripheral bus clock gate
+            - description: AXI bus clock gate
+            - description: AHB bus clock gate
+        clock-names:
+          items:
+            - const: source
+            - const: hclk
+            - const: source_cg
+            - const: sys_cg
+            - const: pclk_cg
+            - const: axi_cg
+            - const: ahb_cg
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt2712-mmc
+    then:
+      properties:
+        clocks:
+          minItems: 3
+          items:
+            - description: source clock
+            - description: HCLK which used for host
+            - description: independent source clock gate
+            - description: bus clock used for internal register access (required for MSDC0/3).
+        clock-names:
+          minItems: 3
+          items:
+            - const: source
+            - const: hclk
+            - const: source_cg
+            - const: bus_clk
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - mediatek,mt2712-mmc
+                - mediatek,mt8192-mmc
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          items:
+            - description: source clock
+            - description: HCLK which used for host
+            - description: independent source clock gate
+        clock-names:
+          minItems: 2
+          items:
+            - const: source
+            - const: hclk
+            - const: source_cg
 
 unevaluatedProperties: false
 
-- 
2.36.1


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

* Re: [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible
  2022-06-23 15:40 [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible Nícolas F. R. A. Prado
@ 2022-06-24  2:13 ` Wenbin Mei
  2022-06-24 10:02 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Wenbin Mei @ 2022-06-24  2:13 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Ulf Hansson
  Cc: kernel, AngeloGioacchino Del Regno, Chaotian Jing,
	Krzysztof Kozlowski, Matthias Brugger, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-mediatek, linux-mmc

On Thu, 2022-06-23 at 11:40 -0400, Nícolas F. R. A. Prado wrote:
> The binding was describing a single clock list for all platforms, but
> that's not really suitable: mt2712 requires an extra 'bus_clk' on
> some
> of its controllers, while mt8192 requires four different extra
> clocks.
> The rest of the platforms can share the same 3 clocks, with the third
> being optional as it's not present on all platforms.
> 
> Move the clock definitions inside if blocks that match on the
> compatibles. In practice this gets rid of dtbs_check warnings on
> mt8192,
> since the 'bus_clk' clock from mt2712 is no longer expected on this
> platform.
> 
> Fixes: 59a23395d8aa ("dt-bindings: mmc: Add support for MT8192 SoC")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> 

Reviewed-by: Wenbin Mei <wenbin.mei@mediatek.com>

> ---
> v1: 
> https://lore.kernel.org/all/20220617230114.2438875-1-nfraprado@collabora.com
> 
> Changes in v2:
> - Kept widest minItems/maxItems outside the if blocks
> 
>  .../devicetree/bindings/mmc/mtk-sd.yaml       | 111 +++++++++++++---
> --
>  1 file changed, 81 insertions(+), 30 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> index 2a2e9fa8c188..5e73218d2e6e 100644
> --- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> +++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> @@ -10,9 +10,6 @@ maintainers:
>    - Chaotian Jing <chaotian.jing@mediatek.com>
>    - Wenbin Mei <wenbin.mei@mediatek.com>
>  
> -allOf:
> -  - $ref: mmc-controller.yaml#
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -49,27 +46,11 @@ properties:
>      description:
>        Should contain phandle for the clock feeding the MMC
> controller.
>      minItems: 2
> -    items:
> -      - description: source clock (required).
> -      - description: HCLK which used for host (required).
> -      - description: independent source clock gate (required for
> MT2712).
> -      - description: bus clock used for internal register access
> (required for MT2712 MSDC0/3).
> -      - description: msdc subsys clock gate (required for MT8192).
> -      - description: peripheral bus clock gate (required for
> MT8192).
> -      - description: AXI bus clock gate (required for MT8192).
> -      - description: AHB bus clock gate (required for MT8192).
> +    maxItems: 7
>  
>    clock-names:
>      minItems: 2
> -    items:
> -      - const: source
> -      - const: hclk
> -      - const: source_cg
> -      - const: bus_clk
> -      - const: sys_cg
> -      - const: pclk_cg
> -      - const: axi_cg
> -      - const: ahb_cg
> +    maxItems: 7
>  
>    interrupts:
>      maxItems: 1
> @@ -171,15 +152,85 @@ required:
>    - vmmc-supply
>    - vqmmc-supply
>  
> -if:
> -  properties:
> -    compatible:
> -      contains:
> -        const: mediatek,mt8183-mmc
> -then:
> -  properties:
> -    reg:
> -      minItems: 2
> +allOf:
> +  - $ref: mmc-controller.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: mediatek,mt8183-mmc
> +    then:
> +      properties:
> +        reg:
> +          minItems: 2
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: mediatek,mt8192-mmc
> +    then:
> +      properties:
> +        clocks:
> +          items:
> +            - description: source clock
> +            - description: HCLK which used for host
> +            - description: independent source clock gate
> +            - description: msdc subsys clock gate
> +            - description: peripheral bus clock gate
> +            - description: AXI bus clock gate
> +            - description: AHB bus clock gate
> +        clock-names:
> +          items:
> +            - const: source
> +            - const: hclk
> +            - const: source_cg
> +            - const: sys_cg
> +            - const: pclk_cg
> +            - const: axi_cg
> +            - const: ahb_cg
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: mediatek,mt2712-mmc
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 3
> +          items:
> +            - description: source clock
> +            - description: HCLK which used for host
> +            - description: independent source clock gate
> +            - description: bus clock used for internal register
> access (required for MSDC0/3).
> +        clock-names:
> +          minItems: 3
> +          items:
> +            - const: source
> +            - const: hclk
> +            - const: source_cg
> +            - const: bus_clk
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - mediatek,mt2712-mmc
> +                - mediatek,mt8192-mmc
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 2
> +          items:
> +            - description: source clock
> +            - description: HCLK which used for host
> +            - description: independent source clock gate
> +        clock-names:
> +          minItems: 2
> +          items:
> +            - const: source
> +            - const: hclk
> +            - const: source_cg
>  
>  unevaluatedProperties: false
>  


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

* Re: [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible
  2022-06-23 15:40 [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible Nícolas F. R. A. Prado
  2022-06-24  2:13 ` Wenbin Mei
@ 2022-06-24 10:02 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-24 10:02 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Ulf Hansson
  Cc: kernel, AngeloGioacchino Del Regno, Chaotian Jing,
	Krzysztof Kozlowski, Matthias Brugger, Rob Herring, Wenbin Mei,
	devicetree, linux-arm-kernel, linux-kernel, linux-mediatek,
	linux-mmc

On 23/06/2022 17:40, Nícolas F. R. A. Prado wrote:
> The binding was describing a single clock list for all platforms, but
> that's not really suitable: mt2712 requires an extra 'bus_clk' on some
> of its controllers, while mt8192 requires four different extra clocks.
> The rest of the platforms can share the same 3 clocks, with the third
> being optional as it's not present on all platforms.
> 
> Move the clock definitions inside if blocks that match on the
> compatibles. In practice this gets rid of dtbs_check warnings on mt8192,
> since the 'bus_clk' clock from mt2712 is no longer expected on this
> platform.

And now we see that you introduce incompatible change and ABI break.
This should not be combined with that patch but instead separate patch
explaining why ABI break is ok.

Best regards,
Krzysztof

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

end of thread, other threads:[~2022-06-24 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 15:40 [PATCH v2] dt-bindings: mmc: mtk-sd: Set clocks based on compatible Nícolas F. R. A. Prado
2022-06-24  2:13 ` Wenbin Mei
2022-06-24 10:02 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).