linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema
@ 2024-05-14 20:54 Eddie James
  2024-05-19 18:03 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: Eddie James @ 2024-05-14 20:54 UTC (permalink / raw)
  To: linux-i2c
  Cc: devicetree, linux-kernel, eajames, conor+dt, krzk+dt, robh, andi.shyti

Convert to json-schema for the FSI-attached I2C controller.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
This patch was previously included in
https://lore.kernel.org/all/20240429210131.373487-1-eajames@linux.ibm.com/

Changes since v4:
 - Add patternProperties for the busses that will reference the i2c-controller
   schema, since the root node provides multiple i2c busses.

Changes since v3:
 - Update MAINTAINERS
 - Change commit message to match similar commits

 .../devicetree/bindings/i2c/i2c-fsi.txt       | 40 ----------
 .../devicetree/bindings/i2c/ibm,i2c-fsi.yaml  | 76 +++++++++++++++++++
 MAINTAINERS                                   |  2 +-
 3 files changed, 77 insertions(+), 41 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-fsi.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-fsi.txt b/Documentation/devicetree/bindings/i2c/i2c-fsi.txt
deleted file mode 100644
index b1be2ceb7e696..0000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-fsi.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Device-tree bindings for FSI-attached I2C master and busses
------------------------------------------------------------
-
-Required properties:
- - compatible = "ibm,i2c-fsi";
- - reg = < address size >;		: The FSI CFAM address and address
-					  space size.
- - #address-cells = <1>;		: Number of address cells in child
-					  nodes.
- - #size-cells = <0>;			: Number of size cells in child nodes.
- - child nodes				: Nodes to describe busses off the I2C
-					  master.
-
-Child node required properties:
- - reg = < port number >		: The port number on the I2C master.
-
-Child node optional properties:
- - child nodes				: Nodes to describe devices on the I2C
-					  bus.
-
-Examples:
-
-    i2c@1800 {
-        compatible = "ibm,i2c-fsi";
-        reg = < 0x1800 0x400 >;
-        #address-cells = <1>;
-        #size-cells = <0>;
-
-        i2c-bus@0 {
-            reg = <0>;
-        };
-
-        i2c-bus@1 {
-            reg = <1>;
-
-            eeprom@50 {
-                compatible = "vendor,dev-name";
-            };
-        };
-    };
diff --git a/Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml b/Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml
new file mode 100644
index 0000000000000..62e70aaea9d56
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/ibm,i2c-fsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IBM FSI-attached I2C controller
+
+maintainers:
+  - Eddie James <eajames@linux.ibm.com>
+
+description:
+  This I2C controller is an FSI CFAM engine, providing access to a number of
+  I2C busses. Therefore this node will always be a child of an FSI CFAM node.
+
+properties:
+  compatible:
+    enum:
+      - ibm,i2c-fsi
+
+  reg:
+    items:
+      - description: FSI slave address
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^i2c(@.*)?":
+    type: object
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+    allOf:
+      - $ref: /schemas/i2c/i2c-controller.yaml#
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c@1800 {
+        compatible = "ibm,i2c-fsi";
+        reg = <0x1800 0x400>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        i2c-bus@0 {
+            reg = <0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+
+        i2c-bus@1 {
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            eeprom@50 {
+                compatible = "atmel,24c64";
+                reg = <0x50>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index b2df2cc60dc78..86c1c8dd86093 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8976,7 +8976,7 @@ M:	Eddie James <eajames@linux.ibm.com>
 L:	linux-i2c@vger.kernel.org
 L:	openbmc@lists.ozlabs.org (moderated for non-subscribers)
 S:	Maintained
-F:	Documentation/devicetree/bindings/i2c/i2c-fsi.txt
+F:	Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml
 F:	drivers/i2c/busses/i2c-fsi.c
 
 FSI-ATTACHED SPI DRIVER
-- 
2.39.3


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

* Re: [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema
  2024-05-14 20:54 [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema Eddie James
@ 2024-05-19 18:03 ` Krzysztof Kozlowski
  2024-05-20 14:56   ` Eddie James
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-19 18:03 UTC (permalink / raw)
  To: Eddie James, linux-i2c
  Cc: devicetree, linux-kernel, conor+dt, krzk+dt, robh, andi.shyti

On 14/05/2024 22:54, Eddie James wrote:

> +properties:
> +  compatible:
> +    enum:
> +      - ibm,i2c-fsi
> +
> +  reg:
> +    items:
> +      - description: FSI slave address
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +patternProperties:
> +  "^i2c(@.*)?":

Either you have or you have not unit addresses. Please fix the pattern.
Why is this so flexible? Do you want to deprecate i2c-bus in favor of
i2c? If so, then example should use new naming. I am fine with children
as i2c-bus, assuming this is allowed by dtschema. Did you actually test it?

Best regards,
Krzysztof


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

* Re: [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema
  2024-05-19 18:03 ` Krzysztof Kozlowski
@ 2024-05-20 14:56   ` Eddie James
  2024-05-21  7:36     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: Eddie James @ 2024-05-20 14:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-i2c
  Cc: devicetree, linux-kernel, conor+dt, krzk+dt, robh, andi.shyti


On 5/19/24 13:03, Krzysztof Kozlowski wrote:
> On 14/05/2024 22:54, Eddie James wrote:
>
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - ibm,i2c-fsi
>> +
>> +  reg:
>> +    items:
>> +      - description: FSI slave address
>> +
>> +  "#address-cells":
>> +    const: 1
>> +
>> +  "#size-cells":
>> +    const: 0
>> +
>> +patternProperties:
>> +  "^i2c(@.*)?":
> Either you have or you have not unit addresses. Please fix the pattern.
> Why is this so flexible? Do you want to deprecate i2c-bus in favor of
> i2c? If so, then example should use new naming. I am fine with children
> as i2c-bus, assuming this is allowed by dtschema. Did you actually test it?


This is the exact pattern of the i2c-controller schema node name, which 
I thought would be good. I can make it more specific. But yes I tested 
it, i2c-bus works fine


Thanks, Eddie


>
> Best regards,
> Krzysztof
>

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

* Re: [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema
  2024-05-20 14:56   ` Eddie James
@ 2024-05-21  7:36     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-21  7:36 UTC (permalink / raw)
  To: Eddie James, linux-i2c
  Cc: devicetree, linux-kernel, conor+dt, krzk+dt, robh, andi.shyti

On 20/05/2024 16:56, Eddie James wrote:
> 
> On 5/19/24 13:03, Krzysztof Kozlowski wrote:
>> On 14/05/2024 22:54, Eddie James wrote:
>>
>>> +properties:
>>> +  compatible:
>>> +    enum:
>>> +      - ibm,i2c-fsi
>>> +
>>> +  reg:
>>> +    items:
>>> +      - description: FSI slave address
>>> +
>>> +  "#address-cells":
>>> +    const: 1
>>> +
>>> +  "#size-cells":
>>> +    const: 0
>>> +
>>> +patternProperties:
>>> +  "^i2c(@.*)?":
>> Either you have or you have not unit addresses. Please fix the pattern.
>> Why is this so flexible? Do you want to deprecate i2c-bus in favor of
>> i2c? If so, then example should use new naming. I am fine with children
>> as i2c-bus, assuming this is allowed by dtschema. Did you actually test it?
> 
> 
> This is the exact pattern of the i2c-controller schema node name, which 
> I thought would be good. I can make it more specific. But yes I tested 
> it, i2c-bus works fine

i2c-controller schema is a generic schema, applicable to various cases,
including non-MMIO. You have here specific instances.

Best regards,
Krzysztof


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

end of thread, other threads:[~2024-05-21  7:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-14 20:54 [PATCH v5] dt-bindings: i2c: i2c-fsi: Convert to json-schema Eddie James
2024-05-19 18:03 ` Krzysztof Kozlowski
2024-05-20 14:56   ` Eddie James
2024-05-21  7:36     ` 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).