23.07.2020 15:18, Krishna Yarlagadda пишет: > In chips earlier to Tegra186, register write gets buffered. So to make > sure register writes are completed, there is need to readback the > register. Adding flag to disable this readback for Tegra186 and later > chips. > > Signed-off-by: Krishna Yarlagadda <kyarlagadda@xxxxxxxxxx> > --- > drivers/i2c/busses/i2c-tegra.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c > index a841d6c..bdbbca0 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -220,6 +220,7 @@ struct tegra_i2c_hw_feature { > bool has_mst_fifo; > const struct i2c_adapter_quirks *quirks; > bool supports_bus_clear; > + bool has_reg_write_buffering; > bool has_apb_dma; > u8 tlow_std_mode; > u8 thigh_std_mode; > @@ -325,8 +326,11 @@ static void i2c_writel(struct tegra_i2c_dev *i2c_dev, u32 val, > writel_relaxed(val, i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); > > /* Read back register to make sure that register writes completed */ > - if (reg != I2C_TX_FIFO) > - readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); > + if (i2c_dev->hw->has_reg_write_buffering) { > + if (reg != I2C_TX_FIFO) Should be single line. What problem does this solve? If there is no visible effect, then please drop this patch. > + readl_relaxed(i2c_dev->base + > + tegra_i2c_reg_addr(i2c_dev, reg)); > + }