diff mbox series

[v3,1/4] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format

Message ID 20211110194959.20611-1-fparent@baylibre.com
State Changes Requested, archived
Headers show
Series [v3,1/4] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 2 warnings, 106 lines checked
robh/dt-meta-schema fail build log

Commit Message

Fabien Parent Nov. 10, 2021, 7:49 p.m. UTC
Convert the binding documentation for i2c-mt65xx driver to the
YAML schema format.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---

v3:
	* rebased: added new compatible since last revision + added vbus-supply
		description
	* added clock-div description

v2:
	* write compatibles in a more compact way
	* set the node pattern to be "^i2c@[0-9a-f]+$" instead of
		"^i2c[0-9]*@[0-9a-f]+"$

 .../devicetree/bindings/i2c/i2c-mt65xx.txt    |  51 ---------
 .../devicetree/bindings/i2c/i2c-mt65xx.yaml   | 106 ++++++++++++++++++
 2 files changed, 106 insertions(+), 51 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml

Comments

Rob Herring (Arm) Nov. 11, 2021, 2:57 p.m. UTC | #1
On Wed, 10 Nov 2021 20:49:56 +0100, Fabien Parent wrote:
> Convert the binding documentation for i2c-mt65xx driver to the
> YAML schema format.
> 
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> ---
> 
> v3:
> 	* rebased: added new compatible since last revision + added vbus-supply
> 		description
> 	* added clock-div description
> 
> v2:
> 	* write compatibles in a more compact way
> 	* set the node pattern to be "^i2c@[0-9a-f]+$" instead of
> 		"^i2c[0-9]*@[0-9a-f]+"$
> 
>  .../devicetree/bindings/i2c/i2c-mt65xx.txt    |  51 ---------
>  .../devicetree/bindings/i2c/i2c-mt65xx.yaml   | 106 ++++++++++++++++++
>  2 files changed, 106 insertions(+), 51 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml: properties:vbus-supply: '$ref' is not one of ['description', 'deprecated']
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml: properties:clocks: {'minItems': 2, 'maxItems': 4, 'items': [{'description': 'Controller clock'}, {'description': 'DMA clock'}, {'description': 'ARB clock for multi-master when a bus has more than one i2c controllers'}, {'description': 'PMIC clock. Only when mediatek,have-pmic is set.'}]} should not be valid under {'required': ['maxItems']}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml: properties:clock-names: {'minItems': 2, 'maxItems': 4, 'items': [{'const': 'main'}, {'const': 'dma'}, {'const': 'arb'}, {'const': 'pmic'}]} should not be valid under {'required': ['maxItems']}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml: ignoring, error in schema: properties: vbus-supply
warning: no schema found in file: ./Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
Documentation/devicetree/bindings/i2c/i2c-mt65xx.example.dt.yaml:0:0: /example-0/i2c@1100d000: failed to match any schema with compatible: ['mediatek,mt6577-i2c']

doc reference errors (make refcheckdocs):
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
MAINTAINERS: Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt

See https://patchwork.ozlabs.org/patch/1553583

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Matthias Brugger Nov. 17, 2021, 5:09 p.m. UTC | #2
On 10/11/2021 20:49, Fabien Parent wrote:
> Fix the i2c node names to be compliant to the YAML schema. The
> I2C node name should match the following pattern: "^i2c@[0-9a-f]+$".
> 
> Signed-off-by: Fabien Parent <fparent@baylibre.com>

Applied to v5.16-next/dts64

Thanks

