aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeifeng Voon <weifeng.voon@intel.com>2016-08-12 10:02:50 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-08-25 18:42:06 -0400
commit548e6695d16d201f390f7554ae7d0b5bb8690166 (patch)
tree34600c2e0d5b83645ed998c288b2bfd31ca173b4
parentd608c3d9ac818fc0addc884144c7550e03b0fc6f (diff)
i2c: designware: set the common config before the if else
DW_IC_CON_MASTER, DW_IC_CON_SLAVE_DISABLE and DW_IC_CON_RESTART_EN are common config that need to be set for i2c designware master. So, configure it first without having to repeat inside the if else. Signed-off-by: Weifeng Voon <weifeng.voon@intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index ea92e9f3fba1..d45481ee1b56 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -217,12 +217,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
217 I2C_FUNC_SMBUS_BYTE_DATA | 217 I2C_FUNC_SMBUS_BYTE_DATA |
218 I2C_FUNC_SMBUS_WORD_DATA | 218 I2C_FUNC_SMBUS_WORD_DATA |
219 I2C_FUNC_SMBUS_I2C_BLOCK; 219 I2C_FUNC_SMBUS_I2C_BLOCK;
220
221 dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
222 DW_IC_CON_RESTART_EN;
223
220 if (dev->clk_freq == 100000) 224 if (dev->clk_freq == 100000)
221 dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE | 225 dev->master_cfg |= DW_IC_CON_SPEED_STD;
222 DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_STD;
223 else 226 else
224 dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE | 227 dev->master_cfg |= DW_IC_CON_SPEED_FAST;
225 DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;
226 228
227 dev->clk = devm_clk_get(&pdev->dev, NULL); 229 dev->clk = devm_clk_get(&pdev->dev, NULL);
228 if (!i2c_dw_plat_prepare_clk(dev, true)) { 230 if (!i2c_dw_plat_prepare_clk(dev, true)) {