View | Details | Raw Unified | Return to bug 247528 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/rtwn/rtl8192c/r92c_chan.c (+8 lines)
Lines 52-57 Link Here
52
#include <dev/rtwn/rtl8192c/r92c_priv.h>
52
#include <dev/rtwn/rtl8192c/r92c_priv.h>
53
#include <dev/rtwn/rtl8192c/r92c_reg.h>
53
#include <dev/rtwn/rtl8192c/r92c_reg.h>
54
#include <dev/rtwn/rtl8192c/r92c_var.h>
54
#include <dev/rtwn/rtl8192c/r92c_var.h>
55
#include <dev/rtwn/usb/rtwn_usb_var.h>
55
56
56
static int
57
static int
57
r92c_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
58
r92c_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
Lines 291-299 void Link Here
291
r92c_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
292
r92c_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
292
{
293
{
293
	struct r92c_softc *rs = sc->sc_priv;
294
	struct r92c_softc *rs = sc->sc_priv;
295
	struct rtwn_usb_softc *uc;
294
	u_int chan;
296
	u_int chan;
295
	int i;
297
	int i;
296
298
299
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
300
		uc->uc_write_delay = 1;
301
297
	chan = rtwn_chan2centieee(c);
302
	chan = rtwn_chan2centieee(c);
298
303
299
	/* Set Tx power for this new channel. */
304
	/* Set Tx power for this new channel. */
Lines 307-312 r92c_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c) Link Here
307
		r92c_set_bw40(sc, chan, IEEE80211_IS_CHAN_HT40U(c));
312
		r92c_set_bw40(sc, chan, IEEE80211_IS_CHAN_HT40U(c));
308
	else
313
	else
309
		rtwn_r92c_set_bw20(sc, chan);
314
		rtwn_r92c_set_bw20(sc, chan);
315
316
	if (uc != NULL)
317
		uc->uc_write_delay = 0;
310
}
318
}
311
319
312
void
320
void
(-)b/sys/dev/rtwn/rtl8192e/r92e_chan.c (+6 lines)
Lines 60-65 Link Here
60
#include <dev/rtwn/rtl8192e/r92e.h>
60
#include <dev/rtwn/rtl8192e/r92e.h>
61
#include <dev/rtwn/rtl8192e/r92e_reg.h>
61
#include <dev/rtwn/rtl8192e/r92e_reg.h>
62
#include <dev/rtwn/rtl8192e/r92e_var.h>
62
#include <dev/rtwn/rtl8192e/r92e_var.h>
63
#include <dev/rtwn/usb/rtwn_usb_var.h>
63
64
64
static int
65
static int
65
r92e_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
66
r92e_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
Lines 210-218 void Link Here
210
r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
211
r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
211
{
212
{
212
	struct r92e_softc *rs = sc->sc_priv;
213
	struct r92e_softc *rs = sc->sc_priv;
214
	struct rtwn_usb_softc *uc;
213
	u_int chan;
215
	u_int chan;
214
	int i;
216
	int i;
215
217
218
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
219
		uc->uc_write_delay = 1;
216
	chan = rtwn_chan2centieee(c);
220
	chan = rtwn_chan2centieee(c);
217
221
218
	for (i = 0; i < sc->nrxchains; i++) {
222
	for (i = 0; i < sc->nrxchains; i++) {
Lines 227-230 r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c) Link Here
227
231
228
	/* Set Tx power for this new channel. */
232
	/* Set Tx power for this new channel. */
229
	r92e_set_txpower(sc, c);
233
	r92e_set_txpower(sc, c);
234
	if (uc != NULL)
235
		uc->uc_write_delay = 0;
230
}
236
}
(-)b/sys/dev/rtwn/rtl8192e/r92e_init.c (-2 / +29 lines)
Lines 53-58 Link Here
53
53
54
#include <dev/rtwn/if_rtwn_debug.h>
54
#include <dev/rtwn/if_rtwn_debug.h>
55
55
56
#include <dev/rtwn/usb/rtwn_usb_var.h>
57
56
#include <dev/rtwn/rtl8192c/r92c.h>
58
#include <dev/rtwn/rtl8192c/r92c.h>
57
59
58
#include <dev/rtwn/rtl8192e/r92e.h>
60
#include <dev/rtwn/rtl8192e/r92e.h>
Lines 224-231 r92e_power_on(struct rtwn_softc *sc) Link Here
224
	if (res != 0)		\
226
	if (res != 0)		\
225
		return (EIO);	\
227
		return (EIO);	\
226
} while(0)
228
} while(0)
229
	struct rtwn_usb_softc *uc;
227
	int ntries;
230
	int ntries;
228
231
232
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
233
		uc->uc_write_delay = 1;
234
229
	if (rtwn_read_4(sc, R92C_SYS_CFG) & R92C_SYS_CFG_TRP_BT_EN)
