Let PCA9564 recover from unacked data byte (state 0x30)
PATCH 1/1 Let PCA9564 recover from unacked data byte (state 0x30)
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 controller data sheet and the same is done for other NACK states as well.
--- drivers/i2c/algos/i2c-algo-pca.c | 2 ++ 1 file changed, 2 insertions(+)
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +2 -0
@@ -270,10 +270,12 @@ 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" ); +// XXX pca_start()? pca_reset()? goto out;case 0x58 :/* Data byte has been received; NOT ACK has been returned */
A message that is not in the archive (sent off-list or not yet received): 20090407103847.GA13586-wEgbaqU1+uOv+36yZLenwA0JkcsJGQge@public.gmane.org
Hi Enrik,
Quoted 22 lines · Enrik Berkhan
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 controller data sheet and the same is done for other NACK states as well.
Signed-off-by Enrik Berkhan <[email protected]>--- drivers/i2c/algos/i2c-algo-pca.c | 2 ++ 1 file changed, 2 insertions(+)Index:
drivers/i2c/algos/i2c-algo-pca.c
===================================================================
i2c/algos/i2c-algo-pca.c static int pca_xfer(struct i2c_adapter * · line 273
Quoted 4 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +1
-0@@ -270,10 +270,12 @@ 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);
This looks okay.
i2c/algos/i2c-algo-pca.c static int pca_xfer(struct i2c_adapter * · line 278
Quoted 5 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +1
-0goto out;case 0x38 :/* Arbitration lost during SLA+W, SLA+R or data bytes */ DEB2 ("Arbitration lost\n" ); +// XXX pca_start()? pca_reset()?
(No // comments, see CodingStyle)
I think we should do something here, too. The manual says something about doing another start. What about doing this and adding a comment that possibly a reset is another thing to try in case of problems?
Quoted 3 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +0
-0goto out;case 0x58 :/* Data byte has been received; NOT ACK has been returned */
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Wolfram,
Quoted 30 lines · Wolfram Sang
Quoted 22 lines · Enrik Berkhan
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 controller data sheet and the same is done for other NACK states as well.
Signed-off-by Enrik Berkhan <[email protected]>--- drivers/i2c/algos/i2c-algo-pca.c | 2 ++ 1 file changed, 2 insertions(+)Index:
drivers/i2c/algos/i2c-algo-pca.c
===================================================================i2c/algos/i2c-algo-pca.c static int pca_xfer(struct i2c_adapter * · line 273
Quoted 4 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +1
-0@@ -270,10 +270,12 @@ 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);This looks okay.
Quoted 7 lines
i2c/algos/i2c-algo-pca.c static int pca_xfer(struct i2c_adapter * · line 278
Quoted 5 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +1
-0goto out;case 0x38 :/* Arbitration lost during SLA+W, SLA+R or data bytes */ DEB2 ("Arbitration lost\n" ); +// XXX pca_start()? pca_reset()? (No // comments, see CodingStyle)
Yes, of course. Read that as "RFC" :)
Quoted 3 lines
I think we should do something here, too. The manual says something about doing another start. What about doing this and adding a comment that possibly a reset is another thing to try in case of problems?
That sounds good. Updated version will follow.
Enrik
Signature · 15 lines
Enrik Berkhan Electronics Design Engineer GE Oil & Gas PII Pipeline Solutions T +49 7244 732 476 F +49 7244 732 304 E [email protected] PII Pipetronix GmbH, Lorenzstraße 10, 76297 Stutensee, Deutschland Geschäftsführer: David Allen, Werner van Wickeren Sitz der Gesellschaft: Stutensee Amtsgericht Mannheim HRB 702297 USt-ID: DE 244323981, Steuer-Nr.: 5930/0173 Deutsche Bank Karlsruhe, BLZ 660 700 04, Kto: 1 435 700 00
PATCH v2 1/1 Let PCA9564 recover from unacked data byte (state 0x30)
In reply to a message not in the archiveCurrently, 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 controller data sheet 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 manual 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.
--- drivers/i2c/algos/i2c-algo-pca.c | 7 +++++++ 1 file changed, 7 insertions(+)
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +7 -0
@@ -270,10 +270,17 @@ 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 manual says to send another start +* condition in this case. If this won't be +* sufficient, try pca_reset() instead. +*/ +pca_start (adap); goto out;case 0x58 :/* Data byte has been received; NOT ACK has been returned */
A message that is not in the archive (sent off-list or not yet received): 20090409093855.GB539-wEgbaqU1+uOv+36yZLenwA0JkcsJGQge@public.gmane.org
Wolfram Sang
Reviewed-byHi Enrik,
one minor nit. If that is sorted out, you can add
Thanks for the patch,
Wolfram
Quoted 28 lines · Enrik Berkhan
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 controller data sheet and the same is done for other NACK states as well.
Further, state
0x38isn't handled completely, either. Try to do another START in this case like the manual 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]>--- drivers/i2c/algos/i2c-algo-pca.c | 7 +++++++ 1 file changed, 7 insertions(+)Index:
drivers/i2c/algos/i2c-algo-pca.c
===================================================================i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +0
-0@@ -270,10 +270,17 @@ static int pca_xfer(struct i2c_adapter *
i2c/algos/i2c-algo-pca.c static int pca_xfer(struct i2c_adapter * · line 280
Quoted 10 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +4
-0case 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 manual says to send another start +* condition in this case. If this won't be
A pointer, where the manual says it, is always helpful (revision, chapter, page number or such).
Quoted 10 lines
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +3
-1+* sufficient, 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
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 Let PCA9564 recover from unacked data byte (state 0x30)
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.
--- drivers/i2c/algos/i2c-algo-pca.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +11 -0
@@ -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 */
A message that is not in the archive (sent off-list or not yet received): 20090415074500.GA629-wEgbaqU1+uOv+36yZLenwA0JkcsJGQge@public.gmane.org
Hi Jean,
can you pick this one up? I think it qualifies as a bugfix.
Regards,
Wolfram
Quoted 53 lines · Enrik Berkhan
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
0x38isn'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
===================================================================i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +11
-1@@ -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
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Wolfram,
Quoted 3 lines · Wolfram Sang
Hi Jean,
can you pick this one up? I think it qualifies as a bugfix.
Sure! Sorry I had missed your review. It's queued up for 2.6.30 now.
Quoted 60 lines
Regards,
Wolfram
Quoted 53 lines · Enrik Berkhan
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
0x38isn'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
===================================================================i2c/algos/i2c-algo-pca.c renamed from i2c/algos/i2c-algo-pca.c.orig +11
-1@@ -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
Signature · 1 line
Jean Delvare