Files
OpenCellular/chip
Charlie Mooney 265478ccdf Snow: Increase timeout for i2c stop bit sending
On snow, there are reports of the following warning in the i2c master
reciever code:

	Stop event deadline passed: CR1=0000001000000001

I've been running this torture test, and even with the timeout feature
completely removed, it never hangs.  The stop bit is always sent
eventually, even through thousands and thousands of transactions (of which
a couple take too long for the current timeout).

I timed a lot of these and it looks like the vast majority are fine but
just a few are really really slow.  To this end, I'm increasing the
timeout.  It seems that the wait loop is getting preempted for a while
before it can go back and check, causing these timeout messages.  So every
now and then the process get pre-empted for a long time causing what
looks like a long timeout.  The thing is, the  stop bit is always getting
sent, we're just not noticing for a while.  So even in the really slow
cases, everything should be fine.

Since the bit's getting sent either way, it seems like increasing the
timeout all but fixes the problem where the EC thinks it didn't send.
However, since the timeout is quite high now, I added a sleep
in the busy loop so that if a message is messed up and the stop bit doesn't
send, the task won't steal the cpu for the entire time.

Note: This also fixes a bug in the i2c error handler where it was trying
to print ints and strings and ads a little more information to the
timeout warning in case it starts showing up again.

BUG=chrome-os-partner:12742
TEST=From the EC console run "battery 100000" while running
"while true; do /usr/local/sbin/i2cdump -f -y 4 0x48; done" to seriously
stress test the i2c bus.  Then reboot the machine several times.  There
should be no Stop bit warnings, or failed i2c transfers
BRANCH=snow

Change-Id: I590a9458783d16e57987102b1ec1299d5ddb0fa2
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31024
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-08-23 17:28:00 -07:00
..