i2c: at91: fix SMBus quick command
Subsystems (2)
PATCH v2 1/1 i2c: at91: fix SMBus quick command
From: Ludovic Desroches <[email protected]>
The driver claims to support SMBus quick command but it was not the case. This patch fixes this issue.
---
Hi Wolfram,
Thanks to Jean explanation about i2cdetect and eeprom behavior, I realized that the first version of the patch was incorrect. This time all the i2c devices are detected with i2cdetect -q.
I hope this fix could go into 3.7 since the driver claims SMBus quick capability but it doesn't support it. Moreover without it i2cdetect find imaginary devices, and with some IP versions, trying to send 0 byte can cause issue when writing data to an EEPROM.
Regards
Ludovic
Changes since v1:
* enable txcomp irq to have a correct behavior
drivers/i2c/busses/i2c-at91.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-at91.c +6 -1
@@ -44,6 +44,7 @@#define AT91_TWI_STOP 0x0002/* Send a Stop Condition */ #define AT91_TWI_MSEN 0x0004/* Master Transfer Enable */ #define AT91_TWI_SVDIS 0x0020/* Slave Transfer Disable */ +#define AT91_TWI_QUICK 0x0040/* SMBus quick command */ #define AT91_TWI_SWRST 0x0080/* Software Reset */ #define AT91_TWI_MMR 0x0004/* Master Mode Register */
@@ -386,7 +387,11 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)INIT_COMPLETION (dev->cmd_complete); dev->transfer_status =0 ; -if (dev->msg->flags &I2C_M_RD ) { + +if (!dev->buf_len) { +at91_twi_write (dev,AT91_TWI_CR ,AT91_TWI_QUICK ); +at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_TXCOMP ); + }else if (dev->msg->flags &I2C_M_RD ) {unsigned start_flags =AT91_TWI_START ;if (at91_twi_read (dev,AT91_TWI_SR ) &AT91_TWI_RXRDY ) {
Signature · 1 line
1.7.11.3
PATCH v2 1/1 i2c: at91: fix SMBus quick command
Quoted 6 lines · ludovic.desroches at atmel.com
From: Ludovic Desroches <[email protected]>
The driver claims to support SMBus quick command but it was not the case. This patch fixes this issue.
Signed-off-by Ludovic Desroches <[email protected]>
Best Regards
J.
PATCH v2 1/1 i2c: at91: fix SMBus quick command
In reply to ludovic.desroches at atmel.comQuoted 10 lines · ludovic.desroches at atmel.com
From: Ludovic Desroches <[email protected]>
The driver claims to support SMBus quick command but it was not the case. This patch fixes this issue.
Signed-off-by Ludovic Desroches <[email protected]>---
Hi Wolfram,
Quoted 8 lines
Thanks to Jean explanation about i2cdetect and eeprom behavior, I realized that the first version of the patch was incorrect. This time all the i2c devices are detected with i2cdetect -q.
I hope this fix could go into 3.7 since the driver claims SMBus quick capability but it doesn't support it. Moreover without it i2cdetect find imaginary devices, and with some IP versions, trying to send 0 byte can cause issue when writing data to an EEPROM.
Updated the commit message with the latter paragraph and added to for-current, thanks!
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/45ccbe2b/attachment-0001.sig>