diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-06-13 15:42:36 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-07-19 15:38:42 -0700 |
commit | 5642461e69a5a051a4f748c0330270982ada3d20 (patch) | |
tree | 0229b5573326a0d614ced3cf4bf2d4ace422d320 | |
parent | 4bee10d8a9b5404c490fe2c6ed4bac574f9d20f0 (diff) |
i2c: tegra: make sure register writes completes
The Tegra PPSB (an peripheral bus) queues writes transactions.
In order to guarantee that writes have completed before a
certain time, a read transaction to a register on the same
bus must be executed.
This is necessary in situations such as when clearing an
interrupt status or enable, so that when returning from an
interrupt handler, the HW has already de-asserted its
interrupt status output, which will avoid spurious interrupts.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cherry-picked from mainline
ec7aaca2f64f509f45d463d784b41d0b3d2be083
Change-Id: I4f064c38993031303bfeef794015efd5517561cc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/116469
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bandi Krishna Chaitanya <bandik@nvidia.com>
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 1ac2429a5c6c..5961aa0f5fcb 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -235,6 +235,10 @@ static void i2c_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned long reg) { writel(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(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); } static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg) |