aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDu, Wenkai <wenkai.du@intel.com>2014-04-10 23:03:19 +0000
committerJon Medhurst <tixy@linaro.org>2014-10-08 16:59:12 +0100
commit2014c4a1cc7f34430aab738e416b64fe9d68dc8b (patch)
treebf6c5ad6e9fa127c497660d3ec740d97c956eda2
parentab4ac6c8095dac41e1e7d51930262b18a901448d (diff)
downloadjuno-2014c4a1cc7f34430aab738e416b64fe9d68dc8b.tar.gz
i2c: designware: Mask all interrupts during i2c controller enable
There have been "i2c_designware 80860F41:00: controller timed out" errors on a number of Baytrail platforms. The issue is caused by incorrect value in Interrupt Mask Register (DW_IC_INTR_MASK) when i2c core is being enabled. This causes call to __i2c_dw_enable() to immediately start the transfer which leads to timeout. There are 3 failure modes observed: 1. Failure in S0 to S3 resume path The default value after reset for DW_IC_INTR_MASK is 0x8ff. When we start the first transaction after resuming from system sleep, TX_EMPTY interrupt is already unmasked because of the hardware default. 2. Failure in normal operational path This failure happens rarely and is hard to reproduce. Debug trace showed that DW_IC_INTR_MASK had value of 0x254 when failure occurred, which meant TX_EMPTY was unmasked. 3. Failure in S3 to S0 suspend path This failure also happens rarely and is hard to reproduce. Adding debug trace that read DW_IC_INTR_MASK made this failure not reproducible. But from ISR call trace we could conclude TX_EMPTY was unmasked when problem occurred. The patch masks all interrupts before the controller is enabled to resolve the faulty DW_IC_INTR_MASK conditions. Signed-off-by: Wenkai Du <wenkai.du@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> [wsa: improved the comment and removed typo in commit msg] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org (cherry picked from commit 47bb27e78867997040a228328f2a631c3c7f2c82) Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 0bf59265000..80975bf405e 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -412,6 +412,9 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
/* enforce disabled interrupts (due to HW issues) */
i2c_dw_disable_int(dev);
+ /* enforce disabled interrupts (due to HW issues) */
+ i2c_dw_disable_int(dev);
+
/* Enable the adapter */
__i2c_dw_enable(dev, true);