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 |
} |