Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2012 19:08:44 +0000 (UTC)
From:      Bernhard Schmidt <bschmidt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233283 - head/sys/dev/usb/wlan
Message-ID:  <201203211908.q2LJ8iI6089788@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bschmidt
Date: Wed Mar 21 19:08:44 2012
New Revision: 233283
URL: http://svn.freebsd.org/changeset/base/233283

Log:
  Load the firmware during init not attach, as a root filesystem might
  not yet be available. While here, also print the firmware version.
  
  Submitted by:	PseudoCylon
  MFC after:	3 days

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c	Wed Mar 21 16:59:39 2012	(r233282)
+++ head/sys/dev/usb/wlan/if_run.c	Wed Mar 21 19:08:44 2012	(r233283)
@@ -600,12 +600,6 @@ run_attach(device_t self)
 	    sc->mac_ver, sc->mac_rev, run_get_rf(sc->rf_rev),
 	    sc->ntxchains, sc->nrxchains, ether_sprintf(sc->sc_bssid));
 
-	if ((error = run_load_microcode(sc)) != 0) {
-		device_printf(sc->sc_dev, "could not load 8051 microcode\n");
-		RUN_UNLOCK(sc);
-		goto detach;
-	}
-
 	RUN_UNLOCK(sc);
 
 	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
@@ -1050,8 +1044,9 @@ run_load_microcode(struct run_softc *sc)
 		error = ETIMEDOUT;
 		goto fail;
 	}
-	device_printf(sc->sc_dev, "firmware %s loaded\n",
-	    (base == fw->data) ? "RT2870" : "RT3071");
+	device_printf(sc->sc_dev, "firmware %s ver. %u.%u loaded\n",
+	    (base == fw->data) ? "RT2870" : "RT3071",
+	    *(base + 4092), *(base + 4093));
 
 fail:
 	firmware_put(fw, FIRMWARE_UNLOAD);
@@ -4677,6 +4672,11 @@ run_init_locked(struct run_softc *sc)
 
 	run_stop(sc);
 
+	if (run_load_microcode(sc) != 0) {
+		device_printf(sc->sc_dev, "could not load 8051 microcode\n");
+		goto fail;
+	}
+
 	for (ntries = 0; ntries < 100; ntries++) {
 		if (run_read(sc, RT2860_ASIC_VER_ID, &tmp) != 0)
 			goto fail;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203211908.q2LJ8iI6089788>