i2c: designware: allow IP specific sda_hold_time
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 31 Aug 2018 15:11:10 +0000 (17:11 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 2 Sep 2018 21:51:15 +0000 (23:51 +0200)
Because some old designware IPs were not supporting setting an SDA hold
time, vendors developed their own solution. Add a way for the final driver
to provide its own SDA hold time handling.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-common.c
drivers/i2c/busses/i2c-designware-core.h

index 69ec4a791f23e78e1462c002eaca62c9e400da5a..36271cd7534283c847e5116701c14fd2847f32e1 100644 (file)
@@ -201,6 +201,8 @@ int i2c_dw_set_sda_hold(struct dw_i2c_dev *dev)
                dev_dbg(dev->dev, "SDA Hold Time TX:RX = %d:%d\n",
                        dev->sda_hold_time & ~(u32)DW_IC_SDA_HOLD_RX_MASK,
                        dev->sda_hold_time >> DW_IC_SDA_HOLD_RX_SHIFT);
+       } else if (dev->set_sda_hold_time) {
+               dev->set_sda_hold_time(dev);
        } else if (dev->sda_hold_time) {
                dev_warn(dev->dev,
                        "Hardware too old to adjust SDA hold time.\n");
index e367b1af4ab2cdebb120fa72e3dbc1a9f7c94171..f6cad20a86ffbbed8ddbe4bfa8903feddd713460 100644 (file)
@@ -269,6 +269,7 @@ struct dw_i2c_dev {
        void                    (*disable)(struct dw_i2c_dev *dev);
        void                    (*disable_int)(struct dw_i2c_dev *dev);
        int                     (*init)(struct dw_i2c_dev *dev);
+       int                     (*set_sda_hold_time)(struct dw_i2c_dev *dev);
        int                     mode;
        struct i2c_bus_recovery_info rinfo;
 };