Module Name:    src
Committed By:   kiyohara
Date:           Sat Aug  3 07:39:31 UTC 2013

Modified Files:
        src/sys/dev/marvell: gttwsi.c gttwsireg.h

Log Message:
Issue the STOP-bit if needed.
And remove #ifdef ARMADAXP.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/gttwsi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gttwsireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gttwsi.c
diff -u src/sys/dev/marvell/gttwsi.c:1.8 src/sys/dev/marvell/gttwsi.c:1.9
--- src/sys/dev/marvell/gttwsi.c:1.8	Mon May 13 15:47:18 2013
+++ src/sys/dev/marvell/gttwsi.c	Sat Aug  3 07:39:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $	*/
+/*	$NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 Eiji Kawauchi.
  * All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $");
 #include "locators.h"
 
 #include <sys/param.h>
@@ -341,13 +341,8 @@ gttwsi_read_byte(void *v, uint8_t *valp,
 		error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags);
 	if (!error)
 		*valp = RREG(sc, TWSI_DATA);
-	if (flags & I2C_F_LAST) {
-#if defined(ARMADAXP)
+	if ((flags & (I2C_F_LAST | I2C_F_STOP)) == (I2C_F_LAST | I2C_F_STOP))
 		error = gttwsi_send_stop(sc, flags);
-#else
-		WREG(sc, TWSI_CONTROL, 0);
-#endif
-	}
 	return error;
 }
 
@@ -355,13 +350,13 @@ static int
 gttwsi_write_byte(void *v, uint8_t val, int flags)
 {
 	struct gttwsi_softc *sc = v;
+	int error;
 
 	WREG(sc, TWSI_DATA, val);
-#if defined(ARMADAXP)
-	if (flags & I2C_F_LAST)
+	error = gttwsi_wait(sc, 0, STAT_MTDB_AR, flags);
+	if (flags & I2C_F_STOP)
 		gttwsi_send_stop(sc, flags);
-#endif
-	return gttwsi_wait(sc, 0, STAT_MTDB_AR, flags);
+	return error;
 }
 
 static int
@@ -399,19 +394,5 @@ gttwsi_wait(struct gttwsi_softc *sc, uin
 		    "unexpected status 0x%x: expect 0x%x\n", status, expect);
 		return EIO;
 	}
-
-#ifndef ARMADAXP
-	if (flags & I2C_F_STOP)
-		switch (expect) {
-		case STAT_SCT:
-		case STAT_RSCT:
-		case STAT_MRRD_AT:
-		case STAT_ARBT_AR:
-			break;
-		default:
-			error = gttwsi_send_stop(sc, flags);
-		}
-#endif
-
 	return error;
 }

Index: src/sys/dev/marvell/gttwsireg.h
diff -u src/sys/dev/marvell/gttwsireg.h:1.3 src/sys/dev/marvell/gttwsireg.h:1.4
--- src/sys/dev/marvell/gttwsireg.h:1.3	Wed May  1 12:25:31 2013
+++ src/sys/dev/marvell/gttwsireg.h	Sat Aug  3 07:39:31 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: gttwsireg.h,v 1.3 2013/05/01 12:25:31 rkujawa Exp $ */
+/* $NetBSD: gttwsireg.h,v 1.4 2013/08/03 07:39:31 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2008 Eiji Kawauchi.
@@ -74,12 +74,7 @@
 #define TWSI_RETRY_COUNT	1000		/* retry loop count */
 #define TWSI_RETRY_DELAY	1		/* retry delay */
 #define	TWSI_STAT_DELAY		1		/* poll status delay */
-#ifdef ARMADAXP
-#define	TWSI_READ_DELAY		15		/* read delay */
-#define	TWSI_WRITE_DELAY	15		/* write delay */
-#else
 #define	TWSI_READ_DELAY		2		/* read delay */
 #define	TWSI_WRITE_DELAY	2		/* write delay */
-#endif /* ARMADAXP */
 
 #endif	/* _GTTWSIREG_H_ */

Reply via email to