i2c-designware: move i2c functionality bit field to be adapter specific
authorDirk Brandewie <dirk.brandewie@gmail.com>
Thu, 6 Oct 2011 18:26:31 +0000 (11:26 -0700)
committerBen Dooks <ben-linux@fluff.org>
Sat, 29 Oct 2011 10:03:50 +0000 (11:03 +0100)
The functionality of the adapter depends on the configuration of the
IP block at silicon compile time and is adapter specific.

Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
drivers/i2c/busses/i2c-designware-core.c
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-platdrv.c

index cd52f17028cd12f19b2de187368c735100926e37..71055114bd80410a4b0eb2ae464e4950c3fbb388 100644 (file)
@@ -457,12 +457,8 @@ done:
 
 u32 i2c_dw_func(struct i2c_adapter *adap)
 {
-       return  I2C_FUNC_I2C |
-               I2C_FUNC_10BIT_ADDR |
-               I2C_FUNC_SMBUS_BYTE |
-               I2C_FUNC_SMBUS_BYTE_DATA |
-               I2C_FUNC_SMBUS_WORD_DATA |
-               I2C_FUNC_SMBUS_I2C_BLOCK;
+       struct dw_i2c_dev *dev = i2c_get_adapdata(adap);
+       return dev->functionality;
 }
 
 static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev)
index 43de340af57feda4697b7e9ddca03da92b1f3e6f..ab4e655a6c615829d4b8ac579f15017be7eb6cb6 100644 (file)
@@ -182,6 +182,7 @@ struct dw_i2c_dev {
        int                     irq;
        int                     swab;
        struct i2c_adapter      adapter;
+       u32                     functionality;
        unsigned int            tx_fifo_depth;
        unsigned int            rx_fifo_depth;
 };
index 08783a6ff1a2dcc1efea2c4d40762acf46727225..36db7a80cbb23a7aa341feea68c6adb33fde55e8 100644 (file)
@@ -96,6 +96,14 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
        }
        clk_enable(dev->clk);
 
+       dev->functionality =
+               I2C_FUNC_I2C |
+               I2C_FUNC_10BIT_ADDR |
+               I2C_FUNC_SMBUS_BYTE |
+               I2C_FUNC_SMBUS_BYTE_DATA |
+               I2C_FUNC_SMBUS_WORD_DATA |
+               I2C_FUNC_SMBUS_I2C_BLOCK;
+
        dev->base = ioremap(mem->start, resource_size(mem));
        if (dev->base == NULL) {
                dev_err(&pdev->dev, "failure mapping io resources\n");