Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/marvell Add timeout for wait.
details: https://anonhg.NetBSD.org/src/rev/d37e377d7dad
branches: trunk
changeset: 757977:d37e377d7dad
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Sun Oct 10 04:49:48 2010 +0000
description:
Add timeout for wait.
Not send STOP, if received ACK.
diffstat:
sys/dev/marvell/gttwsi.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r fd073d831d8e -r d37e377d7dad sys/dev/marvell/gttwsi.c
--- a/sys/dev/marvell/gttwsi.c Sat Oct 09 19:46:15 2010 +0000
+++ b/sys/dev/marvell/gttwsi.c Sun Oct 10 04:49:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gttwsi.c,v 1.4 2010/10/03 07:14:33 kiyohara Exp $ */
+/* $NetBSD: gttwsi.c,v 1.5 2010/10/10 04:49:48 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.4 2010/10/03 07:14:33 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.5 2010/10/10 04:49:48 kiyohara Exp $");
#include "locators.h"
#include <sys/param.h>
@@ -335,7 +335,7 @@
struct gttwsi_softc *sc = v;
int error;
- if (flags & I2C_F_STOP)
+ if (flags & I2C_F_LAST)
error = gttwsi_wait(sc, 0, STAT_MRRD_ANT, flags);
else
error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags);
@@ -360,13 +360,14 @@
int flags)
{
uint32_t status;
- int error = 0;
+ int timo, error = 0;
DELAY(5);
if (!(flags & I2C_F_POLL))
control |= CONTROL_INTEN;
WREG(sc, TWSI_CONTROL, control | CONTROL_TWSIEN);
+ timo = 0;
for (;;) {
control = RREG(sc, TWSI_CONTROL);
if (control & CONTROL_IFLG)
@@ -379,6 +380,8 @@
return error;
}
DELAY(TWSI_RETRY_DELAY);
+ if (timo++ > 1000000) /* 1sec */
+ break;
}
status = RREG(sc, TWSI_STATUS);
@@ -388,7 +391,8 @@
return EIO;
}
- if ((flags & I2C_F_STOP) && expect != STAT_MRRD_AT)
+ if ((flags & I2C_F_STOP) && expect != STAT_RSCT &&
+ expect != STAT_MRRD_AT && expect != STAT_ARBT_AR)
error = gttwsi_send_stop(sc, flags);
return error;
Home |
Main Index |
Thread Index |
Old Index