On 1/31/24 16:16, Jarkko Nikula wrote:
I got an idea the i2c-designware should not need duplicated state
machines for the interrupt and polling modes. The IP is practically the
same and state transitions happens in response to the events that can be
observed from the DW_IC_RAW_INTR_STAT register. Either by interrupts or
by polling.
Another reasons are the interrupt mode is the most tested, has handling
for many exceptions as well as transmit abort handling and those are
missing from two polling mode quirks.
Patch implements generic polling mode code which shares the same code
with interrupt mode code. This is done by moving event handling from the
i2c_dw_isr() into a new i2c_dw_process_transfer() that will be called
both from the i2c_dw_isr() and polling loop.
Polling loop is implemented in a new i2c_dw_wait_transfer() that is
shared between both modes. In interrupt mode it waits for the completion
object as before. In polling mode both completion object and
DW_IC_RAW_INTR_STAT are polled.
I decided to convert the txgbe_i2c_dw_xfer_quirk() straight to generic
polling mode code in this patch. It doesn't have HW dependent quirks
like the amd_i2c_dw_xfer_quirk() does have and without users this patch
is needless.
Signed-off-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
---
drivers/i2c/busses/i2c-designware-core.h | 5 +
drivers/i2c/busses/i2c-designware-master.c | 169 +++++++++------------
2 files changed, 77 insertions(+), 97 deletions(-)
Please discard this 5/5 which was accidental left over file in the same
directory with the patches 0-6/6.