]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: pasemi: Wait for write xfers to finish
authorMartin Povišer <povik+lin@cutebit.org>
Tue, 29 Mar 2022 18:38:17 +0000 (20:38 +0200)
committerWolfram Sang <wsa@kernel.org>
Fri, 15 Apr 2022 21:12:02 +0000 (23:12 +0200)
commit6cc3be9ef5dc4dd86830c8cc73f7c3931b42afc8
tree3cf4f86e904a021d3d061471b00266beef0b7506
parentef8e7cd3bfb3e514a5772f2c5874cf0913238d68
i2c: pasemi: Wait for write xfers to finish

Wait for completion of write transfers before returning from the driver.
At first sight it may seem advantageous to leave write transfers queued
for the controller to carry out on its own time, but there's a couple of
issues with it:

 * Driver doesn't check for FIFO space.

 * The queued writes can complete while the driver is in its I2C read
   transfer path which means it will get confused by the raising of
   XEN (the 'transaction ended' signal). This can cause a spurious
   ENODATA error due to premature reading of the MRXFIFO register.

Adding the wait fixes some unreliability issues with the driver. There's
some efficiency cost to it (especially with pasemi_smb_waitready doing
its polling), but that will be alleviated once the driver receives
interrupt support.

Fixes: a04f225eb00d ("i2c: PA Semi SMBus driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-pasemi-core.c