Unverified Commit 7e2c0876 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5932 [sync] PR-5895: i2c: i801: Fix block process call transactions

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/5895 
 
PR sync from: Liao Chen <liaochen4@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/MP5WRJGPAQWUNCND6JWO6SSBEYJMBV5O/ 
According to the Intel datasheets, software must reset the block
buffer index twice for block process call transactions: once before
writing the outgoing data to the buffer, and once again before
reading the incoming data from the buffer.

The driver is currently missing the second reset, causing the wrong
portion of the block buffer to be read.

Jean Delvare (1):
  i2c: i801: Fix block process call transactions


-- 
2.34.1
 
https://gitee.com/src-openeuler/kernel/issues/I93ELY 
 
Link:https://gitee.com/openeuler/kernel/pulls/5932

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 3195027d ebb8558f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -540,12 +540,11 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
		return -EOPNOTSUPP;
	}

	inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */

	/* Use 32-byte buffer to process this transaction */
	if (read_write == I2C_SMBUS_WRITE) {
		len = data->block[0];
		outb_p(len, SMBHSTDAT0(priv));
		inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */
		for (i = 0; i < len; i++)
			outb_p(data->block[i+1], SMBBLKDAT(priv));
	}
@@ -561,6 +560,7 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
			return -EPROTO;

		data->block[0] = len;
		inb_p(SMBHSTCNT(priv));	/* reset the data buffer index */
		for (i = 0; i < len; i++)
			data->block[i + 1] = inb_p(SMBBLKDAT(priv));
	}