Re: [PATCH] i2c: cgbc: Fetch the status of a write transfer
From: Andi Shyti
Date: Thu Nov 26 2026 - 08:15:01 EST
Hi Thomas and Markus,
> > diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c
> > index dfdb9ffc6447..2361591a1e31 100644
> > --- a/drivers/i2c/busses/i2c-cgbc.c
> > +++ b/drivers/i2c/busses/i2c-cgbc.c
> > @@ -254,6 +254,22 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap)
> > ret = cgbc_command(cgbc, &cmd, cmd_len, NULL, 0, NULL);
> > if (ret)
> > goto err;
> > +
> > + ret = read_poll_timeout(cgbc_i2c_get_status, status,
> > + status != CGBC_I2C_STAT_BUSY, 0,
> > + 2 * algo_data->read_maxtime_us, false, adap);
would it make sense use USEC_PER_SEC here to preserve the
existing one-second timeout between write chunks?
> > + if (ret)
> > + goto err;
> > +
> > + if (status < 0) {
> > + ret = status;
> > + goto err;
> > + }
> > +
> > + if (status != CGBC_I2C_STAT_IDL) {
> > + ret = -EIO;
> > + goto err;
> > + }
> > } else if (i2c->state == CGBC_I2C_STATE_READ) {
> > xfer.write = 0;
> > xfer.read = len;
>
> I was able to reproduce the issue on conga-SA7 (and also the reboot crash).
>
> $ i2ctransfer -y 11 w1@0x40 0x00 <- non-existing device
> $ i2ctransfer -y 11 w1@0x50 0x00 r1@0x50 <- read EEPROM
> Error: Sending messages failed: Input/output error
> $ i2ctransfer -y 11 w1@0x50 0x00 r1@0x50 <- read EEPROM
> 0x01
>
> And with your patch:
>
> $ i2ctransfer -y 11 w1@0x40 0x00 <- non-existing device
> Error: Sending messages failed: Input/output error
> $ i2ctransfer -y 11 w1@0x50 0x00 r1@0x50 <- read EEPROM
> 0x01
>
> Reviewed-by: Thomas Richard (congatec GmbH) <thomas.richard@xxxxxxxxxxx>
> Tested-by: Thomas Richard (congatec GmbH) <thomas.richard@xxxxxxxxxxx>
>
> Yes it conflicts (compile issue) with the series [1]. The possibilies are:
> - I pick this patch in my series and send a v7.
> - [1] is applied, an immutable branch is created, you rebase your patch on
> top of it, and patch is applied in I2C tree.
> - [1] is applied, you rebase on top of mfd-next, and your patch is applied
> in MFD tree.
>
> Andi, Lee, what do you prefer?
Let's wait your patches to get in first and then Markus can
rebase on top of them.
I will now prioritize your series.
Thanks,
Andi