LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Fredrik Arnerup" <fredrik.arnerup@edgeware.tv>
To: <linuxppc-dev@ozlabs.org>
Subject: MPC85xx erratum "I2C1 - I2C controller is unable to generate clocks when SDA is low coming out of reset"
Date: Tue, 26 May 2009 10:22:21 +0200	[thread overview]
Message-ID: <738D541FBC1741A18DB4F3CB466DF78A@edgeware.tv> (raw)

We've had some trouble with I2C not working after a soft reboot,
which we think is due to the the erratum "I2C1" which is present in
at least the mpc8540 and the mpc8560. Since there is no good workaround,
the only choice seems to be to avoid resetting the CPU while the I2C bus is
busy.

The problem seems to be that the i2c-mpc driver leaves I2C in a busy state
when
it receives a signal (e.g. upon shutdown).
The code below is not meant as a patch, just me thinking aloud.
Thoughts?

/Fredrik Arnerup
fredrik.arnerup@edgeware.tv

Index: drivers/i2c/busses/i2c-mpc.c
===================================================================
--- drivers/i2c/busses/i2c-mpc.c        (revision 6933)
+++ drivers/i2c/busses/i2c-mpc.c        (working copy)
@@ -262,12 +262,14 @@
        /* Allow bus up to 1s to become not busy */
        while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
                if (signal_pending(current)) {
-                       pr_debug("I2C: Interrupted\n");
-                       writeccr(i2c, 0);
+                       printk(KERN_WARNING "I2C: Interrupted\n");
+                       if (readb(i2c->base + MPC_I2C_SR) ==
+                           (CSR_MCF | CSR_MBB | CSR_RXAK))
+                               mpc_i2c_fixup(i2c);
                        return -EINTR;
                }
                if (time_after(jiffies, orig_jiffies + HZ)) {
-                       pr_debug("I2C: timeout\n");
+                       printk(KERN_WARNING "I2C: mpc_xfer() timeout\n");
                        if (readb(i2c->base + MPC_I2C_SR) ==
                            (CSR_MCF | CSR_MBB | CSR_RXAK))
                                mpc_i2c_fixup(i2c);

             reply	other threads:[~2009-05-26  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26  8:22 Fredrik Arnerup [this message]
2009-06-11  4:32 ` MPC85xx erratum "I2C1 - I2C controller is unable to generate clocks when SDA is low coming out of reset" Kumar Gala

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=738D541FBC1741A18DB4F3CB466DF78A@edgeware.tv \
    --to=fredrik.arnerup@edgeware.tv \
    --cc=linuxppc-dev@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