Skip to contentSkip to conversation

dt-bindings: net: New binding mctp-i2c-controller

RFC PATCH Superseded Matt Johnston 2 participants 2 messages Sep 9, 2021 – Sep 21, 2021

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v3 1/1 dt-bindings: net: New binding mctp-i2c-controller

Used to define a local endpoint to communicate with MCTP peripherals attached to an I2C bus. This I2C endpoint can communicate with remote MCTP devices on the I2C bus.

In the example I2C topology below (matching the second yaml example) we have MCTP devices on busses i2c1 and i2c6. MCTP-supporting busses are indicated by the 'mctp-controller' DT property on an I2C bus node.

A mctp-i2c-controller I2C client DT node is placed at the top of the mux topology, since only the root I2C adapter will support I2C slave functionality.

                                               .-------.
                                               |eeprom |
    .------------.     .------.               /'-------'
    | adapter    |     | mux  --@0,i2c5------'
    | i2c1       ----.*|      --@1,i2c6--.--.
    |............|    \'------'           \  \  .........
    | mctp-i2c-  |     \                   \  \ .mctpB  .
    | controller |      \                   \  '.0x30   .
    |            |       \  .........        \  '.......'
    | 0x50       |        \ .mctpA  .         \ .........
    '------------'         '.0x1d   .          '.mctpC  .
                            '.......'          '.0x31   .
                                                '.......'

(mctpX boxes above are remote MCTP devices not included in the DT at present, they can be hotplugged/probed at runtime. A DT binding for specific fixed MCTP devices could be added later if required)

---

