git: 50e3b6aa480b - main - rtwn: Restore RF_ENV control type after initializing RF.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 08 Apr 2022 00:03:41 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=50e3b6aa480b34e6eb87530d307db7ceba591a17

commit 50e3b6aa480b34e6eb87530d307db7ceba591a17
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-08 00:01:28 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-08 00:01:28 +0000

    rtwn: Restore RF_ENV control type after initializing RF.
    
    Both rwlwifi in Linux and rtwn in OpenBSD restore this register,
    and the existing code was saving the value and not using it.
    
    Reported by:    -Wunused-but-set-variable
    Reviewed by:    imp
    Obtained from:  OpenBSD
    Differential Revision:  https://reviews.freebsd.org/D34838
---
 sys/dev/rtwn/rtl8192e/r92e_init.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/rtwn/rtl8192e/r92e_init.c b/sys/dev/rtwn/rtl8192e/r92e_init.c
index b38a9661567d..48a87e6ae98c 100644
--- a/sys/dev/rtwn/rtl8192e/r92e_init.c
+++ b/sys/dev/rtwn/rtl8192e/r92e_init.c
@@ -195,6 +195,11 @@ r92e_init_rf(struct rtwn_softc *sc)
 		/* Write RF initialization values for this chain. */
 		i += r92c_init_rf_chain(sc, &sc->rf_prog[i], chain);
 
+		/* Restore RF_ENV control type. */
+		reg = rtwn_bb_read(sc, R92C_FPGA0_RFIFACESW(idx));
+		reg &= ~(0x10 << off) | (type << off);
+		rtwn_bb_write(sc, R92C_FPGA0_RFIFACESW(idx), reg);
+
 		/* Cache RF register CHNLBW. */
 		rs->rf_chnlbw[chain] = rtwn_rf_read(sc, chain, R92C_RF_CHNLBW);
 	}