linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format
@ 2021-05-18 14:55 Fabien Parent
  2021-05-18 14:55 ` [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC Fabien Parent
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fabien Parent @ 2021-05-18 14:55 UTC (permalink / raw)
  To: Qii Wang, Rob Herring, Matthias Brugger
  Cc: mkorpershoek, Fabien Parent, linux-i2c, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

Convert the binding documentation for i2c-mt65xx driver to the
YAML schema format.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 .../devicetree/bindings/i2c/i2c-mt65xx.txt    | 49 ----------
 .../devicetree/bindings/i2c/i2c-mt65xx.yaml   | 97 +++++++++++++++++++
 2 files changed, 97 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
deleted file mode 100644
index 7f0194fdd0cc..000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
+++ /dev/null
@@ -1,49 +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,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.
-
-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..0f445d2ab727
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
@@ -0,0 +1,97 @@
+# 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-9]*@[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:
+          - const: mediatek,mt2701-i2c
+          - const: mediatek,mt6577-i2c
+      - items:
+          - const: mediatek,mt6797-i2c
+          - const: mediatek,mt6577-i2c
+      - items:
+          - const: mediatek,mt7623-i2c
+          - const: mediatek,mt6577-i2c
+      - items:
+          - const: mediatek,mt7629-i2c
+          - const: mediatek,mt2712-i2c
+      - items:
+          - const: mediatek,mt8516-i2c
+          - const: mediatek,mt2712-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.
+
+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";
+    };
-- 
2.31.1


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

* [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC
  2021-05-18 14:55 [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Fabien Parent
@ 2021-05-18 14:55 ` Fabien Parent
  2021-05-20  0:01   ` Rob Herring
  2021-05-18 14:55 ` [PATCH 3/3] i2c: i2c-mt65xx: add MT8365 SoC support Fabien Parent
  2021-05-20  0:01 ` [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Fabien Parent @ 2021-05-18 14:55 UTC (permalink / raw)
  To: Rob Herring, Matthias Brugger, Qii Wang
  Cc: mkorpershoek, Fabien Parent, linux-i2c, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

Add binding documentation for the MT8365 I2C controllers.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
index 0f445d2ab727..ddeda6d7348a 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
@@ -27,6 +27,7 @@ properties:
           - mediatek,mt8173-i2c
           - mediatek,mt8183-i2c
           - mediatek,mt8192-i2c
+          - mediatek,mt8365-i2c
       - items:
           - const: mediatek,mt2701-i2c
           - const: mediatek,mt6577-i2c
-- 
2.31.1


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

* [PATCH 3/3] i2c: i2c-mt65xx: add MT8365 SoC support
  2021-05-18 14:55 [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Fabien Parent
  2021-05-18 14:55 ` [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC Fabien Parent
@ 2021-05-18 14:55 ` Fabien Parent
  2021-05-20  0:01 ` [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Fabien Parent @ 2021-05-18 14:55 UTC (permalink / raw)
  To: Qii Wang, Matthias Brugger
  Cc: mkorpershoek, Fabien Parent, linux-i2c, linux-arm-kernel,
	linux-mediatek, linux-kernel

Add support for I2C on MT8365 SoCs.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 5ddfa4e56ee2..0e6ad84e0e47 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -404,6 +404,19 @@ static const struct mtk_i2c_compatible mt8192_compat = {
 	.max_dma_support = 36,
 };
 
+static const struct mtk_i2c_compatible mt8365_compat = {
+	.regs = mt_i2c_regs_v1,
+	.pmic_i2c = 0,
+	.dcm = 1,
+	.auto_restart = 1,
+	.aux_len_reg = 1,
+	.timing_adjust = 1,
+	.dma_sync = 1,
+	.ltiming_adjust = 0,
+	.apdma_sync = 0,
+	.max_dma_support = 33,
+};
+
 static const struct of_device_id mtk_i2c_of_match[] = {
 	{ .compatible = "mediatek,mt2712-i2c", .data = &mt2712_compat },
 	{ .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat },
@@ -412,6 +425,7 @@ static const struct of_device_id mtk_i2c_of_match[] = {
 	{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
 	{ .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat },
 	{ .compatible = "mediatek,mt8192-i2c", .data = &mt8192_compat },
+	{ .compatible = "mediatek,mt8365-i2c", .data = &mt8365_compat },
 	{}
 };
 MODULE_DEVICE_TABLE(of, mtk_i2c_of_match);
-- 
2.31.1


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

* Re: [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format
  2021-05-18 14:55 [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Fabien Parent
  2021-05-18 14:55 ` [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC Fabien Parent
  2021-05-18 14:55 ` [PATCH 3/3] i2c: i2c-mt65xx: add MT8365 SoC support Fabien Parent
@ 2021-05-20  0:01 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-05-20  0:01 UTC (permalink / raw)
  To: Fabien Parent
  Cc: Qii Wang, Matthias Brugger, mkorpershoek, linux-i2c, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Tue, May 18, 2021 at 04:55:20PM +0200, Fabien Parent wrote:
> Convert the binding documentation for i2c-mt65xx driver to the
> YAML schema format.
> 
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> ---
>  .../devicetree/bindings/i2c/i2c-mt65xx.txt    | 49 ----------
>  .../devicetree/bindings/i2c/i2c-mt65xx.yaml   | 97 +++++++++++++++++++
>  2 files changed, 97 insertions(+), 49 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
> deleted file mode 100644
> index 7f0194fdd0cc..000000000000
> --- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
> +++ /dev/null
> @@ -1,49 +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,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.
> -
> -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..0f445d2ab727
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml
> @@ -0,0 +1,97 @@
> +# 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-9]*@[0-9a-f]+$"

Drop '[0-9]*'. The base name should be just 'i2c'. 

> +
> +  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:
> +          - const: mediatek,mt2701-i2c
> +          - const: mediatek,mt6577-i2c
> +      - items:
> +          - const: mediatek,mt6797-i2c
> +          - const: mediatek,mt6577-i2c
> +      - items:
> +          - const: mediatek,mt7623-i2c
> +          - const: mediatek,mt6577-i2c
> +      - items:
> +          - const: mediatek,mt7629-i2c
> +          - const: mediatek,mt2712-i2c
> +      - items:
> +          - const: mediatek,mt8516-i2c
> +          - const: mediatek,mt2712-i2c

This can be simplified a bit like the other binding.

> +
> +  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.
> +
> +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";
> +    };
> -- 
> 2.31.1
> 

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

* Re: [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC
  2021-05-18 14:55 ` [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC Fabien Parent
@ 2021-05-20  0:01   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-05-20  0:01 UTC (permalink / raw)
  To: Fabien Parent
  Cc: linux-i2c, Matthias Brugger, mkorpershoek, linux-kernel,
	Qii Wang, linux-arm-kernel, Rob Herring, linux-mediatek,
	devicetree

On Tue, 18 May 2021 16:55:21 +0200, Fabien Parent wrote:
> Add binding documentation for the MT8365 I2C controllers.
> 
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2021-05-20  0:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 14:55 [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Fabien Parent
2021-05-18 14:55 ` [PATCH 2/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC Fabien Parent
2021-05-20  0:01   ` Rob Herring
2021-05-18 14:55 ` [PATCH 3/3] i2c: i2c-mt65xx: add MT8365 SoC support Fabien Parent
2021-05-20  0:01 ` [PATCH 1/3] dt-bindings: i2c: i2c-mt65xx: convert doc to yaml schema format Rob Herring

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).