Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | %YAML 1.2 |
| 3 | --- |
| 4 | $id: http://devicetree.org/schemas/i2c/i2c-rk3x.yaml# |
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 | |
| 7 | title: Rockchip RK3xxx I2C controller |
| 8 | |
| 9 | description: |
| 10 | This driver interfaces with the native I2C controller present in Rockchip |
| 11 | RK3xxx SoCs. |
| 12 | |
| 13 | allOf: |
| 14 | - $ref: /schemas/i2c/i2c-controller.yaml# |
| 15 | |
| 16 | maintainers: |
| 17 | - Heiko Stuebner <heiko@sntech.de> |
| 18 | |
| 19 | # Everything else is described in the common file |
| 20 | properties: |
| 21 | compatible: |
| 22 | oneOf: |
| 23 | - const: rockchip,rv1108-i2c |
| 24 | - const: rockchip,rk3066-i2c |
| 25 | - const: rockchip,rk3188-i2c |
| 26 | - const: rockchip,rk3228-i2c |
| 27 | - const: rockchip,rk3288-i2c |
| 28 | - const: rockchip,rk3399-i2c |
| 29 | - items: |
| 30 | - enum: |
| 31 | - rockchip,rk3036-i2c |
| 32 | - rockchip,rk3128-i2c |
| 33 | - rockchip,rk3368-i2c |
| 34 | - const: rockchip,rk3288-i2c |
| 35 | - items: |
| 36 | - enum: |
| 37 | - rockchip,px30-i2c |
| 38 | - rockchip,rk3308-i2c |
| 39 | - rockchip,rk3328-i2c |
| 40 | - rockchip,rk3568-i2c |
| 41 | - rockchip,rk3588-i2c |
| 42 | - rockchip,rv1126-i2c |
| 43 | - const: rockchip,rk3399-i2c |
| 44 | |
| 45 | reg: |
| 46 | maxItems: 1 |
| 47 | |
| 48 | interrupts: |
| 49 | maxItems: 1 |
| 50 | |
| 51 | clocks: |
| 52 | minItems: 1 |
| 53 | items: |
| 54 | - description: |
| 55 | For older hardware (rk3066, rk3188, rk3228, rk3288) |
| 56 | there is one clock that is used both to derive the functional clock |
| 57 | for the device and as the bus clock. |
| 58 | For newer hardware (rk3399) this clock is used to derive |
| 59 | the functional clock |
| 60 | - description: |
| 61 | For newer hardware (rk3399) this is the bus clock |
| 62 | |
| 63 | clock-names: |
| 64 | minItems: 1 |
| 65 | items: |
| 66 | - const: i2c |
| 67 | - const: pclk |
| 68 | |
| 69 | rockchip,grf: |
| 70 | $ref: /schemas/types.yaml#/definitions/phandle |
| 71 | description: |
| 72 | Required on RK3066, RK3188 the phandle of the syscon node for |
| 73 | the general register file (GRF) |
| 74 | On those SoCs an alias with the correct I2C bus ID |
| 75 | (bit offset in the GRF) is also required. |
| 76 | |
| 77 | clock-frequency: |
| 78 | default: 100000 |
| 79 | description: |
| 80 | SCL frequency to use (in Hz). If omitted, 100kHz is used. |
| 81 | |
| 82 | i2c-scl-rising-time-ns: |
| 83 | default: 1000 |
| 84 | description: |
| 85 | Number of nanoseconds the SCL signal takes to rise |
| 86 | (t(r) in I2C specification). If not specified this is assumed to be |
| 87 | the maximum the specification allows(1000 ns for Standard-mode, |
| 88 | 300 ns for Fast-mode) which might cause slightly slower communication. |
| 89 | |
| 90 | i2c-scl-falling-time-ns: |
| 91 | default: 300 |
| 92 | description: |
| 93 | Number of nanoseconds the SCL signal takes to fall |
| 94 | (t(f) in the I2C specification). If not specified this is assumed to |
| 95 | be the maximum the specification allows (300 ns) which might cause |
| 96 | slightly slower communication. |
| 97 | |
| 98 | i2c-sda-falling-time-ns: |
| 99 | default: 300 |
| 100 | description: |
| 101 | Number of nanoseconds the SDA signal takes to fall |
| 102 | (t(f) in the I2C specification). If not specified we will use the SCL |
| 103 | value since they are the same in nearly all cases. |
| 104 | |
| 105 | required: |
| 106 | - compatible |
| 107 | - reg |
| 108 | - interrupts |
| 109 | - clocks |
| 110 | - clock-names |
| 111 | |
| 112 | if: |
| 113 | properties: |
| 114 | compatible: |
| 115 | contains: |
| 116 | enum: |
| 117 | - rockchip,rk3066-i2c |
| 118 | - rockchip,rk3188-i2c |
| 119 | |
| 120 | then: |
| 121 | required: |
| 122 | - rockchip,grf |
| 123 | |
| 124 | unevaluatedProperties: false |
| 125 | |
| 126 | examples: |
| 127 | - | |
| 128 | #include <dt-bindings/clock/rk3188-cru-common.h> |
| 129 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 130 | #include <dt-bindings/interrupt-controller/irq.h> |
| 131 | i2c0: i2c@2002d000 { |
| 132 | compatible = "rockchip,rk3188-i2c"; |
| 133 | reg = <0x2002d000 0x1000>; |
| 134 | interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; |
| 135 | clocks = <&cru PCLK_I2C0>; |
| 136 | clock-names = "i2c"; |
| 137 | rockchip,grf = <&grf>; |
| 138 | i2c-scl-falling-time-ns = <100>; |
| 139 | i2c-scl-rising-time-ns = <800>; |
| 140 | #address-cells = <1>; |
| 141 | #size-cells = <0>; |
| 142 | }; |