summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_zyd.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2006-06-28 04:30:25 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2006-06-28 04:30:25 +0000
commit82f7ccf6bfb779c51c04924480cca7b10eb50956 (patch)
tree7df7f4acf7c1d35f54b0600ac4372bbd74c4a8fc /sys/dev/usb/if_zyd.c
parentf3464137375c31d8fc41a99312d59a26f907204b (diff)
Add a roothook so the firmware can load when the adapter
is already inserted at boot time.
Diffstat (limited to 'sys/dev/usb/if_zyd.c')
-rw-r--r--sys/dev/usb/if_zyd.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c
index 30681d7e280..ea8c629eeff 100644
--- a/sys/dev/usb/if_zyd.c
+++ b/sys/dev/usb/if_zyd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_zyd.c,v 1.8 2006/06/28 04:15:40 jsg Exp $ */
+/* $OpenBSD: if_zyd.c,v 1.9 2006/06/28 04:30:24 jsg Exp $ */
/*
* Copyright (c) 2006 by Florian Stoehr <ich@florian-stoehr.de>
@@ -148,6 +148,7 @@ void zyd_rxframeproc(struct zyd_rx_data *, uint8_t *, uint16_t);
void zyd_rxeof(usbd_xfer_handle, usbd_private_handle, usbd_status);
int zyd_uploadfirmware(struct zyd_softc *);
+void zyd_attachhook(void *);
void zyd_lock_phy(struct zyd_softc *);
void zyd_unlock_phy(struct zyd_softc *);
usbd_status zyd_get_aw_pt_bi(struct zyd_softc *, struct zyd_aw_pt_bi *);
@@ -1360,6 +1361,23 @@ skip: /* setup a new transfer */
usbd_transfer(xfer);
}
+void
+zyd_attachhook(void *xsc)
+{
+ struct zyd_softc *sc = xsc;
+
+ if (zyd_uploadfirmware(sc))
+ USB_ATTACH_ERROR_RETURN;
+
+ /* Perform a device reset */
+ zyd_reset(sc);
+
+ /* Complete the attach process (hardware init) */
+ if (zyd_complete_attach(sc) != 0)
+ USB_ATTACH_ERROR_RETURN;
+ sc->zyd_attached = 1;
+}
+
/*
* Upload firmware to device.
*
@@ -1388,7 +1406,7 @@ zyd_uploadfirmware(struct zyd_softc *sc)
if (result) {
printf("%s: failed loadfirmware of file %s: errno %d\n",
- USBDEVNAME(sc->zyd_dev), "zyd", result);
+ USBDEVNAME(sc->zyd_dev), "zd1211", result);
return -1;
}
@@ -1523,21 +1541,15 @@ USB_ATTACH(zyd)
sc->zyd_udev = dev;
/* Now upload the firmware */
- if (zyd_uploadfirmware(sc) != 0)
- USB_ATTACH_ERROR_RETURN;
+ if (rootvp == NULL)
+ mountroothook_establish(zyd_attachhook, sc);
+ else
+ zyd_attachhook(sc);
DPRINTF(("Setting debug flags\n"));
/* TODO: What about debugging flags in OpenBSD? */
/* sc->sc_ic.ic_debug = IEEE80211_MSG_ANY;*/ /* <<<--- this is the NetBSD version */
- /* Perform a device reset */
- zyd_reset(sc);
-
- /* Complete the attach process (hardware init) */
- if (zyd_complete_attach(sc) != 0)
- USB_ATTACH_ERROR_RETURN;
- sc->zyd_attached = 1;
-
USB_ATTACH_SUCCESS_RETURN;
}