]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: rcar: fix NACK handling when being a target
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 15 Jan 2025 12:36:23 +0000 (13:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2025 16:16:00 +0000 (17:16 +0100)
commitc5f1bc1d2324072d4b2715bbcfdfde46e5950ea1
treec0fc954e6b13fa78c26e8f48bb5b2b92a66b0d72
parent6c6e0961ccfde3934c82d42c870379b016cf1541
i2c: rcar: fix NACK handling when being a target

[ Upstream commit 093f70c134f70e4632b295240f07d2b50b74e247 ]

When this controller is a target, the NACK handling had two issues.
First, the return value from the backend was not checked on the initial
WRITE_REQUESTED. So, the driver missed to send a NACK in this case.
Also, the NACK always arrives one byte late on the bus, even in the
WRITE_RECEIVED case. This seems to be a HW issue. We should then not
rely on the backend to correctly NACK the superfluous byte as well. Fix
both issues by introducing a flag which gets set whenever the backend
requests a NACK and keep sending it until we get a STOP condition.

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