aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2011-05-30 10:43:04 -0400
committerBen Dooks <ben-linux@fluff.org>2011-10-29 04:37:07 -0400
commitb88530884141e977b3702d8e82de52e553b45876 (patch)
treeb61b80ad5d681027c14fde5da1697a85bd27ecc0 /drivers
parent1fdb24e969110fafea36d3b393bea438f702c87f (diff)
I2C: OMAP2+: Name registers in I2C IP V2 only accordingly
The OMAP I2C driver dynamically chooses between two register sets of differing sizes depending on the cpu type it finds itself on. It has been observed that the existing code references non-existing registers on OMAP3530, because while it correctly chose the smaller register layout based on cpu type, the code uses the probed register ID to decide if to execute code referencing an extra register, and both register layout devices on OMAP3530 and OMAP4430 report the same probed ID of 0x40. This patch changes the extended register names only found on IP V2 of the I2C peripheral unit accordingly to help show up errors in usage. Cc: patches@linaro.org Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andy Green <andy.green@linaro.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-omap.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 2dfb6317685..d40943c23fc 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -72,11 +72,12 @@ enum {
72 OMAP_I2C_SCLH_REG, 72 OMAP_I2C_SCLH_REG,
73 OMAP_I2C_SYSTEST_REG, 73 OMAP_I2C_SYSTEST_REG,
74 OMAP_I2C_BUFSTAT_REG, 74 OMAP_I2C_BUFSTAT_REG,
75 OMAP_I2C_REVNB_LO, 75 /* only on OMAP4430 */
76 OMAP_I2C_REVNB_HI, 76 OMAP_I2C_IP_V2_REVNB_LO,
77 OMAP_I2C_IRQSTATUS_RAW, 77 OMAP_I2C_IP_V2_REVNB_HI,
78 OMAP_I2C_IRQENABLE_SET, 78 OMAP_I2C_IP_V2_IRQSTATUS_RAW,
79 OMAP_I2C_IRQENABLE_CLR, 79 OMAP_I2C_IP_V2_IRQENABLE_SET,
80 OMAP_I2C_IP_V2_IRQENABLE_CLR,
80}; 81};
81 82
82/* I2C Interrupt Enable Register (OMAP_I2C_IE): */ 83/* I2C Interrupt Enable Register (OMAP_I2C_IE): */
@@ -244,11 +245,11 @@ static const u8 omap4_reg_map[] = {
244 [OMAP_I2C_SCLH_REG] = 0xb8, 245 [OMAP_I2C_SCLH_REG] = 0xb8,
245 [OMAP_I2C_SYSTEST_REG] = 0xbC, 246 [OMAP_I2C_SYSTEST_REG] = 0xbC,
246 [OMAP_I2C_BUFSTAT_REG] = 0xc0, 247 [OMAP_I2C_BUFSTAT_REG] = 0xc0,
247 [OMAP_I2C_REVNB_LO] = 0x00, 248 [OMAP_I2C_IP_V2_REVNB_LO] = 0x00,
248 [OMAP_I2C_REVNB_HI] = 0x04, 249 [OMAP_I2C_IP_V2_REVNB_HI] = 0x04,
249 [OMAP_I2C_IRQSTATUS_RAW] = 0x24, 250 [OMAP_I2C_IP_V2_IRQSTATUS_RAW] = 0x24,
250 [OMAP_I2C_IRQENABLE_SET] = 0x2c, 251 [OMAP_I2C_IP_V2_IRQENABLE_SET] = 0x2c,
251 [OMAP_I2C_IRQENABLE_CLR] = 0x30, 252 [OMAP_I2C_IP_V2_IRQENABLE_CLR] = 0x30,
252}; 253};
253 254
254static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, 255static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
@@ -309,7 +310,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
309 310
310 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); 311 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
311 if (dev->rev >= OMAP_I2C_REV_ON_4430) 312 if (dev->rev >= OMAP_I2C_REV_ON_4430)
312 omap_i2c_write_reg(dev, OMAP_I2C_IRQENABLE_CLR, 1); 313 omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
313 else 314 else
314 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0); 315 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
315 316