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

Collapse All | Expand All

(-)b/sys/dev/rtwn/rtl8192e/r92e_chan.c (+12 lines)
Lines 62-67 __FBSDID("$FreeBSD$"); Link Here
62
#include <dev/rtwn/rtl8192e/r92e.h>
62
#include <dev/rtwn/rtl8192e/r92e.h>
63
#include <dev/rtwn/rtl8192e/r92e_reg.h>
63
#include <dev/rtwn/rtl8192e/r92e_reg.h>
64
#include <dev/rtwn/rtl8192e/r92e_var.h>
64
#include <dev/rtwn/rtl8192e/r92e_var.h>
65
#include <dev/rtwn/usb/rtwn_usb_var.h>
65
66
66
static int
67
static int
67
r92e_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
68
r92e_get_power_group(struct rtwn_softc *sc, struct ieee80211_channel *c)
Lines 212-220 void Link Here
212
r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
213
r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
213
{
214
{
214
	struct r92e_softc *rs = sc->sc_priv;
215
	struct r92e_softc *rs = sc->sc_priv;
216
	struct rtwn_usb_softc *uc;
215
	u_int chan;
217
	u_int chan;
216
	int i;
218
	int i;
217
219
220
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL) {
221
		RTWN_LOCK(sc);
222
		uc->uc_write_delay = 1;
223
		RTWN_UNLOCK(sc);
224
	}
218
	chan = rtwn_chan2centieee(c);
225
	chan = rtwn_chan2centieee(c);
219
226
220
	for (i = 0; i < sc->nrxchains; i++) {
227
	for (i = 0; i < sc->nrxchains; i++) {
Lines 229-232 r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c) Link Here
229
236
230
	/* Set Tx power for this new channel. */
237
	/* Set Tx power for this new channel. */
231
	r92e_set_txpower(sc, c);
238
	r92e_set_txpower(sc, c);
239
	if (uc != NULL) {
240
		RTWN_LOCK(sc);
241
		uc->uc_write_delay = 0;
242
		RTWN_UNLOCK(sc);
243
	}
232
}
244
}
(-)b/sys/dev/rtwn/rtl8192e/r92e_init.c (-2 / +56 lines)
Lines 55-60 __FBSDID("$FreeBSD$"); Link Here
55
55
56
#include <dev/rtwn/if_rtwn_debug.h>
56
#include <dev/rtwn/if_rtwn_debug.h>
57
57
58
#include <dev/rtwn/usb/rtwn_usb_var.h>
59
58
#include <dev/rtwn/rtl8192c/r92c.h>
60
#include <dev/rtwn/rtl8192c/r92c.h>
59
61
60
#include <dev/rtwn/rtl8192e/r92e.h>
62
#include <dev/rtwn/rtl8192e/r92e.h>
Lines 226-233 r92e_power_on(struct rtwn_softc *sc) Link Here
226
	if (res != 0)		\
228
	if (res != 0)		\
227
		return (EIO);	\
229
		return (EIO);	\
228
} while(0)
230
} while(0)
231
	struct rtwn_usb_softc *uc;
229
	int ntries;
232
	int ntries;
230
233
234
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL) {
235
		RTWN_LOCK(sc);
236
		uc->uc_write_delay = 1;
237
		RTWN_UNLOCK(sc);
238
	}
239
231
	if (rtwn_read_4(sc, R92C_SYS_CFG) & R92C_SYS_CFG_TRP_BT_EN)
240
	if (rtwn_read_4(sc, R92C_SYS_CFG) & R92C_SYS_CFG_TRP_BT_EN)
232
		RTWN_CHK(rtwn_write_1(sc, R92C_LDO_SWR_CTRL, 0xc3));
241
		RTWN_CHK(rtwn_write_1(sc, R92C_LDO_SWR_CTRL, 0xc3));
233
	else {
242
	else {
Lines 254-259 r92e_power_on(struct rtwn_softc *sc) Link Here
254
		rtwn_delay(sc, 10);
263
		rtwn_delay(sc, 10);
255
	}
264
	}
