linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste receive mode
       [not found] <0001-i2c-rk3x-fix-bug-that-cause-transfer-fails-in-master.patch>
@ 2014-08-21 21:38 ` Addy Ke
  2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
  2014-08-22  1:14   ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste " Doug Anderson
  0 siblings, 2 replies; 10+ messages in thread
From: Addy Ke @ 2014-08-21 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
must be less than or equal 32 bytes at a time.

Tested on rk3288-pinky board, elan receive 158 bytes data.

Acked-by: Max Schwarz <max.schwarz@online.de>
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
---
Changes in v2:
- Use cleaner syntax as suggested by Sergei.
- Update commit message as suggested by Wolfram.

 drivers/i2c/busses/i2c-rk3x.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 69e1185..806724a 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
 	/* ack interrupt */
 	i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
 
+	/* Can only handle a maximum of 32 bytes at a time */
+	if (unlikely(len > 32))
+		len  = 32;
+
 	/* read the data from receive buffer */
 	for (i = 0; i < len; ++i) {
 		if (i % 4 == 0)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-21 21:38 ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste receive mode Addy Ke
@ 2014-08-22  1:13   ` Addy Ke
  2014-08-22  1:15     ` Doug Anderson
                       ` (2 more replies)
  2014-08-22  1:14   ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste " Doug Anderson
  1 sibling, 3 replies; 10+ messages in thread
From: Addy Ke @ 2014-08-22  1:13 UTC (permalink / raw)
  To: linux-arm-kernel

In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
must be less than or equal 32 bytes at a time.

Tested on rk3288-pinky board, elan receive 158 bytes data.

Acked-by: Max Schwarz <max.schwarz@online.de>
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
---
Changes in v2:
- Use cleaner syntax as suggested by Sergei.
- Update commit message as suggested by Wolfram.

Changes in v3:
- fix typo: maste --> master and double spaces after 'len'

 drivers/i2c/busses/i2c-rk3x.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 69e1185..806724a 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
 	/* ack interrupt */
 	i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
 
