From f8ef5bfb0d9b27c901a29c37fb1dc0cfa81e6a70 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 9 Apr 2001 06:33:36 +0000 Subject: Two minor fixes: o Change the number of init tries from 5 to a #define. o Allow up to 5s rather than 2s for commands to complete. This is still much less than 51 minutes, but makes my intel card init with more reliability than before. --- sys/dev/wi/if_wi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sys/dev/wi') diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 8a527beab889..49e5a947913d 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -770,7 +770,7 @@ static int wi_cmd(sc, cmd, val) int i, s = 0; /* wait for the busy bit to clear */ - for (i = 200; i > 0; i--) { + for (i = 500; i > 0; i--) { /* 5s */ if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY)) { break; } @@ -814,14 +814,15 @@ static int wi_cmd(sc, cmd, val) static void wi_reset(sc) struct wi_softc *sc; { +#define WI_INIT_TRIES 5 int i; - for (i = 0; i < 5; i++) { + for (i = 0; i < WI_INIT_TRIES; i++) { if (wi_cmd(sc, WI_CMD_INI, 0) == 0) break; - DELAY(100000); + DELAY(50 * 1000); /* 50ms */ } - if (i == 5) + if (i == WI_INIT_TRIES) device_printf(sc->dev, "init failed\n"); CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); -- cgit v1.3