i2c: Is This a Bug?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i2c: Is This a Bug?

Jump to solution
3,014 Views
swarga
Contributor I

I have a design based on the MPC8349EA processor. While perusing the driver source from my Linux 2.6.35.2 kernel (drivers/i2c/busses/i2c-mpc.c) I came across the following function:

/* Sometimes 9th clock pulse isn't generated, and slave doesn't release

* the bus, because it wants to send ACK.

* Following sequence of enabling/disabling and sending start/stop generates

* the pulse, so it's all OK.

*/

static void mpc_i2c_fixup(struct mpc_i2c *i2c)

{

        writeccr(i2c, 0);

        udelay(30);

        writeccr(i2c, CCR_MEN);

        udelay(30);

        writeccr(i2c, CCR_MSTA | CCR_MTX);

        udelay(30);

        writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN);

        udelay(30);

        writeccr(i2c, CCR_MEN);

        udelay(30);

}

Indeed, while working with the i2c, I have occasionally experienced an i2c bus hang while waiting for the ACK from the slave which this little kludge recovers from. My question is why is this needed? Is this a bug in the i2c peripheral? I see no mention of this in the errata sheet.

Thanks for any insight.

Tags (2)
1 Solution
1,295 Views
TomE
Specialist II

Google for "mpc_i2c_fixup". That finds:

[i2c] [PATCH] i2c-mpc: work around missing-9th-clock-pulse bug

Which points to:

https://lists.ozlabs.org/pipermail/linuxppc-embedded/2005-July/019038.html

Which states it was a problem in the MPC5200 (in 2005) that is not in the Errata, but according to the above "

After contacting Freescale, they recognize the problem.".

It is still not in the Errata for that chip, but I'm not surprised at that.

These silicon modules are used in lots of different chips, so it is possible the MPC5200 bug is in the MPC8349 as well. I suggest you download the MPC5200 manual and compare the I2C controller register set with your one to see if they match.

Here's some more tracking of old I2C bugs that might be worth checking through:

http://www.digipedia.pl/usenet/thread/11185/30289/

Tom

View solution in original post

0 Kudos
Reply
2 Replies
1,295 Views
nikitavostokov
Contributor I

We also get hang of i2c bus at p1020 while slave devices reboot. Kernels 2.6.29 and 3.4.85 return errors EIO (Input/Output error) or ETIMEDOUT (Connection timed out).

0 Kudos
Reply
1,296 Views
TomE
Specialist II

Google for "mpc_i2c_fixup". That finds:

[i2c] [PATCH] i2c-mpc: work around missing-9th-clock-pulse bug

Which points to:

https://lists.ozlabs.org/pipermail/linuxppc-embedded/2005-July/019038.html

Which states it was a problem in the MPC5200 (in 2005) that is not in the Errata, but according to the above "

After contacting Freescale, they recognize the problem.".

It is still not in the Errata for that chip, but I'm not surprised at that.

These silicon modules are used in lots of different chips, so it is possible the MPC5200 bug is in the MPC8349 as well. I suggest you download the MPC5200 manual and compare the I2C controller register set with your one to see if they match.

Here's some more tracking of old I2C bugs that might be worth checking through:

http://www.digipedia.pl/usenet/thread/11185/30289/

Tom

0 Kudos
Reply