Small fix with i2c-ismt driver
Subsystems (2)
cover Small fix with i2c-ismt driver
Hi,
This patcheset fix two issue with i2c ismt driver:
Patch1: Use only 2 descriptor for transfer and receive
Patch2: Only copy valid data when transfer
Fan Du (2):
i2c-ismt: Use minimum descriptor size
i2c-ismt: use correct length when copy buffer
drivers/i2c/busses/i2c-ismt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 1410859264-7118-1-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/2 i2c-ismt: Use minimum descriptor size
Software is allowed to allocate number of descriptor size from 2 to 256, this i2c controller could process more descriptor, but for i2c core soft ware layer, only one i2c transaction is allowed each time.
So here switch to minimum 2 descriptor when initialization.
--- drivers/i2c/busses/i2c-ismt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-ismt.c +1 -1
@@ -81,7 +81,7 @@#define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a#define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 -#define ISMT_DESC_ENTRIES 32/* number of descriptor entries */ +#define ISMT_DESC_ENTRIES 2/* number of descriptor entries */ #define ISMT_MAX_RETRIES 3/* number of SMBus retries to attempt */ /* Hardware Descriptor Constants - Control Field */
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 1410859264-7118-2-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Neil Horman
Acked-byRe: [PATCH 1/2] i2c-ismt: Use minimum descriptor size
Quoted 28 lines · Fan Du
Software is allowed to allocate number of descriptor size from 2 to 256, this i2c controller could process more descriptor, but for i2c core soft ware layer, only one i2c transaction is allowed each time.
So here switch to minimum 2 descriptor when initialization.
Signed-off-by Fan Du <[email protected]>--- drivers/i2c/busses/i2c-ismt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-ismt.c +1
-1@@ -81,7 +81,7 @@#define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a#define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 -#define ISMT_DESC_ENTRIES 32/* number of descriptor entries */ +#define ISMT_DESC_ENTRIES 2/* number of descriptor entries */ #define ISMT_MAX_RETRIES 3/* number of SMBus retries to attempt */ /* Hardware Descriptor Constants - Control Field */ Signature · 1 line
1.7.9.5
Wolfram Sang
AppliedRe: [PATCH 1/2] i2c-ismt: Use minimum descriptor size
In reply to a message not in the archiveQuoted 7 lines · Fan Du
Software is allowed to allocate number of descriptor size from 2 to 256, this i2c controller could process more descriptor, but for i2c core soft ware layer, only one i2c transaction is allowed each time.
So here switch to minimum 2 descriptor when initialization.
Signed-off-by Fan Du <[email protected]>
Applied to for-next, thanks!
PATCH 2/2 i2c-ismt: use correct length when copy buffer
In reply to a message not in the archiveIn block write mode, when encapsulating dma_buffer, first element is 'command', the rest is data buffer, so only copy actual data buffer starting from block[1] with the size indicating by block[0].
--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-ismt.c +2 -2
@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, desc->wr_len_cmd = dma_size; desc->control |=ISMT_DESC_BLK ; priv->dma_buffer[0 ] = command; -memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size); +memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size -1 ); }else {/* Block Read */ dev_dbg (dev,"I2C_SMBUS_BLOCK_DATA: READ\n" );
@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, desc->wr_len_cmd = dma_size; desc->control |=ISMT_DESC_I2C ; priv->dma_buffer[0 ] = command; -memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size); +memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size -1 ); }else {/* i2c Block Read */ dev_dbg (dev,"I2C_SMBUS_I2C_BLOCK_DATA: READ\n" );
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 1410859264-7118-3-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Neil Horman
Acked-byRe: [PATCH 2/2] i2c-ismt: use correct length when copy buffer
Quoted 35 lines · Fan Du
In block write mode, when encapsulating
dma_buffer, first element is 'command', the rest is data buffer, so only copy actual data buffer starting from block[1] with the size indicating by block[0].Signed-off-by Fan Du <[email protected]>--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-ismt.c +2
-2@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, desc->wr_len_cmd = dma_size; desc->control |=ISMT_DESC_BLK ; priv->dma_buffer[0 ] = command; -memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size); +memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size -1 ); }else {/* Block Read */ dev_dbg (dev,"I2C_SMBUS_BLOCK_DATA: READ\n" );@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, desc->wr_len_cmd = dma_size; desc->control |=ISMT_DESC_I2C ; priv->dma_buffer[0 ] = command; -memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size); +memcpy (&priv->dma_buffer[1 ], &data->block[1 ], dma_size -1 ); }else {/* i2c Block Read */ dev_dbg (dev,"I2C_SMBUS_I2C_BLOCK_DATA: READ\n" );Signature · 1 line
1.7.9.5
Wolfram Sang
AppliedRe: [PATCH 2/2] i2c-ismt: use correct length when copy buffer
In reply to a message not in the archiveQuoted 5 lines · Fan Du
In block write mode, when encapsulating
dma_buffer, first element is 'command', the rest is data buffer, so only copy actual data buffer starting from block[1] with the size indicating by block[0].Signed-off-by Fan Du <[email protected]>
Applied to for-current and added stable, thanks!