aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Mello <fabio.mello@intel.com>2015-04-14 19:17:44 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2015-07-14 23:52:27 -0300
commit8fc71bae16a0405b199b195c9683054d3ba248d4 (patch)
tree07993a356c355ec70fa58549de0c1655ecd0bb9a
parent8864dd19952114bae75f59e4322e85e2faedcc94 (diff)
downloadlinux-stable-4.0.y-minnow.tar.gz
i2c: designware: use enable on resume instead initializationstable-4.0.y-minnow
According to documentation and tests, initialization is not necessary on module resume, since the controller keeps its state between disable/enable. Change the target address is also allowed. So, this patch replaces the initialization on module resume with a simple enable, and removes the (non required anymore) enables and disables. Signed-off-by: Fabio Mello <fabio.mello@intel.com> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c19
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c2
2 files changed, 5 insertions, 16 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 6e25c010e6903..b386c100c3545 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -375,8 +375,12 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
/* configure the i2c master */
dw_writel(dev, dev->master_cfg , DW_IC_CON);
+ /* Enable the adapter */
+ __i2c_dw_enable(dev, true);
+
if (dev->release_lock)
dev->release_lock(dev);
+
return 0;
}
EXPORT_SYMBOL_GPL(i2c_dw_init);
@@ -405,9 +409,6 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
struct i2c_msg *msgs = dev->msgs;
u32 ic_con, ic_tar = 0;
- /* Disable the adapter */
- __i2c_dw_enable(dev, false);
-
/* if the slave address is ten bit address, enable 10BITADDR */
ic_con = dw_readl(dev, DW_IC_CON);
if (msgs[dev->msg_write_idx].flags & I2C_M_TEN) {
@@ -434,9 +435,6 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
/* enforce disabled interrupts (due to HW issues) */
i2c_dw_disable_int(dev);
- /* Enable the adapter */
- __i2c_dw_enable(dev, true);
-
/* Clear and enable interrupts */
i2c_dw_clear_int(dev);
dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK);
@@ -665,15 +663,6 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
goto done;
}
- /*
- * We must disable the adapter before unlocking the &dev->lock mutex
- * below. Otherwise the hardware might continue generating interrupts
- * which in turn causes a race condition with the following transfer.
- * Needs some more investigation if the additional interrupts are
- * a hardware bug or this driver doesn't handle them correctly yet.
- */
- __i2c_dw_enable(dev, false);
-
if (dev->msg_err) {
ret = dev->msg_err;
goto done;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index c270f5f9a8f9a..0598695f5628e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -320,7 +320,7 @@ static int dw_i2c_resume(struct device *dev)
clk_prepare_enable(i_dev->clk);
if (!i_dev->pm_runtime_disabled)
- i2c_dw_init(i_dev);
+ i2c_dw_enable(i_dev);
return 0;
}