256
	if (ntries == 5000) {
265
	if (ntries == 5000) {
266
		if (uc != NULL) {
267
			RTWN_LOCK(sc);
268
			uc->uc_write_delay = 0;
269
			RTWN_UNLOCK(sc);
270
		}
257
		device_printf(sc->sc_dev,
271
		device_printf(sc->sc_dev,
258
		    "timeout waiting for chip power up\n");
272
		    "timeout waiting for chip power up\n");
259
		return (ETIMEDOUT);
273
		return (ETIMEDOUT);
Lines 271-278 r92e_power_on(struct rtwn_softc *sc) Link Here
271
			break;
285
			break;
272
		rtwn_delay(sc, 10);
286
		rtwn_delay(sc, 10);
273
	}
287
	}
274
	if (ntries == 5000)
288
	if (ntries == 5000) {
289
		if (uc != NULL) {
290
			RTWN_LOCK(sc);
291
			uc->uc_write_delay = 0;
292
			RTWN_UNLOCK(sc);
293
		}
275
		return (ETIMEDOUT);
294
		return (ETIMEDOUT);
295
	}
276
296
277
	/* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
297
	/* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
278
	RTWN_CHK(rtwn_write_2(sc, R92C_CR, 0));
298
	RTWN_CHK(rtwn_write_2(sc, R92C_CR, 0));
Lines 283-300 r92e_power_on(struct rtwn_softc *sc) Link Here
283
	    ((sc->sc_hwcrypto != RTWN_CRYPTO_SW) ? R92C_CR_ENSEC : 0) |
303
	    ((sc->sc_hwcrypto != RTWN_CRYPTO_SW) ? R92C_CR_ENSEC : 0) |
284
	    R92C_CR_CALTMR_EN));
304
	    R92C_CR_CALTMR_EN));
285
305
306
	if (uc != NULL) {
307
		RTWN_LOCK(sc);
308
		uc->uc_write_delay = 0;
309
		RTWN_UNLOCK(sc);
310
	}
286
	return (0);
311
	return (0);
287
}
312
}
288
313
289
void
314
void
290
r92e_power_off(struct rtwn_softc *sc)
315
r92e_power_off(struct rtwn_softc *sc)
291
{
316
{
317
	struct rtwn_usb_softc *uc;
292
	int error, ntries;
318
	int error, ntries;
293
319
320
	if ((uc = RTWN_USB_SOFTC(sc)) != NULL) {
321
		RTWN_LOCK(sc);
322
		uc->uc_write_delay = 1;
323
		RTWN_UNLOCK(sc);
324
	}
325
294
	/* Stop Rx. */
326
	/* Stop Rx. */
295
	error = rtwn_write_1(sc, R92C_CR, 0);
327
	error = rtwn_write_1(sc, R92C_CR, 0);
296
	if (error == ENXIO)	/* hardware gone */
328
	if (error == ENXIO) {	/* hardware gone */
329
		if (uc != NULL) {
330
			RTWN_LOCK(sc);
331
			uc->uc_write_delay = 0;
332
			RTWN_UNLOCK(sc);
333
		}
297
		return;
334
		return;
335
	}
298
336
299
	/* Move card to Low Power state. */
337
	/* Move card to Low Power state. */
300
	/* Block all Tx queues. */
338
	/* Block all Tx queues. */
Lines 308-313 r92e_power_off(struct rtwn_softc *sc) Link Here
308
		rtwn_delay(sc, 10);
346
		rtwn_delay(sc, 10);
309
	}
347
	}
310
	if (ntries == 5000) {
348
	if (ntries == 5000) {
349
		if (uc != NULL) {
350
			RTWN_LOCK(sc);
351
			uc->uc_write_delay = 0;
352
			RTWN_UNLOCK(sc);
353
		}
311
		device_printf(sc->sc_dev, "%s: failed to block Tx queues\n",
354
		device_printf(sc->sc_dev, "%s: failed to block Tx queues\n",
312
		    __func__);
355
		    __func__);
313
		return;
356
		return;
Lines 365-370 r92e_power_off(struct rtwn_softc *sc) Link Here
365
		rtwn_delay(sc, 10);
408
		rtwn_delay(sc, 10);
366
	}
409
	}
