The number of clock cycles to be written into the CLKDIV register that determines the I2C clk high phase includes the rise time. So to meet the timing requirements defined in the I2C specification which defines the minimal time SCL has to be high, the rise time has to taken into account. The same applies to the low phase with falling time. In my test on RK3288-Pink2 board, which is not an upstream board yet, if external pull-up resistor is 4.7K, rise_ns is about 700ns. So the measured high_ns is about 3900ns, which is less than 4000ns (the minimum high_ns in I2C specification for Standard-mode). To fix this bug min_low_ns should include fall time and min_high_ns should include rise time. This patch merged the patch from chromium project which can get the rise and fall times for signals from the device tree. This allows us to more accurately calculate timings. see: https://chromium-review.googlesource.com/#/c/232774/ Signed-off-by: Addy Ke <addy.ke@rock-chips.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org> [wsa: fixed a typo in the docs] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
54 lines
1.5 KiB
Plaintext
54 lines
1.5 KiB
Plaintext
* Rockchip RK3xxx I2C controller
|
|
|
|
This driver interfaces with the native I2C controller present in Rockchip
|
|
RK3xxx SoCs.
|
|
|
|
Required properties :
|
|
|
|
- reg : Offset and length of the register set for the device
|
|
- compatible : should be "rockchip,rk3066-i2c", "rockchip,rk3188-i2c" or
|
|
"rockchip,rk3288-i2c".
|
|
- interrupts : interrupt number
|
|
- clocks : parent clock
|
|
|
|
Required on RK3066, RK3188 :
|
|
|
|
- rockchip,grf : the phandle of the syscon node for the general register
|
|
file (GRF)
|
|
- on those SoCs an alias with the correct I2C bus ID (bit offset in the GRF)
|
|
is also required.
|
|
|
|
Optional properties :
|
|
|
|
- clock-frequency : SCL frequency to use (in Hz). If omitted, 100kHz is used.
|
|
- i2c-scl-rising-time-ns : Number of nanoseconds the signal takes to rise
|
|
(t(r) in I2C specification). If not specified this is assumed to be
|
|
the maximum the specification allows(1000 ns for Standard-mode,
|
|
300 ns for Fast-mode) which might cause slightly slower communication.
|
|
- i2c-scl-falling-time-ns : Number of nanoseconds the signal takes to fall
|
|
(t(f) in the I2C specification). If not specified this is assumed to
|
|
be the maximum the specification allows (300 ns) which might cause
|
|
slightly slower communication.
|
|
|
|
Example:
|
|
|
|
aliases {
|
|
i2c0 = &i2c0;
|
|
}
|
|
|
|
i2c0: i2c@2002d000 {
|
|
compatible = "rockchip,rk3188-i2c";
|
|
reg = <0x2002d000 0x1000>;
|
|
interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
|
|
rockchip,grf = <&grf>;
|
|
|
|
clock-names = "i2c";
|
|
clocks = <&cru PCLK_I2C0>;
|
|
|
|
i2c-scl-rising-time-ns = <800>;
|
|
i2c-scl-falling-time-ns = <100>;
|
|
};
|