]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Program the firmware setup stuff with the current hardware setup:
authoradrian <adrian@FreeBSD.org>
Thu, 17 Sep 2015 03:42:18 +0000 (03:42 +0000)
committeradrian <adrian@FreeBSD.org>
Thu, 17 Sep 2015 03:42:18 +0000 (03:42 +0000)
* 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

sys/dev/usb/wlan/if_rsu.c

index 34a38c1ec3794b6e81079614540dfe2a92e43a8f..d7ccecb60efa21d561680244b96eecf451e507a1 100644 (file)
@@ -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) {