i2c: ismt: Separate I2C block read from SMBus block read
authorPontus Andersson <epontan@gmail.com>
Mon, 2 Oct 2017 12:45:19 +0000 (14:45 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 13 Oct 2017 18:31:03 +0000 (20:31 +0200)
commitc6ebcedbab7ca78984959386012a17b21183e1a3
tree1ee43b48f351506a1cbe97d3bb6fb488e9845aa0
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f
i2c: ismt: Separate I2C block read from SMBus block read

Commit b6c159a9cb69 ("i2c: ismt: Don't duplicate the receive length for
block reads") broke I2C block reads. It aimed to fix normal SMBus block
read, but changed the correct behavior of I2C block read in the process.

According to Documentation/i2c/smbus-protocol, one vital difference
between normal SMBus block read and I2C block read is that there is no
byte count prefixed in the data sent on the wire:

 SMBus Block Read:  i2c_smbus_read_block_data()
 S Addr Wr [A] Comm [A]
            S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P

 I2C Block Read:  i2c_smbus_read_i2c_block_data()
 S Addr Wr [A] Comm [A]
            S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P

Therefore the two transaction types need to be processed differently in
the driver by copying of the dma_buffer as done previously for the
I2C_SMBUS_I2C_BLOCK_DATA case.

Fixes: b6c159a9cb69 ("i2c: ismt: Don't duplicate the receive length for block reads")
Signed-off-by: Pontus Andersson <epontan@gmail.com>
Tested-by: Stephen Douthit <stephend@adiengineering.com>
Cc: stable@vger.kernel.org
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-ismt.c