aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorScott Anderson <saa@google.com>2011-11-01 19:37:16 -0700
committerTodd Poynor <toddpoynor@google.com>2011-11-03 19:19:30 -0700
commit185da66d584a635f1b1b673b2ec87e0cf14f232f (patch)
tree3b91eea098c95f77b762e8e6d9bec4c7592bc230 /drivers/i2c
parent9209a609b131206a460b1dcff83c8dce230f9096 (diff)
downloadkernel_samsung_espresso10-185da66d584a635f1b1b673b2ec87e0cf14f232f.tar.gz
kernel_samsung_espresso10-185da66d584a635f1b1b673b2ec87e0cf14f232f.tar.bz2
kernel_samsung_espresso10-185da66d584a635f1b1b673b2ec87e0cf14f232f.zip
i2c: omap3: Fix accessing of invalid registers
When cpu_is_omap44xx, dev->regs is set to point to omap4_reg_map[], which contains entries for OMAP_I2C_IRQENABLE_SET and OMAP_I2C_IRQENABLE_CLR. These entries are not present in the other reg_map. However, the code that uses these registers does not ensure that cpu_is_omap44xx before using them. This can cause register 0x00 (the revision register) to be accessed instead and the proper register to not be accessed. This problem was observed on the OMAP3630 and caused long hangs. The fix is to ensure that cpu_is_omap44xx before accessing the registers. Thanks to vikram pandita for pointing me in the right direction. Change-Id: Ic3accee9ce251724f13056bdb01f4db3308cd099 Signed-off-by: Scott Anderson <saa@google.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 5f2f56a3747..ead17f9354b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -288,7 +288,7 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
}
dev->idle = 0;
- if (dev->rev >= OMAP_I2C_REV_ON_4430) {
+ if (cpu_is_omap44xx() && dev->rev >= OMAP_I2C_REV_ON_4430) {
omap_i2c_write_reg(dev, OMAP_I2C_IRQENABLE_CLR,0x6FFF);
omap_i2c_write_reg(dev, OMAP_I2C_IRQENABLE_SET, dev->iestate);
} else {
@@ -307,7 +307,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
pdev = to_platform_device(dev->dev);
pdata = pdev->dev.platform_data;
- if (dev->rev >= OMAP_I2C_REV_ON_4430)
+ if (cpu_is_omap44xx() && dev->rev >= OMAP_I2C_REV_ON_4430)
omap_i2c_write_reg(dev, OMAP_I2C_IRQENABLE_CLR, 0x6FFF);
else
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);