All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Schwarz <max.schwarz-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
To: Alexandru M Stan <amstan-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Sonny Rao <sonnyrao-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	addy ke <addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	ZhengShunQian <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] i2c: rk3x: fix 0 length write transfers
Date: Thu, 02 Oct 2014 15:30:47 +0200	[thread overview]
Message-ID: <2239755.0FknEeHYOT@typ> (raw)
In-Reply-To: <1412185241-24950-1-git-send-email-amstan-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Hi Alexandru,

On Wednesday 01 October 2014 at 10:40:41, Alexandru M Stan wrote:
> i2cdetect -q was broken (everything was a false positive, and no transfers
> were actually being sent over i2c). The way it works is by sending a 0
> length write request and checking for NACK. This patch fixes the 0 length
> writes and actually sends them.
> 
> Reported-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Alexandru M Stan <amstan-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-rk3x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index b41d979..f486d0e 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c
> *i2c) for (i = 0; i < 8; ++i) {
>  		val = 0;
>  		for (j = 0; j < 4; ++j) {
> -			if (i2c->processed == i2c->msg->len)
> +			if ((i2c->processed == i2c->msg->len) && (cnt != 0))
>  				break;
> 
>  			if (i2c->processed == 0 && cnt == 0)

Yes, looks correct and makes i2cdetect work for me on Radxa Rock.

Reviewed-By: Max Schwarz <max.schwarz-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
Tested-By: Max Schwarz <max.schwarz-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>

Cheers,
  Max

WARNING: multiple messages have this Message-ID (diff)
From: max.schwarz@online.de (Max Schwarz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] i2c: rk3x: fix 0 length write transfers
Date: Thu, 02 Oct 2014 15:30:47 +0200	[thread overview]
Message-ID: <2239755.0FknEeHYOT@typ> (raw)
In-Reply-To: <1412185241-24950-1-git-send-email-amstan@chromium.org>

Hi Alexandru,

On Wednesday 01 October 2014 at 10:40:41, Alexandru M Stan wrote:
> i2cdetect -q was broken (everything was a false positive, and no transfers
> were actually being sent over i2c). The way it works is by sending a 0
> length write request and checking for NACK. This patch fixes the 0 length
> writes and actually sends them.
> 
> Reported-by: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Alexandru M Stan <amstan@chromium.org>
> ---
>  drivers/i2c/busses/i2c-rk3x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index b41d979..f486d0e 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c
> *i2c) for (i = 0; i < 8; ++i) {
>  		val = 0;
>  		for (j = 0; j < 4; ++j) {
> -			if (i2c->processed == i2c->msg->len)
> +			if ((i2c->processed == i2c->msg->len) && (cnt != 0))
>  				break;
> 
>  			if (i2c->processed == 0 && cnt == 0)

Yes, looks correct and makes i2cdetect work for me on Radxa Rock.

Reviewed-By: Max Schwarz <max.schwarz@online.de>
Tested-By: Max Schwarz <max.schwarz@online.de>

Cheers,
  Max

WARNING: multiple messages have this Message-ID (diff)
From: Max Schwarz <max.schwarz@online.de>
To: Alexandru M Stan <amstan@chromium.org>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Doug Anderson <dianders@chromium.org>,
	Sonny Rao <sonnyrao@chromium.org>,
	addy ke <addy.ke@rock-chips.com>,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	ZhengShunQian <zhengsq@rock-chips.com>,
	linux-rockchip@lists.infradead.org, heiko@sntech.de,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: rk3x: fix 0 length write transfers
Date: Thu, 02 Oct 2014 15:30:47 +0200	[thread overview]
Message-ID: <2239755.0FknEeHYOT@typ> (raw)
In-Reply-To: <1412185241-24950-1-git-send-email-amstan@chromium.org>

Hi Alexandru,

On Wednesday 01 October 2014 at 10:40:41, Alexandru M Stan wrote:
> i2cdetect -q was broken (everything was a false positive, and no transfers
> were actually being sent over i2c). The way it works is by sending a 0
> length write request and checking for NACK. This patch fixes the 0 length
> writes and actually sends them.
> 
> Reported-by: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Alexandru M Stan <amstan@chromium.org>
> ---
>  drivers/i2c/busses/i2c-rk3x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index b41d979..f486d0e 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c
> *i2c) for (i = 0; i < 8; ++i) {
>  		val = 0;
>  		for (j = 0; j < 4; ++j) {
> -			if (i2c->processed == i2c->msg->len)
> +			if ((i2c->processed == i2c->msg->len) && (cnt != 0))
>  				break;
> 
>  			if (i2c->processed == 0 && cnt == 0)

Yes, looks correct and makes i2cdetect work for me on Radxa Rock.

Reviewed-By: Max Schwarz <max.schwarz@online.de>
Tested-By: Max Schwarz <max.schwarz@online.de>

Cheers,
  Max

  parent reply	other threads:[~2014-10-02 13:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 17:40 [PATCH] i2c: rk3x: fix 0 length write transfers Alexandru M Stan
2014-10-01 17:40 ` Alexandru M Stan
2014-10-01 17:40 ` Alexandru M Stan
     [not found] ` <1412185241-24950-1-git-send-email-amstan-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-10-01 22:47   ` Doug Anderson
2014-10-01 22:47     ` Doug Anderson
2014-10-01 22:47     ` Doug Anderson
2014-10-02 13:30   ` Max Schwarz [this message]
2014-10-02 13:30     ` Max Schwarz
2014-10-02 13:30     ` Max Schwarz
2014-10-03  0:27     ` Wolfram Sang
2014-10-03  0:27       ` Wolfram Sang
2014-10-03  0:27   ` Wolfram Sang
2014-10-03  0:27     ` Wolfram Sang
2014-10-03  0:27     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2239755.0FknEeHYOT@typ \
    --to=max.schwarz-bgeptl67xyczqb+pc5nmwq@public.gmane.org \
    --cc=addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=amstan-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=sonnyrao-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    --cc=zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.