]> git.sur5r.net Git - u-boot/commit
i2c: mvtwsi: Make delay times frequency-dependent
authormario.six@gdsys.cc <mario.six@gdsys.cc>
Thu, 21 Jul 2016 09:57:12 +0000 (11:57 +0200)
committerHeiko Schocher <hs@denx.de>
Tue, 26 Jul 2016 08:20:28 +0000 (10:20 +0200)
commitc68c624320e315ec79e78fef1d7baaaa3c64b790
treee0d199f7f33f77d95a2d49a68d8066bde5af7fc8
parent24f9c6bbc7d5e5e276dea32a81ade71f0e6b56ae
i2c: mvtwsi: Make delay times frequency-dependent

Some devices using the MVTWSI driver have the option to run at speeds
faster than Standard Mode (100kHZ). On the Armada 38x controllers, this
is actually necessary, since due to erratum FE-8471889, a timing
violation concerning repeated starts prevents the controller from
working correctly in Standard Mode. One of the workarounds recommended
in the erratum is to set the bus to Fast Mode (400kHZ) operation and
ensure all connected devices are set to Fast Mode.

In the current version of the driver, however, the delay times are
hard-coded to 10ms, corresponding to Standard Mode operation. To take
full advantage of the faster modes, we would need to either keep the
currently configured I2C speed in a globally accessible variable, or
pass it to the necessary functions as a parameter. For DM, the first
option is not a problem, and we can simply keep the speed in the private
data of the driver. For the legacy interface, however, we would need to
introduce a static variable, which would cause problems with boots from
NOR flashes; see commit d6b7757 "i2c: mvtwsi: Eliminate
twsi_control_flags."

As to not clutter the interface with yet another parameter, we therefore
keep the default 10ms delays for the legacy functions.

In DM mode, we make the delay time dependant on the frequency to allow
taking full advantage of faster modes of operation (tested with up to
1MHZ frequency on Armada MV88F6820).

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/i2c/mvtwsi.c