[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191021135910.GA26782@ninjato>
Date: Mon, 21 Oct 2019 15:59:10 +0200
From: Wolfram Sang <wsa@...-dreams.de>
To: Fabrice Gasnier <fabrice.gasnier@...com>
Cc: pierre-yves.mordret@...com, alain.volmat@...com,
alexandre.torgue@...com, linux-i2c@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: i2c-stm32f7: fix a race in slave mode with
arbitration loss irq
On Tue, Oct 01, 2019 at 10:51:09AM +0200, Fabrice Gasnier wrote:
> When in slave mode, an arbitration loss (ARLO) may be detected before the
> slave had a chance to detect the stop condition (STOPF in ISR).
> This is seen when two master + slave adapters switch their roles. It
> provokes the i2c bus to be stuck, busy as SCL line is stretched.
> - the I2C_SLAVE_STOP event is never generated due to STOPF flag is set but
> don't generate an irq (race with ARLO irq, STOPIE is masked). STOPF flag
> remains set until next master xfer (e.g. when STOPIE irq get unmasked).
> In this case, completion is generated too early: immediately upon new
> transfer request (then it doesn't send all data).
> - Some data get stuck in TXDR register. As a consequence, the controller
> stretches the SCL line: the bus gets busy until a future master transfer
> triggers the bus busy / recovery mechanism (this can take time... and
> may never happen at all)
>
> So choice is to let the STOPF being detected by the slave isr handler,
> to properly handle this stop condition. E.g. don't mask IRQs in error
> handler, when the slave is running.
>
> Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support")
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@...com>
Applied to for-current, thanks!
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists