]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
i2c: rcar: in slave mode, clear NACK earlier
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 17 Aug 2020 12:19:30 +0000 (14:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:26:55 +0000 (11:26 +0200)
[ Upstream commit 914a7b3563b8fb92f976619bbd0fa3a4a708baae ]

Currently, a NACK in slave mode is set/cleared when SCL is held low by
the IP core right before the bit is about to be pushed out. This is too
late for clearing and then a NACK from the previous byte is still used
for the current one. Now, let's clear the NACK right after we detected
the STOP condition following the NACK.

Fixes: de20d1857dd6 ("i2c: rcar: add slave support")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-rcar.c

index 0b90aa0318df307ba790c26d30b58a180f60416e..9c162a01a58492c6028430af01cd1f47634997c6 100644 (file)
@@ -587,6 +587,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
        /* master sent stop */
        if (ssr_filtered & SSR) {
                i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
+               rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
                rcar_i2c_write(priv, ICSIER, SAR);
                rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
        }