Skip to contentSkip to conversation

Add Synopsys MIPI I3C Driver support

PATCH In review [email protected] 6 participants 21 messages Feb 18, 2025 – Feb 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add Synopsys MIPI I3C Driver support

From: Dinesh Maniyam <[email protected]>

This patchset add Synopsys MIPI I3C Driver support for Intel Agilex5 devices.

The i3c driver is leveraged from the master/dw-i3c-master.c, i3c/device.c and i3c/master.c Linux version 6.6.37 LTS And few header files included to be
part of the migration; i3c/internals.h, include/linux/i3c/ccc.h, include/linux/i3c/device.h and include/linux/i3c/master.h. Additional i3c uclass driver and command files added to support i3c read and write in U-Boot.

Dinesh Maniyam (10):
dt-bindings: i3c: Add YAML schema for Cadence I3C controller
drivers: i3c: Add new i3c uclass id
drivers: i3c: Add driver for MIPI DWI3C
drivers: Enabled Kconfig and Makefile for I3C support
drivers: i3c: Enabled Kconfig and Makefile for DWI3C
drivers: i3c: Add i3c uclass driver.
drivers: i3c: master: Enable probe i3c without slave device
i3c: master: dw-i3c-master: Fix OD_TIMING for spike filter
cmd: Add i3c command support.
cmd: Enabled Kconfig and Makefile for DWI3C cmd support

 cmd/Kconfig                                   |    6 +
 cmd/Makefile                                  |    1 +
 cmd/i3c.c                                     |  193 ++
 .../i3c/cdns,i3c-master.yaml                  |   51 +
 doc/device-tree-bindings/i3c/i3c.yaml         |  186 ++
 drivers/i3c/Kconfig                           |   21 +
 drivers/i3c/Makefile                          |    4 +
 drivers/i3c/device.c                          |  263 +++
 drivers/i3c/i3c-uclass.c                      |   38 +
 drivers/i3c/internals.h                       |   26 +
 drivers/i3c/master.c                          | 2073 +++++++++++++++++
 drivers/i3c/master/Kconfig                    |   11 +
 drivers/i3c/master/Makefile                   |    3 +
 drivers/i3c/master/dw-i3c-master.c            | 1058 +++++++++
 include/dm/device.h                           |    2 +
 include/dm/uclass-id.h                        |    1 +
 include/dw-i3c.h                              |  252 ++
 include/i3c.h                                 |   67 +
 include/linux/i3c/ccc.h                       |  385 +++
 include/linux/i3c/device.h                    |  286 +++
 include/linux/i3c/master.h                    |  700 ++++++
 21 files changed, 5627 insertions(+)
 create mode 100644 cmd/i3c.c
 create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml
 create mode 100644 drivers/i3c/Kconfig
 create mode 100644 drivers/i3c/Makefile
 create mode 100644 drivers/i3c/device.c
 create mode 100644 drivers/i3c/i3c-uclass.c
 create mode 100644 drivers/i3c/internals.h
 create mode 100644 drivers/i3c/master.c
 create mode 100644 drivers/i3c/master/Kconfig
 create mode 100644 drivers/i3c/master/Makefile
 create mode 100644 drivers/i3c/master/dw-i3c-master.c
 create mode 100644 include/dw-i3c.h
 create mode 100644 include/i3c.h
 create mode 100644 include/linux/i3c/ccc.h
 create mode 100644 include/linux/i3c/device.h
 create mode 100644 include/linux/i3c/master.h
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/10 dt-bindings: i3c: Add YAML schema for Cadence I3C controller

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller, defining required and optional properties for proper integration and validation with dt-schema.

---
 .../i3c/cdns,i3c-master.yaml                  |  51 +++++
 doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +51 -0
new file mode 100644
index 0000000000..0eda16482e
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/cdns,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence I3C master block
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: snps,dw-i3c-master-1.00a
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i3c-master@2000 {
+        compatible = "snps,dw-i3c-master-1.00a";
+        reg = <0x02000 0x1000>;
+        interrupts = <0>;
+        clocks = <&i3cclk>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        eeprom@57{
+            compatible = "atmel,24c01";
+            reg = <0x57 0x0 0x10>;
+            pagesize = <0x8>;
+        };
+    };
doc/device-tree-bindings/i3c/i3c.yaml new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 27 lines · On 2/18/25 03:56, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller, defining required and optional properties for proper integration and validation with dt-schema.

---
  .../i3c/cdns,i3c-master.yaml                  |  51 +++++
  doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
  2 files changed, 237 insertions(+)

create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +7 -0
new file mode 100644
index 0000000000..0eda16482e
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/cdns,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence I3C master block

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 17

Quoted 10 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +10 -0
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: snps,dw-i3c-master-1.00a

Filename is not fitting with compatible string used here.
Anyway binding is already in the linux kernel that's why you don't need to put it here. Documentation/devicetree/bindings/i3c/snps,dw-i3c-master.yaml

M

#3 lore raw

RE: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 71 lines

-----Original Message-----
From: Michal Simek <[email protected]>
Sent: Tuesday, 18 February 2025 3:26 pm
To: Maniyam, Dinesh <[email protected]>; [email protected]
Cc: Marek <[email protected]>; Simon Goldschmidt <[email protected]>; Simon Glass <[email protected]>; Tom Rini <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Wang Jie <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 28 lines · On 2/18/25 03:56, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller, defining required and optional properties for proper integration and validation with dt-schema.

---
  .../i3c/cdns,i3c-master.yaml                  |  51 +++++
  doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
  2 files changed, 237 insertions(+)

create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +7 -0
new file mode 100644
index 0000000000..0eda16482e
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/cdns,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence I3C master block

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 17

Quoted 10 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +10 -0
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: snps,dw-i3c-master-1.00a

Filename is not fitting with compatible string used here.
Anyway binding is already in the linux kernel that's why you don't need to put it here.
Documentation/devicetree/bindings/i3c/snps,dw-i3c-master.yaml

Quoted 1 line

M

Will drop this commit, since the files in this commit are redundant. Please expect v2 of this patch series which will exclude this patch.

Regards
Dinesh

reviewer
#4 lore raw

Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

In reply to [email protected]
Quoted 3 lines · On Tue, Feb 18, 2025 at 10:56:56AM +0800, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller,

Cadence or snps? compatible string said snps.

Quoted 9 lines

defining required and optional properties for proper integration and validation with dt-schema.

---
 .../i3c/cdns,i3c-master.yaml                  |  51 +++++
 doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml

file name should be one of compatible string.

Quoted 1 line
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

Where doc/device-tree-bindings/i3c?

in kernel, and already have i3c.yaml
Documentation/devicetree/bindings/i3c/

stop here, fix file path firsly.

Frank

Quoted 7 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +0 -0
new file mode 100644
index 0000000000..0eda16482e

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 7

Quoted 7 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +7 -0
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/cdns,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence I3C master block

Snps?

Quoted 31 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +31 -0
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: snps,dw-i3c-master-1.00a
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i3c-master@2000 {

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 48

Quoted 10 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +10 -0
+        compatible = "snps,dw-i3c-master-1.00a";
+        reg = <0x02000 0x1000>;
+        interrupts = <0>;
+        clocks = <&i3cclk>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        eeprom@57{
+            compatible = "atmel,24c01";
+            reg = <0x57 0x0 0x10>;

please use macro in include/dt-bindings/i3c/i3c.h

Quoted 11 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +3 -0
+            pagesize = <0x8>;
+        };
+    };
doc/device-tree-bindings/i3c/i3c.yaml new file +2 -0
new file mode 100644
index 0000000000..8f9c440db2
@@ -0,0 +1,186 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2

doc/device-tree-bindings/i3c/i3c.yaml line 12

Quoted 10 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/i3c/i3c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I3C bus
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+description: |

