]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: mac: clear global interrupt right after power-on
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 14 Jan 2026 01:39:39 +0000 (09:39 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 22 Jan 2026 01:30:37 +0000 (09:30 +0800)
The global interrupt indicator is always persistent, and firmware will
handle it right after boot. To prevent this unnecessary handling, clear
the indicator before downloading firmware.

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

index 1435e4c664b6891264f73431f9597d145ad5bc2f..4f0f17c499fa58215be07532a7619769c6d40396 100644 (file)
@@ -1554,6 +1554,7 @@ static int rtw89_mac_power_switch(struct rtw89_dev *rtwdev, bool on)
                set_bit(RTW89_FLAG_CMAC0_FUNC, rtwdev->flags);
 
                rtw89_mac_update_scoreboard(rtwdev, MAC_AX_NOTIFY_TP_MAJOR);
+               rtw89_mac_clr_aon_intr(rtwdev);
        } else {
                clear_bit(RTW89_FLAG_POWERON, rtwdev->flags);
                clear_bit(RTW89_FLAG_DMAC_FUNC, rtwdev->flags);
@@ -7303,6 +7304,7 @@ const struct rtw89_mac_gen_def rtw89_mac_gen_ax = {
        .sys_init = sys_init_ax,
        .trx_init = trx_init_ax,
        .preload_init = preload_init_set_ax,
+       .clr_aon_intr = NULL,
        .err_imr_ctrl = err_imr_ctrl_ax,
        .mac_func_en = NULL,
        .hci_func_en = rtw89_mac_hci_func_en_ax,
index 14fffb660a29cb72e483c5ea04e68edce440f9a0..784a1cf4c6f4ab8824c8ceb722212e67b6fdc9d0 100644 (file)
@@ -1039,6 +1039,7 @@ struct rtw89_mac_gen_def {
        int (*trx_init)(struct rtw89_dev *rtwdev);
        int (*preload_init)(struct rtw89_dev *rtwdev, u8 mac_idx,
                            enum rtw89_qta_mode mode);
+       void (*clr_aon_intr)(struct rtw89_dev *rtwdev);
        void (*err_imr_ctrl)(struct rtw89_dev *rtwdev, bool en);
        int (*mac_func_en)(struct rtw89_dev *rtwdev);
        void (*hci_func_en)(struct rtw89_dev *rtwdev);
@@ -1251,6 +1252,14 @@ int rtw89_mac_check_mac_en(struct rtw89_dev *rtwdev, u8 band,
        return mac->check_mac_en(rtwdev, band, sel);
 }
 
+static inline void rtw89_mac_clr_aon_intr(struct rtw89_dev *rtwdev)
+{
+       const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
+
+       if (mac->clr_aon_intr)
+               mac->clr_aon_intr(rtwdev);
+}
+
 int rtw89_mac_write_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 val);
 int rtw89_mac_read_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 *val);
 int rtw89_mac_dle_dfi_cfg(struct rtw89_dev *rtwdev, struct rtw89_mac_dle_dfi_ctrl *ctrl);
index 142e892f85c4f191de1ba885809fd67db3c12a9b..028fb63014eb72bdd781083f9d7dd10907eac7da 100644 (file)
@@ -1990,6 +1990,15 @@ static int preload_init_be(struct rtw89_dev *rtwdev, u8 mac_idx,
        return 0;
 }
 
+static void clr_aon_intr_be(struct rtw89_dev *rtwdev)
+{
+       if (rtwdev->hci.type != RTW89_HCI_TYPE_PCIE)
+               return;
+
+       rtw89_write32_clr(rtwdev, R_BE_FWS0IMR, B_BE_FS_GPIOA_INT_EN);
+       rtw89_write32_set(rtwdev, R_BE_FWS0ISR, B_BE_FS_GPIOA_INT);
+}
+
 static int dbcc_bb_ctrl_be(struct rtw89_dev *rtwdev, bool bb1_en)
 {
        u32 set = B_BE_FEN_BB1PLAT_RSTB | B_BE_FEN_BB1_IP_RSTN;
@@ -3179,6 +3188,7 @@ const struct rtw89_mac_gen_def rtw89_mac_gen_be = {
        .sys_init = sys_init_be,
        .trx_init = trx_init_be,
        .preload_init = preload_init_be,
+       .clr_aon_intr = clr_aon_intr_be,
        .err_imr_ctrl = err_imr_ctrl_be,
        .mac_func_en = mac_func_en_be,
        .hci_func_en = rtw89_mac_hci_func_en_be,
index efeb4507b1a9f5baca20f5af2c710ef0b275ef61..df0866ba1d1721e66baea6bbb24a1f412ab405f3 100644 (file)
 
 #define R_BE_SECURE_BOOT_MALLOC_INFO 0x0184
 
+#define R_BE_FWS0IMR 0x0190
+#define B_BE_FS_HALT_H2C_INT_EN BIT(31)
+#define B_BE_FS_FSM_HIOE_TO_EVENT_INT_EN BIT(30)
+#define B_BE_FS_HCI_SUS_INT_EN BIT(29)
+#define B_BE_FS_HCI_RES_INT_EN BIT(28)
+#define B_BE_FS_HCI_RESET_INT_EN BIT(27)
+#define B_BE_FS_BT_SB1_INT_EN BIT(26)
+#define B_BE_FS_ACT2RECOVERY_INT_EN BIT(25)
+#define B_BE_FS_GEN1GEN2_SWITCH_INT_EN BIT(24)
+#define B_BE_FS_USB_LPMRSM_INT_EN BIT(22)
+#define B_BE_FS_USB_LPMINT_INT_EN BIT(21)
+#define B_BE_FS_PWMERR_INT_EN BIT(20)
+#define B_BE_FS_PDNINT_EN BIT(19)
+#define B_BE_FS_SPSA_OCP_INT_EN BIT(18)
+#define B_BE_FS_SPSD_OCP_INT_EN BIT(17)
+#define B_BE_FS_BT_SB0_INT_EN BIT(16)
+#define B_BE_FS_GPIOF_INT_EN BIT(15)
+#define B_BE_FS_GPIOE_INT_EN BIT(14)
+#define B_BE_FS_GPIOD_INT_EN BIT(13)
+#define B_BE_FS_GPIOC_INT_EN BIT(12)
+#define B_BE_FS_GPIOB_INT_EN BIT(11)
+#define B_BE_FS_GPIOA_INT_EN BIT(10)
+#define B_BE_FS_GPIO9_INT_EN BIT(9)
+#define B_BE_FS_GPIO8_INT_EN BIT(8)
+#define B_BE_FS_GPIO7_INT_EN BIT(7)
+#define B_BE_FS_GPIO6_INT_EN BIT(6)
+#define B_BE_FS_GPIO5_INT_EN BIT(5)
+#define B_BE_FS_GPIO4_INT_EN BIT(4)
+#define B_BE_FS_GPIO3_INT_EN BIT(3)
+#define B_BE_FS_GPIO2_INT_EN BIT(2)
+#define B_BE_FS_GPIO1_INT_EN BIT(1)
+#define B_BE_FS_GPIO0_INT_EN BIT(0)
+
+#define R_BE_FWS0ISR 0x0194
+#define B_BE_FS_HALT_H2C_INT BIT(31)
+#define B_BE_FS_FSM_HIOE_TO_EVENT_INT BIT(30)
+#define B_BE_FS_HCI_SUS_INT BIT(29)
+#define B_BE_FS_HCI_RES_INT BIT(28)
+#define B_BE_FS_HCI_RESET_INT BIT(27)
+#define B_BE_FS_BT_SB1_INT BIT(26)
+#define B_BE_FS_ACT2RECOVERY_INT BIT(25)
+#define B_BE_FS_GEN1GEN2_SWITCH_INT BIT(24)
+#define B_BE_FS_USB_LPMRSM_INT BIT(22)
+#define B_BE_FS_USB_LPMINT_INT BIT(21)
+#define B_BE_FS_PWMERR_INT BIT(20)
+#define B_BE_FS_PDNINT BIT(19)
+#define B_BE_FS_SPSA_OCP_INT BIT(18)
+#define B_BE_FS_SPSD_OCP_INT BIT(17)
+#define B_BE_FS_BT_SB0_INT BIT(16)
+#define B_BE_FS_GPIOF_INT BIT(15)
+#define B_BE_FS_GPIOE_INT BIT(14)
+#define B_BE_FS_GPIOD_INT BIT(13)
+#define B_BE_FS_GPIOC_INT BIT(12)
+#define B_BE_FS_GPIOB_INT BIT(11)
+#define B_BE_FS_GPIOA_INT BIT(10)
+#define B_BE_FS_GPIO9_INT BIT(9)
+#define B_BE_FS_GPIO8_INT BIT(8)
+#define B_BE_FS_GPIO7_INT BIT(7)
+#define B_BE_FS_GPIO6_INT BIT(6)
+#define B_BE_FS_GPIO5_INT BIT(5)
+#define B_BE_FS_GPIO4_INT BIT(4)
+#define B_BE_FS_GPIO3_INT BIT(3)
+#define B_BE_FS_GPIO2_INT BIT(2)
+#define B_BE_FS_GPIO1_INT BIT(1)
+#define B_BE_FS_GPIO0_INT BIT(0)
+
 #define R_BE_FWS1IMR 0x0198
 #define B_BE_FS_RPWM_INT_EN_V1 BIT(24)
 #define B_BE_PCIE_HOTRST_EN BIT(22)