From: adrian Date: Thu, 17 Sep 2015 03:42:18 +0000 (+0000) Subject: Program the firmware setup stuff with the current hardware setup: X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=085a5ea64a369b01de22c8f47eb9e512c70d4e02;p=people%2Fjulieng%2Ffreebsd.git Program the firmware setup stuff with the current hardware setup: * Do 1T1R for now, until we read the config out of ROM and use it. * Disable turbo mode, I dunno what this is, but the linux drivers have this disabled. * Set the firmware endpoints to what we read from USB. Tested: * RTL8712 cut 3, STA mode --- diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 34a38c1ec379..d7ccecb60efa 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -363,6 +363,13 @@ rsu_attach(device_t self) iface = usbd_get_iface(sc->sc_udev, 0); sc->sc_nendpoints = iface->idesc->bNumEndpoints; + /* Endpoints are hard-coded for now, so enforce 4-endpoint only */ + if (sc->sc_nendpoints != 4) { + device_printf(sc->sc_dev, + "the driver currently only supports 4-endpoint devices\n"); + return (ENXIO); + } + mtx_init(&sc->sc_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK, MTX_DEF); TIMEOUT_TASK_INIT(taskqueue_thread, &sc->calib_task, 0, @@ -2318,14 +2325,15 @@ rsu_load_firmware(struct rsu_softc *sc) dmem = __DECONST(struct r92s_fw_priv *, &hdr->priv); memset(dmem, 0, sizeof(*dmem)); dmem->hci_sel = R92S_HCI_SEL_USB | R92S_HCI_SEL_8172; - dmem->nendpoints = 0; - dmem->rf_config = 0x12; /* 1T2R */ + dmem->nendpoints = sc->sc_nendpoints; + /* XXX TODO: rf_config should come from ROM */ + dmem->rf_config = 0x11; /* 1T1R */ dmem->vcs_type = R92S_VCS_TYPE_AUTO; dmem->vcs_mode = R92S_VCS_MODE_RTS_CTS; #ifdef notyet dmem->bw40_en = (ic->ic_htcaps & IEEE80211_HTCAP_CBW20_40) != 0; #endif - dmem->turbo_mode = 1; + dmem->turbo_mode = 0; /* Load DMEM section. */ error = rsu_fw_loadsection(sc, (uint8_t *)dmem, sizeof(*dmem)); if (error != 0) {