From: Tony Lindgren <tony@atomide.com>
To: Jason Marini <jason.marini@gmail.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] ARM: OMAP: Fix occasional i2c driver hang
Date: Wed, 10 Sep 2008 16:42:47 -0700 [thread overview]
Message-ID: <20080910234246.GR21163@atomide.com> (raw)
In-Reply-To: <423644ca0808281230g1f8c20ceta4a6822098d4e431@mail.gmail.com>
* Jason Marini <jason.marini@gmail.com> [080828 12:31]:
> The i2c driver contains a while loop that has no timeout. If i2c is in a
> funky state and OMAP_I2C_CON_STT remains asserted, the kernel hangs. Insert
> the standard i2c timeout into the loop.
Pushing today.
Tony
> Signed-off-by: Jason P Marini <jason.marini@gmail.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 3c4e581..3a7b6ef 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -440,9 +440,16 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
> omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
>
> if (dev->b_hw && stop) {
> + unsigned long delay = jiffies + OMAP_I2C_TIMEOUT;
> +
> /* H/w behavior: dont write stt and stp together.. */
> while (omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) & OMAP_I2C_CON_STT) {
> - /* Dont do anything - this will come in a couple of loops at max*/
> + /* Let the user know if i2c is in a bad state */
> + if (time_after (jiffies, delay)) {
> + dev_err(dev->dev, "controller timed out "
> + "waiting for start condition to finish\n");
> + return -ETIMEDOUT;
> + }
> }
> w |= OMAP_I2C_CON_STP;
> w &= ~OMAP_I2C_CON_STT;
> --
> 1.5.5.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-09-10 23:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 19:30 [PATCH] ARM: OMAP: Fix occasional i2c driver hang Jason Marini
2008-09-10 23:42 ` Tony Lindgren [this message]
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=20080910234246.GR21163@atomide.com \
--to=tony@atomide.com \
--cc=jason.marini@gmail.com \
--cc=linux-omap@vger.kernel.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