diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2018-06-19 14:23:19 +0300 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-07-03 23:05:20 +0200 |
commit | 3aca0bd6f4f87f554b1e9bbe4f6fbfb9a6eff916 (patch) | |
tree | f7af6acf39eff54cb4016b7b130aeabd2a99923c /drivers/i2c/busses/i2c-designware-slave.c | |
parent | 6e6bcc0d30079056ad12946fb8c51e31ebce8d07 (diff) |
i2c: designware: Move register access detection to common code
Move register access detection out from master and slave HW
initialization code to common code. Motivation for this is to have
register access configured before HW initialization and remove
duplicated code.
This allows to do further separation between probe time initialization
and runtime reinitialization code.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-designware-slave.c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-slave.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 2036a579b5df..a1f802001e1f 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -58,20 +58,6 @@ static int i2c_dw_init_slave(struct dw_i2c_dev *dev) if (ret) return ret; - reg = dw_readl(dev, DW_IC_COMP_TYPE); - if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) { - /* Configure register endianness access. */ - dev->flags |= ACCESS_SWAP; - } else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) { - /* Configure register access mode 16bit. */ - dev->flags |= ACCESS_16BIT; - } else if (reg != DW_IC_COMP_TYPE_VALUE) { - dev_err(dev->dev, - "Unknown Synopsys component type: 0x%08x\n", reg); - i2c_dw_release_lock(dev); - return -ENODEV; - } - /* Disable the adapter. */ __i2c_dw_disable(dev); @@ -297,6 +283,10 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev) dev->disable = i2c_dw_disable; dev->disable_int = i2c_dw_disable_int; + ret = i2c_dw_set_reg_access(dev); + if (ret) + return ret; + ret = dev->init(dev); if (ret) return ret; |