Re: [PATCH v2] i2c: iproc: reset bus after timeout if START_BUSY is stuck
From: Ray Jui
Date: Tue Jul 28 2026 - 14:04:23 EST
Hi Andi / Jonas,
On Tue, Jul 28, 2026 at 8:04 AM Andi Shyti <andi.shyti@xxxxxxxxxx> wrote:
Hi Jonas,
...
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index b5629cffe99b..86ca4c2221c4 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -803,6 +803,17 @@ static int bcm_iproc_i2c_xfer_wait(struct bcm_iproc_i2c_dev *iproc_i2c,
> }
>
> if (!time_left && !iproc_i2c->xfer_is_done) {
> + /*
> + * The controller may fail to clear START_BUSY after a timeout,
> + * reset the controller to recover in that case.
> + */
> + if (!!(iproc_i2c_rd_reg(iproc_i2c, M_CMD_OFFSET) &
> + BIT(M_CMD_START_BUSY_SHIFT))) {
> + bcm_iproc_i2c_enable_disable(iproc_i2c, false);
> + bcm_iproc_i2c_init(iproc_i2c);
> + bcm_iproc_i2c_enable_disable(iproc_i2c, true);
> + }
> +
> /* flush both TX/RX FIFOs */
> val = BIT(M_FIFO_RX_FLUSH_SHIFT) | BIT(M_FIFO_TX_FLUSH_SHIFT);
> iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val);
the patch makes sense to me, but can I have an ack from the
Broadcom folks? Ray? Scott?
Sorry for the late reply. But yea, this reset after timeout when start busy is still set looks good to me. Thanks.
Acked-by: Ray Jui <ray.jui@xxxxxxxxxxxx>
Acked-by: Ray Jui <ray.jui@xxxxxxxxxxxx>
Thanks,
Andi
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature