Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102927196
D47562.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D47562.id.diff
View Options
diff --git a/sys/dev/rtwn/rtl8192c/r92c_chan.c b/sys/dev/rtwn/rtl8192c/r92c_chan.c
--- a/sys/dev/rtwn/rtl8192c/r92c_chan.c
+++ b/sys/dev/rtwn/rtl8192c/r92c_chan.c
@@ -52,6 +52,7 @@
#include <dev/rtwn/rtl8192c/r92c_priv.h>
#include <dev/rtwn/rtl8192c/r92c_reg.h>
#include <dev/rtwn/rtl8192c/r92c_var.h>
+#include <dev/rtwn/usb/rtwn_usb_var.h>
static int
r92c_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
@@ -291,9 +292,13 @@
r92c_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
{
struct r92c_softc *rs = sc->sc_priv;
+ struct rtwn_usb_softc *uc;
u_int chan;
int i;
+ if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
+ uc->uc_write_delay = 1;
+
chan = rtwn_chan2centieee(c);
/* Set Tx power for this new channel. */
@@ -307,6 +312,9 @@
r92c_set_bw40(sc, chan, IEEE80211_IS_CHAN_HT40U(c));
else
rtwn_r92c_set_bw20(sc, chan);
+
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
}
void
diff --git a/sys/dev/rtwn/rtl8192e/r92e_chan.c b/sys/dev/rtwn/rtl8192e/r92e_chan.c
--- a/sys/dev/rtwn/rtl8192e/r92e_chan.c
+++ b/sys/dev/rtwn/rtl8192e/r92e_chan.c
@@ -60,6 +60,7 @@
#include <dev/rtwn/rtl8192e/r92e.h>
#include <dev/rtwn/rtl8192e/r92e_reg.h>
#include <dev/rtwn/rtl8192e/r92e_var.h>
+#include <dev/rtwn/usb/rtwn_usb_var.h>
static int
r92e_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
@@ -210,9 +211,12 @@
r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
{
struct r92e_softc *rs = sc->sc_priv;
+ struct rtwn_usb_softc *uc;
u_int chan;
int i;
+ if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
+ uc->uc_write_delay = 1;
chan = rtwn_chan2centieee(c);
for (i = 0; i < sc->nrxchains; i++) {
@@ -227,4 +231,6 @@
/* Set Tx power for this new channel. */
r92e_set_txpower(sc, c);
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
}
diff --git a/sys/dev/rtwn/rtl8192e/r92e_init.c b/sys/dev/rtwn/rtl8192e/r92e_init.c
--- a/sys/dev/rtwn/rtl8192e/r92e_init.c
+++ b/sys/dev/rtwn/rtl8192e/r92e_init.c
@@ -53,6 +53,8 @@
#include <dev/rtwn/if_rtwn_debug.h>
+#include <dev/rtwn/usb/rtwn_usb_var.h>
+
#include <dev/rtwn/rtl8192c/r92c.h>
#include <dev/rtwn/rtl8192e/r92e.h>
@@ -224,8 +226,12 @@
if (res != 0) \
return (EIO); \
} while(0)
+ struct rtwn_usb_softc *uc;
int ntries;
+ if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
+ uc->uc_write_delay = 1;
+
if (rtwn_read_4(sc, R92C_SYS_CFG) & R92C_SYS_CFG_TRP_BT_EN)
RTWN_CHK(rtwn_write_1(sc, R92C_LDO_SWR_CTRL, 0xc3));
else {
@@ -252,6 +258,8 @@
rtwn_delay(sc, 10);
}
if (ntries == 5000) {
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
device_printf(sc->sc_dev,
"timeout waiting for chip power up\n");
return (ETIMEDOUT);
@@ -269,8 +277,11 @@
break;
rtwn_delay(sc, 10);
}
- if (ntries == 5000)
+ if (ntries == 5000) {
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
return (ETIMEDOUT);
+ }
/* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
RTWN_CHK(rtwn_write_2(sc, R92C_CR, 0));
@@ -281,18 +292,27 @@
((sc->sc_hwcrypto != RTWN_CRYPTO_SW) ? R92C_CR_ENSEC : 0) |
R92C_CR_CALTMR_EN));
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
return (0);
}
void
r92e_power_off(struct rtwn_softc *sc)
{
+ struct rtwn_usb_softc *uc;
int error, ntries;
+ if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
+ uc->uc_write_delay = 1;
+
/* Stop Rx. */
error = rtwn_write_1(sc, R92C_CR, 0);
- if (error == ENXIO) /* hardware gone */
+ if (error == ENXIO) { /* hardware gone */
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
return;
+ }
/* Move card to Low Power state. */
/* Block all Tx queues. */
@@ -306,6 +326,8 @@
rtwn_delay(sc, 10);
}
if (ntries == 5000) {
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
device_printf(sc->sc_dev, "%s: failed to block Tx queues\n",
__func__);
return;
@@ -363,6 +385,8 @@
rtwn_delay(sc, 10);
}
if (ntries == 5000) {
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
device_printf(sc->sc_dev, "%s: could not turn off MAC\n",
__func__);
return;
@@ -385,4 +409,7 @@
/* Enable SW LPS. */
rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0,
R92C_APS_FSMCO_APFM_RSM, 1);
+
+ if (uc != NULL)
+ uc->uc_write_delay = 0;
}
diff --git a/sys/dev/rtwn/rtl8192e/r92e_reg.h b/sys/dev/rtwn/rtl8192e/r92e_reg.h
--- a/sys/dev/rtwn/rtl8192e/r92e_reg.h
+++ b/sys/dev/rtwn/rtl8192e/r92e_reg.h
@@ -41,5 +41,6 @@
/* Bits for R92E_AFE_XTAL_CTRL. */
#define R92E_AFE_XTAL_CTRL_ADDR_M 0x00fff000
#define R92E_AFE_XTAL_CTRL_ADDR_S 12
+#define R92E_USB_DELAY_US_DEF 1000
#endif /* R92E_REG_H */
diff --git a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
--- a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
+++ b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c
@@ -100,6 +100,7 @@
/* USB part. */
uc->uc_align_rx = r12au_align_rx;
uc->tx_agg_desc_num = 3;
+ uc->uc_delay_us = R92E_USB_DELAY_US_DEF;
/* Common part. */
sc->sc_flags = RTWN_FLAG_EXT_HDR;
diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.c b/sys/dev/rtwn/usb/rtwn_usb_attach.c
--- a/sys/dev/rtwn/usb/rtwn_usb_attach.c
+++ b/sys/dev/rtwn/usb/rtwn_usb_attach.c
@@ -369,6 +369,11 @@
uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MIN;
if (uc->uc_rx_buf_size > RTWN_USB_RXBUFSZ_MAX)
uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MAX;
+
+ uc->uc_delay_us = RTWN_USB_DELAY_US_DEF;
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "delay_us", CTLFLAG_RWTUN, &uc->uc_delay_us,
+ uc->uc_delay_us, "RTWN USB set channel delay microseconds");
}
static int
diff --git a/sys/dev/rtwn/usb/rtwn_usb_reg.c b/sys/dev/rtwn/usb/rtwn_usb_reg.c
--- a/sys/dev/rtwn/usb/rtwn_usb_reg.c
+++ b/sys/dev/rtwn/usb/rtwn_usb_reg.c
@@ -88,12 +88,16 @@
int len)
{
usb_device_request_t req;
+ struct rtwn_usb_softc *uc;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = R92C_REQ_REGS;
USETW(req.wValue, addr);
USETW(req.wIndex, 0);
USETW(req.wLength, len);
+ uc = RTWN_USB_SOFTC(sc);
+ if (uc->uc_write_delay == 1)
+ (sc->sc_delay)(sc,uc->uc_delay_us);
return (rtwn_do_request(sc, &req, buf));
}
diff --git a/sys/dev/rtwn/usb/rtwn_usb_var.h b/sys/dev/rtwn/usb/rtwn_usb_var.h
--- a/sys/dev/rtwn/usb/rtwn_usb_var.h
+++ b/sys/dev/rtwn/usb/rtwn_usb_var.h
@@ -27,6 +27,7 @@
#define RTWN_USB_RXBUFSZ_DEF (24)
#define RTWN_USB_RXBUFSZ_MAX (64)
#define RTWN_USB_TXBUFSZ (16 * 1024)
+#define RTWN_USB_DELAY_US_DEF 0
#define RTWN_IFACE_INDEX 0
@@ -78,6 +79,8 @@
int ntx;
int tx_agg_desc_num;
+ int uc_delay_us;
+ int uc_write_delay;
};
#define RTWN_USB_SOFTC(sc) ((struct rtwn_usb_softc *)(sc))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 8:30 PM (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14709957
Default Alt Text
D47562.id.diff (6 KB)
Attached To
Mode
D47562: rtwn: Fix RTL8192EU cannot associate in STA mode
Attached
Detach File
Event Timeline
Log In to Comment