i2c: designware: make HCNT/LCNT values configurable
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 19 Aug 2013 12:07:53 +0000 (15:07 +0300)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 28 Aug 2013 09:11:10 +0000 (11:11 +0200)
commitdefc0b2fb5221bca847a9adb8159b88bc3c93904
tree345ed01cb257616a5607515dd011ae9c179aca4c
parentb3bfce2bc205ff4fdb4ec0b048513557cef459cf
i2c: designware: make HCNT/LCNT values configurable

The DesignWare I2C controller has high count (HCNT) and low count (LCNT)
registers for each of the I2C speed modes (standard and fast). These
registers are programmed based on the input clock speed in the driver.

The current code calculates these values based on the input clock speed and
tries hard to meet the I2C bus timing requirements. This could result
non-optimal values with regarding to the bus speed. For example on Intel
BayTrail we get bus speed of 315.41kHz which is ~20% slower than we would
expect (400kHz) in fast mode (even though the timing requirements are met).

This patch makes it possible for the platform code to pass more optimal
HCNT/LCNT values to the core driver if they are known beforehand. If these
are not set we use the calculated and more conservative values.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Shinya Kuribayashi <skuribay@pobox.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-core.c
drivers/i2c/busses/i2c-designware-core.h