Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/marvell Issue the STOP-bit if needed.



details:   https://anonhg.NetBSD.org/src/rev/2aa30d1c1c81
branches:  trunk
changeset: 788995:2aa30d1c1c81
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sat Aug 03 07:39:31 2013 +0000

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

diffstat:

 sys/dev/marvell/gttwsi.c    |  33 +++++++--------------------------
 sys/dev/marvell/gttwsireg.h |   7 +------
 2 files changed, 8 insertions(+), 32 deletions(-)

diffs (93 lines):

diff -r 5a7d73c98e87 -r 2aa30d1c1c81 sys/dev/marvell/gttwsi.c
--- a/sys/dev/marvell/gttwsi.c  Fri Aug 02 20:13:09 2013 +0000
+++ b/sys/dev/marvell/gttwsi.c  Sat Aug 03 07:39:31 2013 +0000
@@ -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 @@
                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 @@
 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 @@
                    "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;
 }
diff -r 5a7d73c98e87 -r 2aa30d1c1c81 sys/dev/marvell/gttwsireg.h
--- a/sys/dev/marvell/gttwsireg.h       Fri Aug 02 20:13:09 2013 +0000
+++ b/sys/dev/marvell/gttwsireg.h       Sat Aug 03 07:39:31 2013 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index