Needn't |

Quoted 177 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +174 -1
+  I3C busses can be described with a node for the primary I3C controller device
+  and a set of child nodes for each I2C or I3C slave on the bus. Each of them
+  may, during the life of the bus, request mastership.
+
+properties:
+  $nodename:
+    pattern: "^i3c-master@[0-9a-f]+$"
+
+  "#address-cells":
+    const: 3
+    description: |
+      Each I2C device connected to the bus should be described in a subnode.
+
+      All I3C devices are supposed to support DAA (Dynamic Address Assignment),
+      and are thus discoverable. So, by default, I3C devices do not have to be
+      described in the device tree. This being said, one might want to attach
+      extra resources to these devices, and those resources may have to be
+      described in the device tree, which in turn means we have to describe
+      I3C devices.
+
+      Another use case for describing an I3C device in the device tree is when
+      this I3C device has a static I2C address and we want to assign it a
+      specific I3C dynamic address before the DAA takes place (so that other
+      devices on the bus can't take this dynamic address).
+
+  "#size-cells":
+    const: 0
+
+  i3c-scl-hz:
+    description: |
+      Frequency of the SCL signal used for I3C transfers. When undefined, the
+      default value should be 12.5MHz.
+
+      May not be supported by all controllers.
+
+  i2c-scl-hz:
+    description: |
+      Frequency of the SCL signal used for I2C transfers. When undefined, the
+      default should be to look at LVR (Legacy Virtual Register) values of
+      I2C devices described in the device tree to determine the maximum I2C
+      frequency.
+
+      May not be supported by all controllers.
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+
+patternProperties:
+  "@[0-9a-f]+$":
+    type: object
+    description: |
+      I2C child, should be named: <device-type>@<i2c-address>
+
+      All properties described in Documentation/devicetree/bindings/i2c/i2c.txt
+      are valid here, except the reg property whose content is changed.
+
+    properties:
+      compatible:
+        description:
+          Compatible of the I2C device.
+
+      reg:
+        items:
+          - items:
+              - description: |
+                  I2C address. 10 bit addressing is not supported. Devices with
+                  10-bit address can't be properly passed through DEFSLVS
+                  command.
+                minimum: 0
+                maximum: 0x7f
+              - const: 0
+              - description: |
+                  Shall encode the I3C LVR (Legacy Virtual Register):
+                    bit[31:8]: unused/ignored
+                    bit[7:5]: I2C device index. Possible values:
+                      * 0: I2C device has a 50 ns spike filter
+                      * 1: I2C device does not have a 50 ns spike filter but
+                           supports high frequency on SCL
+                      * 2: I2C device does not have a 50 ns spike filter and is
+                           not tolerant to high frequencies
+                      * 3-7: reserved
+                    bit[4]: tell whether the device operates in FM (Fast Mode)
+                            or FM+ mode:
+                      * 0: FM+ mode
+                      * 1: FM mode
+                    bit[3:0]: device type
+                      * 0-15: reserved
+
+    required:
+      - compatible
+      - reg
+
+  "@[0-9a-f]+,[0-9a-f]+$":
+    type: object
+    description: |
+      I3C child, should be named: <device-type>@<static-i2c-address>,<i3c-pid>
+
+    properties:
+      reg:
+        items:
+          - items:
+              - description: |
+                  Encodes the static I2C address. Should be 0 if the device does
+                  not have one (0 is not a valid I2C address).
+                minimum: 0
+                maximum: 0x7f
+              - description: |
+                  First half of the Provisional ID (following the PID
+                  definition provided by the I3C specification).
+
+                  Contains the manufacturer ID left-shifted by 1.
+              - description: |
+                  Second half of the Provisional ID (following the PID
+                  definition provided by the I3C specification).
+
+                  Contains the ORing of the part ID left-shifted by 16,
+                  the instance ID left-shifted by 12 and extra information.
+
+      assigned-address:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 0x1
+        maximum: 0xff
+        description: |
+          Dynamic address to be assigned to this device. In case static address is
+          present (first cell of the reg property != 0), this address is assigned
+          through SETDASA. If static address is not present, this address is assigned
+          through SETNEWDA after assigning a temporary address via ENTDAA.
+
+    required:
+      - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    i3c-master@d040000 {
+        compatible = "cdns,i3c-master";
+        clocks = <&coreclock>, <&i3csysclock>;
+        clock-names = "pclk", "sysclk";
+        interrupts = <3 0>;
+        reg = <0x0d040000 0x1000>;
+        #address-cells = <3>;
+        #size-cells = <0>;
+        i2c-scl-hz = <100000>;
+
+        /* I2C device. */
+        eeprom@57 {
+            compatible = "atmel,24c01";
+            reg = <0x57 0x0 0x10>;
+            pagesize = <0x8>;
+        };
+
+        /* I3C device with a static I2C address and assigned address. */
+        thermal_sensor: sensor@68,39200144004 {
+            reg = <0x68 0x392 0x144004>;
+            assigned-address = <0xa>;
+        };
+
+        /* I3C device with only assigned address. */
+        pressure_sensor: sensor@0,39200124004 {
+            reg = <0x0 0x392 0x124000>;
+            assigned-address = <0xc>;
+        };
+
+        /*
+         * I3C device without a static I2C address but requiring
+         * resources described in the DT.
+         */
+        sensor@0,39200154004 {
+            reg = <0x0 0x392 0x154004>;
+            clocks = <&clock_provider 0>;
+        };
+    };
--

2.26.2

#5 lore raw

Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 19 lines · Frank Li
Quoted 3 lines · On Tue, Feb 18, 2025 at 10:56:56AM +0800, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller,

Cadence or snps? compatible string said snps.

Quoted 9 lines

defining required and optional properties for proper integration and validation with dt-schema.

---
 .../i3c/cdns,i3c-master.yaml                  |  51 +++++
 doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml

file name should be one of compatible string.

Quoted 8 lines
Quoted 1 line
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

Where doc/device-tree-bindings/i3c?

in kernel, and already have i3c.yaml
Documentation/devicetree/bindings/i3c/

stop here, fix file path firsly.

We don't need this in U-Boot at all because we already have it:
dts/upstream/Bindings/i3c/cdns,i3c-master.yaml

Signature · 1 line
Tom
#6 lore raw

RE: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 53 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, 19 February 2025 12:29 am
To: Frank Li <[email protected]>
Cc: Maniyam, Dinesh <[email protected]>; [email protected]; Marek <[email protected]>; Simon Goldschmidt <[email protected]>; Simon Glass <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <ibai.erkiaga- [email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Wang Jie <dave.wang@rock- chips.com>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 28 lines · Frank Li
Quoted 4 lines · On Tue, Feb 18, 2025 at 10:56:56AM +0800, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller,

Cadence or snps? compatible string said snps.

Quoted 10 lines

defining required and optional properties for proper integration and validation with dt-schema.

---
 .../i3c/cdns,i3c-master.yaml                  |  51 +++++
 doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml

file name should be one of compatible string.

Quoted 1 line
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

Where doc/device-tree-bindings/i3c?

in kernel, and already have i3c.yaml
Documentation/devicetree/bindings/i3c/

Quoted 7 lines
Quoted 1 line

stop here, fix file path firsly.

We don't need this in U-Boot at all because we already have it:
dts/upstream/Bindings/i3c/cdns,i3c-master.yaml

--
Tom

Will drop this commit, since the files in this commit are redundant.

Dinesh

#7 lore raw

RE: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

In reply to Frank Li
Quoted 311 lines

-----Original Message-----
From: Frank Li <[email protected]>
Sent: Wednesday, 19 February 2025 12:24 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon Goldschmidt <[email protected]>; Simon Glass <[email protected]>; Tom Rini <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Wang Jie <dave.wang@rock- chips.com>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [PATCH 01/10] dt-bindings: i3c: Add YAML schema for Cadence I3C controller

Quoted 3 lines · On Tue, Feb 18, 2025 at 10:56:56AM +0800, [email protected] wrote:

From: Dinesh Maniyam <[email protected]>

Add a YAML device tree binding schema for the Cadence I3C controller,

Cadence or snps? compatible string said snps.

Quoted 9 lines

defining required and optional properties for proper integration and validation with dt-schema.

---
 .../i3c/cdns,i3c-master.yaml                  |  51 +++++
 doc/device-tree-bindings/i3c/i3c.yaml         | 186 ++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644 doc/device-tree-bindings/i3c/cdns,i3c-master.yaml

file name should be one of compatible string.

Quoted 1 line
 create mode 100644 doc/device-tree-bindings/i3c/i3c.yaml

Where doc/device-tree-bindings/i3c?

in kernel, and already have i3c.yaml
Documentation/devicetree/bindings/i3c/

stop here, fix file path firsly.

Frank

Quoted 8 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +0 -0
new file mode 100644
index 0000000000..0eda16482e

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 7

Quoted 7 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +7 -0
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/cdns,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence I3C master block

Snps?

Quoted 31 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +31 -0
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: snps,dw-i3c-master-1.00a
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i3c-master@2000 {

doc/device-tree-bindings/i3c/cdns,i3c-master.yaml line 48

Quoted 10 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +10 -0
+        compatible = "snps,dw-i3c-master-1.00a";
+        reg = <0x02000 0x1000>;
+        interrupts = <0>;
+        clocks = <&i3cclk>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        eeprom@57{
+            compatible = "atmel,24c01";
+            reg = <0x57 0x0 0x10>;

please use macro in include/dt-bindings/i3c/i3c.h

Quoted 11 lines
doc/device-tree-bindings/i3c/cdns,i3c-master.yaml new file +3 -0
+            pagesize = <0x8>;
+        };
+    };
doc/device-tree-bindings/i3c/i3c.yaml new file +1 -0
new file mode 100644
index 0000000000..8f9c440db2
@@ -0,0 +1,186 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2

doc/device-tree-bindings/i3c/i3c.yaml line 11

Quoted 10 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/i3c/i3c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I3C bus
+
+maintainers:
+  - Dinesh Maniyam <[email protected]>
+
+description: |

Needn't |

doc/device-tree-bindings/i3c/i3c.yaml line 14

Quoted 3 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +3 -0
+  I3C busses can be described with a node for the primary I3C
+ controller device  and a set of child nodes for each I2C or I3C
+ slave on the bus. Each of them  may, during the life of the bus, request

mastership.

doc/device-tree-bindings/i3c/i3c.yaml

Quoted 11 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +11 -0
+
+properties:
+  $nodename:
+    pattern: "^i3c-master@[0-9a-f]+$"
+
+  "#address-cells":
+    const: 3
+    description: |
+      Each I2C device connected to the bus should be described in a subnode.
+
+      All I3C devices are supposed to support DAA (Dynamic Address

Assignment),

Quoted 156 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +156 -0
+      and are thus discoverable. So, by default, I3C devices do not have to be
+      described in the device tree. This being said, one might want to attach
+      extra resources to these devices, and those resources may have to be
+      described in the device tree, which in turn means we have to describe
+      I3C devices.
+
+      Another use case for describing an I3C device in the device tree is when
+      this I3C device has a static I2C address and we want to assign it a
+      specific I3C dynamic address before the DAA takes place (so that other
+      devices on the bus can't take this dynamic address).
+
+  "#size-cells":
+    const: 0
+
+  i3c-scl-hz:
+    description: |
+      Frequency of the SCL signal used for I3C transfers. When undefined, the
+      default value should be 12.5MHz.
+
+      May not be supported by all controllers.
+
+  i2c-scl-hz:
+    description: |
+      Frequency of the SCL signal used for I2C transfers. When undefined, the
+      default should be to look at LVR (Legacy Virtual Register) values of
+      I2C devices described in the device tree to determine the maximum I2C
+      frequency.
+
+      May not be supported by all controllers.
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+
+patternProperties:
+  "@[0-9a-f]+$":
+    type: object
+    description: |
+      I2C child, should be named: <device-type>@<i2c-address>
+
+      All properties described in Documentation/devicetree/bindings/i2c/i2c.txt
+      are valid here, except the reg property whose content is changed.
+
+    properties:
+      compatible:
+        description:
+          Compatible of the I2C device.
+
+      reg:
+        items:
+          - items:
+              - description: |
+                  I2C address. 10 bit addressing is not supported. Devices with
+                  10-bit address can't be properly passed through DEFSLVS
+                  command.
+                minimum: 0
+                maximum: 0x7f
+              - const: 0
+              - description: |
+                  Shall encode the I3C LVR (Legacy Virtual Register):
+                    bit[31:8]: unused/ignored
+                    bit[7:5]: I2C device index. Possible values:
+                      * 0: I2C device has a 50 ns spike filter
+                      * 1: I2C device does not have a 50 ns spike filter but
+                           supports high frequency on SCL
+                      * 2: I2C device does not have a 50 ns spike filter and is
+                           not tolerant to high frequencies
+                      * 3-7: reserved
+                    bit[4]: tell whether the device operates in FM (Fast Mode)
+                            or FM+ mode:
+                      * 0: FM+ mode
+                      * 1: FM mode
+                    bit[3:0]: device type
+                      * 0-15: reserved
+
+    required:
+      - compatible
+      - reg
+
+  "@[0-9a-f]+,[0-9a-f]+$":
+    type: object
+    description: |
+      I3C child, should be named:
+ <device-type>@<static-i2c-address>,<i3c-pid>
+
+    properties:
+      reg:
+        items:
+          - items:
+              - description: |
+                  Encodes the static I2C address. Should be 0 if the device does
+                  not have one (0 is not a valid I2C address).
+                minimum: 0
+                maximum: 0x7f
+              - description: |
+                  First half of the Provisional ID (following the PID
+                  definition provided by the I3C specification).
+
+                  Contains the manufacturer ID left-shifted by 1.
+              - description: |
+                  Second half of the Provisional ID (following the PID
+                  definition provided by the I3C specification).
+
+                  Contains the ORing of the part ID left-shifted by 16,
+                  the instance ID left-shifted by 12 and extra information.
+
+      assigned-address:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 0x1
+        maximum: 0xff
+        description: |
+          Dynamic address to be assigned to this device. In case static address is
+          present (first cell of the reg property != 0), this address is assigned
+          through SETDASA. If static address is not present, this address is assigned
+          through SETNEWDA after assigning a temporary address via ENTDAA.
+
+    required:
+      - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    i3c-master@d040000 {
+        compatible = "cdns,i3c-master";
+        clocks = <&coreclock>, <&i3csysclock>;
+        clock-names = "pclk", "sysclk";
+        interrupts = <3 0>;
+        reg = <0x0d040000 0x1000>;
+        #address-cells = <3>;
+        #size-cells = <0>;
+        i2c-scl-hz = <100000>;
+
+        /* I2C device. */
+        eeprom@57 {
+            compatible = "atmel,24c01";
+            reg = <0x57 0x0 0x10>;
+            pagesize = <0x8>;
+        };
+
+        /* I3C device with a static I2C address and assigned address. */
+        thermal_sensor: sensor@68,39200144004 {
+            reg = <0x68 0x392 0x144004>;
+            assigned-address = <0xa>;
+        };
+
+        /* I3C device with only assigned address. */
+        pressure_sensor: sensor@0,39200124004 {
+            reg = <0x0 0x392 0x124000>;
+            assigned-address = <0xc>;
+        };
+
+        /*
+         * I3C device without a static I2C address but requiring
+         * resources described in the DT.
+         */
Quoted 8 lines
Quoted 8 lines
doc/device-tree-bindings/i3c/i3c.yaml new file +5 -1
+        sensor@0,39200154004 {
+            reg = <0x0 0x392 0x154004>;
+            clocks = <&clock_provider 0>;
+        };
+    };
--

2.26.2

Will drop this commit, since the files in this commit are redundant.
Will make sure compatible string follow as per this yaml located in Documentation/devicetree/bindings/i3c/snps,dw-i3c-master.yaml

Regards
Dinesh

#8 lore raw

PATCH 2/10 drivers: i3c: Add new i3c uclass id

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Add i3c general uclass id.

---
 include/dm/uclass-id.h | 1 +
 1 file changed, 1 insertion(+)
include/dm/uclass-id.h +1 -0
index 270088ad94..1d259b439f 100644
@@ -78,6 +78,7 @@ enum uclass_id {
 	UCLASS_I2C_GENERIC,	/* Generic I2C device */
 	UCLASS_I2C_MUX,		/* I2C multiplexer */
 	UCLASS_I2S,		/* I2S bus */
+	UCLASS_I3C,		/* I3C bus */
 	UCLASS_IDE,		/* IDE device */
 	UCLASS_IOMMU,		/* IOMMU */
 	UCLASS_IRQ,		/* Interrupt controller */
Signature · 1 line
2.26.2
#9 lore raw

Re: [PATCH 02/10] drivers: i3c: Add new i3c uclass id

Hi Dinesh,

Quoted 23 lines · On Mon, 17 Feb 2025 at 19:57, <[email protected]> wrote:

From: Dinesh Maniyam <[email protected]>

Add i3c general uclass id.

---
 include/dm/uclass-id.h | 1 +
 1 file changed, 1 insertion(+)
include/dm/uclass-id.h +1 -1
index 270088ad94..1d259b439f 100644
@@ -78,6 +78,7 @@ enum uclass_id {
        UCLASS_I2C_GENERIC,     /* Generic I2C device */
        UCLASS_I2C_MUX,         /* I2C multiplexer */
        UCLASS_I2S,             /* I2S bus */
+       UCLASS_I3C,             /* I3C bus */
        UCLASS_IDE,             /* IDE device */
        UCLASS_IOMMU,           /* IOMMU */
        UCLASS_IRQ,             /* Interrupt controller */
--
Quoted 2 lines

2.26.2

When you add a new uclass, please add a sandbox driver and some tests. There is the existing i2c to follow, but your tests may be simpler.

Regards,
Simon

#10 lore raw

RE: [PATCH 02/10] drivers: i3c: Add new i3c uclass id

Quoted 54 lines

-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Tuesday, 18 February 2025 9:29 pm
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <ibai.erkiaga- [email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Wang Jie <dave.wang@rock- chips.com>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [PATCH 02/10] drivers: i3c: Add new i3c uclass id

Hi Dinesh,

Quoted 23 lines · On Mon, 17 Feb 2025 at 19:57, <[email protected]> wrote:

From: Dinesh Maniyam <[email protected]>

Add i3c general uclass id.

---
 include/dm/uclass-id.h | 1 +
 1 file changed, 1 insertion(+)
include/dm/uclass-id.h index renamed from include/dm/uclass-id.h +0 -0

270088ad94..1d259b439f 100644

include/dm/uclass-id.h +1 -1
@@ -78,6 +78,7 @@ enum uclass_id {
        UCLASS_I2C_GENERIC,     /* Generic I2C device */
        UCLASS_I2C_MUX,         /* I2C multiplexer */
        UCLASS_I2S,             /* I2S bus */
+       UCLASS_I3C,             /* I3C bus */
        UCLASS_IDE,             /* IDE device */
        UCLASS_IOMMU,           /* IOMMU */
        UCLASS_IRQ,             /* Interrupt controller */
--
Quoted 2 lines

2.26.2

When you add a new uclass, please add a sandbox driver and some tests. There is the existing i2c to follow, but your tests may be simpler.

Quoted 2 lines

Regards,
Simon

Thanks for the reference, will add the sandbox driver and simple tests in v2.

Regards
Dinesh

#11 lore raw

PATCH 3/10 drivers: i3c: Add driver for MIPI DWI3C

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Enable driver for Synopsis MIPI DWI3C for the family device agilex5. This driver is migrated from linux version 6.6.37 LTS

---
 drivers/i3c/device.c               |  263 ++++
 drivers/i3c/internals.h            |   26 +
 drivers/i3c/master.c               | 2067 ++++++++++++++++++++++++++++
 drivers/i3c/master/dw-i3c-master.c | 1002 ++++++++++++++
 include/dm/device.h                |    2 +
 include/dw-i3c.h                   |  248 ++++
 include/linux/i3c/ccc.h            |  385 ++++++
 include/linux/i3c/device.h         |  286 ++++
 include/linux/i3c/master.h         |  699 ++++++++++
 9 files changed, 4978 insertions(+)
 create mode 100644 drivers/i3c/device.c
 create mode 100644 drivers/i3c/internals.h
 create mode 100644 drivers/i3c/master.c
 create mode 100644 drivers/i3c/master/dw-i3c-master.c
 create mode 100644 include/dw-i3c.h
 create mode 100644 include/linux/i3c/ccc.h
 create mode 100644 include/linux/i3c/device.h
 create mode 100644 include/linux/i3c/master.h
drivers/i3c/device.c new file +263 -0
new file mode 100644
index 0000000000..579c5efe7c
@@ -0,0 +1,263 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Cadence Design Systems Inc.
+ *
+ * Author: Boris Brezillon <[email protected]>
+ */
+
+#include <asm/atomic.h>
+#include <linux/bug.h>
+#include <linux/completion.h>
+#include <dm/device.h>
+
+#include "internals.h"
+
+/* i3c */
+
+#define I3C_MATCH_DCR			0x1
+#define I3C_MATCH_MANUF			0x2
+#define I3C_MATCH_PART			0x4
+#define I3C_MATCH_EXTRA_INFO		0x8
+
+struct i3c_device_id {
+	__u8 match_flags;
+	__u8 dcr;
+	__u16 manuf_id;
+	__u16 part_id;
+	__u16 extra_info;
+
+	const void *data;
+};
+
+/**
+ * i3c_device_do_priv_xfers() - do I3C SDR private transfers directed to a
+ *				specific device
+ *
+ * @dev: device with which the transfers should be done
+ * @xfers: array of transfers
+ * @nxfers: number of transfers
+ *
+ * Initiate one or several private SDR transfers with @dev.
+ *
+ * This function can sleep and thus cannot be called in atomic context.
+ *
+ * Return: 0 in case of success, a negative error core otherwise.
+ */
+int i3c_device_do_priv_xfers(struct i3c_device *dev,
+			     struct i3c_priv_xfer *xfers,
+			     int nxfers)
+{
+	int ret, i;
+
+	if (nxfers < 1)
+		return 0;
+
+	for (i = 0; i < nxfers; i++) {
+		if (!xfers[i].len || !xfers[i].data.in)
+			return -EINVAL;
+	}
+
+	i3c_bus_normaluse_lock(dev->bus);
+	ret = i3c_dev_do_priv_xfers_locked(dev->desc, xfers, nxfers);
+	i3c_bus_normaluse_unlock(dev->bus);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(i3c_device_do_priv_xfers);
+
+/**
+ * i3c_device_get_info() - get I3C device information
+ *
+ * @dev: device we want information on
+ * @info: the information object to fill in
+ *
+ * Retrieve I3C dev info.
+ */
+void i3c_device_get_info(struct i3c_device *dev,
+			 struct i3c_device_info *info)
+{
+	if (!info)
+		return;
+
+	i3c_bus_normaluse_lock(dev->bus);
+	if (dev->desc)
+		*info = dev->desc->info;
+	i3c_bus_normaluse_unlock(dev->bus);
+}
+EXPORT_SYMBOL_GPL(i3c_device_get_info);
+
+/**
+ * i3c_device_disable_ibi() - Disable IBIs coming from a specific device
+ * @dev: device on which IBIs should be disabled
+ *
+ * This function disable IBIs coming from a specific device and wait for
+ * all pending IBIs to be processed.
+ *
+ * Return: 0 in case of success, a negative error core otherwise.
+ */
+int i3c_device_disable_ibi(struct i3c_device *dev)
+{
+	int ret = -ENOENT;
+
+	i3c_bus_normaluse_lock(dev->bus);
+	if (dev->desc) {
+		mutex_lock(&dev->desc->ibi_lock);
+		ret = i3c_dev_disable_ibi_locked(dev->desc);
+		mutex_unlock(&dev->desc->ibi_lock);
+	}
+	i3c_bus_normaluse_unlock(dev->bus);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(i3c_device_disable_ibi);
+
+/**
+ * i3c_device_enable_ibi() - Enable IBIs coming from a specific device
+ * @dev: device on which IBIs should be enabled
+ *
+ * This function enable IBIs coming from a specific device and wait for
+ * all pending IBIs to be processed. This should be called on a device
+ * where i3c_device_request_ibi() has succeeded.
+ *
+ * Note that IBIs from this device might be received before this function
+ * returns to its caller.
+ *
+ * Return: 0 in case of success, a negative error core otherwise.
+ */
+int i3c_device_enable_ibi(struct i3c_device *dev)
+{
+	int ret = -ENOENT;
+
+	i3c_bus_normaluse_lock(dev->bus);
+	if (dev->desc) {
+		mutex_lock(&dev->desc->ibi_lock);
+		ret = i3c_dev_enable_ibi_locked(dev->desc);
+		mutex_unlock(&dev->desc->ibi_lock);
+	}
+	i3c_bus_normaluse_unlock(dev->bus);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(i3c_device_enable_ibi);
+
+/**
+ * i3c_device_request_ibi() - Request an IBI
+ * @dev: device for which we should enable IBIs
+ * @req: setup requested for this IBI
+ *
+ * This function is responsible for pre-allocating all resources needed to
+ * process IBIs coming from @dev. When this function returns, the IBI is not
+ * enabled until i3c_device_enable_ibi() is called.
+ *
+ * Return: 0 in case of success, a negative error core otherwise.
+ */
+int i3c_device_request_ibi(struct i3c_device *dev,
+			   const struct i3c_ibi_setup *req)
+{
+	int ret = -ENOENT;
+
+	if (!req->handler || !req->num_slots)
+		return -EINVAL;
+
+	i3c_bus_normaluse_lock(dev->bus);
+	if (dev->desc) {
+		mutex_lock(&dev->desc->ibi_lock);
+		ret = i3c_dev_request_ibi_locked(dev->desc, req);
+		mutex_unlock(&dev->desc->ibi_lock);
+	}
+	i3c_bus_normaluse_unlock(dev->bus);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(i3c_device_request_ibi);
+
+/**
+ * i3c_device_free_ibi() - Free all resources needed for IBI handling
+ * @dev: device on which you want to release IBI resources
+ *
+ * This function is responsible for de-allocating resources previously
+ * allocated by i3c_device_request_ibi(). It should be called after disabling
+ * IBIs with i3c_device_disable_ibi().
+ */
+void i3c_device_free_ibi(struct i3c_device *dev)
+{
+	i3c_bus_normaluse_lock(dev->bus);
+	if (dev->desc) {
+		mutex_lock(&dev->desc->ibi_lock);
+		i3c_dev_free_ibi_locked(dev->desc);
+		mutex_unlock(&dev->desc->ibi_lock);
+	}
+	i3c_bus_normaluse_unlock(dev->bus);
+}
+EXPORT_SYMBOL_GPL(i3c_device_free_ibi);
+
+/**
+ * i3cdev_to_dev() - Returns the device embedded in @i3cdev
+ * @i3cdev: I3C device
+ *
+ * Return: a pointer to a device object.
+ */
+struct udevice *i3cdev_to_dev(struct i3c_device *i3cdev)
+{
+	return &i3cdev->dev;
+}
+EXPORT_SYMBOL_GPL(i3cdev_to_dev);
+
+/**
+ * dev_to_i3cdev() - Returns the I3C device containing @dev
+ * @dev: device object
+ *
+ * Return: a pointer to an I3C device object.
+ */
+struct i3c_device *dev_to_i3cdev(struct udevice *dev)
+{
+	return container_of(dev, struct i3c_device, dev);
+}
+EXPORT_SYMBOL_GPL(dev_to_i3cdev);
+
+/**
+ * i3c_device_match_id() - Returns the i3c_device_id entry matching @i3cdev
+ * @i3cdev: I3C device
+ * @id_table: I3C device match table
+ *
+ * Return: a pointer to an i3c_device_id object or NULL if there's no match.
+ */
+const struct i3c_device_id *
+i3c_device_match_id(struct i3c_device *i3cdev,
+		    const struct i3c_device_id *id_table)
+{
+	struct i3c_device_info devinfo;
+	const struct i3c_device_id *id;
+	u16 manuf, part, ext_info;
+	bool rndpid;
+
+	i3c_device_get_info(i3cdev, &devinfo);
+
+	manuf = I3C_PID_MANUF_ID(devinfo.pid);
+	part = I3C_PID_PART_ID(devinfo.pid);
+	ext_info = I3C_PID_EXTRA_INFO(devinfo.pid);
+	rndpid = I3C_PID_RND_LOWER_32BITS(devinfo.pid);
+
+	for (id = id_table; id->match_flags != 0; id++) {
+		if ((id->match_flags & I3C_MATCH_DCR) &&
+		    id->dcr != devinfo.dcr)
+			continue;
+
+		if ((id->match_flags & I3C_MATCH_MANUF) &&
+		    id->manuf_id != manuf)
+			continue;
+
+		if ((id->match_flags & I3C_MATCH_PART) &&
+		    (rndpid || id->part_id != part))
+			continue;
+
+		if ((id->match_flags & I3C_MATCH_EXTRA_INFO) &&
+		    (rndpid || id->extra_info != ext_info))
+			continue;
+
+		return id;
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(i3c_device_match_id);
drivers/i3c/internals.h new file +26 -0
new file mode 100644
index 0000000000..86b7b44cfc
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 Cadence Design Systems Inc.
+ *
+ * Author: Boris Brezillon <[email protected]>
+ */
+
+#ifndef I3C_INTERNALS_H
+#define I3C_INTERNALS_H
+
+#include <linux/i3c/master.h>
+
+extern struct bus_type i3c_bus_type;
+
+void i3c_bus_normaluse_lock(struct i3c_bus *bus);
+void i3c_bus_normaluse_unlock(struct i3c_bus *bus);
+
+int i3c_dev_do_priv_xfers_locked(struct i3c_dev_desc *dev,
+				 struct i3c_priv_xfer *xfers,
+				 int nxfers);
+int i3c_dev_disable_ibi_locked(struct i3c_dev_desc *dev);
+int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev);
+int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev,
+			       const struct i3c_ibi_setup *req);
+void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
+#endif /* I3C_INTERNAL_H */
drivers/i3c/master.c new file +2067 -0

2,067 lines not on this page · raw message

drivers/i3c/master/dw-i3c-master.c new file +1002 -0

644 lines not on this page · raw message

include/dm/device.h +2 -0
index add67f9ec0..c63ea36a75 100644

Lines of this file are not shown. View the raw message.

include/dw-i3c.h new file +248 -0

248 lines not on this page · raw message

include/linux/i3c/ccc.h new file +385 -0

385 lines not on this page · raw message

include/linux/i3c/device.h new file +286 -0

286 lines not on this page · raw message

include/linux/i3c/master.h new file +699 -0

699 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.26.2

Part of the diff is not shown here. View the raw message.

#12 lore raw

PATCH 4/10 drivers: Enabled Kconfig and Makefile for I3C support

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Enable I3C driver support.

---
 drivers/i3c/Kconfig  | 21 +++++++++++++++++++++
 drivers/i3c/Makefile |  3 +++
 2 files changed, 24 insertions(+)
 create mode 100644 drivers/i3c/Kconfig
 create mode 100644 drivers/i3c/Makefile
drivers/i3c/Kconfig new file +21 -0
new file mode 100644
index 0000000000..00c8d19f62
@@ -0,0 +1,21 @@
+menuconfig I3C
+	tristate "I3C support"
+	select I2C
+	help
+	  I3C is a serial protocol standardized by the MIPI alliance.
+
+	  It's supposed to be backward compatible with I2C while providing
+	  support for high speed transfers and native interrupt support
+	  without the need for extra pins.
+
+	  The I3C protocol also standardizes the slave device types and is
+	  mainly designed to communicate with sensors.
+
+	  If you want I3C support, you should say Y here and also to the
+	  specific driver for your bus adapter(s) below.
+
+config DW_I3C_MASTER
+	tristate "Synospsys DesignWare I3C master driver"
+	depends on I3C
+	help
+	  Support for Synopsys DesignWare MIPI I3C Controller.
\ No newline at end of file
drivers/i3c/Makefile new file +3 -0
new file mode 100644
index 0000000000..2d42864d79
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
\ No newline at end of file
Signature · 1 line
2.26.2
#13 lore raw

PATCH 5/10 drivers: i3c: Enabled Kconfig and Makefile for DWI3C

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Enable the Kconfig and Makefile for the MIPI DWI3C driver.

---
 drivers/i3c/master/Kconfig  | 11 +++++++++++
 drivers/i3c/master/Makefile |  3 +++
 2 files changed, 14 insertions(+)
 create mode 100644 drivers/i3c/master/Kconfig
 create mode 100644 drivers/i3c/master/Makefile
drivers/i3c/master/Kconfig new file +11 -0
new file mode 100644
index 0000000000..65e160e5ca
@@ -0,0 +1,11 @@
+config DW_I3C_MASTER
+	tristate "Synospsys DesignWare I3C master driver"
+	depends on I3C
+	help
+	  Support for Synopsys DesignWare MIPI I3C Controller.
+
+	  For details please see
+	  https://www.synopsys.com/dw/ipdir.php?ds=mipi_i3c
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called dw-i3c-master.
\ No newline at end of file
drivers/i3c/master/Makefile new file +3 -0
new file mode 100644
index 0000000000..2d42864d79
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
\ No newline at end of file
Signature · 1 line
2.26.2
#14 lore raw

PATCH 6/10 drivers: i3c: Add i3c uclass driver.

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Enable i3c general uclass driver. This uclass driver will have genaral read and write api to call the specific i3c driver.

---
 drivers/i3c/Makefile     |  1 +
 drivers/i3c/i3c-uclass.c | 38 ++++++++++++++++++++++++
 include/dw-i3c.h         |  1 +
 include/i3c.h            | 63 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/i3c/i3c-uclass.c
 create mode 100644 include/i3c.h
drivers/i3c/Makefile +1 -0
index 2d42864d79..d560939145 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+obj-y += i3c-uclass.o
 obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
\ No newline at end of file
drivers/i3c/i3c-uclass.c new file +38 -0
new file mode 100644
index 0000000000..644f578889
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Altera Corporation <www.altera.com>
+ */
+
+#include <dm.h>
+#include <i3c.h>
+#include <errno.h>
+#include <log.h>
+#include <dm/device-internal.h>
+#include <linux/ctype.h>
+
+int dm_i3c_read(struct udevice *dev, u8 dev_number,
+		u8 *buf, int num_bytes)
+{
+	struct dm_i3c_ops *ops = i3c_get_ops(dev);
+
+	if (!ops->read)
+		return -ENOSYS;
+
+	return ops->read(dev, dev_number, buf, num_bytes);
+}
+
+int dm_i3c_write(struct udevice *dev, u8 dev_number,
+		 u8 *buf, int num_bytes)
+{
+	struct dm_i3c_ops *ops = i3c_get_ops(dev);
+
+	if (!ops->write)
+		return -ENOSYS;
+
+	return ops->write(dev, dev_number, buf, num_bytes);
+}
+
+UCLASS_DRIVER(i3c) = {
+	.id		= UCLASS_I3C,
+	.name		= "i3c",
+};
include/dw-i3c.h +1 -0
index e37fd4dc32..920f18bccb 100644
@@ -7,6 +7,7 @@
 #define _DW_I3C_H_
 
 #include <clk.h>
+#include <i3c.h>
 #include <reset.h>
 #include <dm/device.h>
 #include <linux/bitops.h>
include/i3c.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.26.2
#15 lore raw

PATCH 7/10 drivers: i3c: master: Enable probe i3c without slave device

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Picked linux i3c driver upstraming patch to fix the issue to probe for i3c controller without slave device attached. With this fix, the ret check will be on command error and will success without slave device attached.

---
 drivers/i3c/master.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/i3c/master.c +6 -0
index 024db9c2a3..cd238777b9 100644
@@ -455,6 +455,9 @@ static int i3c_master_rstdaa_locked(struct i3c_master_controller *master,
 
 	i3c_ccc_cmd_dest_cleanup(&dest);
 
+	if (ret)
+		ret = cmd.err;
+
 	return ret;
 }
 
@@ -510,6 +513,9 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,
 	ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
 	i3c_ccc_cmd_dest_cleanup(&dest);
 
+	if (ret)
+		ret = cmd.err;
+
 	return ret;
 }
 
Signature · 1 line
2.26.2
#16 lore raw

PATCH 8/10 i3c: master: dw-i3c-master: Fix OD_TIMING for spike filter

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Fix the I3C device with spike filter unable to detect issue by setting tHIGH_INIT to 200ns for first broadcast address.
This is according to MIPI SPEC 1.1.1 for first broadcast address which is already part of linux upstreamed patch.

---
 drivers/i3c/master/dw-i3c-master.c | 23 +++++++++++++++++++++++
 include/dw-i3c.h                   |  1 +
 include/linux/i3c/master.h         |  1 +
 3 files changed, 25 insertions(+)
drivers/i3c/master/dw-i3c-master.c +23 -0
index b3c5bf210c..af6e472f23 100644
@@ -330,6 +330,14 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)
 	if (hcnt < SCL_I3C_TIMING_CNT_MIN)
 		hcnt = SCL_I3C_TIMING_CNT_MIN;
 
+	/* set back to THIGH_MAX_NS, after disable spike filter */
+	if (!master->first_broadcast) {
+		lcnt = SCL_I3C_TIMING_LCNT(readl(master->regs + SCL_I3C_OD_TIMING));
+		scl_timing = SCL_I3C_TIMING_HCNT(hcnt) | lcnt;
+		writel(scl_timing, master->regs + SCL_I3C_OD_TIMING);
+		return 0;
+	}
+
 	lcnt = DIV_ROUND_UP(core_rate, master->base.bus.scl_rate.i3c) - hcnt;
 	if (lcnt < SCL_I3C_TIMING_CNT_MIN)
 		lcnt = SCL_I3C_TIMING_CNT_MIN;
@@ -347,6 +355,9 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)
 	lcnt = max_t(u8,
 		     DIV_ROUND_UP(I3C_BUS_TLOW_OD_MIN_NS, core_period), lcnt);
 
+	/* first broadcast thigh to 200ns, to disable spike filter */
+	hcnt = DIV_ROUND_UP(I3C_BUS_THIGH_INIT_OD_MIN_NS, core_period);
+
 	scl_timing = SCL_I3C_TIMING_HCNT(hcnt) | SCL_I3C_TIMING_LCNT(lcnt);
 	writel(scl_timing, master->regs + SCL_I3C_OD_TIMING);
 
@@ -402,6 +413,9 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)
 	u32 thld_ctrl;
 	int ret;
 
+	/* first broadcast to disable spike filter */
+	master->first_broadcast = true;
+
 	switch (bus->mode) {
 	case I3C_BUS_MODE_MIXED_FAST:
 	case I3C_BUS_MODE_MIXED_LIMITED:
@@ -481,6 +495,15 @@ static void dw_i3c_master_irq_handler(struct dw_i3c_master *master)
 	if (status & INTR_TRANSFER_ERR_STAT)
 		writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
 
+	/* set back to THIGH_MAX_NS, after disable spike filter */
+	if (master->first_broadcast) {
+		master->first_broadcast = false;
+		int ret = dw_i3c_clk_cfg(master);
+
+		if (ret)
+			pr_err("Failed to set clk cfg\n");
+	}
+
 	spin_unlock(&master->xferqueue.lock);
 }
 
include/dw-i3c.h +1 -0
index 920f18bccb..42c37d6dfa 100644
@@ -240,6 +240,7 @@ struct dw_i3c_master {
 	char version[5];
 	char type[5];
 	u8 addrs[MAX_DEVS];
+	bool first_broadcast;
 };
 
 struct dw_i3c_i2c_dev_data {
include/linux/i3c/master.h +1 -0
index 759e689e2c..aefe593fc2 100644
@@ -280,6 +280,7 @@ struct i3c_device {
 #define I3C_BUS_I2C_FM_PLUS_SCL_RATE	1000000
 #define I3C_BUS_I2C_FM_SCL_RATE		400000
 #define I3C_BUS_TLOW_OD_MIN_NS		200
+#define I3C_BUS_THIGH_INIT_OD_MIN_NS	200
 
 /**
  * enum i3c_bus_mode - I3C bus mode
Signature · 1 line
2.26.2
#17 lore raw

PATCH 9/10 cmd: Add i3c command support.

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Add i3c command file to support select, get i3c device target list, read and write operation.

---
 cmd/i3c.c                          | 193 +++++++++++++++++++++++++++++
 drivers/i3c/master/dw-i3c-master.c |  35 +++++-
 include/dw-i3c.h                   |   2 +
 include/i3c.h                      |   4 +
 4 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 cmd/i3c.c
cmd/i3c.c new file +193 -0
new file mode 100644
index 0000000000..5631f487cc
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2023 Intel Coporation.
+ */
+
+#include <bootretry.h>
+#include <cli.h>
+#include <command.h>
+#include <console.h>
+#include <dm.h>
+#include <dw-i3c.h>
+#include <edid.h>
+#include <errno.h>
+#include <log.h>
+#include <malloc.h>
+#include <asm/byteorder.h>
+#include <linux/compiler.h>
+#include <linux/delay.h>
+#include <u-boot/crc.h>
+#include <linux/i3c/master.h>
+
+static struct udevice *currdev;
+static struct udevice *prevdev;
+static struct dw_i3c_master *master;
+
+void low_to_high_bytes(void *data, size_t size)
+{
+	unsigned char *byte_data = (unsigned char *)data;
+	size_t start = 0;
+	size_t end = size - 1;
+
+	while (start < end) {
+		unsigned char temp = byte_data[start];
+
+		byte_data[start] = byte_data[end];
+		byte_data[end] = temp;
+		start++;
+		end--;
+	}
+}
+
+/**
+ * do_i3c() - Handle the "i3c" command-line command
+ * @cmdtp:    Command data struct pointer
+ * @flag:    Command flag
+ * @argc:    Command-line argument count
+ * @argv:    Array of command-line arguments
+ *
+ * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
+ * on error.
+ */
+static int do_i3c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	struct uclass *uc;
+	int ret;
+	struct udevice *dev_list;
+	u32 length, bytes;
+	u8 *data;
+	u8 *rdata;
+	u8 device_num;
+
+	if (argc > 1) {
+		ret = uclass_get_device_by_name(UCLASS_I3C, argv[1], &currdev);
+		if (ret) {
+			if (!strcmp(argv[1], "help"))
+				return CMD_RET_USAGE;
+
+			currdev = prevdev;
+			if (!currdev) {
+				ret = uclass_get(UCLASS_I3C, &uc);
+				if (ret)
+					return CMD_RET_FAILURE;
+
+				uclass_foreach_dev(dev_list, uc)
+					printf("%s (%s)\n", dev_list->name, dev_list->driver->name);
+
+				printf("i3c master controller is not initialized: %s\n", argv[1]);
+				return CMD_RET_FAILURE;
+			}
+		} else {
+			master = dev_get_priv(currdev);
+			printf("current dev: %s\n", currdev->name);
+			prevdev = currdev;
+		}
+	} else {
+		if (!currdev) {
+			printf("No i3c device set!\n");
+			return CMD_RET_FAILURE;
+		}
+		printf("dev: %s\n", currdev->name);
+	}
+
+	if (!strcmp(argv[1], "list")) {
+		ret = uclass_get(UCLASS_I3C, &uc);
+		if (ret)
+			return CMD_RET_FAILURE;
+
+		uclass_foreach_dev(dev_list, uc)
+		printf("%s (%s)\n", dev_list->name, dev_list->driver->name);
+	}
+
+	if (!strcmp(argv[1], "current")) {
+		if (!currdev)
+			printf("no current dev!\n");
+		else
+			printf("current dev: %s\n", currdev->name);
+	}
+
+	if ((!strcmp(argv[1], "write")) && !(argv[2] == NULL) && !(argv[3] == NULL) &&
+	    !(argv[4] == NULL)) {
+		length = hextoul(argv[3], NULL);
+
+		data = (u8 *)malloc(sizeof(u8) * length);
+		if (!data) {
+			debug("Memory allocation for data failed\n");
+			return -ENOMEM;
+		}
+
+		device_num = hextoul(argv[4], NULL);
+		bytes = hextoul(argv[2], NULL);
+
+		for (int i = 0; i < length; i++)
+			data[i] = (u8)((bytes >> (8 * i)) & 0xFF);
+
+		low_to_high_bytes(data, length);
+		ret = dm_i3c_write(currdev, device_num, data, length);
+		if (ret) {
+			ret = CMD_RET_FAILURE;
+			goto write_out;
+		}
+	}
+
+	if (!strcmp(argv[1], "read") && !(argv[2] == NULL) && !(argv[3] == NULL)) {
+		length = hextoul(argv[2], NULL);
+
+		rdata = (u8 *) malloc(sizeof(u8) * length);
+		if (!rdata) {
+			debug("Memory allocation for rdata failed\n");
+			return -ENOMEM;
+		}
+
+		device_num = hextoul(argv[3], NULL);
+
+		ret = dm_i3c_read(currdev, device_num, rdata, length);
+		if (ret) {
+			ret =  CMD_RET_FAILURE;
+		} else {
+			printf("Read buff: ");
+			for (size_t i = 0; i < length; ++i)
+				printf("%02x", rdata[i]);
+
+			printf("\n");
+		}
+
+		goto read_out;
+	}
+
+	if (!strcmp(argv[1], "device_list")) {
+		if (master) {
+			for (int i = 0; i < master->num_i3cdevs; i++) {
+				printf("device:%d\n", i);
+				printf("dynamic address:0x%X\n", master->i3cdev[i]->info.dyn_addr);
+				printf("PID:%llx\n", master->i3cdev[i]->info.pid);
+				printf("BCR:%X\n", master->i3cdev[i]->info.bcr);
+				printf("DCR:%X\n", master->i3cdev[i]->info.dcr);
+				printf("Max Read DS:%X\n", master->i3cdev[i]->info.max_read_ds);
+				printf("Max Write DS:%X\n", master->i3cdev[i]->info.max_write_ds);
+				printf("\n");
+			}
+		}
+	}
+
+	return CMD_RET_SUCCESS;
+
+read_out:
+	free(rdata);
+	return ret;
+
+write_out:
+	free(data);
+	return ret;
+}
+
+U_BOOT_CMD(
+	i3c,    5,    1,     do_i3c,
+	"access the system i3c\n",
+	"i3c write<data><length><device_number> - write to device.\n"
+	"i3c read<length><device_number> - read from device.\n"
+	"i3c device_list   - List valid target devices\n"
+	"i3c <i3c name>   - Select i3c controller.\n"
+	"i3c list   - List all the available i3c controller.\n"
+	"i3c current   - print current i3c controller.\n"
+);
drivers/i3c/master/dw-i3c-master.c +34 -1
index af6e472f23..98bf894701 100644
@@ -670,8 +670,11 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
 	newdevs &= ~olddevs;
 
 	for (pos = 0; pos < master->maxdevs; pos++) {
-		if (newdevs & BIT(pos))
+		if (newdevs & BIT(pos)) {
 			i3c_master_add_i3c_dev_locked(m, master->addrs[pos]);
+			master->i3cdev[pos] = m->this;
+			master->num_i3cdevs++;
+		}
 	}
 
 	dw_i3c_master_free_xfer(xfer);
@@ -1006,8 +1009,38 @@ err_assert_rst:
 	return ret;
 }
 
+static int dw_i3c_master_priv_read(struct udevice *dev, u8 dev_number,
+				   u8 *buf, int buf_size)
+{
+	struct dw_i3c_master *master = dev_get_priv(dev);
+	struct i3c_dev_desc *i3cdev = master->i3cdev[dev_number];
+	struct i3c_priv_xfer i3c_xfers;
+
+	i3c_xfers.data.in = buf;
+	i3c_xfers.len = buf_size;
+	i3c_xfers.rnw = I3C_MSG_READ;
+
+	return dw_i3c_master_priv_xfers(i3cdev, &i3c_xfers, 1);
+}
+
+static int dw_i3c_master_priv_write(struct udevice *dev, u8 dev_number,
+				    u8 *buf, int buf_size)
+{
+	struct dw_i3c_master *master = dev_get_priv(dev);
+	struct i3c_dev_desc *i3cdev = master->i3cdev[dev_number];
+	struct i3c_priv_xfer i3c_xfers;
+
+	i3c_xfers.data.out = buf;
+	i3c_xfers.len = buf_size;
+	i3c_xfers.rnw = I3C_MSG_WRITE;
+
+	return dw_i3c_master_priv_xfers(i3cdev, &i3c_xfers, 1);
+}
+
 static const struct dm_i3c_ops dw_i3c_ops = {
 	.i3c_xfers = dw_i3c_master_priv_xfers,
+	.read = dw_i3c_master_priv_read,
+	.write = dw_i3c_master_priv_write,
 };
 
 static const struct udevice_id dw_i3c_ids[] = {
include/dw-i3c.h +2 -0
index 42c37d6dfa..c652de7740 100644
@@ -241,6 +241,8 @@ struct dw_i3c_master {
 	char type[5];
 	u8 addrs[MAX_DEVS];
 	bool first_broadcast;
+	struct i3c_dev_desc *i3cdev[I3C_BUS_MAX_DEVS];
+	u16 num_i3cdevs;
 };
 
 struct dw_i3c_i2c_dev_data {
include/i3c.h +4 -0
index 6ef4982dcf..969753ae49 100644
@@ -28,6 +28,10 @@ struct dm_i3c_ops {
 	int (*i3c_xfers)(struct i3c_dev_desc *dev,
 			 struct i3c_priv_xfer *i3c_xfers,
 			 int i3c_nxfers);
+	int (*read)(struct udevice *dev, u8 dev_number,
+		    u8 *buf, int num_bytes);
+	int (*write)(struct udevice *dev, u8 dev_number,
+		     u8 *buf, int num_bytes);
 };
 
 #define i3c_get_ops(dev)	((struct dm_i3c_ops *)(dev)->driver->ops)
Signature · 1 line
2.26.2
#18 lore raw

Re: [PATCH 09/10] cmd: Add i3c command support.

Hi Dinesh,

Quoted 6 lines · On Mon, 17 Feb 2025 at 19:58, <[email protected]> wrote:

From: Dinesh Maniyam <[email protected]>

Add i3c command file to support select, get i3c device target list, read and write operation.

Quoted 8 lines
---
 cmd/i3c.c                          | 193 +++++++++++++++++++++++++++++
 drivers/i3c/master/dw-i3c-master.c |  35 +++++-
 include/dw-i3c.h                   |   2 +
 include/i3c.h                      |   4 +
 4 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 cmd/i3c.c

Please can you add doc/usage/cmd in this patch?

Ideally there should be a simple test of the command too, like test/dm/acpi.c or the things in test/cmd/

Regards,
SImon

#19 lore raw

RE: [PATCH 09/10] cmd: Add i3c command support.

Quoted 40 lines

-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Tuesday, 18 February 2025 9:29 pm
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <ibai.erkiaga- [email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Wang Jie <dave.wang@rock- chips.com>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [PATCH 09/10] cmd: Add i3c command support.

Hi Dinesh,

Quoted 6 lines · On Mon, 17 Feb 2025 at 19:58, <[email protected]> wrote:

From: Dinesh Maniyam <[email protected]>

Add i3c command file to support select, get i3c device target list, read and write operation.

Quoted 8 lines
---
 cmd/i3c.c                          | 193 +++++++++++++++++++++++++++++
 drivers/i3c/master/dw-i3c-master.c |  35 +++++-
 include/dw-i3c.h                   |   2 +
 include/i3c.h                      |   4 +
 4 files changed, 233 insertions(+), 1 deletion(-)  create mode 100644

cmd/i3c.c

Quoted 7 lines

Please can you add doc/usage/cmd in this patch?

Ideally there should be a simple test of the command too, like test/dm/acpi.c or the things in test/cmd/

Regards,
Simon

Noted, will add the doc/usage/cmd and simple test for this new i3c command support in v2.

Regards
Dinesh

#20 lore raw

PATCH 10/10 cmd: Enabled Kconfig and Makefile for DWI3C cmd support

In reply to [email protected]

From: Dinesh Maniyam <[email protected]>

Enable the Kconfig and Makefile for the
DWI3C driver cmd support.

---
 cmd/Kconfig  | 6 ++++++
 cmd/Makefile | 1 +
 2 files changed, 7 insertions(+)
cmd/Kconfig +6 -0
index a04fcaa0e0..5236e7ea76 100644
@@ -1327,6 +1327,12 @@ config CMD_I2C
 	help
 	  I2C support.
 
+config CMD_I3C
+	bool "i3c"
+	help
+	  Enable command to list i3c devices connected to the i3c controller
+	  and perform read and write on the connected i3c devices.
+
 config CMD_W1
 	depends on W1
 	default y if W1
cmd/Makefile +1 -0
index 8410be576b..082470fa10 100644
@@ -95,6 +95,7 @@ obj-$(CONFIG_CMD_GPIO) += gpio.o
 obj-$(CONFIG_CMD_HISTORY) += history.o
 obj-$(CONFIG_CMD_HVC) += smccc.o
 obj-$(CONFIG_CMD_I2C) += i2c.o
+obj-$(CONFIG_CMD_I3C) += i3c.o
 obj-$(CONFIG_CMD_IOTRACE) += iotrace.o
 obj-$(CONFIG_CMD_HASH) += hash.o
 obj-$(CONFIG_CMD_IDE) += ide.o disk.o
Signature · 1 line
2.26.2