Deleted Added
full compact
if_urtwn.c (266722) if_urtwn.c (268586)
1/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */
2
3/*-
4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
5 * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
1/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */
2
3/*-
4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
5 * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/cdefs.h>
21__FBSDID("$FreeBSD: stable/10/sys/dev/usb/wlan/if_urtwn.c 266722 2014-05-27 01:58:05Z kevlo $");
21__FBSDID("$FreeBSD: stable/10/sys/dev/usb/wlan/if_urtwn.c 268586 2014-07-13 15:13:25Z kevlo $");
22
23/*
24 * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU.
25 */
26
27#include <sys/param.h>
28#include <sys/sockio.h>
29#include <sys/sysctl.h>

--- 2245 unchanged lines hidden (view full) ---

2275 for (ntries = 0; ntries < 100; ntries++) {
2276 reg = urtwn_read_2(sc, R92C_SYS_FUNC_EN);
2277 if (!(reg & R92C_SYS_FUNC_EN_CPUEN))
2278 return;
2279 urtwn_ms_delay(sc);
2280 }
2281 /* Force 8051 reset. */
2282 urtwn_write_2(sc, R92C_SYS_FUNC_EN, reg & ~R92C_SYS_FUNC_EN_CPUEN);
22
23/*
24 * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU.
25 */
26
27#include <sys/param.h>
28#include <sys/sockio.h>
29#include <sys/sysctl.h>

--- 2245 unchanged lines hidden (view full) ---

2275 for (ntries = 0; ntries < 100; ntries++) {
2276 reg = urtwn_read_2(sc, R92C_SYS_FUNC_EN);
2277 if (!(reg & R92C_SYS_FUNC_EN_CPUEN))
2278 return;
2279 urtwn_ms_delay(sc);
2280 }
2281 /* Force 8051 reset. */
2282 urtwn_write_2(sc, R92C_SYS_FUNC_EN, reg & ~R92C_SYS_FUNC_EN_CPUEN);
2283 urtwn_write_2(sc, R92C_SYS_FUNC_EN,
2284 urtwn_read_2(sc, R92C_SYS_FUNC_EN) |
2285 R92C_SYS_FUNC_EN_CPUEN);
2286}
2287
2288static void
2289urtwn_r88e_fw_reset(struct urtwn_softc *sc)
2290{
2291 uint16_t reg;
2292
2293 reg = urtwn_read_2(sc, R92C_SYS_FUNC_EN);

--- 83 unchanged lines hidden (view full) ---

2377 if (urtwn_read_1(sc, R92C_MCUFWDL) & R92C_MCUFWDL_RAM_DL_SEL) {
2378 if (sc->chip & URTWN_CHIP_88E)
2379 urtwn_r88e_fw_reset(sc);
2380 else
2381 urtwn_fw_reset(sc);
2382 urtwn_write_1(sc, R92C_MCUFWDL, 0);
2383 }
2384
2283}
2284
2285static void
2286urtwn_r88e_fw_reset(struct urtwn_softc *sc)
2287{
2288 uint16_t reg;
2289
2290 reg = urtwn_read_2(sc, R92C_SYS_FUNC_EN);

--- 83 unchanged lines hidden (view full) ---

2374 if (urtwn_read_1(sc, R92C_MCUFWDL) & R92C_MCUFWDL_RAM_DL_SEL) {
2375 if (sc->chip & URTWN_CHIP_88E)
2376 urtwn_r88e_fw_reset(sc);
2377 else
2378 urtwn_fw_reset(sc);
2379 urtwn_write_1(sc, R92C_MCUFWDL, 0);
2380 }
2381
2382 if (!(sc->chip & URTWN_CHIP_88E)) {
2383 urtwn_write_2(sc, R92C_SYS_FUNC_EN,
2384 urtwn_read_2(sc, R92C_SYS_FUNC_EN) |
2385 R92C_SYS_FUNC_EN_CPUEN);
2386 }
2385 urtwn_write_1(sc, R92C_MCUFWDL,
2386 urtwn_read_1(sc, R92C_MCUFWDL) | R92C_MCUFWDL_EN);
2387 urtwn_write_1(sc, R92C_MCUFWDL + 2,
2388 urtwn_read_1(sc, R92C_MCUFWDL + 2) & ~0x08);
2389
2390 /* Reset the FWDL checksum. */
2391 urtwn_write_1(sc, R92C_MCUFWDL,
2392 urtwn_read_1(sc, R92C_MCUFWDL) | R92C_MCUFWDL_CHKSUM_RPT);

--- 1172 unchanged lines hidden ---
2387 urtwn_write_1(sc, R92C_MCUFWDL,
2388 urtwn_read_1(sc, R92C_MCUFWDL) | R92C_MCUFWDL_EN);
2389 urtwn_write_1(sc, R92C_MCUFWDL + 2,
2390 urtwn_read_1(sc, R92C_MCUFWDL + 2) & ~0x08);
2391
2392 /* Reset the FWDL checksum. */
2393 urtwn_write_1(sc, R92C_MCUFWDL,
2394 urtwn_read_1(sc, R92C_MCUFWDL) | R92C_MCUFWDL_CHKSUM_RPT);

--- 1172 unchanged lines hidden ---