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-04 00:05:20 +0300 |
commit | 3aca0bd6f4f87f554b1e9bbe4f6fbfb9a6eff916 (patch) | |
tree | f7af6acf39eff54cb4016b7b130aeabd2a99923c /drivers/i2c/busses/i2c-designware-master.c | |
parent | 6e6bcc0d30079056ad12946fb8c51e31ebce8d07 (diff) | |
download | linux-3aca0bd6f4f87f554b1e9bbe4f6fbfb9a6eff916.tar.xz |
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-master.c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-master.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index 27436a937492..3a7c184f24c8 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -64,20 +64,6 @@ static int i2c_dw_init_master(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 endianess 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; - } - comp_param1 = dw_readl(dev, DW_IC_COMP_PARAM_1); /* Disable the adapter */ @@ -681,6 +667,10 @@ int i2c_dw_probe(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; |