From ee7fce76b032f2a5f94f122e8214e9cfc8790f62 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Fri, 10 Feb 2012 14:54:41 -0800 Subject: [PATCH] Must wait on I2C controller before checking status We have to wait until the controller is no longer busy before we announce that we're done. Just waiting for the first interrupt isn't enough, because that's often just an error indicator and the controller still has to stop. BUG=none TEST=none Change-Id: I065c049111d7de276bf8f7cd0eed39c3f5cff5f4 --- chip/lm4/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c index 0f31fc39a5..67316a519a 100644 --- a/chip/lm4/i2c.c +++ b/chip/lm4/i2c.c @@ -26,7 +26,7 @@ static int wait_idle(int port) int wait_msg; i = LM4_I2C_MCS(port); - if (i & 0x01) { + while (i & 0x01) { /* Port is busy, so wait for the interrupt */ task_waiting_on_port[port] = task_get_current(); LM4_I2C_MIMR(port) = 0x03;