[Letux-kernel] jz4730-i2c

H. Nikolaus Schaller hns at goldelico.com
Sat Feb 13 17:13:46 CET 2021


> Am 13.02.2021 um 16:33 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> What I have also tried is to guess from the values I see in the I2CSR and
> the ISR what boolean equation could describe an IRQ:
> 
> 	IRQ = !DRF & (STX | !TEND)
> 
> But that may not be correct. I remember from an earlier attempt to do the
> same that I got both (IRQ=1 and IRQ=0) for the same values of the I2CSR.
> 
> So there may be some internal and invisible state involved.
> 
> And the problem with the above assumption is that we can only write the DRF
> bit! So we must write it to 1 to stop any IRQ. Even after writing the
> last byte.

This gives me an idea: the IC2C could have an internal flag if something
was written to (or read from) the data register. So it could decide between
setting DRF with fresh data or DRF with no data.

Or do we have to reset the DRF manually? The 1.5.3 Write Operation flow chart
seems to test for DRF only once and then uses TEND.

On the other hand 1.5.3 Read Operation indicates that DRF is reset automatically
or it would not suggest to wait for DRF=0 before sending the next byte.

Anyways that is something to experiment with.

With my new debug setup I can add such code at specific locations and look
what happens...

> 
> So I don't know how to switch to read mode...

What also could be a factor is setting the AC bit in I2CCR. Especially since
it is used in the 1.5.3 Read Operation flow chart *after* reading n-1 bytes.

But read seems to work by simply stopping to write...




More information about the Letux-kernel mailing list