]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commit
i2c: pnx: Fix read transactions of >= 2 bytes
authorRoland Stigge <stigge@antcom.de>
Wed, 8 Aug 2012 07:42:32 +0000 (09:42 +0200)
committerWolfram Sang <w.sang@pengutronix.de>
Wed, 12 Sep 2012 15:52:44 +0000 (17:52 +0200)
commitc076ada4e4aaf45e1a31ad6de7c6cce36081e045
tree0c1676608ef8316d271ed0a54f275c21feb3008e
parentb3aafe80c83097403d2b5edccfc440fac3d5f028
i2c: pnx: Fix read transactions of >= 2 bytes

On transactions with n>=2 bytes, the controller actually wrongly clocks in n+1
bytes. This is caused by the (wrong) assumption that RFE in the Status Register
is 1 iff there is no byte already ordered (via a dummy TX byte). This lead to
the implementation of synchronized byte ordering, e.g.:

Dummy-TX - RX - Dummy-TX - RX - ...

But since RFE actually stays high after some Dummy-TX, it rather looks like:

Dummy-TX - Dummy-TX - RX - Dummy-TX - RX - (RX)

The last RX byte is clocked in by the bus controller, but ignored by the kernel
when filling the userspace buffer.

This patch fixes the issue by asking for RX via Dummy-TX asynchronously.
Introducing a separate counter for TX bytes.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
drivers/i2c/busses/i2c-pnx.c
include/linux/i2c-pnx.h