summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-06-10 05:36:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-06-10 05:36:00 +0000
commit89ba2a3cfc3ac56ff6fa207e27f5a1555d7fd89a (patch)
tree1e85b694d9fec87f57c52d83c33dc5b39cf24c65
parent3f367e9f9ee6362d6e3b21b5f6d253efb2c96c97 (diff)
In wi_cmd() wait for the busy bit to clear; from NetBSD (ichiro)
-rw-r--r--sys/dev/ic/if_wi.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 58eeeb76235..3b7c081d06a 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.7 2001/06/09 20:17:22 millert Exp $ */
+/* $OpenBSD: if_wi.c,v 1.8 2001/06/10 05:35:59 millert Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -120,7 +120,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.7 2001/06/09 20:17:22 millert Exp $";
+ "$OpenBSD: if_wi.c,v 1.8 2001/06/10 05:35:59 millert Exp $";
#endif /* lint */
#ifdef foo
@@ -528,7 +528,16 @@ wi_cmd(sc, cmd, val)
{
int i, s = 0;
+ /* Wait for the busy bit to clear. */
+ for (i = 0; i < WI_TIMEOUT; i++) {
+ if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
+ break;
+ DELAY(1);
+ }
+
CSR_WRITE_2(sc, WI_PARAM0, val);
+ CSR_WRITE_2(sc, WI_PARAM1, 0);
+ CSR_WRITE_2(sc, WI_PARAM2, 0);
CSR_WRITE_2(sc, WI_COMMAND, cmd);
for (i = WI_TIMEOUT; i--; DELAY(1)) {