提交 ca85e248 编写于 作者: S Shubhrajyoti D 提交者: Wolfram Sang

i2c: omap: cleanup the sysc write

Currently after the reset the sysc is written with hardcoded values.
The patch reads the sysc register and writes back the same value
after reset.

- Some unnecessary rev checks can be optimised.
- Also due to whatever reason the hwmod flags are changed
we will not reset the values.
- In some of the cases the minor values of the 2430 register
is different(0x37) in that case the autoidle setting may be missed.
Signed-off-by: NShubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
上级 554c9674
...@@ -305,7 +305,11 @@ static void __omap_i2c_init(struct omap_i2c_dev *dev) ...@@ -305,7 +305,11 @@ static void __omap_i2c_init(struct omap_i2c_dev *dev)
static int omap_i2c_reset(struct omap_i2c_dev *dev) static int omap_i2c_reset(struct omap_i2c_dev *dev)
{ {
unsigned long timeout; unsigned long timeout;
u16 sysc;
if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
sysc = omap_i2c_read_reg(dev, OMAP_I2C_SYSC_REG);
/* Disable I2C controller before soft reset */ /* Disable I2C controller before soft reset */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) & omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
...@@ -327,22 +331,8 @@ static int omap_i2c_reset(struct omap_i2c_dev *dev) ...@@ -327,22 +331,8 @@ static int omap_i2c_reset(struct omap_i2c_dev *dev)
} }
/* SYSC register is cleared by the reset; rewrite it */ /* SYSC register is cleared by the reset; rewrite it */
if (dev->rev == OMAP_I2C_REV_ON_2430) { omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, sysc);
omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
SYSC_AUTOIDLE_MASK);
} else if (dev->rev >= OMAP_I2C_REV_ON_3430_3530) {
dev->syscstate = SYSC_AUTOIDLE_MASK;
dev->syscstate |= SYSC_ENAWAKEUP_MASK;
dev->syscstate |= (SYSC_IDLEMODE_SMART <<
__ffs(SYSC_SIDLEMODE_MASK));
dev->syscstate |= (SYSC_CLOCKACTIVITY_FCLK <<
__ffs(SYSC_CLOCKACTIVITY_MASK));
omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
dev->syscstate);
}
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册