Skip to content
Commit 8f09ece1 authored by Gregor Herburger's avatar Gregor Herburger Committed by Greg Kroah-Hartman
Browse files

i2c: ocores: generate stop condition after timeout in polling mode



[ Upstream commit f8160d3b ]

In polling mode, no stop condition is generated after a timeout. This
causes SCL to remain low and thereby block the bus. If this happens
during a transfer it can cause slaves to misinterpret the subsequent
transfer and return wrong values.

To solve this, pass the ETIMEDOUT error up from ocores_process_polling()
instead of setting STATE_ERROR directly. The caller is adjusted to call
ocores_process_timeout() on error both in polling and in IRQ mode, which
will set STATE_ERROR and generate a stop condition.

Fixes: 69c8c0c0 ("i2c: ocores: add polling interface")
Signed-off-by: default avatarGregor Herburger <gregor.herburger@tq-group.com>
Signed-off-by: default avatarMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Acked-by: default avatarPeter Korsgaard <peter@korsgaard.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFederico Vaga <federico.vaga@cern.ch>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6f5758fd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment