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>
此提交包含在:
@@ -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;
|
||||
|
新增問題並參考
封鎖使用者