linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: khali@linux-fr.org, w.sang@pengutronix.de, ben-linux@fluff.org,
	swarren@wwwdotorg.org, olof@lixom.net
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org,
	Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V3 1/4] i2c: tegra: make sure register writes completes
Date: Wed, 13 Jun 2012 15:42:36 +0530	[thread overview]
Message-ID: <1339582359-7911-2-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1339582359-7911-1-git-send-email-ldewangan@nvidia.com>

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>
---
Changes from V1:
- Using the readback for mask/unmask of irq also.

Changes from V2:
- Read back is done whenever write happen in i2c register other than TX FIFO.

 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 8b2e555..785f7f7 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -165,6 +165,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)
-- 
1.7.1.1

  reply	other threads:[~2012-06-13 10:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 10:12 [PATCH v3 0/4] i2c: tegra: Bug fixes, cleanups and M_NOSTART support Laxman Dewangan
2012-06-13 10:12 ` Laxman Dewangan [this message]
     [not found]   ` <1339582359-7911-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-13 15:55     ` [PATCH V3 1/4] i2c: tegra: make sure register writes completes Stephen Warren
     [not found]       ` <4FD8B7FC.3060708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-14 12:35         ` Laxman Dewangan
2012-06-14 15:57           ` Stephen Warren
     [not found]             ` <4FDA09FC.1010307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-14 16:07               ` Wolfram Sang
2012-06-13 10:12 ` [PATCH V3 2/4] i2c: tegra: add PROTOCOL_MANGLING as supported functionality Laxman Dewangan
2012-06-13 10:12 ` [PATCH V3 3/4] i2c: tegra: support for I2C_M_NOSTART functionality Laxman Dewangan
2012-06-13 10:12 ` [PATCH V3 4/4] i2c: tegra: make all resource allocation through devm_* Laxman Dewangan
     [not found] ` <1339582359-7911-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-13 14:05   ` [PATCH v3 0/4] i2c: tegra: Bug fixes, cleanups and M_NOSTART support Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339582359-7911-2-git-send-email-ldewangan@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=ben-linux@fluff.org \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=swarren@wwwdotorg.org \
    --cc=w.sang@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).