162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/i3c/i3c.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: I3C bus
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Alexandre Belloni <alexandre.belloni@bootlin.com>
1162306a36Sopenharmony_ci  - Miquel Raynal <miquel.raynal@bootlin.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  I3C busses can be described with a node for the primary I3C controller device
1562306a36Sopenharmony_ci  and a set of child nodes for each I2C or I3C slave on the bus. Each of them
1662306a36Sopenharmony_ci  may, during the life of the bus, request mastership.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciproperties:
1962306a36Sopenharmony_ci  $nodename:
2062306a36Sopenharmony_ci    pattern: "^i3c-master@[0-9a-f]+$"
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci  "#address-cells":
2362306a36Sopenharmony_ci    const: 3
2462306a36Sopenharmony_ci    description: |
2562306a36Sopenharmony_ci      Each I2C device connected to the bus should be described in a subnode.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci      All I3C devices are supposed to support DAA (Dynamic Address Assignment),
2862306a36Sopenharmony_ci      and are thus discoverable. So, by default, I3C devices do not have to be
2962306a36Sopenharmony_ci      described in the device tree. This being said, one might want to attach
3062306a36Sopenharmony_ci      extra resources to these devices, and those resources may have to be
3162306a36Sopenharmony_ci      described in the device tree, which in turn means we have to describe
3262306a36Sopenharmony_ci      I3C devices.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci      Another use case for describing an I3C device in the device tree is when
3562306a36Sopenharmony_ci      this I3C device has a static I2C address and we want to assign it a
3662306a36Sopenharmony_ci      specific I3C dynamic address before the DAA takes place (so that other
3762306a36Sopenharmony_ci      devices on the bus can't take this dynamic address).
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci  "#size-cells":
4062306a36Sopenharmony_ci    const: 0
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci  i3c-scl-hz:
4362306a36Sopenharmony_ci    description: |
4462306a36Sopenharmony_ci      Frequency of the SCL signal used for I3C transfers. When undefined, the
4562306a36Sopenharmony_ci      default value should be 12.5MHz.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci      May not be supported by all controllers.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci  i2c-scl-hz:
5062306a36Sopenharmony_ci    description: |
5162306a36Sopenharmony_ci      Frequency of the SCL signal used for I2C transfers. When undefined, the
5262306a36Sopenharmony_ci      default should be to look at LVR (Legacy Virtual Register) values of
5362306a36Sopenharmony_ci      I2C devices described in the device tree to determine the maximum I2C
5462306a36Sopenharmony_ci      frequency.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci      May not be supported by all controllers.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cirequired:
5962306a36Sopenharmony_ci  - "#address-cells"
6062306a36Sopenharmony_ci  - "#size-cells"
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cipatternProperties:
6362306a36Sopenharmony_ci  "@[0-9a-f]+$":
6462306a36Sopenharmony_ci    type: object
6562306a36Sopenharmony_ci    description: |
6662306a36Sopenharmony_ci      I2C child, should be named: <device-type>@<i2c-address>
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci      All properties described in Documentation/devicetree/bindings/i2c/i2c.txt
6962306a36Sopenharmony_ci      are valid here, except the reg property whose content is changed.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci    properties:
7262306a36Sopenharmony_ci      compatible:
7362306a36Sopenharmony_ci        description:
7462306a36Sopenharmony_ci          Compatible of the I2C device.
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci      reg:
7762306a36Sopenharmony_ci        items:
7862306a36Sopenharmony_ci          - items:
7962306a36Sopenharmony_ci              - description: |
8062306a36Sopenharmony_ci                  I2C address. 10 bit addressing is not supported. Devices with
8162306a36Sopenharmony_ci                  10-bit address can't be properly passed through DEFSLVS
8262306a36Sopenharmony_ci                  command.
8362306a36Sopenharmony_ci                minimum: 0
8462306a36Sopenharmony_ci                maximum: 0x7f
8562306a36Sopenharmony_ci              - const: 0
8662306a36Sopenharmony_ci              - description: |
8762306a36Sopenharmony_ci                  Shall encode the I3C LVR (Legacy Virtual Register):
8862306a36Sopenharmony_ci                    bit[31:8]: unused/ignored
8962306a36Sopenharmony_ci                    bit[7:5]: I2C device index. Possible values:
9062306a36Sopenharmony_ci                      * 0: I2C device has a 50 ns spike filter
9162306a36Sopenharmony_ci                      * 1: I2C device does not have a 50 ns spike filter but
9262306a36Sopenharmony_ci                           supports high frequency on SCL
9362306a36Sopenharmony_ci                      * 2: I2C device does not have a 50 ns spike filter and is
9462306a36Sopenharmony_ci                           not tolerant to high frequencies
9562306a36Sopenharmony_ci                      * 3-7: reserved
9662306a36Sopenharmony_ci                    bit[4]: tell whether the device operates in FM (Fast Mode)
9762306a36Sopenharmony_ci                            or FM+ mode:
9862306a36Sopenharmony_ci                      * 0: FM+ mode
9962306a36Sopenharmony_ci                      * 1: FM mode
10062306a36Sopenharmony_ci                    bit[3:0]: device type
10162306a36Sopenharmony_ci                      * 0-15: reserved
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci    required:
10462306a36Sopenharmony_ci      - compatible
10562306a36Sopenharmony_ci      - reg
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci  "@[0-9a-f]+,[0-9a-f]+$":
10862306a36Sopenharmony_ci    type: object
10962306a36Sopenharmony_ci    description: |
11062306a36Sopenharmony_ci      I3C child, should be named: <device-type>@<static-i2c-address>,<i3c-pid>
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci    properties:
11362306a36Sopenharmony_ci      reg:
11462306a36Sopenharmony_ci        items:
11562306a36Sopenharmony_ci          - items:
11662306a36Sopenharmony_ci              - description: |
11762306a36Sopenharmony_ci                  Encodes the static I2C address. Should be 0 if the device does
11862306a36Sopenharmony_ci                  not have one (0 is not a valid I2C address).
11962306a36Sopenharmony_ci                minimum: 0
12062306a36Sopenharmony_ci                maximum: 0x7f
12162306a36Sopenharmony_ci              - description: |
12262306a36Sopenharmony_ci                  First half of the Provisional ID (following the PID
12362306a36Sopenharmony_ci                  definition provided by the I3C specification).
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci                  Contains the manufacturer ID left-shifted by 1.
12662306a36Sopenharmony_ci              - description: |
12762306a36Sopenharmony_ci                  Second half of the Provisional ID (following the PID
12862306a36Sopenharmony_ci                  definition provided by the I3C specification).
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci                  Contains the ORing of the part ID left-shifted by 16,
13162306a36Sopenharmony_ci                  the instance ID left-shifted by 12 and extra information.
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci      assigned-address:
13462306a36Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/uint32
13562306a36Sopenharmony_ci        minimum: 0x1
13662306a36Sopenharmony_ci        maximum: 0xff
13762306a36Sopenharmony_ci        description: |
13862306a36Sopenharmony_ci          Dynamic address to be assigned to this device. In case static address is
13962306a36Sopenharmony_ci          present (first cell of the reg property != 0), this address is assigned
14062306a36Sopenharmony_ci          through SETDASA. If static address is not present, this address is assigned
14162306a36Sopenharmony_ci          through SETNEWDA after assigning a temporary address via ENTDAA.
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci    required:
14462306a36Sopenharmony_ci      - reg
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciadditionalProperties: true
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciexamples:
14962306a36Sopenharmony_ci  - |
15062306a36Sopenharmony_ci    i3c-master@d040000 {
15162306a36Sopenharmony_ci        compatible = "cdns,i3c-master";
15262306a36Sopenharmony_ci        clocks = <&coreclock>, <&i3csysclock>;
15362306a36Sopenharmony_ci        clock-names = "pclk", "sysclk";
15462306a36Sopenharmony_ci        interrupts = <3 0>;
15562306a36Sopenharmony_ci        reg = <0x0d040000 0x1000>;
15662306a36Sopenharmony_ci        #address-cells = <3>;
15762306a36Sopenharmony_ci        #size-cells = <0>;
15862306a36Sopenharmony_ci        i2c-scl-hz = <100000>;
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci        /* I2C device. */
16162306a36Sopenharmony_ci        eeprom@57 {
16262306a36Sopenharmony_ci            compatible = "atmel,24c01";
16362306a36Sopenharmony_ci            reg = <0x57 0x0 0x10>;
16462306a36Sopenharmony_ci            pagesize = <0x8>;
16562306a36Sopenharmony_ci        };
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci        /* I3C device with a static I2C address and assigned address. */
16862306a36Sopenharmony_ci        thermal_sensor: sensor@68,39200144004 {
16962306a36Sopenharmony_ci            reg = <0x68 0x392 0x144004>;
17062306a36Sopenharmony_ci            assigned-address = <0xa>;
17162306a36Sopenharmony_ci        };
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci        /* I3C device with only assigned address. */
17462306a36Sopenharmony_ci        pressure_sensor: sensor@0,39200124004 {
17562306a36Sopenharmony_ci            reg = <0x0 0x392 0x124000>;
17662306a36Sopenharmony_ci            assigned-address = <0xc>;
17762306a36Sopenharmony_ci        };
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci        /*
18062306a36Sopenharmony_ci         * I3C device without a static I2C address but requiring
18162306a36Sopenharmony_ci         * resources described in the DT.
18262306a36Sopenharmony_ci         */
18362306a36Sopenharmony_ci        sensor@0,39200154004 {
18462306a36Sopenharmony_ci            reg = <0x0 0x392 0x154004>;
18562306a36Sopenharmony_ci            clocks = <&clock_provider 0>;
18662306a36Sopenharmony_ci        };
18762306a36Sopenharmony_ci    };
188