]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
I2C: OMAP2+: use platform_data ip revision to select register map
authorAndy Green <andy@warmcat.com>
Mon, 30 May 2011 14:43:06 +0000 (07:43 -0700)
committerBen Dooks <ben-linux@fluff.org>
Sat, 29 Oct 2011 08:37:07 +0000 (09:37 +0100)
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>
drivers/i2c/busses/i2c-omap.c

index d40943c23fcc1def888cbc58402de3f98d6a36f9..9172a57ea3c00c58c7d90ccca0a627fd77224833 100644 (file)
@@ -205,7 +205,7 @@ struct omap_i2c_dev {
        u16                     errata;
 };
 
-static const u8 reg_map[] = {
+static const u8 reg_map_ip_v1[] = {
        [OMAP_I2C_REV_REG] = 0x00,
        [OMAP_I2C_IE_REG] = 0x01,
        [OMAP_I2C_STAT_REG] = 0x02,
@@ -226,7 +226,7 @@ static const u8 reg_map[] = {
        [OMAP_I2C_BUFSTAT_REG] = 0x10,
 };
 
-static const u8 omap4_reg_map[] = {
+static const u8 reg_map_ip_v2[] = {
        [OMAP_I2C_REV_REG] = 0x04,
        [OMAP_I2C_IE_REG] = 0x2c,
        [OMAP_I2C_STAT_REG] = 0x28,
@@ -1035,10 +1035,10 @@ omap_i2c_probe(struct platform_device *pdev)
        else
                dev->reg_shift = 2;
 
-       if (cpu_is_omap44xx())
-               dev->regs = (u8 *) omap4_reg_map;
+       if (pdata->rev == OMAP_I2C_IP_VERSION_2)
+               dev->regs = (u8 *)reg_map_ip_v2;
        else
-               dev->regs = (u8 *) reg_map;
+               dev->regs = (u8 *)reg_map_ip_v1;
 
        pm_runtime_enable(&pdev->dev);
        omap_i2c_unidle(dev);