Re: [PATCH v6 07/19] i2c: octeon: Use i2c recovery framework
From: Wolfram Sang
Date: Wed Apr 20 2016 - 17:31:31 EST
On Mon, Apr 11, 2016 at 05:28:38PM +0200, Jan Glauber wrote:
> Switch to the i2c bus recovery framework using generic SCL recovery.
> If this fails try to reset the hardware. The recovery is triggered
> during START on timeout of the interrupt or failure to reach
> the START / repeated-START condition.
>
> The START function is moved to xfer and while at it:
> - removed xfer debug message (i2c core already provides debugging)
> - removed length is zero check
>
> Signed-off-by: Jan Glauber <jglauber@xxxxxxxxxx>
> ---
> drivers/i2c/busses/i2c-octeon.c | 178 +++++++++++++++++++++++++---------------
> 1 file changed, 111 insertions(+), 67 deletions(-)
Interesting, it got larger...
>
> +/**
> + * octeon_i2c_write_int - read the TWSI_INT register
read_int
> + int ret, retries = 2;
I don't think 'retries' makes sense here. On failure, you return
-EAGAIN, so the core will retry 'adapter->retries' times anyhow.
> - if (length < 1)
> - return -EINVAL;
So, the adapter support 0-length messages now? Or why was it there? I
have the feeling this is a seperate patch.
> +static void octeon_i2c_prepare_recovery(struct i2c_adapter *adap)
> +{
> + struct octeon_i2c *i2c = i2c_get_adapdata(adap);
> +
> + /*
> + * The stop resets the state machine, does not _transmit_ STOP unless
> + * engine was active.
> + */
> + octeon_i2c_stop(i2c);
> +
> + octeon_i2c_write_int(i2c, 0);
Maybe a comment why the delay?
> + udelay(5);
> +}
Attachment:
signature.asc
Description: PGP signature