]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r324169:
authorian <ian@FreeBSD.org>
Fri, 5 Jan 2018 19:21:45 +0000 (19:21 +0000)
committerian <ian@FreeBSD.org>
Fri, 5 Jan 2018 19:21:45 +0000 (19:21 +0000)
commitc8e409513a3f55f253aed21eff87784fc0b3c182
tree4066aaf0892712c3da518370f186d7712e5b6b7d
parent4e61a7d6908ba1102ee39a48be215711dae07c59
MFC r324169:

Work around bcm283x silicon bugs to make i2c repeat-start work for the most
common case where it's needed -- a write followed by a read to the same slave.

The i2c controller in this chip only performs complete transfers, it does
not provide control over start/repeat-start/stop operations on the bus.
Thus, we have gotten a full stop/start sequence rather than a repeat-start
when doing a typical i2c slave access of "write address, read data".  Some
i2c slave devices require a repeat-start to work correctly.

These changes cause the controller to do a repeat-start by pre-staging the
read parameters in the controller registers immediate after the controller
has latched the values for the initial write operation, but before any
bytes are actually written.  With the values pre-staged, when the write
portion of the transfer completes, the state machine in the silicon sees
a new start operation already staged and that causes it to perform a
repeat-start.  The key to tricking the buggy hardware into doing this is
to avoid prefilling any output data in the transmit FIFO so that it is
possible to catch the silicon in the state where transmit values are
latched but the transmit isn't completed yet.
sys/arm/broadcom/bcm2835/bcm2835_bsc.c
sys/arm/broadcom/bcm2835/bcm2835_bscreg.h
sys/arm/broadcom/bcm2835/bcm2835_bscvar.h