aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2011-05-30 10:43:06 -0400
committerBen Dooks <ben-linux@fluff.org>2011-10-29 04:37:07 -0400
commita1295577773d9756b65972be7b462e4382996d08 (patch)
treef952af3bd57fed8d2111ee45b46c89f4972f38cc
parentd177e5ddb83a4bc518270e705e60ccc5a5aa6410 (diff)
I2C: OMAP2+: use platform_data ip revision to select register map
Change the register map names to reflect the IP revision they are representing, and use the platform_data IP revision index to select between them at init time. Eliminates 1 of 17 cpu_...() calls in the driver. 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>
-rw-r--r--drivers/i2c/busses/i2c-omap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index d40943c23fcc..9172a57ea3c0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -205,7 +205,7 @@ struct omap_i2c_dev {
205 u16 errata; 205 u16 errata;
206}; 206};
207 207
208static const u8 reg_map[] = { 208static const u8 reg_map_ip_v1[] = {
209 [OMAP_I2C_REV_REG] = 0x00, 209 [OMAP_I2C_REV_REG] = 0x00,
210 [OMAP_I2C_IE_REG] = 0x01, 210 [OMAP_I2C_IE_REG] = 0x01,
211 [OMAP_I2C_STAT_REG] = 0x02, 211 [OMAP_I2C_STAT_REG] = 0x02,
@@ -226,7 +226,7 @@ static const u8 reg_map[] = {
226 [OMAP_I2C_BUFSTAT_REG] = 0x10, 226 [OMAP_I2C_BUFSTAT_REG] = 0x10,
227}; 227};
228 228
229static const u8 omap4_reg_map[] = { 229static const u8 reg_map_ip_v2[] = {
230 [OMAP_I2C_REV_REG] = 0x04, 230 [OMAP_I2C_REV_REG] = 0x04,
231 [OMAP_I2C_IE_REG] = 0x2c, 231 [OMAP_I2C_IE_REG] = 0x2c,
232 [OMAP_I2C_STAT_REG] = 0x28, 232 [OMAP_I2C_STAT_REG] = 0x28,
@@ -1035,10 +1035,10 @@ omap_i2c_probe(struct platform_device *pdev)
1035 else 1035 else
1036 dev->reg_shift = 2; 1036 dev->reg_shift = 2;
1037 1037
1038 if (cpu_is_omap44xx()) 1038 if (pdata->rev == OMAP_I2C_IP_VERSION_2)
1039 dev->regs = (u8 *) omap4_reg_map; 1039 dev->regs = (u8 *)reg_map_ip_v2;
1040 else 1040 else
1041 dev->regs = (u8 *) reg_map; 1041 dev->regs = (u8 *)reg_map_ip_v1;
1042 1042
1043 pm_runtime_enable(&pdev->dev); 1043 pm_runtime_enable(&pdev->dev);
1044 omap_i2c_unidle(dev); 1044 omap_i2c_unidle(dev);