1. 13 1月, 2015 2 次提交
    • D
      i2c: rk3x: Account for repeated start time requirement · 387f0de6
      Doug Anderson 提交于
      On Rockchip I2C the controller drops SDA low slightly too soon to meet
      the "repeated start" requirements.
      
      >From my own experimentation over a number of rates:
       - controller appears to drop SDA at .875x (7/8) programmed clk high.
       - controller appears to keep SCL high for 2x programmed clk high.
      
      The first rule isn't enough to meet tSU;STA requirements in
      Standard-mode on the system I tested on.  The second rule is probably
      enough to meet tHD;STA requirements in nearly all cases (especially
      after accounting for the first), but it doesn't hurt to account for it
      anyway just in case.
      
      Even though the repeated start requirement only need to be accounted
      for during a small part of the transfer, we'll adjust the timings for
      the whole transfer to meet it.  I believe that adjusting the timings
      in just the right place to switch things up for repeated start would
      require several extra interrupts and that doesn't seem terribly worth
      it.
      
      With this change and worst case rise/fall times, I see 100kHz i2c
      going to ~85kHz.  With slightly optimized rise/fall (800ns / 50ns) I
      see i2c going to ~89kHz.  Fast-mode isn't affected much because
      tSU;STA is shorter relative to tHD;STA there.
      
      As part of this change we needed to account for the SDA falling time.
      The specification indicates that this should be the same, but we'll
      follow Designware's lead and add a binding.  Note that we deviate from
      Designware and assign the default SDA falling time to be the same as
      the SCL falling time, which is incredibly likely.
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      [wsa: rebased to i2c/for-next]
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      387f0de6
    • A
      i2c: rk3x: fix bug that cause measured high_ns doesn't meet I2C specification · 1330e291
      addy ke 提交于
      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: NAddy Ke <addy.ke@rock-chips.com>
      Reviewed-by: NDoug Anderson <dianders@chromium.org>
      Tested-by: NDoug Anderson <dianders@chromium.org>
      [wsa: fixed a typo in the docs]
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      1330e291
  2. 24 11月, 2014 1 次提交
    • M
      i2c: rk3x: handle dynamic clock rate changes correctly · 249051f4
      Max Schwarz 提交于
      The i2c input clock can change dynamically, e.g. on the RK3066 where
      pclk_i2c0 and pclk_i2c1 are connected to the armclk, which changes
      rate on cpu frequency scaling.
      
      Until now, we incorrectly called clk_get_rate() while holding the
      i2c->lock in rk3x_i2c_xfer() to adapt to clock rate changes.
      Thanks to Huang Tao for reporting this issue.
      
      Do it properly now using the clk notifier framework. The callback
      logic was taken from i2c-cadence.c.
      
      Also rename all misleading "i2c_rate" variables to "clk_rate", as they
      describe the *input* clk rate.
      Signed-off-by: NMax Schwarz <max.schwarz@online.de>
      Tested-by: Doug Anderson <dianders@chromium.org> on RK3288
      Reviewed-by: NDoug Anderson <dianders@chromium.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      249051f4
  3. 10 11月, 2014 1 次提交
  4. 20 10月, 2014 1 次提交
  5. 03 10月, 2014 1 次提交
  6. 30 9月, 2014 1 次提交
  7. 21 9月, 2014 1 次提交
  8. 02 9月, 2014 1 次提交
  9. 09 8月, 2014 1 次提交
  10. 13 6月, 2014 1 次提交
  11. 12 6月, 2014 1 次提交