I2C: cdns: Fix broken retry mechanism on arbitration lost.
authorAndrea Merello <andrea.merello@iit.it>
Fri, 26 May 2023 14:56:16 +0000 (16:56 +0200)
committerHeiko Schocher <hs@denx.de>
Mon, 5 Jun 2023 04:54:25 +0000 (06:54 +0200)
commit419ddf944cbf376e3c1d5b8571e82d89056bebfa
tree21203eab5efc77d2aa99b2b9cf21a58e7cbd6a7e
parentba5b9203f55bae1ef3566a84648cad46c6949270
I2C: cdns: Fix broken retry mechanism on arbitration lost.

In the current implementation, in case of I2C arbitration lost, a retry is
attempted; the message counter and pointer are reset to the original values
and the I2C xfer process is restart from the beginning.

However the message counter and message pointer are respectively
decremented and incremented by one before attempting any transfer, causing
the 1st transfer not to be actually retried (in case of a single transfer,
nothing is actually retried at all).

This patch fixes this: in case of retry, the 1st transfer is also retried.

Tested on a ZynqMP Kria board, with upstream older u-boot, but the involved
file and underlying logic seem basically the same.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
drivers/i2c/i2c-cdns.c