aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-omap.c
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2012-11-05 07:23:43 -0500
committerWolfram Sang <w.sang@pengutronix.de>2012-11-14 11:44:43 -0500
commitca85e248b65649176e9e1edfbf5e791bc44ee52b (patch)
tree95e3a76b9f9310e3298dc96f0f62dd6461bc496b /drivers/i2c/busses/i2c-omap.c
parent554c96744afd169886bd6fc2736fb0d9aaf634e8 (diff)
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: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-omap.c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 067a73922be3..482c63d53685 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -305,7 +305,11 @@ static void __omap_i2c_init(struct omap_i2c_dev *dev)
305static int omap_i2c_reset(struct omap_i2c_dev *dev) 305static int omap_i2c_reset(struct omap_i2c_dev *dev)
306{ 306{
307 unsigned long timeout; 307 unsigned long timeout;
308 u16 sysc;
309
308 if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { 310 if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
311 sysc = omap_i2c_read_reg(dev, OMAP_I2C_SYSC_REG);
312
309 /* Disable I2C controller before soft reset */ 313 /* Disable I2C controller before soft reset */
310 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 314 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
311 omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) & 315 omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
@@ -327,22 +331,8 @@ static int omap_i2c_reset(struct omap_i2c_dev *dev)
327 } 331 }
328 332
329 /* SYSC register is cleared by the reset; rewrite it */ 333 /* SYSC register is cleared by the reset; rewrite it */
330 if (dev->rev == OMAP_I2C_REV_ON_2430) { 334 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, sysc);
331
332 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
333 SYSC_AUTOIDLE_MASK);
334 335
335 } else if (dev->rev >= OMAP_I2C_REV_ON_3430_3530) {
336 dev->syscstate = SYSC_AUTOIDLE_MASK;
337 dev->syscstate |= SYSC_ENAWAKEUP_MASK;
338 dev->syscstate |= (SYSC_IDLEMODE_SMART <<
339 __ffs(SYSC_SIDLEMODE_MASK));
340 dev->syscstate |= (SYSC_CLOCKACTIVITY_FCLK <<
341 __ffs(SYSC_CLOCKACTIVITY_MASK));
342
343 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
344 dev->syscstate);
345 }
346 } 336 }
347 return 0; 337 return 0;
348} 338}