summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-04-04 06:03:39 +0000
committerimp <imp@FreeBSD.org>2001-04-04 06:03:39 +0000
commit6f21113f7dc090863707b4d92b930cde939fe67b (patch)
treedbbdd3d687beb318b5dd18d5dad9b3b75046790a /sys
parent3209bda73aa437c6a76060bc029917fe552a41f0 (diff)
downloadFreeBSD-src-6f21113f7dc090863707b4d92b930cde939fe67b.zip
FreeBSD-src-6f21113f7dc090863707b4d92b930cde939fe67b.tar.gz
Try to INIT the cards up to 5 times in a row rather than just once.
It appears that some of the new PRISM2 cards need it. Fail the probe if we fail to read the MAC address. Fix a comment. Delete the unload printf. The bus system now prints this message.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wi/if_wi.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index cbe3fc2..e7f16ce 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -287,7 +287,6 @@ static int wi_pccard_detach(dev)
wi_free(dev);
sc->wi_gone = 1;
- device_printf(dev, "unload\n");
WI_UNLOCK(sc);
mtx_destroy(&sc->wi_mtx);
@@ -377,6 +376,8 @@ wi_pci_attach(device_t dev)
/*
* From Linux driver:
* Write COR to enable PC card
+ * This is a subset of the protocol that the pccard bus code
+ * would do.
*/
CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE);
reg = CSM_READ_1(sc, WI_COR_OFFSET);
@@ -428,7 +429,11 @@ wi_generic_attach(device_t dev)
/* Read the station address. */
mac.wi_type = WI_RID_MAC_NODE;
mac.wi_len = 4;
- wi_read_record(sc, (struct wi_ltv_gen *)&mac);
+ if (error = wi_read_record(sc, (struct wi_ltv_gen *)&mac)) {
+ device_printf(dev, "mac read failed %d\n", error);
+ wi_free(dev);
+ return (error);
+ }
bcopy((char *)&mac.wi_mac_addr,
(char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
@@ -810,13 +815,14 @@ static int wi_cmd(sc, cmd, val)
static void wi_reset(sc)
struct wi_softc *sc;
{
-#ifdef foo
- wi_cmd(sc, WI_CMD_INI, 0);
- DELAY(100000);
- wi_cmd(sc, WI_CMD_INI, 0);
-#endif
- DELAY(100000);
- if (wi_cmd(sc, WI_CMD_INI, 0))
+ int i, err;
+
+ for (i = 0; i < 5; i++) {
+ if (wi_cmd(sc, WI_CMD_INI, 0) == 0)
+ break;
+ DELAY(100000);
+ }
+ if (i == 5)
device_printf(sc->dev, "init failed\n");
CSR_WRITE_2(sc, WI_INT_EN, 0);
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
OpenPOWER on IntegriCloud