Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2019 21:13:00 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354317 - head/sys/dev/ichiic
Message-ID:  <201911032113.xA3LD0FU077727@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf
Date: Sun Nov  3 21:12:59 2019
New Revision: 354317
URL: https://svnweb.freebsd.org/changeset/base/354317

Log:
  [ig4] wait for bus stop condition after stop command issued
  
  It gives better error detection and ig4 driver's lock coverage
  in a pipelined write case

Modified:
  head/sys/dev/ichiic/ig4_iic.c

Modified: head/sys/dev/ichiic/ig4_iic.c
==============================================================================
--- head/sys/dev/ichiic/ig4_iic.c	Sun Nov  3 21:10:47 2019	(r354316)
+++ head/sys/dev/ichiic/ig4_iic.c	Sun Nov  3 21:12:59 2019	(r354317)
@@ -362,7 +362,8 @@ ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave, 
 
 	if (!repeated_start) {
 		/*
-		 * Clear any previous TX/RX FIFOs overflow/underflow bits.
+		 * Clear any previous TX/RX FIFOs overflow/underflow bits
+		 * and I2C bus STOP condition.
 		 */
 		reg_read(sc, IG4_REG_CLR_INTR);
 	}
@@ -613,6 +614,13 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui
 		else
 			error = ig4iic_write(sc, msgs[i].buf, msgs[i].len,
 			    rpstart, stop);
+
+		/* Wait for error or stop condition occurred on the I2C bus */
+		if (stop && error == 0) {
+			error = wait_intr(sc, IG4_INTR_STOP_DET);
+			if (error == 0)
+				reg_read(sc, IG4_REG_CLR_INTR);
+		}
 
 		if (error != 0) {
 			/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911032113.xA3LD0FU077727>