[PATCH] i2c: mvtwsi: reset controller if stuck in "bus error" state

Heiko Schocher hs at denx.de
Mon Aug 7 11:43:35 CEST 2023


Hello Sam,

On 26.07.23 00:13, Sam Edwards wrote:
> The MVTWSI controller can act either as a master or slave device. When
> acting as a master, the FSM is driven by the CPU. As a slave, the FSM is
> driven by the bus directly. In what is (apparently) a safety mechanism,
> if the bus transitions our FSM in any improper way, the FSM goes to a
> "bus error" state (0x00). I could find no documented or experimental way
> to get the FSM out of this state, except for a controller reset.
> 
> Since U-Boot only uses the MVTWSI controller as a bus master, this
> feature only gets in the way: we do not care what happened on the bus
> previously as long as the bus is ready for a new transaction. So, when
> trying to start a new transaction, check for this state and reset the
> controller if necessary.
> 
> Note that this should not be confused with the "deblocking" technique
> (used by the `i2c reset` command), which involves pulsing SCL repeatedly
> if SDA is found to be held low, in an attempt to force the bus back to
> an idle state. This patch only resets the controller in case something
> else had previously upset it, and (in principle) results in no
> externally-observable change in behavior.
> 
> Signed-off-by: Sam Edwards <CFSworks at gmail.com>
> ---
>  drivers/i2c/mvtwsi.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)

Reviewed-by: Heiko Schocher <hs at denx.de>

bye,
Heiko

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list