]> git.baikalelectronics.ru Git - uboot.git/commit
i2c: designware_i2c: Rewrite timing calculation
authorSimon Glass <sjg@chromium.org>
Thu, 23 Jan 2020 18:48:14 +0000 (11:48 -0700)
committerHeiko Schocher <hs@denx.de>
Mon, 27 Jan 2020 06:21:51 +0000 (07:21 +0100)
commit9180233870c64abdc2c5f9d46b5ee602dd526038
treefa9de3073f2cafdc153aba4e70adbe024ed8352f
parent0a173b1b18c35e380a1369ae2543dd9f025557d7
i2c: designware_i2c: Rewrite timing calculation

At present the driver can end up with timing parameters which are slightly
faster than those expected. It is possible to optimise the parameters to
get the best possible result.

Create a new function to handle the timing calculation. This uses a table
of defaults for each speed mode rather than writing it in code.

The function works by calculating the 'period' of each bit on the bus in
terms of the input clock to the controller (IC_CLK). It makes sure that
the constraints are met and that the different components of that period
add up correctly.

This code was taken from coreboot which has ended up with this same
driver, but now in a much-different form.

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