linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Domen Puncer <domen.puncer@telargo.com>
Cc: linuxppc-embedded@ozlabs.org,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	i2c@lm-sensors.org
Subject: Re: [PATCH] i2c-mpc: don't disable I2C module on stop condition.
Date: Wed, 8 Aug 2007 19:19:13 +0200	[thread overview]
Message-ID: <20070808191913.3e6bb0e6@hyperion.delvare> (raw)
In-Reply-To: <20070724051431.GF4529@moe.telargo.com>

Hi Domen,

On Tue, 24 Jul 2007 07:14:31 +0200, Domen Puncer wrote:
> Disabling module on stop doesn't work on some CPUs (ie. mpc8241,
> as reported by Guennadi Liakhovetski), so remove that.
> 
> Disable I2C module on errors/interrupts to prevent it from
> locking up on mpc5200b.
> 
> 
> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
> ---
> Hi!
> 
> So I fixed i2c on one board, and broke it on another :-(
> This patch works on both Guennadi's and mine (hey, it might break
> a third one!).
> Jean, can you please push this, if there are no objections
> and "doesn't work for me" reports.

Queued for 2.6.23-rc3, thanks. Guennadi, can you please confirm that
this patch fixes your problem?

> 
> 
> 	Domen
> 
> 
>  drivers/i2c/busses/i2c-mpc.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> Index: work-powerpc.git/drivers/i2c/busses/i2c-mpc.c
> ===================================================================
> --- work-powerpc.git.orig/drivers/i2c/busses/i2c-mpc.c
> +++ work-powerpc.git/drivers/i2c/busses/i2c-mpc.c
> @@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c,
>  			schedule();
>  			if (time_after(jiffies, orig_jiffies + timeout)) {
>  				pr_debug("I2C: timeout\n");
> +				writeccr(i2c, 0);
>  				result = -EIO;
>  				break;
>  			}
> @@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c,
>  		result = wait_event_interruptible_timeout(i2c->queue,
>  			(i2c->interrupt & CSR_MIF), timeout * HZ);
>  
> -		if (unlikely(result < 0))
> +		if (unlikely(result < 0)) {
>  			pr_debug("I2C: wait interrupted\n");
> -		else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
> +			writeccr(i2c, 0);
> +		} else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
>  			pr_debug("I2C: wait timeout\n");
> +			writeccr(i2c, 0);
>  			result = -ETIMEDOUT;
>  		}
>  
> @@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c
>  static void mpc_i2c_stop(struct mpc_i2c *i2c)
>  {
>  	writeccr(i2c, CCR_MEN);
> -	writeccr(i2c, 0);
>  }
>  
>  static int mpc_write(struct mpc_i2c *i2c, int target,
> @@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *
>  	while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
>  		if (signal_pending(current)) {
>  			pr_debug("I2C: Interrupted\n");
> +			writeccr(i2c, 0);
>  			return -EINTR;
>  		}
>  		if (time_after(jiffies, orig_jiffies + HZ)) {


-- 
Jean Delvare

  reply	other threads:[~2007-08-08 17:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  7:19 [PATCH] i2c-mpc: work around missing-9th-clock-pulse bug Domen Puncer
2007-07-09 15:53 ` Grant Likely
2007-07-10  6:17   ` Domen Puncer
2007-07-10  6:22     ` Grant Likely
2007-07-10 12:40       ` Jean Delvare
2007-07-11  5:49         ` Domen Puncer
2007-07-11  6:03           ` Grant Likely
2007-07-11  6:33             ` Domen Puncer
2007-07-11 11:40               ` Jean Delvare
2007-07-21  0:03 ` [i2c] " Guennadi Liakhovetski
2007-07-24  5:14   ` [PATCH] i2c-mpc: don't disable I2C module on stop condition Domen Puncer
2007-08-08 17:19     ` Jean Delvare [this message]
2007-08-08 18:33       ` Guennadi Liakhovetski

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=20070808191913.3e6bb0e6@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=domen.puncer@telargo.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=i2c@lm-sensors.org \
    --cc=linuxppc-embedded@ozlabs.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).