mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
I2C: S3C2410: Check ACK on byte transmission
We should check for the reception of an ACK after transmitting each data byte. The address send has been correctly checking this, but the data write byte state should have also been checking for these failures. As part of the same fix, we remove the ACK checking from the receive path where it should not have been checking for an ACK which our hardware was sending. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
This commit is contained in:
parent
e1441b9a41
commit
2709781be6
@ -323,7 +323,17 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
|
||||
* end of the message, and if so, work out what to do
|
||||
*/
|
||||
|
||||
if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
|
||||
if (iicstat & S3C2410_IICSTAT_LASTBIT) {
|
||||
dev_dbg(i2c->dev, "WRITE: No Ack\n");
|
||||
|
||||
s3c24xx_i2c_stop(i2c, -ECONNREFUSED);
|
||||
goto out_ack;
|
||||
}
|
||||
}
|
||||
|
||||
retry_write:
|
||||
|
||||
if (!is_msgend(i2c)) {
|
||||
byte = i2c->msg->buf[i2c->msg_ptr++];
|
||||
writeb(byte, i2c->regs + S3C2410_IICDS);
|
||||
@ -377,17 +387,6 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
|
||||
* going to do any more read/write
|
||||
*/
|
||||
|
||||
if (!(i2c->msg->flags & I2C_M_IGNORE_NAK) &&
|
||||
!(is_msglast(i2c) && is_lastmsg(i2c))) {
|
||||
|
||||
if (iicstat & S3C2410_IICSTAT_LASTBIT) {
|
||||
dev_dbg(i2c->dev, "READ: No Ack\n");
|
||||
|
||||
s3c24xx_i2c_stop(i2c, -ECONNREFUSED);
|
||||
goto out_ack;
|
||||
}
|
||||
}
|
||||
|
||||
byte = readb(i2c->regs + S3C2410_IICDS);
|
||||
i2c->msg->buf[i2c->msg_ptr++] = byte;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user