mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harini Katakam <harinik@xilinx.com>
To: wsa@the-dreams.de, mark.rutland@arm.com
Cc: michal.simek@xilinx.com, soren.brinkmann@xilinx.com,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, vishnum@xilinx.com,
	harinik@xilinx.com, harinikatakamlinux@gmail.com
Subject: [PATCH v2 2/3] i2c: cadence: Set the hardware time-out register to maximum value
Date: Wed,  3 Dec 2014 18:05:25 +0530	[thread overview]
Message-ID: <1417610126-7957-3-git-send-email-harinik@xilinx.com> (raw)
In-Reply-To: <1417610126-7957-1-git-send-email-harinik@xilinx.com>

From: Vishnu Motghare <vishnum@xilinx.com>

Cadence I2C controller has bug wherein it generates invalid read transactions
after timeout in master receiver mode. This driver does not use the HW
timeout and this interrupt is disabled but the feature itself cannot be
disabled. Hence, this patch writes the maximum value (0xFF) to this register.
This is one of the workarounds to this bug and it will not avoid the issue
completely but reduces the chances of error.

Signed-off-by: Vishnu Motghare <vishnum@xilinx.com>
Signed-off-by: Harini Katakam <harinik@xilinx.com>
---

v2:
Added comments in driver.

---
 drivers/i2c/busses/i2c-cadence.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index e54899e..67077c2 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -111,6 +111,8 @@
 #define CDNS_I2C_DIVA_MAX	4
 #define CDNS_I2C_DIVB_MAX	64
 
+#define CDNS_I2C_TIMEOUT_MAX	0xFF
+
 #define cdns_i2c_readreg(offset)       readl_relaxed(id->membase + offset)
 #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset)
 
@@ -858,6 +860,15 @@ static int cdns_i2c_probe(struct platform_device *pdev)
 		goto err_clk_dis;
 	}
 
+	/*
+	 * Cadence I2C controller has a bug wherein it generates
+	 * invalid read transaction after HW timeout in master receiver mode.
+	 * HW timeout is not used by this driver and the interrupt is disabled.
+	 * But the feature itself cannot be disabled. Hence maximum value
+	 * is written to this register to reduce the chances of error.
+	 */
+	cdns_i2c_writereg(CDNS_I2C_TIMEOUT_MAX, CDNS_I2C_TIME_OUT_OFFSET);
+
 	dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n",
 		 id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq);
 
-- 
1.7.9.5


  parent reply	other threads:[~2014-12-03 12:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 12:35 [PATCH v2 0/3] Cadence I2C driver fixes Harini Katakam
2014-12-03 12:35 ` [PATCH v2 1/3] i2c: cadence: Handle > 252 byte transfers Harini Katakam
2014-12-04 18:32   ` Wolfram Sang
2014-12-05  4:20     ` Harini Katakam
2014-12-05  5:41   ` rajeev kumar
2014-12-05  5:57     ` Harini Katakam
2014-12-05  8:15     ` Michal Simek
2014-12-03 12:35 ` Harini Katakam [this message]
2014-12-04 18:30   ` [PATCH v2 2/3] i2c: cadence: Set the hardware time-out register to maximum value Wolfram Sang
2014-12-03 12:35 ` [PATCH v2 3/3] i2c: cadence: Check for errata condition involving master receive Harini Katakam
2014-12-04 18:34   ` Wolfram Sang
2014-12-05  4:12     ` Harini Katakam

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=1417610126-7957-3-git-send-email-harinik@xilinx.com \
    --to=harinik@xilinx.com \
    --cc=harinikatakamlinux@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michal.simek@xilinx.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=vishnum@xilinx.com \
    --cc=wsa@the-dreams.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

all inboxes | Powered by JetHome®