235
	if (rtwn_read_4(sc, R92C_SYS_CFG) & R92C_SYS_CFG_TRP_BT_EN)
230
		RTWN_CHK(rtwn_write_1(sc, R92C_LDO_SWR_CTRL, 0xc3));
236
		RTWN_CHK(rtwn_write_1(sc, R92C_LDO_SWR_CTRL, 0xc3));
231
	else {
237
	else {
Lines 252-257 r92e_power_on(struct rtwn_softc *sc) Link Here
252
		rtwn_delay(sc, 10);
258
		rtwn_delay(sc, 10);
253
	}
259
	}
254
	if (ntries == 5000) {
260
	if (ntries == 5000) {
261
		if (uc != NULL)
262
			uc->uc_write_delay = 0;
255
		device_printf(sc->sc_dev,
263
		device_printf(sc->sc_dev,
256
		    "timeout waiting for chip power up\n");
264
		    "timeout waiting for chip power up\n");
257
		return (ETIMEDOUT);
265
		return (ETIMEDOUT);
Lines 269-276 r92e_power_on(struct rtwn_softc *sc) Link Here
269
			break;
277
			break;
270
		rtwn_delay(sc, 10);
278
		rtwn_delay(sc, 10);
271
	}
279
	}
272
	if (ntries == 5000)
280
	if (ntries == 5000) {
281
		if (uc != NULL)
282
			uc->uc_write_delay = 0;
273
		return (ETIMEDOUT);
283
		return (ETIMEDOUT);
284
	}
274
285
275
	/* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
286
	/* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
276
	RTWN_CHK(rtwn_write_2(sc, R92C_CR, 0));
287
	RTWN_CHK(rtwn_write_2(sc, R92C_CR, 0));
Lines 281-298 r92e_power_on(struct rtwn_softc *sc) Link Here
281
	    ((sc->sc_hwcrypto != RTWN_CRYPTO_SW) ? R92C_CR_ENSEC : 0) |
292
	    ((sc->sc_hwcrypto != RTWN_CRYPTO_SW) ? R92C_CR_ENSEC : 0) |
282
	    R92C_CR_CALTMR_EN));
293
	    R92C_CR_CALTMR_EN));
283
294
295
	if (uc != NULL)
296
		uc->uc_write_delay = 0;
284
	return (0);
297
	return (0);
285
}
298
}
286
299
287
void
300
void
288
r92e_power_off(struct rtwn_softc *sc)
301
r92e_power_off(struct rtwn_softc *sc)
289
{
302
{
303
	struct rtwn_usb_softc *uc;
290
	int error, ntries;
304
	int error, ntries;
291
305
306
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL)
307
		uc->uc_write_delay = 1;
308
292
	/* Stop Rx. */
309
	/* Stop Rx. */
293
	error = rtwn_write_1(sc, R92C_CR, 0);
310
	error = rtwn_write_1(sc, R92C_CR, 0);
294
	if (error == ENXIO)	/* hardware gone */
311
	if (error == ENXIO) {	/* hardware gone */
312
		if (uc != NULL)
313
			uc->uc_write_delay = 0;
295
		return;
314
		return;
315
	}
296
316
297
	/* Move card to Low Power state. */
317
	/* Move card to Low Power state. */
298
	/* Block all Tx queues. */
318
	/* Block all Tx queues. */
Lines 306-311 r92e_power_off(struct rtwn_softc *sc) Link Here
306
		rtwn_delay(sc, 10);
326
		rtwn_delay(sc, 10);
307
	}
327
	}
308
	if (ntries == 5000) {
328
	if (ntries == 5000) {
329
		if (uc != NULL)
330
			uc->uc_write_delay = 0;
309
		device_printf(sc->sc_dev, "%s: failed to block Tx queues\n",
331
		device_printf(sc->sc_dev, "%s: failed to block Tx queues\n",
310
		    __func__);
332
		    __func__);
311
		return;
333
		return;
Lines 363-368 r92e_power_off(struct rtwn_softc *sc) Link Here
363
		rtwn_delay(sc, 10);
385
		rtwn_delay(sc, 10);
364
	}
386
	}
365
	if (ntries == 5000) {
387
	if (ntries == 5000) {
388
		if (uc != NULL)
389
			uc->uc_write_delay = 0;
366
		device_printf(sc->sc_dev, "%s: could not turn off MAC\n",
390
		device_printf(sc->sc_dev, "%s: could not turn off MAC\n",
367
		    __func__);
391
		    __func__);
368
		return;
392
		return;
Lines 385-388 r92e_power_off(struct rtwn_softc *sc) Link Here
385
	/* Enable SW LPS. */
409
	/* Enable SW LPS. */
386
	rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0,
410
	rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0,
387
	    R92C_APS_FSMCO_APFM_RSM, 1);
411
	    R92C_APS_FSMCO_APFM_RSM, 1);
412
413
	if (uc != NULL)
