summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2013-05-13 00:54:30 +0000
committerBen Hutchings <ben@decadent.org.uk>2013-05-30 14:35:02 +0100
commite6ba935d6c8a7297a9b0a846cb58df2479703cba (patch)
tree01d9c37ad44be5141c0b6314933f25aa196da2cc
parentdc7838a64147429730e997a9fede3f47106b9f96 (diff)
downloadlwn-e6ba935d6c8a7297a9b0a846cb58df2479703cba.tar.gz
lwn-e6ba935d6c8a7297a9b0a846cb58df2479703cba.zip
i2c: designware: always clear interrupts before enabling them
commit 2a2d95e9d6d29e726cc294b65391917ed2e32bf4 upstream. If the I2C bus is put to a low power state by an ACPI method it might pull the SDA line low (as its power is removed). Once the bus is put to full power state again, the SDA line is pulled back to high. This transition looks like a STOP condition from the controller point-of-view which sets STOP detected bit in its status register causing the driver to fail subsequent transfers. Fix this by always clearing all interrupts before we start a transfer. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 619334994df9..3c2812f13d96 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -349,7 +349,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
/* Enable the adapter */
dw_writel(dev, 1, DW_IC_ENABLE);
- /* Enable interrupts */
+ /* Clear and enable interrupts */
+ i2c_dw_clear_int(dev);
dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK);
}