+	/* Can only handle a maximum of 32 bytes at a time */
+	if (unlikely(len > 32))
+		len = 32;
+
 	/* read the data from receive buffer */
 	for (i = 0; i < len; ++i) {
 		if (i % 4 == 0)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste receive mode
  2014-08-21 21:38 ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste receive mode Addy Ke
  2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
@ 2014-08-22  1:14   ` Doug Anderson
  1 sibling, 0 replies; 10+ messages in thread
From: Doug Anderson @ 2014-08-22  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

Addy,

Title should probably have "master", not "maste"

On Thu, Aug 21, 2014 at 2:38 PM, Addy Ke <addy.ke@rock-chips.com> wrote:
> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
> must be less than or equal 32 bytes at a time.
>
> Tested on rk3288-pinky board, elan receive 158 bytes data.
>
> Acked-by: Max Schwarz <max.schwarz@online.de>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> ---
> Changes in v2:
> - Use cleaner syntax as suggested by Sergei.
> - Update commit message as suggested by Wolfram.
>
>  drivers/i2c/busses/i2c-rk3x.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index 69e1185..806724a 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
>         /* ack interrupt */
>         i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
>
> +       /* Can only handle a maximum of 32 bytes at a time */
> +       if (unlikely(len > 32))
> +               len  = 32;

nit: one space before "=", not two.

Tested-by: Doug Anderson <dianders@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
@ 2014-08-22  1:15     ` Doug Anderson
  2014-08-22 16:16     ` Dmitry Torokhov
  2014-08-22 18:00     ` [PATCH v4] " Addy Ke
  2 siblings, 0 replies; 10+ messages in thread
From: Doug Anderson @ 2014-08-22  1:15 UTC (permalink / raw)
  To: linux-arm-kernel

Addy,

On Thu, Aug 21, 2014 at 6:13 PM, Addy Ke <addy.ke@rock-chips.com> wrote:
> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
> must be less than or equal 32 bytes at a time.
>
> Tested on rk3288-pinky board, elan receive 158 bytes data.
>
> Acked-by: Max Schwarz <max.schwarz@online.de>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> ---
> Changes in v2:
> - Use cleaner syntax as suggested by Sergei.
> - Update commit message as suggested by Wolfram.
>
> Changes in v3:
> - fix typo: maste --> master and double spaces after 'len'
>
>  drivers/i2c/busses/i2c-rk3x.c | 4 ++++
>  1 file changed, 4 insertions(+)

Oops, we collided in the ether.  This looks good to me.

Tested-by: Doug Anderson <dianders@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
  2014-08-22  1:15     ` Doug Anderson
@ 2014-08-22 16:16     ` Dmitry Torokhov
  2014-08-22 18:00     ` [PATCH v4] " Addy Ke
  2 siblings, 0 replies; 10+ messages in thread
From: Dmitry Torokhov @ 2014-08-22 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Addy,

On Fri, Aug 22, 2014 at 09:13:11AM +0800, Addy Ke wrote:
> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
> must be less than or equal 32 bytes at a time.
> 
> Tested on rk3288-pinky board, elan receive 158 bytes data.
> 
> Acked-by: Max Schwarz <max.schwarz@online.de>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> ---
> Changes in v2:
> - Use cleaner syntax as suggested by Sergei.
> - Update commit message as suggested by Wolfram.
> 
> Changes in v3:
> - fix typo: maste --> master and double spaces after 'len'
> 
>  drivers/i2c/busses/i2c-rk3x.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index 69e1185..806724a 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
>  	/* ack interrupt */
>  	i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
>  
> +	/* Can only handle a maximum of 32 bytes at a time */
> +	if (unlikely(len > 32))
> +		len = 32;

I do not think we should be using unlikely here (and in another spot in the
driver): unlikely should be used only if the condition happens extremely
infrequently in all of the systems. Here, if a box happens to have a device
that uses transfers larger than 32 bytes we'd be hitting unlikely branch pretty
often.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
  2014-08-22  1:15     ` Doug Anderson
  2014-08-22 16:16     ` Dmitry Torokhov
@ 2014-08-22 18:00     ` Addy Ke
  2014-08-22 18:33       ` Doug Anderson
  2014-09-02 11:01       ` Wolfram Sang
  2 siblings, 2 replies; 10+ messages in thread
From: Addy Ke @ 2014-08-22 18:00 UTC (permalink / raw)
  To: linux-arm-kernel

In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
must be less than or equal 32 bytes at a time.

Tested on rk3288-pinky board, elan receive 158 bytes data.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Acked-by: Max Schwarz <max.schwarz@online.de>
---
Changes in v2:
- Use cleaner syntax as suggested by Sergei.
- Update commit message as suggested by Wolfram.

Changes in v3:
- fix typo: maste --> master and double spaces after 'len'
 drivers/i2c/busses/i2c-rk3x.c | 4 ++++

Changes in v4:
- remove unlikely() annotations, suggested by Dmitry Torokhov

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index b8b2b89..31de730 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
 	/* ack interrupt */
 	i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
 
+	/* Can only handle a maximum of 32 bytes at a time */
+	if (len > 32)
+		len = 32;
+
 	/* read the data from receive buffer */
 	for (i = 0; i < len; ++i) {
 		if (i % 4 == 0)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22 18:00     ` [PATCH v4] " Addy Ke
@ 2014-08-22 18:33       ` Doug Anderson
  2014-08-22 18:47         ` addy ke
  2014-09-02 11:01       ` Wolfram Sang
  1 sibling, 1 reply; 10+ messages in thread
From: Doug Anderson @ 2014-08-22 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

Addy,

On Fri, Aug 22, 2014 at 11:00 AM, Addy Ke <addy.ke@rock-chips.com> wrote:
> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
> must be less than or equal 32 bytes at a time.
>
> Tested on rk3288-pinky board, elan receive 158 bytes data.
>
> Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

You only need a "Suggested-by" if the entire patch was suggested by
someone.  If someone provides you review feedback you don't need it.

Said another way: in this case Dmitry didn't suggest that you need to
fix the i2c controller to transmit 32 byte chunks (he only provided
review feedback), so you shouldn't say this was Suggested-by him.

You also had my reviewed-by on a previous version so you could keep it.

Reviewed-by: Doug Anderson <dianders@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22 18:33       ` Doug Anderson
@ 2014-08-22 18:47         ` addy ke
  2014-08-22 20:04           ` Doug Anderson
  0 siblings, 1 reply; 10+ messages in thread
From: addy ke @ 2014-08-22 18:47 UTC (permalink / raw)
  To: linux-arm-kernel

> Addy,
> 
> On Fri, Aug 22, 2014 at 11:00 AM, Addy Ke <addy.ke@rock-chips.com> wrote:
>> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
>> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
>> must be less than or equal 32 bytes at a time.
>>
>> Tested on rk3288-pinky board, elan receive 158 bytes data.
>>
>> Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> You only need a "Suggested-by" if the entire patch was suggested by
> someone.  If someone provides you review feedback you don't need it.
> 
> Said another way: in this case Dmitry didn't suggest that you need to
> fix the i2c controller to transmit 32 byte chunks (he only provided
> review feedback), so you shouldn't say this was Suggested-by him.
> 
> You also had my reviewed-by on a previous version so you could keep it.
> 
> Reviewed-by: Doug Anderson <dianders@chromium.org>

so, Do I need repost this patch or post a new one as patch v5?
> 
> 
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22 18:47         ` addy ke
@ 2014-08-22 20:04           ` Doug Anderson
  0 siblings, 0 replies; 10+ messages in thread
From: Doug Anderson @ 2014-08-22 20:04 UTC (permalink / raw)
  To: linux-arm-kernel

Addy,

On Fri, Aug 22, 2014 at 11:47 AM, addy ke <addy.ke@rock-chips.com> wrote:
>> Addy,
>>
>> On Fri, Aug 22, 2014 at 11:00 AM, Addy Ke <addy.ke@rock-chips.com> wrote:
>>> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
>>> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
>>> must be less than or equal 32 bytes at a time.
>>>
>>> Tested on rk3288-pinky board, elan receive 158 bytes data.
>>>
>>> Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>
>> You only need a "Suggested-by" if the entire patch was suggested by
>> someone.  If someone provides you review feedback you don't need it.
>>
>> Said another way: in this case Dmitry didn't suggest that you need to
>> fix the i2c controller to transmit 32 byte chunks (he only provided
>> review feedback), so you shouldn't say this was Suggested-by him.
>>
>> You also had my reviewed-by on a previous version so you could keep it.
>>
>> Reviewed-by: Doug Anderson <dianders@chromium.org>
>
> so, Do I need repost this patch or post a new one as patch v5?

Tags are typically something that the maintainer (Wolfram) can adjust
when he adds his own.  I think it's OK and he can remove the
"Suggested-by".  However, if Wolfram responds and asks you to respin
then you should follow his advice.


-Doug

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] i2c: rk3x: fix bug that cause transfer fails in master receive mode
  2014-08-22 18:00     ` [PATCH v4] " Addy Ke
  2014-08-22 18:33       ` Doug Anderson
@ 2014-09-02 11:01       ` Wolfram Sang
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2014-09-02 11:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 23, 2014 at 02:00:52AM +0800, Addy Ke wrote:
> In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data
> in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx
> must be less than or equal 32 bytes at a time.
> 
> Tested on rk3288-pinky board, elan receive 158 bytes data.
> 
> Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> Acked-by: Max Schwarz <max.schwarz@online.de>

Applied to for-current, thanks! Please don't send new versions of a
patch as reply-to of a previous version.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140902/b1524370/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-09-02 11:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0001-i2c-rk3x-fix-bug-that-cause-transfer-fails-in-master.patch>
2014-08-21 21:38 ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste receive mode Addy Ke
2014-08-22  1:13   ` [PATCH v3] i2c: rk3x: fix bug that cause transfer fails in master " Addy Ke
2014-08-22  1:15     ` Doug Anderson
2014-08-22 16:16     ` Dmitry Torokhov
2014-08-22 18:00     ` [PATCH v4] " Addy Ke
2014-08-22 18:33       ` Doug Anderson
2014-08-22 18:47         ` addy ke
2014-08-22 20:04           ` Doug Anderson
2014-09-02 11:01       ` Wolfram Sang
2014-08-22  1:14   ` [PATCH v2] i2c: rk3x: fix bug that cause transfer fails in maste " Doug Anderson

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).