提交 908cf12b 编写于 作者: J Jan Glauber 提交者: Wolfram Sang

i2c: octeon: Missing AAK flag in case of I2C_M_RECV_LEN

During receive the controller requires the AAK flag for all
bytes but the final one. This was wrong in case of I2C_M_RECV_LEN,
where the decision if the final byte is to be transmitted
happened before adding the additional received length byte.

Set the AAK flag if additional bytes are to be received.
Signed-off-by: NJan Glauber <jglauber@cavium.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 a7ae8195
...@@ -934,8 +934,15 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, ...@@ -934,8 +934,15 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
return result; return result;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
/* for the last byte TWSI_CTL_AAK must not be set */ /*
if (i + 1 == length) * For the last byte to receive TWSI_CTL_AAK must not be set.
*
* A special case is I2C_M_RECV_LEN where we don't know the
* additional length yet. If recv_len is set we assume we're
* not reading the final byte and therefore need to set
* TWSI_CTL_AAK.
*/
if ((i + 1 == length) && !(recv_len && i == 0))
final_read = true; final_read = true;
/* clear iflg to allow next event */ /* clear iflg to allow next event */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册