Commit 5e9a97b1 authored by Mario Alejandro Posso Escobar's avatar Mario Alejandro Posso Escobar Committed by Wolfram Sang

i2c: ismt: Adding support for I2C_SMBUS_BLOCK_PROC_CALL

Expand the driver to support I2C_SMBUS_BLOCK_PROC_CALL since
HW supports it already.
Co-developed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMario Alejandro Posso Escobar <mario.posso.escobar@intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent dc4e10b6
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* Features supported by this driver: * Features supported by this driver:
* Hardware PEC yes * Hardware PEC yes
* Block buffer yes * Block buffer yes
* Block process call transaction no * Block process call transaction yes
* Slave mode no * Slave mode no
*/ */
...@@ -332,7 +332,8 @@ static int ismt_process_desc(const struct ismt_desc *desc, ...@@ -332,7 +332,8 @@ static int ismt_process_desc(const struct ismt_desc *desc,
if (desc->status & ISMT_DESC_SCS) { if (desc->status & ISMT_DESC_SCS) {
if (read_write == I2C_SMBUS_WRITE && if (read_write == I2C_SMBUS_WRITE &&
size != I2C_SMBUS_PROC_CALL) size != I2C_SMBUS_PROC_CALL &&
size != I2C_SMBUS_BLOCK_PROC_CALL)
return 0; return 0;
switch (size) { switch (size) {
...@@ -345,6 +346,7 @@ static int ismt_process_desc(const struct ismt_desc *desc, ...@@ -345,6 +346,7 @@ static int ismt_process_desc(const struct ismt_desc *desc,
data->word = dma_buffer[0] | (dma_buffer[1] << 8); data->word = dma_buffer[0] | (dma_buffer[1] << 8);
break; break;
case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA:
case I2C_SMBUS_BLOCK_PROC_CALL:
if (desc->rxbytes != dma_buffer[0] + 1) if (desc->rxbytes != dma_buffer[0] + 1)
return -EMSGSIZE; return -EMSGSIZE;
...@@ -518,6 +520,18 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, ...@@ -518,6 +520,18 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
} }
break; break;
case I2C_SMBUS_BLOCK_PROC_CALL:
dev_dbg(dev, "I2C_SMBUS_BLOCK_PROC_CALL\n");
dma_size = I2C_SMBUS_BLOCK_MAX;
desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, 1);
desc->wr_len_cmd = data->block[0] + 1;
desc->rd_len = dma_size;
desc->control |= ISMT_DESC_BLK;
dma_direction = DMA_BIDIRECTIONAL;
dma_buffer[0] = command;
memcpy(&dma_buffer[1], &data->block[1], data->block[0]);
break;
case I2C_SMBUS_I2C_BLOCK_DATA: case I2C_SMBUS_I2C_BLOCK_DATA:
/* Make sure the length is valid */ /* Make sure the length is valid */
if (data->block[0] < 1) if (data->block[0] < 1)
...@@ -624,6 +638,7 @@ static u32 ismt_func(struct i2c_adapter *adap) ...@@ -624,6 +638,7 @@ static u32 ismt_func(struct i2c_adapter *adap)
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_PROC_CALL |
I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_I2C_BLOCK |
I2C_FUNC_SMBUS_PEC; I2C_FUNC_SMBUS_PEC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment