1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

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>
This commit is contained in:
Simon Glass
2020-01-23 11:48:09 -07:00
committed by Heiko Schocher
parent 65190d15ef
commit dd3c1602cf
2 changed files with 10 additions and 12 deletions

View File

@@ -60,8 +60,8 @@ struct i2c_regs {
u32 comp_type;
};
#define IC_CLK 166
#define NANO_TO_MICRO 1000
#define IC_CLK 166666666
#define NANO_TO_KILO 1000000
/* High and low times in different speed modes (in ns) */
#define MIN_SS_SCL_HIGHTIME 4000