]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i2c: uniphier-f: correct error recovery
authorDai Okamura <okamura.dai@socionext.com>
Fri, 9 Dec 2022 11:38:27 +0000 (20:38 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 6 Jan 2023 13:14:19 +0000 (08:14 -0500)
The uniphier i2c block can recognize some handshake errors.
But driver handles all error detections as no error if no timeout.
So this makes unrecoverable state.

This replaces the return values with the right ones to tell the i2c
framework the errors:
- EDEADLK for arbitration lost error
- ENODATA for no answer error

Signed-off-by: Dai Okamura <okamura.dai@socionext.com>
Acked-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/i2c-uniphier-f.c

index 9d6f1688cb100dd5bb18543793a8beebb6c775b6..3dcd382469e6def3023901078aed8201a99d4494 100644 (file)
@@ -130,12 +130,12 @@ static int wait_for_irq(struct uniphier_fi2c_priv *priv, u32 flags,
        if (irq & I2C_INT_AL) {
                dev_dbg(priv->dev, "error: arbitration lost\n");
                *stop = false;
-               return ret;
+               return -EDEADLK;
        }
 
        if (irq & I2C_INT_NA) {
                dev_dbg(priv->dev, "error: no answer\n");
-               return ret;
+               return -ENODATA;
        }
 
        return 0;