]> git.baikalelectronics.ru Git - uboot.git/commit
i2c: designware_i2c: Use an accurate bus clock instead of MHz
authorSimon Glass <sjg@chromium.org>
Thu, 23 Jan 2020 18:48:09 +0000 (11:48 -0700)
committerHeiko Schocher <hs@denx.de>
Mon, 27 Jan 2020 06:20:27 +0000 (07:20 +0100)
commit5876d66bb178e0774bb57b71b6c3652850a7a591
treec27f9d9f558b4ef17e86344fb3483fc91ef45405
parent337abe6a365e7044e41212e34d9804eebd470599
i2c: designware_i2c: Use an accurate bus clock instead of MHz

At present the driver uses an approximation for the bus clock, e.g. 166MHz
instead of 166 2/3 MHz.

This can result in small errors in the resulting I2C speed, perhaps 0.5%
or so.

Adjust the existing code to start from the accurate figure, even if later
rounding reduces this accuracy.

Update the bus speed code to work in KHz instead of MHz, which removes
most of the error.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/designware_i2c.c
drivers/i2c/designware_i2c.h