i2c-eg20t : Support Combined R/W transfer mode

Currently, Combined R/W transfer mode is not supported.
This patch enables Combined R/W transfer mode.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
This commit is contained in:
Tomoya MORINAGA 2011-06-09 11:29:29 +09:00 committed by Ben Dooks
parent 5c470f39ee
commit 7a9c42ccc9
1 changed files with 20 additions and 19 deletions

View File

@ -673,25 +673,26 @@ static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap,
/* transfer not completed */ /* transfer not completed */
adap->pch_i2c_xfer_in_progress = true; adap->pch_i2c_xfer_in_progress = true;
pmsg = &msgs[0]; for (i = 0; i < num; i++) {
pmsg->flags |= adap->pch_buff_mode_en; pmsg = &msgs[i];
status = pmsg->flags; pmsg->flags |= adap->pch_buff_mode_en;
pch_dbg(adap, status = pmsg->flags;
"After invoking I2C_MODE_SEL :flag= 0x%x\n", status); pch_dbg(adap,
/* calculate sub address length and message length */ "After invoking I2C_MODE_SEL :flag= 0x%x\n", status);
/* these are applicable only for buffer mode */ /* calculate sub address length and message length */
subaddrlen = pmsg->buf[0]; /* these are applicable only for buffer mode */
/* calculate actual message length excluding subaddrlen = pmsg->buf[0];
* the sub address fields */ /* calculate actual message length excluding
msglen = (pmsg->len) - (subaddrlen + 1); * the sub address fields */
if (status & (I2C_M_RD)) { msglen = (pmsg->len) - (subaddrlen + 1);
pch_dbg(adap, "invoking pch_i2c_readbytes\n");
ret = pch_i2c_readbytes(i2c_adap, pmsg, (i + 1 == num), if ((status & (I2C_M_RD)) != false) {
(i == 0)); ret = pch_i2c_readbytes(i2c_adap, pmsg, (i + 1 == num),
} else { (i == 0));
pch_dbg(adap, "invoking pch_i2c_writebytes\n"); } else {
ret = pch_i2c_writebytes(i2c_adap, pmsg, (i + 1 == num), ret = pch_i2c_writebytes(i2c_adap, pmsg, (i + 1 == num),
(i == 0)); (i == 0));
}
} }
adap->pch_i2c_xfer_in_progress = false; /* transfer completed */ adap->pch_i2c_xfer_in_progress = false; /* transfer completed */