summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-02-07 21:21:45 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-02-07 21:21:45 +0000
commite38b8ae246af4209b128f26467ba533b8ec13cd2 (patch)
tree214f9e718ec67a48413ef5575e36d0a67cc82ea5 /sys
parent701395e58937f55692c3467ebd02e2eaf52d0f5f (diff)
Fix a logic error when enabling MAC and reset the checksum report bit
before loading page, from FreBSD r262822 and r263154. ok stsp@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_urtwn.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c
index 56ef2b820ab..5ae276fd39f 100644
--- a/sys/dev/usb/if_urtwn.c
+++ b/sys/dev/usb/if_urtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urtwn.c,v 1.40 2014/12/22 02:28:52 tedu Exp $ */
+/* $OpenBSD: if_urtwn.c,v 1.41 2015/02/07 21:21:44 mpi Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -2058,8 +2058,8 @@ urtwn_power_on(struct urtwn_softc *sc)
urtwn_write_2(sc, R92C_APS_FSMCO,
urtwn_read_2(sc, R92C_APS_FSMCO) | R92C_APS_FSMCO_APFM_ONMAC);
for (ntries = 0; ntries < 1000; ntries++) {
- if (urtwn_read_2(sc, R92C_APS_FSMCO) &
- R92C_APS_FSMCO_APFM_ONMAC)
+ if (!(urtwn_read_2(sc, R92C_APS_FSMCO) &
+ R92C_APS_FSMCO_APFM_ONMAC))
break;
DELAY(5);
}
@@ -2229,6 +2229,10 @@ urtwn_load_firmware(struct urtwn_softc *sc)
urtwn_write_1(sc, R92C_MCUFWDL + 2,
urtwn_read_1(sc, R92C_MCUFWDL + 2) & ~0x08);
+ /* Reset the FWDL checksum. */
+ urtwn_write_1(sc, R92C_MCUFWDL,
+ urtwn_read_1(sc, R92C_MCUFWDL) | R92C_MCUFWDL_CHKSUM_RPT);
+
for (page = 0; len > 0; page++) {
mlen = MIN(len, R92C_FW_PAGE_SIZE);
error = urtwn_fw_loadpage(sc, page, ptr, mlen);