> ---
> 
> v3: rebased
> v2: new patch
> 
>   arch/arm64/boot/dts/mediatek/mt8192.dtsi | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts/mediatek/mt8192.dtsi
> index c7c7d4e017ae..53d790c335f9 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi
> @@ -479,7 +479,7 @@ audsys: clock-controller@11210000 {
>   			#clock-cells = <1>;
>   		};
>   
> -		i2c3: i2c3@11cb0000 {
> +		i2c3: i2c@11cb0000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11cb0000 0 0x1000>,
>   			      <0 0x10217300 0 0x80>;
> @@ -498,7 +498,7 @@ imp_iic_wrap_e: clock-controller@11cb1000 {
>   			#clock-cells = <1>;
>   		};
>   
> -		i2c7: i2c7@11d00000 {
> +		i2c7: i2c@11d00000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d00000 0 0x1000>,
>   			      <0 0x10217600 0 0x180>;
> @@ -511,7 +511,7 @@ i2c7: i2c7@11d00000 {
>   			status = "disabled";
>   		};
>   
> -		i2c8: i2c8@11d01000 {
> +		i2c8: i2c@11d01000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d01000 0 0x1000>,
>   			      <0 0x10217780 0 0x180>;
> @@ -524,7 +524,7 @@ i2c8: i2c8@11d01000 {
>   			status = "disabled";
>   		};
>   
> -		i2c9: i2c9@11d02000 {
> +		i2c9: i2c@11d02000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d02000 0 0x1000>,
>   			      <0 0x10217900 0 0x180>;
> @@ -543,7 +543,7 @@ imp_iic_wrap_s: clock-controller@11d03000 {
>   			#clock-cells = <1>;
>   		};
>   
> -		i2c1: i2c1@11d20000 {
> +		i2c1: i2c@11d20000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d20000 0 0x1000>,
>   			      <0 0x10217100 0 0x80>;
> @@ -556,7 +556,7 @@ i2c1: i2c1@11d20000 {
>   			status = "disabled";
>   		};
>   
> -		i2c2: i2c2@11d21000 {
> +		i2c2: i2c@11d21000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d21000 0 0x1000>,
>   			      <0 0x10217180 0 0x180>;
> @@ -569,7 +569,7 @@ i2c2: i2c2@11d21000 {
>   			status = "disabled";
>   		};
>   
> -		i2c4: i2c4@11d22000 {
> +		i2c4: i2c@11d22000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11d22000 0 0x1000>,
>   			      <0 0x10217380 0 0x180>;
> @@ -588,7 +588,7 @@ imp_iic_wrap_ws: clock-controller@11d23000 {
>   			#clock-cells = <1>;
>   		};
>   
> -		i2c5: i2c5@11e00000 {
> +		i2c5: i2c@11e00000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11e00000 0 0x1000>,
>   			      <0 0x10217500 0 0x80>;
> @@ -607,7 +607,7 @@ imp_iic_wrap_w: clock-controller@11e01000 {
>   			#clock-cells = <1>;
>   		};
>   
> -		i2c0: i2c0@11f00000 {
> +		i2c0: i2c@11f00000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11f00000 0 0x1000>,
>   			      <0 0x10217080 0 0x80>;
> @@ -620,7 +620,7 @@ i2c0: i2c0@11f00000 {
>   			status = "disabled";
>   		};
>   
> -		i2c6: i2c6@11f01000 {
> +		i2c6: i2c@11f01000 {
>   			compatible = "mediatek,mt8192-i2c";
>   			reg = <0 0x11f01000 0 0x1000>,
>   			      <0 0x10217580 0 0x80>;
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
deleted file mode 100644
index 5ea216ae7084..000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
+++ /dev/null
@@ -1,51 +0,0 @@ 
-* MediaTek's I2C controller
-
-The MediaTek's I2C controller is used to interface with I2C devices.
-
-Required properties:
-  - compatible: value should be either of the following.
-      "mediatek,mt2701-i2c", "mediatek,mt6577-i2c": for MediaTek MT2701
-      "mediatek,mt2712-i2c": for MediaTek MT2712
-      "mediatek,mt6577-i2c": for MediaTek MT6577
-      "mediatek,mt6589-i2c": for MediaTek MT6589
-      "mediatek,mt6797-i2c", "mediatek,mt6577-i2c": for MediaTek MT6797
-      "mediatek,mt7622-i2c": for MediaTek MT7622
-      "mediatek,mt7623-i2c", "mediatek,mt6577-i2c": for MediaTek MT7623
-      "mediatek,mt7629-i2c", "mediatek,mt2712-i2c": for MediaTek MT7629
-      "mediatek,mt8173-i2c": for MediaTek MT8173
-      "mediatek,mt8183-i2c": for MediaTek MT8183
-      "mediatek,mt8192-i2c": for MediaTek MT8192
-      "mediatek,mt8195-i2c", "mediatek,mt8192-i2c": for MediaTek MT8195
-      "mediatek,mt8516-i2c", "mediatek,mt2712-i2c": for MediaTek MT8516
-  - reg: physical base address of the controller and dma base, length of memory
-    mapped region.
-  - interrupts: interrupt number to the cpu.
-  - clock-div: the fixed value for frequency divider of clock source in i2c
-    module. Each IC may be different.
-  - clocks: clock name from clock manager
-  - clock-names: Must include "main" and "dma", "arb" is for multi-master that
-    one bus has more than two i2c controllers, if enable have-pmic need include
-    "pmic" extra.
-
-Optional properties:
-  - clock-frequency: Frequency in Hz of the bus when transfer, the default value
-    is 100000.
-  - mediatek,have-pmic: platform can control i2c form special pmic side.
-    Only mt6589 and mt8135 support this feature.
-  - mediatek,use-push-pull: IO config use push-pull mode.
-  - vbus-supply: phandle to the regulator that provides power to SCL/SDA.
-
-Example:
-
-	i2c0: i2c@1100d000 {
-			compatible = "mediatek,mt6577-i2c";
-			reg = <0x1100d000 0x70>,
-			      <0x11000300 0x80>;
-			interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_LOW>;
-			clock-frequency = <400000>;
-			mediatek,have-pmic;
-			clock-div = <16>;
-			clocks = <&i2c0_ck>, <&ap_dma_ck>;
-			clock-names = "main", "dma";
-	};
-
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
new file mode 100644
index 000000000000..af0880fcc22b
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
@@ -0,0 +1,106 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/i2c/i2c-mt65xx.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MediaTek I2C Controller
+
+maintainers:
+  - Qii Wang <qii.wang@mediatek.com>
+  - Matthias Brugger <matthias.bgg@gmail.com>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+properties:
+  $nodename:
+    pattern: "^i2c@[0-9a-f]+$"
+
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt2712-i2c
+          - mediatek,mt6577-i2c
+          - mediatek,mt6589-i2c
+          - mediatek,mt7622-i2c
+          - mediatek,mt8173-i2c
+          - mediatek,mt8183-i2c
+          - mediatek,mt8192-i2c
+      - items:
+          - enum:
+              - mediatek,mt2701-i2c
+              - mediatek,mt6797-i2c
+              - mediatek,mt7623-i2c
+          - const: mediatek,mt6577-i2c
+      - items:
+          - enum:
+              - mediatek,mt7629-i2c
+              - mediatek,mt8516-i2c
+          - const: mediatek,mt2712-i2c
+      - items:
+          - enum:
+              - mediatek,mt8195-i2c
+          - const: mediatek,mt8192-i2c
+
+  clocks:
+    minItems: 2
+    maxItems: 4
+    items:
+      - description: Controller clock
+      - description: DMA clock
+      - description: ARB clock for multi-master when a bus has more than
+          one i2c controllers
+      - description: PMIC clock. Only when mediatek,have-pmic is set.
+
+  clock-names:
+    minItems: 2
+    maxItems: 4
+    items:
+      - const: main
+      - const: dma
+      - const: arb
+      - const: pmic
+
+  mediatek,have-pmic:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Platform can control I2C from the PMIC
+
+  mediatek,use-push-pull:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: IO config use push-pull mode.
+
+  vbus-supply:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to the regulator that provides power to SCL/SDA.
+
+  clock-div:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Fixed frequency divider for I2C clock source.
+    minimum: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - clock-div
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c0: i2c@1100d000 {
+            compatible = "mediatek,mt6577-i2c";
+            reg = <0x1100d000 0x70>,
+                  <0x11000300 0x80>;
+            interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_LOW>;
+            clock-frequency = <400000>;
+            mediatek,have-pmic;
+            clock-div = <16>;
+            clocks = <&i2c0_ck>, <&ap_dma_ck>;
+            clock-names = "main", "dma";
+    };