]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: phy: calling BB pre-init by chips with/without BB MCU
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 14 Nov 2025 06:01:18 +0000 (14:01 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 18 Nov 2025 01:18:51 +0000 (09:18 +0800)
The existing flow is doing BB pre-init before downloading BB MCU firmware,
because existing chip RTL8922A has BB MCU. However, the coming chips don't
have this, and BB pre-init configuring registers can affect downloading
WiFi-CPU firmware. Therefore, calling BB pre-init afterward for new coming
chips without BB MCU.

For existing WiFi 6 chips, no BB pre-init. For RTL8922A, don't change
the logic.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251114060128.35363-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/mac.c

index 0cabea7dd92bda3e23c45d457ad944dd0c11c4ae..ea22925b8772dace5257c8ed179247a89e581ec8 100644 (file)
@@ -5615,6 +5615,7 @@ EXPORT_SYMBOL(rtw89_check_quirks);
 
 int rtw89_core_start(struct rtw89_dev *rtwdev)
 {
+       bool no_bbmcu = !rtwdev->chip->bbmcu_nr;
        int ret;
 
        ret = rtw89_mac_preinit(rtwdev);
@@ -5623,6 +5624,9 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
                return ret;
        }
 
+       if (no_bbmcu)
+               rtw89_chip_bb_preinit(rtwdev);
+
        rtw89_phy_init_bb_afe(rtwdev);
 
        /* above do preinit before downloading firmware */
index f63857b389d76285c660fbd32bb5954058cb0ed6..8943166de52cf248e9547be071d4244d3bc6b3e8 100644 (file)
@@ -7039,12 +7039,17 @@ static inline void rtw89_chip_rfk_hw_init(struct rtw89_dev *rtwdev)
 }
 
 static inline
-void rtw89_chip_bb_preinit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
+void rtw89_chip_bb_preinit(struct rtw89_dev *rtwdev)
 {
        const struct rtw89_chip_info *chip = rtwdev->chip;
 
-       if (chip->ops->bb_preinit)
-               chip->ops->bb_preinit(rtwdev, phy_idx);
+       if (!chip->ops->bb_preinit)
+               return;
+
+       chip->ops->bb_preinit(rtwdev, RTW89_PHY_0);
+
+       if (rtwdev->dbcc_en)
+               chip->ops->bb_preinit(rtwdev, RTW89_PHY_1);
 }
 
 static inline
index ff160d25a7c9d3372b0ae67a2644216c75b0c4d5..21f5023c4f69dd873866a178835650bf66c25999 100644 (file)
@@ -4104,9 +4104,12 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev, bool include_bb)
        rtw89_mac_ctrl_hci_dma_trx(rtwdev, true);
 
        if (include_bb) {
-               rtw89_chip_bb_preinit(rtwdev, RTW89_PHY_0);
-               if (rtwdev->dbcc_en)
-                       rtw89_chip_bb_preinit(rtwdev, RTW89_PHY_1);
+               /* Only call BB preinit including configuration of BB MCU for
+                * the chips which need to download BB MCU firmware. Otherwise,
+                * calling preinit later to prevent touching registers affecting
+                * download firmware.
+                */
+               rtw89_chip_bb_preinit(rtwdev);
        }
 
        ret = rtw89_mac_dmac_pre_init(rtwdev);