162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/i2c/i2c-rk3x.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Rockchip RK3xxx I2C controller
862306a36Sopenharmony_ci
962306a36Sopenharmony_cidescription:
1062306a36Sopenharmony_ci  This driver interfaces with the native I2C controller present in Rockchip
1162306a36Sopenharmony_ci  RK3xxx SoCs.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciallOf:
1462306a36Sopenharmony_ci  - $ref: /schemas/i2c/i2c-controller.yaml#
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_cimaintainers:
1762306a36Sopenharmony_ci  - Heiko Stuebner <heiko@sntech.de>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci# Everything else is described in the common file
2062306a36Sopenharmony_ciproperties:
2162306a36Sopenharmony_ci  compatible:
2262306a36Sopenharmony_ci    oneOf:
2362306a36Sopenharmony_ci      - const: rockchip,rv1108-i2c
2462306a36Sopenharmony_ci      - const: rockchip,rk3066-i2c
2562306a36Sopenharmony_ci      - const: rockchip,rk3188-i2c
2662306a36Sopenharmony_ci      - const: rockchip,rk3228-i2c
2762306a36Sopenharmony_ci      - const: rockchip,rk3288-i2c
2862306a36Sopenharmony_ci      - const: rockchip,rk3399-i2c
2962306a36Sopenharmony_ci      - items:
3062306a36Sopenharmony_ci          - enum:
3162306a36Sopenharmony_ci              - rockchip,rk3036-i2c
3262306a36Sopenharmony_ci              - rockchip,rk3128-i2c
3362306a36Sopenharmony_ci              - rockchip,rk3368-i2c
3462306a36Sopenharmony_ci          - const: rockchip,rk3288-i2c
3562306a36Sopenharmony_ci      - items:
3662306a36Sopenharmony_ci          - enum:
3762306a36Sopenharmony_ci              - rockchip,px30-i2c
3862306a36Sopenharmony_ci              - rockchip,rk3308-i2c
3962306a36Sopenharmony_ci              - rockchip,rk3328-i2c
4062306a36Sopenharmony_ci              - rockchip,rk3568-i2c
4162306a36Sopenharmony_ci              - rockchip,rk3588-i2c
4262306a36Sopenharmony_ci              - rockchip,rv1126-i2c
4362306a36Sopenharmony_ci          - const: rockchip,rk3399-i2c
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci  reg:
4662306a36Sopenharmony_ci    maxItems: 1
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci  interrupts:
4962306a36Sopenharmony_ci    maxItems: 1
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci  clocks:
5262306a36Sopenharmony_ci    minItems: 1
5362306a36Sopenharmony_ci    items:
5462306a36Sopenharmony_ci      - description:
5562306a36Sopenharmony_ci          For older hardware (rk3066, rk3188, rk3228, rk3288)
5662306a36Sopenharmony_ci          there is one clock that is used both to derive the functional clock
5762306a36Sopenharmony_ci          for the device and as the bus clock.
5862306a36Sopenharmony_ci          For newer hardware (rk3399) this clock is used to derive
5962306a36Sopenharmony_ci          the functional clock
6062306a36Sopenharmony_ci      - description:
6162306a36Sopenharmony_ci          For newer hardware (rk3399) this is the bus clock
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci  clock-names:
6462306a36Sopenharmony_ci    minItems: 1
6562306a36Sopenharmony_ci    items:
6662306a36Sopenharmony_ci      - const: i2c
6762306a36Sopenharmony_ci      - const: pclk
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci  rockchip,grf:
7062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/phandle
7162306a36Sopenharmony_ci    description:
7262306a36Sopenharmony_ci      Required on RK3066, RK3188 the phandle of the syscon node for
7362306a36Sopenharmony_ci      the general register file (GRF)
7462306a36Sopenharmony_ci      On those SoCs an alias with the correct I2C bus ID
7562306a36Sopenharmony_ci      (bit offset in the GRF) is also required.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci  clock-frequency:
7862306a36Sopenharmony_ci    default: 100000
7962306a36Sopenharmony_ci    description:
8062306a36Sopenharmony_ci      SCL frequency to use (in Hz). If omitted, 100kHz is used.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci  i2c-scl-rising-time-ns:
8362306a36Sopenharmony_ci    default: 1000
8462306a36Sopenharmony_ci    description:
8562306a36Sopenharmony_ci      Number of nanoseconds the SCL signal takes to rise
8662306a36Sopenharmony_ci      (t(r) in I2C specification). If not specified this is assumed to be
8762306a36Sopenharmony_ci      the maximum the specification allows(1000 ns for Standard-mode,
8862306a36Sopenharmony_ci      300 ns for Fast-mode) which might cause slightly slower communication.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci  i2c-scl-falling-time-ns:
9162306a36Sopenharmony_ci    default: 300
9262306a36Sopenharmony_ci    description:
9362306a36Sopenharmony_ci      Number of nanoseconds the SCL signal takes to fall
9462306a36Sopenharmony_ci      (t(f) in the I2C specification). If not specified this is assumed to
9562306a36Sopenharmony_ci      be the maximum the specification allows (300 ns) which might cause
9662306a36Sopenharmony_ci      slightly slower communication.
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci  i2c-sda-falling-time-ns:
9962306a36Sopenharmony_ci    default: 300
10062306a36Sopenharmony_ci    description:
10162306a36Sopenharmony_ci      Number of nanoseconds the SDA signal takes to fall
10262306a36Sopenharmony_ci      (t(f) in the I2C specification). If not specified we will use the SCL
10362306a36Sopenharmony_ci      value since they are the same in nearly all cases.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_cirequired:
10662306a36Sopenharmony_ci  - compatible
10762306a36Sopenharmony_ci  - reg
10862306a36Sopenharmony_ci  - interrupts
10962306a36Sopenharmony_ci  - clocks
11062306a36Sopenharmony_ci  - clock-names
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciif:
11362306a36Sopenharmony_ci  properties:
11462306a36Sopenharmony_ci    compatible:
11562306a36Sopenharmony_ci      contains:
11662306a36Sopenharmony_ci        enum:
11762306a36Sopenharmony_ci          - rockchip,rk3066-i2c
11862306a36Sopenharmony_ci          - rockchip,rk3188-i2c
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_cithen:
12162306a36Sopenharmony_ci  required:
12262306a36Sopenharmony_ci    - rockchip,grf
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ciunevaluatedProperties: false
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ciexamples:
12762306a36Sopenharmony_ci  - |
12862306a36Sopenharmony_ci    #include <dt-bindings/clock/rk3188-cru-common.h>
12962306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
13062306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/irq.h>
13162306a36Sopenharmony_ci    i2c0: i2c@2002d000 {
13262306a36Sopenharmony_ci      compatible = "rockchip,rk3188-i2c";
13362306a36Sopenharmony_ci      reg = <0x2002d000 0x1000>;
13462306a36Sopenharmony_ci      interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
13562306a36Sopenharmony_ci      clocks = <&cru PCLK_I2C0>;
13662306a36Sopenharmony_ci      clock-names = "i2c";
13762306a36Sopenharmony_ci      rockchip,grf = <&grf>;
13862306a36Sopenharmony_ci      i2c-scl-falling-time-ns = <100>;
13962306a36Sopenharmony_ci      i2c-scl-rising-time-ns = <800>;
14062306a36Sopenharmony_ci      #address-cells = <1>;
14162306a36Sopenharmony_ci      #size-cells = <0>;
14262306a36Sopenharmony_ci    };
143