linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Janusz Uzycki <j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
Subject: Re: [PATCH] i2c-mxs: fixed PIO NACK error instead of timeout (1000ms)
Date: Tue, 9 Sep 2014 20:56:14 +0200	[thread overview]
Message-ID: <201409092056.14786.marex@denx.de> (raw)
In-Reply-To: <1410279571-4552-2-git-send-email-j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>

On Tuesday, September 09, 2014 at 06:19:31 PM, Janusz Uzycki wrote:
> i2cdetect scanned i2c bus very slow if address was not occupied by any
> device.

This still fails to explain how the patch fixes the issue. You see, I don't want 
to abuse you unnecessarily, but the commit message serves mostly for the purpose 
of explaining the issue (which you did) and how the change you implemented fixes 
the problem.

So in this case, you should explain that you can use this NO_SLAVE_ACK bit to 
figure out if the peripheral is present. You should also explain that even 
though the mxs_i2c_pio_wait_xfer_end() is called from multiple places, adding 
this particular check will not impact all those other places.

I hope this makes sense. Thank you for the effort though, I really appreciate 
your contributions!

> Signed-off-by: Janusz Uzycki <j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-mxs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 87ee72d..35ae448 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -307,6 +307,10 @@ static int mxs_i2c_pio_wait_xfer_end(struct
> mxs_i2c_dev *i2c) unsigned long timeout = jiffies +
> msecs_to_jiffies(1000);
> 
>  	while (readl(i2c->regs + MXS_I2C_CTRL0) & MXS_I2C_CTRL0_RUN) {
> +		if (readl(i2c->regs + MXS_I2C_CTRL1) &
> +				MXS_I2C_CTRL1_NO_SLAVE_ACK_IRQ)
> +			return -ENXIO;
>  		if (time_after(jiffies, timeout))
>  			return -ETIMEDOUT;
>  		cond_resched();

Best regards,
Marek Vasut

  parent reply	other threads:[~2014-09-09 18:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 16:19 [PATCH] i2c-mxs: fixed error message in pio transfer Janusz Uzycki
     [not found] ` <1410279571-4552-1-git-send-email-j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>
2014-09-09 16:19   ` [PATCH] i2c-mxs: fixed PIO NACK error instead of timeout (1000ms) Janusz Uzycki
     [not found]     ` <1410279571-4552-2-git-send-email-j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>
2014-09-09 18:56       ` Marek Vasut [this message]
2014-09-20 12:49       ` Wolfram Sang
2014-09-20 13:22         ` Marek Vasut
     [not found]           ` <201409201522.00331.marex-ynQEQJNshbs@public.gmane.org>
2014-09-22 15:56             ` Wolfram Sang
2014-09-20 12:39   ` [PATCH] i2c-mxs: fixed error message in pio transfer Wolfram Sang
2014-09-20 13:21     ` Marek Vasut

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=201409092056.14786.marex@denx.de \
    --to=marex-ynqeqjnshbs@public.gmane.org \
    --cc=j.uzycki-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@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 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).