Index: head/sys/conf/options =================================================================== --- head/sys/conf/options +++ head/sys/conf/options @@ -673,6 +673,9 @@ UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h +# options for the Realtek RTL8188*U/RTL8192CU driver (urtwn) +URTWN_WITHOUT_UCODE opt_urtwn.h + # Embedded system options INIT_PATH Index: head/sys/dev/usb/wlan/if_urtwn.c =================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c +++ head/sys/dev/usb/wlan/if_urtwn.c @@ -26,6 +26,7 @@ */ #include "opt_wlan.h" +#include "opt_urtwn.h" #include #include @@ -308,11 +309,13 @@ static int urtwn_r92c_power_on(struct urtwn_softc *); static int urtwn_r88e_power_on(struct urtwn_softc *); static int urtwn_llt_init(struct urtwn_softc *); +#ifndef URTWN_WITHOUT_UCODE static void urtwn_fw_reset(struct urtwn_softc *); static void urtwn_r88e_fw_reset(struct urtwn_softc *); static int urtwn_fw_loadpage(struct urtwn_softc *, int, const uint8_t *, int); static int urtwn_load_firmware(struct urtwn_softc *); +#endif static int urtwn_dma_init(struct urtwn_softc *); static int urtwn_mac_init(struct urtwn_softc *); static void urtwn_bb_init(struct urtwn_softc *); @@ -1376,6 +1379,13 @@ usb_error_t error; int ntries; + if (!(sc->sc_flags & URTWN_FW_LOADED)) { + URTWN_DPRINTF(sc, URTWN_DEBUG_FIRMWARE, "%s: firmware " + "was not loaded; command (id %d) will be discarded\n", + __func__, id); + return (0); + } + /* Wait for current FW box to be empty. */ for (ntries = 0; ntries < 100; ntries++) { if (!(urtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) @@ -3275,6 +3285,7 @@ return (error); } +#ifndef URTWN_WITHOUT_UCODE static void urtwn_fw_reset(struct urtwn_softc *sc) { @@ -3457,6 +3468,7 @@ firmware_put(fw, FIRMWARE_UNLOAD); return (error); } +#endif static int urtwn_dma_init(struct urtwn_softc *sc) @@ -4786,10 +4798,12 @@ urtwn_write_1(sc, R92C_BCN_MAX_ERR, 0xff); } +#ifndef URTWN_WITHOUT_UCODE /* Load 8051 microcode. */ error = urtwn_load_firmware(sc); - if (error != 0) - goto fail; + if (error == 0) + sc->sc_flags |= URTWN_FW_LOADED; +#endif /* Initialize MAC/BB/RF blocks. */ error = urtwn_mac_init(sc); @@ -4892,7 +4906,8 @@ return; } - sc->sc_flags &= ~(URTWN_RUNNING | URTWN_TEMP_MEASURED); + sc->sc_flags &= ~(URTWN_RUNNING | URTWN_FW_LOADED | + URTWN_TEMP_MEASURED); sc->thcal_lctemp = 0; callout_stop(&sc->sc_watchdog_ch); urtwn_abort_xfers(sc); @@ -4991,6 +5006,8 @@ DRIVER_MODULE(urtwn, uhub, urtwn_driver, urtwn_devclass, NULL, NULL); MODULE_DEPEND(urtwn, usb, 1, 1, 1); MODULE_DEPEND(urtwn, wlan, 1, 1, 1); +#ifndef URTWN_WITHOUT_UCODE MODULE_DEPEND(urtwn, firmware, 1, 1, 1); +#endif MODULE_VERSION(urtwn, 1); USB_PNP_HOST_INFO(urtwn_devs); Index: head/sys/dev/usb/wlan/if_urtwnvar.h =================================================================== --- head/sys/dev/usb/wlan/if_urtwnvar.h +++ head/sys/dev/usb/wlan/if_urtwnvar.h @@ -155,7 +155,8 @@ uint8_t sc_flags; #define URTWN_FLAG_CCK_HIPWR 0x01 #define URTWN_DETACHED 0x02 -#define URTWN_RUNNING 0x04 +#define URTWN_RUNNING 0x04 +#define URTWN_FW_LOADED 0x08 #define URTWN_TEMP_MEASURED 0x10 u_int chip; @@ -196,11 +197,6 @@ urtwn_datahead sc_tx_inactive; urtwn_datahead sc_tx_pending; - const char *fwname; - const struct firmware *fw_fp; - struct urtwn_fw_info fw; - void *fw_virtaddr; - union urtwn_rom rom; uint16_t last_rom_addr; Index: head/sys/modules/usb/Makefile =================================================================== --- head/sys/modules/usb/Makefile +++ head/sys/modules/usb/Makefile @@ -47,7 +47,7 @@ SUBDIR += ${_dwc_otg} ehci ${_musb} ohci uhci xhci ${_uss820dci} ${_at91dci} \ ${_atmegadci} ${_avr32dci} ${_rsu} ${_rsufw} ${_saf1761otg} SUBDIR += ${_rum} ${_run} ${_runfw} ${_uath} upgt usie ural ${_zyd} ${_urtw} -SUBDIR += ${_urtwn} ${_urtwnfw} +SUBDIR += urtwn ${_urtwnfw} SUBDIR += atp uhid ukbd ums udbp ufm uep wsp ugold uled SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ umct umcs umodem umoscom uplcom uslcom uvisor uvscom @@ -70,7 +70,6 @@ _uath= uath _zyd= zyd _kue= kue -_urtwn= urtwn _urtwnfw= urtwnfw _run= run _runfw= runfw Index: head/sys/modules/usb/urtwn/Makefile =================================================================== --- head/sys/modules/usb/urtwn/Makefile +++ head/sys/modules/usb/urtwn/Makefile @@ -2,9 +2,16 @@ .PATH: ${.CURDIR}/../../../dev/usb/wlan +.include + KMOD = if_urtwn SRCS = if_urtwn.c if_urtwnreg.h if_urtwnvar.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h + opt_bus.h opt_urtwn.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h + +.if ${MK_SOURCELESS_UCODE} == "no" +opt_urtwn.h: + @echo "#define URTWN_WITHOUT_UCODE 1" > ${.TARGET} +.endif .include