Skip to content

Commit c1c9d0f

Browse files
jdelvareAndi Shyti
authored andcommitted
i2c: i801: Fix block process call transactions
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. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reported-by: Piotr Zakowski <piotr.zakowski@intel.com> Closes: https://lore.kernel.org/linux-i2c/20240213120553.7b0ab120@endymion.delvare/ Fixes: 315cd67 ("i2c: i801: Add Block Write-Block Read Process Call support") Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent f44bff1 commit c1c9d0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-i801.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,10 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
498498
/* Set block buffer mode */
499499
outb_p(inb_p(SMBAUXCTL(priv)) | SMBAUXCTL_E32B, SMBAUXCTL(priv));
500500

501-
inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */
502-
503501
if (read_write == I2C_SMBUS_WRITE) {
504502
len = data->block[0];
505503
outb_p(len, SMBHSTDAT0(priv));
504+
inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */
506505
for (i = 0; i < len; i++)
507506
outb_p(data->block[i+1], SMBBLKDAT(priv));
508507
}
@@ -520,6 +519,7 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
520519
}
521520

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

0 commit comments

Comments
 (0)