Hi Jean,

can you pick this one up? I think it qualifies as a bugfix.

Regards,

   Wolfram

On Wed, Apr 15, 2009 at 09:45:00AM +0200, Enrik Berkhan wrote:
> Currently, the i2c-algo-pca driver does nothing if the chip enters state
> 0x30 (Data byte in I2CDAT has been transmitted; NOT ACK has been
> received).  Thus, the i2c bus connected to the controller gets stuck
> afterwards.
> 
> I have seen this kind of error on a custom board in certain load
> situations most probably caused by interference or noise.
> 
> A possible reaction is to let the controller generate a STOP condition.
> This is documented in the PCA9564 data sheet (2006-09-01) and the same
> is done for other NACK states as well.
> 
> Further, state 0x38 isn't handled completely, either. Try to do another
> START in this case like the data sheet says. As this couldn't be tested,
> I've added a comment to try to reset the chip if the START doesn't help
> as suggested by Wolfram Sang.
> 
> Signed-off-by: Enrik Berkhan <[email protected]>
> Reviewed-by: Wolfram Sang <[email protected]>
> ---
>  drivers/i2c/algos/i2c-algo-pca.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> Index: drivers/i2c/algos/i2c-algo-pca.c
> ===================================================================
> --- drivers/i2c/algos/i2c-algo-pca.c.orig     2008-12-25 00:26:37.000000000 
> +0100
> +++ drivers/i2c/algos/i2c-algo-pca.c  2009-04-15 09:37:22.000000000 +0200
> @@ -270,10 +270,21 @@ static int pca_xfer(struct i2c_adapter *
>  
>               case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK 
> has been received */
>                       DEB2("NOT ACK received after data byte\n");
> +                     pca_stop(adap);
>                       goto out;
>  
>               case 0x38: /* Arbitration lost during SLA+W, SLA+R or data 
> bytes */
>                       DEB2("Arbitration lost\n");
> +                     /*
> +                      * The PCA9564 data sheet (2006-09-01) says "A
> +                      * START condition will be transmitted when the
> +                      * bus becomes free (STOP or SCL and SDA high)"
> +                      * when the STA bit is set (p. 11).
> +                      *
> +                      * In case this won't work, try pca_reset()
> +                      * instead.
> +                      */
> +                     pca_start(adap);
>                       goto out;
>  
>               case 0x58: /* Data byte has been received; NOT ACK has been 
> returned */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Attachment: signature.asc
Description: Digital signature

Reply via email to