From c682beaacfaaab41e942748deb19326a5700fe2c Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 8 Oct 2015 14:43:19 -0700 Subject: [PATCH] mec1322: i2c: Disable i2c interrupts after failed wait If we timeout waiting for an i2c interrupt, we will exit wait_for_interrupt() with the i2c interrupt still enabled. Fix this by explicitly disabling the i2c interrupt before returning. BUG=None TEST=Manual on Glados, verify no i2c errors during normal functionality. BRANCH=None Signed-off-by: Shawn Nematbakhsh Change-Id: Icd85acb6de1d499a29f33ebda594f739cdf9fd3e Reviewed-on: https://chromium-review.googlesource.com/304841 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Alec Berg --- chip/mec1322/i2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c index 19b65e0c55..0d3ef5a0da 100644 --- a/chip/mec1322/i2c.c +++ b/chip/mec1322/i2c.c @@ -133,6 +133,8 @@ static int wait_for_interrupt(int controller) /* Wait until I2C interrupt or timeout. */ event = task_wait_event_mask(TASK_EVENT_I2C_IDLE, cdata[controller].timeout_us); + + task_disable_irq(MEC1322_IRQ_I2C_0 + controller); cdata[controller].task_waiting = TASK_ID_INVALID; return (event & TASK_EVENT_TIMER) ? EC_ERROR_TIMEOUT : EC_SUCCESS;