summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authornat <nat@NetBSD.org>2021-09-17 13:00:20 +0000
committernat <nat@NetBSD.org>2021-09-17 13:00:20 +0000
commit088e3e32faeb53b5f93d51628d67e3822815e07e (patch)
tree3242191bc596489c4c95e407f3f9d2cccd5076c5 /sys/dev
parent89b61c49974eca4b42b024990d8679f787457ed3 (diff)
Initialize firmware mailbox counter when firmware is reset.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_urtwn.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c
index 10c4e1874d2..4fd4b210d6f 100644
--- a/sys/dev/usb/if_urtwn.c
+++ b/sys/dev/usb/if_urtwn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */
/*-
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.99 2021/09/17 13:00:20 nat Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3362,7 +3362,10 @@ urtwn_fw_reset(struct urtwn_softc *sc)
KASSERT(mutex_owned(&sc->sc_write_mtx));
/* Tell 8051 to reset itself. */
+ mutex_enter(&sc->sc_fwcmd_mtx);
urtwn_write_1(sc, R92C_HMETFR + 3, 0x20);
+ sc->fwcur = 0;
+ mutex_exit(&sc->sc_fwcmd_mtx);
/* Wait until 8051 resets by itself. */
for (ntries = 0; ntries < 100; ntries++) {
@@ -3404,6 +3407,11 @@ urtwn_r88e_fw_reset(struct urtwn_softc *sc)
}
DELAY(50);
+ mutex_enter(&sc->sc_fwcmd_mtx);
+ /* Init firmware commands ring. */
+ sc->fwcur = 0;
+ mutex_exit(&sc->sc_fwcmd_mtx);
+
}
static int