414
		uc->uc_write_delay = 0;
388
}
415
}
(-)b/sys/dev/rtwn/rtl8192e/r92e_reg.h (+1 lines)
Lines 41-45 Link Here
41
/* Bits for R92E_AFE_XTAL_CTRL. */
41
/* Bits for R92E_AFE_XTAL_CTRL. */
42
#define R92E_AFE_XTAL_CTRL_ADDR_M	0x00fff000
42
#define R92E_AFE_XTAL_CTRL_ADDR_M	0x00fff000
43
#define R92E_AFE_XTAL_CTRL_ADDR_S	12
43
#define R92E_AFE_XTAL_CTRL_ADDR_S	12
44
#define R92E_USB_DELAY_US_DEF		1000
44
45
45
#endif	/* R92E_REG_H */
46
#endif	/* R92E_REG_H */
(-)b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c (+1 lines)
Lines 100-105 r92eu_attach(struct rtwn_usb_softc *uc) Link Here
100
	/* USB part. */
100
	/* USB part. */
101
	uc->uc_align_rx			= r12au_align_rx;
101
	uc->uc_align_rx			= r12au_align_rx;
102
	uc->tx_agg_desc_num		= 3;
102
	uc->tx_agg_desc_num		= 3;
103
	uc->uc_delay_us			= R92E_USB_DELAY_US_DEF;
103
104
104
	/* Common part. */
105
	/* Common part. */
105
	sc->sc_flags			= RTWN_FLAG_EXT_HDR;
106
	sc->sc_flags			= RTWN_FLAG_EXT_HDR;
(-)b/sys/dev/rtwn/usb/rtwn_usb_attach.c (+5 lines)
Lines 369-374 rtwn_usb_sysctlattach(struct rtwn_softc *sc) Link Here
369
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MIN;
369
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MIN;
370
	if (uc->uc_rx_buf_size > RTWN_USB_RXBUFSZ_MAX)
370
	if (uc->uc_rx_buf_size > RTWN_USB_RXBUFSZ_MAX)
371
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MAX;
371
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MAX;
372
373
	uc->uc_delay_us = RTWN_USB_DELAY_US_DEF;
374
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
375
	    "delay_us", CTLFLAG_RWTUN, &uc->uc_delay_us,
376
	    uc->uc_delay_us, "RTWN USB set channel delay microseconds");
372
}
377
}
373
378
374
static int
379
static int
(-)b/sys/dev/rtwn/usb/rtwn_usb_reg.c (+4 lines)
Lines 88-99 rtwn_usb_write_region_1(struct rtwn_softc *sc, uint16_t addr, uint8_t *buf, Link Here
88
    int len)
88
    int len)
89
{
89
{
90
	usb_device_request_t req;
90
	usb_device_request_t req;
91
	struct rtwn_usb_softc *uc;
91
92
92
	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
93
	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
93
	req.bRequest = R92C_REQ_REGS;
94
	req.bRequest = R92C_REQ_REGS;
94
	USETW(req.wValue, addr);
95
	USETW(req.wValue, addr);
95
	USETW(req.wIndex, 0);
96
	USETW(req.wIndex, 0);
96
	USETW(req.wLength, len);
97
	USETW(req.wLength, len);
98
	uc = RTWN_USB_SOFTC(sc);
99
	if (uc->uc_write_delay == 1)
100
		(sc->sc_delay)(sc,uc->uc_delay_us);
97
	return (rtwn_do_request(sc, &req, buf));
101
	return (rtwn_do_request(sc, &req, buf));
98
}
102
}
99
103
(-)b/sys/dev/rtwn/usb/rtwn_usb_var.h (-1 / +3 lines)
Lines 27-32 Link Here
27
#define RTWN_USB_RXBUFSZ_DEF		(24)
27
#define RTWN_USB_RXBUFSZ_DEF		(24)
28
#define RTWN_USB_RXBUFSZ_MAX		(64)
28
#define RTWN_USB_RXBUFSZ_MAX		(64)
29
#define RTWN_USB_TXBUFSZ		(16 * 1024)
29
#define RTWN_USB_TXBUFSZ		(16 * 1024)
30
#define RTWN_USB_DELAY_US_DEF		0
30
31
31
#define RTWN_IFACE_INDEX		0
32
#define RTWN_IFACE_INDEX		0
32
33
Lines 78-83 struct rtwn_usb_softc { Link Here
78
79
79
	int			ntx;
80
	int			ntx;
80
	int			tx_agg_desc_num;
81
	int			tx_agg_desc_num;
82
	int			uc_delay_us;
83
	int			uc_write_delay;
81
};
84
};
82
#define RTWN_USB_SOFTC(sc)	((struct rtwn_usb_softc *)(sc))
85
#define RTWN_USB_SOFTC(sc)	((struct rtwn_usb_softc *)(sc))
83
86
84
- 

Return to bug 247528