[v1,2/2] dt-bindings: i2c: add loongson i2c

Message ID 20221117075938.23379-2-zhuyinbo@loongson.cn
State New
Headers
Series [v1,1/2] i2c: loongson: add bus driver for the loongson i2c controller |

Commit Message

Yinbo Zhu Nov. 17, 2022, 7:59 a.m. UTC
  Add the Loongson platform i2c binding with DT schema format using
json-schema.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
 .../bindings/i2c/loongson,ls-i2c.yaml         | 49 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
  

Comments

Rob Herring Nov. 20, 2022, 5:23 p.m. UTC | #1
On Thu, Nov 17, 2022 at 03:59:38PM +0800, Yinbo Zhu wrote:
> Add the Loongson platform i2c binding with DT schema format using
> json-schema.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>  .../bindings/i2c/loongson,ls-i2c.yaml         | 49 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
> 
> diff --git a/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml b/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
> new file mode 100644
> index 000000000000..275afe8c8483
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
> @@ -0,0 +1,49 @@
> +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/i2c/loongson,ls-i2c.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson I2C controller
> +
> +maintainers:
> +  - Yinbo Zhu <zhuyinbo@loongson.cn>
> +
> +allOf:
> +  - $ref: /schemas/i2c/i2c-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - loongson,ls2k-i2c
> +      - loongson,ls7a-i2c
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts

> +  - "#address-cells"
> +  - "#size-cells"

You can drop these 2. i2c-controller.yaml requires them.

With that,

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

Patch

diff --git a/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml b/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
new file mode 100644
index 000000000000..275afe8c8483
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
@@ -0,0 +1,49 @@ 
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/loongson,ls-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson I2C controller
+
+maintainers:
+  - Yinbo Zhu <zhuyinbo@loongson.cn>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - loongson,ls2k-i2c
+      - loongson,ls7a-i2c
+
+  interrupts:
+    maxItems: 1
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#address-cells"
+  - "#size-cells"
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c0: i2c@1fe21000 {
+        compatible = "loongson,ls2k-i2c";
+        reg = <0x1fe21000 0x8>;
+        interrupt-parent = <&liointc0>;
+        interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&i2c0_pins_default>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index e45c678eb40e..b956d5e2d9e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12064,6 +12064,7 @@  LOONGSON SERIES I2C DRIVER
 M:	Yinbo Zhu <zhuyinbo@loongson.cn>
 L:	linux-i2c@vger.kernel.org
 S:	Maintained
+F:	Documentation/devicetree/bindings/i2c/loongson,ls-i2c.yaml
 F:	drivers/i2c/busses/i2c-loongson.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)