git: 6aca4e6127e3 - stable/13 - rtwn: Restore RF_ENV control type after initializing RF.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 13 May 2022 17:58:45 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=6aca4e6127e34b0994d3c945af8634fba3aaee40

commit 6aca4e6127e34b0994d3c945af8634fba3aaee40
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-08 00:01:28 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-13 17:44:10 +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
    
    (cherry picked from commit 50e3b6aa480b34e6eb87530d307db7ceba591a17)
---
 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);
 	}