* [PATCH 0/2] Small fix with i2c-ismt driver
@ 2014-09-16 9:21 Fan Du
[not found] ` <1410859264-7118-1-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Fan Du @ 2014-09-16 9:21 UTC (permalink / raw)
To: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
nhorman-2XuSBdqkA4R54TAoqtyWWQ
Cc: fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, Fan Du
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(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] i2c-ismt: Use minimum descriptor size
[not found] ` <1410859264-7118-1-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-09-16 9:21 ` Fan Du
[not found] ` <1410859264-7118-2-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 9:21 ` [PATCH 2/2] i2c-ismt: use correct length when copy buffer Fan Du
1 sibling, 1 reply; 7+ messages in thread
From: Fan Du @ 2014-09-16 9:21 UTC (permalink / raw)
To: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
nhorman-2XuSBdqkA4R54TAoqtyWWQ
Cc: fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-ismt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
index 9844925..8a0275c 100644
--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -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 */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] i2c-ismt: use correct length when copy buffer
[not found] ` <1410859264-7118-1-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 9:21 ` [PATCH 1/2] i2c-ismt: Use minimum descriptor size Fan Du
@ 2014-09-16 9:21 ` Fan Du
[not found] ` <1410859264-7118-3-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 7+ messages in thread
From: Fan Du @ 2014-09-16 9:21 UTC (permalink / raw)
To: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
nhorman-2XuSBdqkA4R54TAoqtyWWQ
Cc: fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-ismt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
index 8a0275c..3f6ecbf 100644
--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -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");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c-ismt: Use minimum descriptor size
[not found] ` <1410859264-7118-2-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-09-16 10:18 ` Neil Horman
2014-09-20 12:55 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Neil Horman @ 2014-09-16 10:18 UTC (permalink / raw)
To: Fan Du
Cc: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Tue, Sep 16, 2014 at 05:21:03PM +0800, Fan Du wrote:
> 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-ismt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
> index 9844925..8a0275c 100644
> --- a/drivers/i2c/busses/i2c-ismt.c
> +++ b/drivers/i2c/busses/i2c-ismt.c
> @@ -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 */
> --
> 1.7.9.5
>
>
Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i2c-ismt: use correct length when copy buffer
[not found] ` <1410859264-7118-3-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-09-16 10:18 ` Neil Horman
2014-09-20 12:58 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Neil Horman @ 2014-09-16 10:18 UTC (permalink / raw)
To: Fan Du
Cc: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Tue, Sep 16, 2014 at 05:21:04PM +0800, Fan Du wrote:
> 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-ismt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
> index 8a0275c..3f6ecbf 100644
> --- a/drivers/i2c/busses/i2c-ismt.c
> +++ b/drivers/i2c/busses/i2c-ismt.c
> @@ -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");
> --
> 1.7.9.5
>
>
Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c-ismt: Use minimum descriptor size
[not found] ` <1410859264-7118-2-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 10:18 ` Neil Horman
@ 2014-09-20 12:55 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2014-09-20 12:55 UTC (permalink / raw)
To: Fan Du
Cc: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
nhorman-2XuSBdqkA4R54TAoqtyWWQ,
fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
On Tue, Sep 16, 2014 at 05:21:03PM +0800, Fan Du wrote:
> 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Applied to for-next, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i2c-ismt: use correct length when copy buffer
[not found] ` <1410859264-7118-3-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 10:18 ` Neil Horman
@ 2014-09-20 12:58 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2014-09-20 12:58 UTC (permalink / raw)
To: Fan Du
Cc: seth.heasley-ral2JQCrhuEAvxtiuMwx3w,
nhorman-2XuSBdqkA4R54TAoqtyWWQ,
fengyuleidian0615-Re5JQEeQqe8AvxtiuMwx3w,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Tue, Sep 16, 2014 at 05:21:04PM +0800, Fan Du wrote:
> 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 <fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Applied to for-current and added stable, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-20 12:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 9:21 [PATCH 0/2] Small fix with i2c-ismt driver Fan Du
[not found] ` <1410859264-7118-1-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 9:21 ` [PATCH 1/2] i2c-ismt: Use minimum descriptor size Fan Du
[not found] ` <1410859264-7118-2-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 10:18 ` Neil Horman
2014-09-20 12:55 ` Wolfram Sang
2014-09-16 9:21 ` [PATCH 2/2] i2c-ismt: use correct length when copy buffer Fan Du
[not found] ` <1410859264-7118-3-git-send-email-fan.du-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-16 10:18 ` Neil Horman
2014-09-20 12:58 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).