Compared to v2 this patch changes the MCTP indicator to being a property on the I2C bus node.
(Previous patches went only to DT list, I've now CCed linux-i2c)

Wolfram does this look OK to you?

Thanks,
Matt

---
 Documentation/devicetree/bindings/i2c/i2c.txt |  4 +
 .../devicetree/bindings/net/mctp-i2c.yaml     | 94 +++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mctp-i2c.yaml
Documentation/devicetree/bindings/i2c/i2c.txt +4 -0
index b864916e087f..fc3dd7ec0445 100644
@@ -95,6 +95,10 @@ wants to support one of the below features, it should adapt these bindings.
 - smbus-alert
 	states that the optional SMBus-Alert feature apply to this bus.
 
+- mctp-controller
+	indicates that the system is accessible via this bus as an endpoint for
+	MCTP over I2C transport.
+
 Required properties (per child device)
 --------------------------------------
 
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 69 lines · Matt Johnston

Used to define a local endpoint to communicate with MCTP peripherals attached to an I2C bus. This I2C endpoint can communicate with remote MCTP devices on the I2C bus.

In the example I2C topology below (matching the second yaml example) we have MCTP devices on busses i2c1 and i2c6. MCTP-supporting busses are indicated by the 'mctp-controller' DT property on an I2C bus node.

A mctp-i2c-controller I2C client DT node is placed at the top of the mux topology, since only the root I2C adapter will support I2C slave functionality.

                                               .-------.
                                               |eeprom |
    .------------.     .------.               /'-------'
    | adapter    |     | mux  --@0,i2c5------'
    | i2c1       ----.*|      --@1,i2c6--.--.
    |............|    \'------'           \  \  .........
    | mctp-i2c-  |     \                   \  \ .mctpB  .
    | controller |      \                   \  '.0x30   .
    |            |       \  .........        \  '.......'
    | 0x50       |        \ .mctpA  .         \ .........
    '------------'         '.0x1d   .          '.mctpC  .
                            '.......'          '.0x31   .
                                                '.......'

(mctpX boxes above are remote MCTP devices not included in the DT at present, they can be hotplugged/probed at runtime. A DT binding for specific fixed MCTP devices could be added later if required)

---

Compared to v2 this patch changes the MCTP indicator to being a property on the I2C bus node.
(Previous patches went only to DT list, I've now CCed linux-i2c)

Wolfram does this look OK to you?

Thanks,
Matt

---
 Documentation/devicetree/bindings/i2c/i2c.txt |  4 +
 .../devicetree/bindings/net/mctp-i2c.yaml     | 94 +++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mctp-i2c.yaml
Documentation/devicetree/bindings/i2c/i2c.txt +4 -0
index b864916e087f..fc3dd7ec0445 100644
@@ -95,6 +95,10 @@ wants to support one of the below features, it should adapt these bindings.
 - smbus-alert
 	states that the optional SMBus-Alert feature apply to this bus.
 
+- mctp-controller
+	indicates that the system is accessible via this bus as an endpoint for
+	MCTP over I2C transport.
+
 Required properties (per child device)
 --------------------------------------
 
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +2 -0
new file mode 100644
index 000000000000..d0ff7fa9e114
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/net/mctp-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MCTP I2C transport binding
+
+maintainers:
+  - Matt Johnston <[email protected]>
+
+description:

Needs '|' to maintain paragraphs.

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 20

Quoted 8 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +8 -0
+  An mctp-i2c-controller defines a local MCTP endpoint on an I2C
+  controller. MCTP I2C is specified by DMTF DSP0237.
+
+  An mctp-i2c-controller must be attached to an I2C adapter
+  which supports slave functionality. I2C busses (either directly or as
+  subordinate mux busses) are attached to the mctp-i2c-controller with
+  a 'mctp-controller' property on each used bus. Each mctp-controller I2C bus
+  will be presented to the host system as a separate MCTP I2C instance.

Odd line breaks here.

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 28

Quoted 8 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +8 -0
+
+properties:
+  compatible:
+    const: mctp-i2c-controller
+
+  reg:
+    # 1<<30
+    minimum: 1073741824

You can use hex: 0x40000000

Quoted 8 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +8 -0
+    # 1<<30 | 0x7f
+    maximum: 1073741951
+    description:
+      7 bit I2C address of the local endpoint.
+      I2C_OWN_SLAVE_ADDRESS (1<<30) flag must be set.
+
+additionalProperties: false
+

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +10 -0
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    // Basic case of a single I2C bus
+    #include <dt-bindings/i2c/i2c.h>
+
+    i2c0: i2cbus0 {

i2c {

Quoted 7 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +7 -0
+      #address-cells = <1>;
+      #size-cells = <0>;
+      mctp-controller;
+
+      mctp@30 {
+        compatible = "mctp-i2c-controller";
+        reg = <(0x30 | I2C_OWN_SLAVE_ADDRESS)>;

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 63

Quoted 10 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +10 -0
+      };
+    };
+
+  - |
+    // Mux topology with multiple MCTP-handling busses under
+    // a single mctp-i2c-controller.
+    // i2c1 and i2c6 can have MCTP devices, i2c5 does not.
+    #include <dt-bindings/i2c/i2c.h>
+
+    i2c1: i2cbus1 {

i2c {

Documentation/devicetree/bindings/net/mctp-i2c.yaml line 74

Quoted 11 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +11 -0
+      #address-cells = <1>;
+      #size-cells = <0>;
+      mctp-controller;
+
+      mctp@50 {
+        compatible = "mctp-i2c-controller";
+        reg = <(0x50 | I2C_OWN_SLAVE_ADDRESS)>;
+      };
+    };
+
+    i2cmux0 {

i2c-mux {

Quoted 24 lines
Documentation/devicetree/bindings/net/mctp-i2c.yaml new file +20 -0
+      #address-cells = <1>;
+      #size-cells = <0>;
+      i2c-parent = <&i2c1>;
+
+      i2c5: i2c@0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        reg = <0>;
+        eeprom@33 {
+          reg = <0x33>;
+        };
+      };
+
+      i2c6: i2c@1 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        reg = <1>;
+        mctp-controller;
+      };
+    };
Signature · 1 line
2.30.2