]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: npcm7xx: Clear LAST bit after a failed transaction.
authorTali Perry <tali.perry1@gmail.com>
Sun, 20 Sep 2020 20:48:09 +0000 (23:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Oct 2020 06:02:53 +0000 (08:02 +0200)
commit83884333497fb58f1d96dada1e9995d868e4d38c
treeeb2c8f3639a1ea01a720fd09ac86a594047d6e9d
parent95b874d021f62febafa4c74c611b38c2b2c14c82
i2c: npcm7xx: Clear LAST bit after a failed transaction.

[ Upstream commit 8947efc077168c53b84d039881a7c967086a248a ]

Due to a HW issue, in some scenarios the LAST bit might remain set.
This will cause an unexpected NACK after reading 16 bytes on the next
read.

Example: if user tries to read from a missing device, get a NACK,
then if the next command is a long read ( > 16 bytes),
the master will stop reading after 16 bytes.
To solve this, if a command fails, check if LAST bit is still
set. If it does, reset the module.

Fixes: 56a1485b102e (i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver)
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-npcm7xx.c