1. 15 4月, 2016 1 次提交
  2. 13 4月, 2016 1 次提交
  3. 30 11月, 2015 1 次提交
  4. 21 10月, 2015 1 次提交
  5. 12 5月, 2015 1 次提交
    • D
      i2c: rk3x: Increase wait timeout to 1 second · 4489750f
      Doug Anderson 提交于
      Although unlikely, it is remotely possible for an i2c command to need
      more than 200ms complete. Unlike smbus, i2c devices can clock stretch
      for an unspecified amount of time. The longest time I've seen
      specified for a device is 144ms (bq27541 battery gas), but one could
      imagine a device taking a bit slower. 1 second "ought to be enough for
      anyone."
      
      The above is not the only justifcation for going above 200ms for a
      timeout, though.  It turns out that if you've got a large number of
      printks going out to a serial console, interrupts on a CPU can be
      disabled for hundreds of milliseconds. That's not a great situation to
      be in to start with (maybe we should put a cap in vprintk_emit()) but
      it's pretty annoying to start seeing unexplained i2c timeouts.
      
      Note that to understand why we can timeout when printk has interrupts
      disabled, you need to understand that on current Linux ARM kernels
      interrupts are routed to a single CPU in a multicore system. Thus,
      you can get:
      
      1. CPU1 is running rk3x_i2c_xfer()
      2. CPU0 calls vprintk_emit(), which disables all IRQs on CPU0.
      3. I2C interrupt is ready but is set to only run on CPU0, where IRQs
         are disabled.
      4. CPU1 timeout expires. I2C interrupt is still ready, but CPU0 is
         still sitting in the same vprintk_emit()
      5. CPU1 sees that no interrupt happened in 200ms, so timeout.
      
      A normal system shouldn't see i2c timeouts anyway, so increasing the
      timeout should help people debugging without hurting other people
      excessively.
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Tested-by: NCaesar Wang <wxt@rock-chips.com>
      Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      4489750f
  6. 24 4月, 2015 1 次提交
  7. 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
  8. 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
  9. 10 11月, 2014 1 次提交
  10. 20 10月, 2014 1 次提交
  11. 03 10月, 2014 1 次提交
  12. 30 9月, 2014 1 次提交
  13. 21 9月, 2014 1 次提交
  14. 02 9月, 2014 1 次提交
  15. 09 8月, 2014 1 次提交
  16. 13 6月, 2014 1 次提交
  17. 12 6月, 2014 1 次提交