linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c_mxs: Set ACK_MODE bit
@ 2013-07-02 16:01 Fabio Estevam
       [not found] ` <1372780860-12972-1-git-send-email-fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Fabio Estevam @ 2013-07-02 16:01 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g
  Cc: marex-ynQEQJNshbs, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	cb-/RsSufbtIHM, Fabio Estevam

According to mx23 erratum 2727:

"2727 : I2C 9th Clock Pulse (ACK) not generated when RETAIN_CLOCK set.

Description:

When RETAIN_CLOCK is set, the ninth clock pulse (ACK) is not generated. 
However, the SDA line is read at the proper timing interval. If 
RETAIN_CLOCK is cleared, the ninth clock pulse is generated.
Also, the HW_I2C_VERSION register incorrectly states the version is 1.2. 
It should be 1.3.

Workaround:
HW_I2C_CTRL1[ACK_MODE] has default value of 0. It should be set to 1 to 
enable the fix for this issue."

It has also been noticed that mx28 needs to implement this fix in order to have
SMBus to work properly.

Reported-by: Christoph Baumann <cb-/RsSufbtIHM@public.gmane.org>
Signed-off-by: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
 drivers/i2c/busses/i2c-mxs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 6d8094d..ce7ac86 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -56,6 +56,7 @@
 #define MXS_I2C_CTRL1_CLR	(0x48)
 
 #define MXS_I2C_CTRL1_CLR_GOT_A_NAK		0x10000000
+#define MXS_I2C_CTRL1_ACK_MODE			0x08000000
 #define MXS_I2C_CTRL1_BUS_FREE_IRQ		0x80
 #define MXS_I2C_CTRL1_DATA_ENGINE_CMPLT_IRQ	0x40
 #define MXS_I2C_CTRL1_NO_SLAVE_ACK_IRQ		0x20
@@ -140,6 +141,14 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c)
 	writel(0x00300030, i2c->regs + MXS_I2C_TIMING2);
 
 	writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET);
+
+	/*
+	 * According to mx23 erratum 2727:
+	 * "I2C 9th Clock Pulse (ACK) not generated when RETAIN_CLOCK set"
+	 *
+	 * HW_I2C_CTRL1[ACK_MODE] needs to be set when RETAIN_CLOCK is set.
+	 */
+	writel(MXS_I2C_CTRL1_ACK_MODE, i2c->regs + MXS_I2C_CTRL1_SET);
 }
 
 static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-08-21  3:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 16:01 [PATCH] i2c: i2c_mxs: Set ACK_MODE bit Fabio Estevam
     [not found] ` <1372780860-12972-1-git-send-email-fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-07-02 18:11   ` Uwe Kleine-König
     [not found]     ` <20130702181115.GR27010-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-07-02 18:45       ` Fabio Estevam
     [not found]         ` <51D31FD1.4080002-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-07-03 13:20           ` Marek Vasut
     [not found]             ` <201307031520.53637.marex-ynQEQJNshbs@public.gmane.org>
2013-07-03 13:34               ` Christoph G. Baumann
     [not found]                 ` <886382023.618771.1372858452205.open-xchange-7tX72C7vayboQLBSYMtkGA@public.gmane.org>
2013-07-04  7:03                   ` Uwe Kleine-König
     [not found]                     ` <20130704070348.GB17454-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-07-09 10:54                       ` Marek Vasut
2013-08-15 10:08   ` Wolfram Sang
2013-08-15 21:30     ` Marek Vasut
2013-08-19 12:19     ` Fabio Estevam
     [not found]       ` <52120D35.707-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-08-20 18:52         ` Uwe Kleine-König
     [not found]           ` <20130820185227.GO30496-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-08-21  3:18             ` Marek Vasut
2013-08-20 19:04         ` Wolfram Sang
2013-08-20 19:10           ` Fabio Estevam
     [not found]             ` <CAOMZO5DTxNxoE7mDCM9UyYZSKFxQxRkiAyvCrLCuXF=ni-H51g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-20 19:20               ` Wolfram Sang
2013-08-20 19:35                 ` Fabio Estevam

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).