367
	if (ntries == 5000) {
410
	if (ntries == 5000) {
411
		if (uc != NULL) {
412
			RTWN_LOCK(sc);
413
			uc->uc_write_delay = 0;
414
			RTWN_UNLOCK(sc);
415
		}
368
		device_printf(sc->sc_dev, "%s: could not turn off MAC\n",
416
		device_printf(sc->sc_dev, "%s: could not turn off MAC\n",
369
		    __func__);
417
		    __func__);
370
		return;
418
		return;
Lines 387-390 r92e_power_off(struct rtwn_softc *sc) Link Here
387
	/* Enable SW LPS. */
435
	/* Enable SW LPS. */
388
	rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0,
436
	rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0,
389
	    R92C_APS_FSMCO_APFM_RSM, 1);
437
	    R92C_APS_FSMCO_APFM_RSM, 1);
438
	if (uc != NULL) {
439
		RTWN_LOCK(sc);
440
		uc->uc_write_delay = 0;
441
		RTWN_UNLOCK(sc);
442
	}
443
390
}
444
}
(-)b/sys/dev/rtwn/usb/rtwn_usb_attach.c (+5 lines)
Lines 372-377 rtwn_usb_sysctlattach(struct rtwn_softc *sc) Link Here
372
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MIN;
372
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MIN;
373
	if (uc->uc_rx_buf_size > RTWN_USB_RXBUFSZ_MAX)
373
	if (uc->uc_rx_buf_size > RTWN_USB_RXBUFSZ_MAX)
374
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MAX;
374
		uc->uc_rx_buf_size = RTWN_USB_RXBUFSZ_MAX;
375
	uc->uc_delay_us = RTWN_USB_DELAY_US_DEF;
376
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
377
	    "RTWN USB set channel delay microseconds",
378
	    CTLFLAG_RDTUN, &uc->uc_delay_us,
379
	    uc->uc_delay_us, str);
375
}
380
}
376
381
377
static int
382
static int
(-)b/sys/dev/rtwn/usb/rtwn_usb_reg.c (+4 lines)
Lines 91-102 rtwn_usb_write_region_1(struct rtwn_softc *sc, uint16_t addr, uint8_t *buf, Link Here
91
    int len)
91
    int len)
92
{
92
{
93
	usb_device_request_t req;
93
	usb_device_request_t req;
94
	struct rtwn_usb_softc *uc;
94
95
95
	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
96
	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
96
	req.bRequest = R92C_REQ_REGS;
97
	req.bRequest = R92C_REQ_REGS;
97
	USETW(req.wValue, addr);
98
	USETW(req.wValue, addr);
98
	USETW(req.wIndex, 0);
99
	USETW(req.wIndex, 0);
99
	USETW(req.wLength, len);
100
	USETW(req.wLength, len);
101
	uc = RTWN_USB_SOFTC(sc);
102
	if (uc->uc_write_delay == 1)
103
		(sc->sc_delay)(sc,uc->uc_delay_us);
100
	return (rtwn_do_request(sc, &req, buf));
104
	return (rtwn_do_request(sc, &req, buf));
101
}
105
}
102
106
(-)b/sys/dev/rtwn/usb/rtwn_usb_var.h (-1 / +3 lines)
Lines 28-33 Link Here
28
#define RTWN_USB_RXBUFSZ_DEF		(24)
28
#define RTWN_USB_RXBUFSZ_DEF		(24)
29
#define RTWN_USB_RXBUFSZ_MAX		(64)
29
#define RTWN_USB_RXBUFSZ_MAX		(64)
30
#define RTWN_USB_TXBUFSZ		(16 * 1024)
30
#define RTWN_USB_TXBUFSZ		(16 * 1024)
31
#define RTWN_USB_DELAY_US_DEF		1000
31
32
32
#define RTWN_IFACE_INDEX		0
33
#define RTWN_IFACE_INDEX		0
33
34
Lines 79-84 struct rtwn_usb_softc { Link Here
79
80
80
	int			ntx;
81
	int			ntx;
81
	int			tx_agg_desc_num;
82
	int			tx_agg_desc_num;
83
	int			uc_delay_us;
84
	int			uc_write_delay;
82
};
85
};
83
#define RTWN_USB_SOFTC(sc)	((struct rtwn_usb_softc *)(sc))
86
#define RTWN_USB_SOFTC(sc)	((struct rtwn_usb_softc *)(sc))
84
87
85
- 

Return to bug 247528