git: 4f3b2bba240b - main - rtw88: Use RF_CFGCH instead of hard coded 0x18

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 05 Oct 2023 14:33:31 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3

commit 4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-10-05 14:01:48 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-10-05 14:30:58 +0000

    rtw88: Use RF_CFGCH instead of hard coded 0x18
    
    While debugging some funky register reads of 0xaeaea from RF_CFGCH
    resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these
    reads came to my attention hidden by using the register index rather
    than the defined value.  Make this more grep-able.
    
    MFC after:      3 days
---
 sys/contrib/dev/rtw88/rtw8822c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/contrib/dev/rtw88/rtw8822c.c b/sys/contrib/dev/rtw88/rtw8822c.c
index da58b9ca8e57..a2fda1b36e6c 100644
--- a/sys/contrib/dev/rtw88/rtw8822c.c
+++ b/sys/contrib/dev/rtw88/rtw8822c.c
@@ -2204,7 +2204,11 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
 	u32 rf_reg18 = 0;
 	u32 rf_rxbb = 0;
 
+#if defined(__linux__)
 	rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK);
+#elif defined(__FreeBSD__)
+	rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
+#endif
 
 	rf_reg18 &= ~(RF18_BAND_MASK | RF18_CHANNEL_MASK | RF18_RFSI_MASK |
 		      RF18_BW_MASK);
@@ -3277,7 +3281,11 @@ static void rtw8822c_dpk_information(struct rtw_dev *rtwdev)
 	u32  reg;
 	u8 band_shift;
 
+#if defined(__linux__)
 	reg = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK);
+#elif defined(__FreeBSD__)
+	reg = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
+#endif
 
 	band_shift = FIELD_GET(BIT(16), reg);
 	dpk_info->dpk_band = 1 << band_shift;
@@ -4158,7 +4166,11 @@ static bool rtw8822c_dpk_reload(struct rtw_dev *rtwdev)
 
 	dpk_info->is_reload = false;
 
+#if defined(__linux__)
 	channel = (u8)(rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK) & 0xff);
+#elif defined(__FreeBSD__)
+	channel = (u8)(rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK) & 0xff);
+#endif
 
 	if (channel == dpk_info->dpk_ch) {
 		rtw_dbg(rtwdev, RTW_DBG_RFK,