]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: add EHT physts and adjust init flow accordingly
authorEric Huang <echuang@realtek.com>
Thu, 5 Jun 2025 11:42:06 +0000 (19:42 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 10 Jun 2025 01:47:33 +0000 (09:47 +0800)
Adding EHT physts and adjust IE bitmap initialization. This setting
is for PHY statistic gathering, won't effect functionality.

Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250605114207.12381-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/phy.c
drivers/net/wireless/realtek/rtw89/phy.h
drivers/net/wireless/realtek/rtw89/reg.h

index 76a2e26d4a10b429e03e6b046d7f0e4112020a12..158550485797cad266b64859d255517912cbad3a 100644 (file)
@@ -5828,14 +5828,20 @@ void rtw89_phy_env_monitor_track(struct rtw89_dev *rtwdev)
                __rtw89_phy_env_monitor_track(rtwdev, bb);
 }
 
-static bool rtw89_physts_ie_page_valid(enum rtw89_phy_status_bitmap *ie_page)
+static bool rtw89_physts_ie_page_valid(struct rtw89_dev *rtwdev,
+                                      enum rtw89_phy_status_bitmap *ie_page)
 {
+       const struct rtw89_chip_info *chip = rtwdev->chip;
+
        if (*ie_page >= RTW89_PHYSTS_BITMAP_NUM ||
            *ie_page == RTW89_RSVD_9)
                return false;
-       else if (*ie_page > RTW89_RSVD_9)
+       else if (*ie_page > RTW89_RSVD_9 && *ie_page < RTW89_EHT_PKT)
                *ie_page -= 1;
 
+       if (*ie_page == RTW89_EHT_PKT && chip->chip_gen == RTW89_CHIP_AX)
+               return false;
+
        return true;
 }
 
@@ -5843,6 +5849,9 @@ static u32 rtw89_phy_get_ie_bitmap_addr(enum rtw89_phy_status_bitmap ie_page)
 {
        static const u8 ie_page_shift = 2;
 
+       if (ie_page == RTW89_EHT_PKT)
+               return R_PHY_STS_BITMAP_EHT;
+
        return R_PHY_STS_BITMAP_ADDR_START + (ie_page << ie_page_shift);
 }
 
@@ -5852,7 +5861,7 @@ static u32 rtw89_physts_get_ie_bitmap(struct rtw89_dev *rtwdev,
 {
        u32 addr;
 
-       if (!rtw89_physts_ie_page_valid(&ie_page))
+       if (!rtw89_physts_ie_page_valid(rtwdev, &ie_page))
                return 0;
 
        addr = rtw89_phy_get_ie_bitmap_addr(ie_page);
@@ -5867,7 +5876,7 @@ static void rtw89_physts_set_ie_bitmap(struct rtw89_dev *rtwdev,
        const struct rtw89_chip_info *chip = rtwdev->chip;
        u32 addr;
 
-       if (!rtw89_physts_ie_page_valid(&ie_page))
+       if (!rtw89_physts_ie_page_valid(rtwdev, &ie_page))
                return;
 
        if (chip->chip_id == RTL8852A)
@@ -5877,21 +5886,6 @@ static void rtw89_physts_set_ie_bitmap(struct rtw89_dev *rtwdev,
        rtw89_phy_write32_idx(rtwdev, addr, MASKDWORD, val, phy_idx);
 }
 
-static void rtw89_physts_enable_ie_bitmap(struct rtw89_dev *rtwdev,
-                                         enum rtw89_phy_status_bitmap bitmap,
-                                         enum rtw89_phy_status_ie_type ie,
-                                         bool enable, enum rtw89_phy_idx phy_idx)
-{
-       u32 val = rtw89_physts_get_ie_bitmap(rtwdev, bitmap, phy_idx);
-
-       if (enable)
-               val |= BIT(ie);
-       else
-               val &= ~BIT(ie);
-
-       rtw89_physts_set_ie_bitmap(rtwdev, bitmap, val, phy_idx);
-}
-
 static void rtw89_physts_enable_fail_report(struct rtw89_dev *rtwdev,
                                            bool enable,
                                            enum rtw89_phy_idx phy_idx)
@@ -5915,30 +5909,37 @@ static void rtw89_physts_enable_fail_report(struct rtw89_dev *rtwdev,
 static void __rtw89_physts_parsing_init(struct rtw89_dev *rtwdev,
                                        enum rtw89_phy_idx phy_idx)
 {
+       const struct rtw89_chip_info *chip = rtwdev->chip;
+       u32 val;
        u8 i;
 
        rtw89_physts_enable_fail_report(rtwdev, false, phy_idx);
 
        for (i = 0; i < RTW89_PHYSTS_BITMAP_NUM; i++) {
-               if (i >= RTW89_CCK_PKT)
-                       rtw89_physts_enable_ie_bitmap(rtwdev, i,
-                                                     RTW89_PHYSTS_IE09_FTR_0,
-                                                     true, phy_idx);
-               if ((i >= RTW89_CCK_BRK && i <= RTW89_VHT_MU) ||
-                   (i >= RTW89_RSVD_9 && i <= RTW89_CCK_PKT))
+               if (i == RTW89_RSVD_9 ||
+                   (i == RTW89_EHT_PKT && chip->chip_gen == RTW89_CHIP_AX))
                        continue;
-               rtw89_physts_enable_ie_bitmap(rtwdev, i,
-                                             RTW89_PHYSTS_IE24_OFDM_TD_PATH_A,
-                                             true, phy_idx);
-       }
-       rtw89_physts_enable_ie_bitmap(rtwdev, RTW89_VHT_PKT,
-                                     RTW89_PHYSTS_IE13_DL_MU_DEF, true, phy_idx);
-       rtw89_physts_enable_ie_bitmap(rtwdev, RTW89_HE_PKT,
-                                     RTW89_PHYSTS_IE13_DL_MU_DEF, true, phy_idx);
-
-       /* force IE01 for channel index, only channel field is valid */
-       rtw89_physts_enable_ie_bitmap(rtwdev, RTW89_CCK_PKT,
-                                     RTW89_PHYSTS_IE01_CMN_OFDM, true, phy_idx);
+
+               val = rtw89_physts_get_ie_bitmap(rtwdev, i, phy_idx);
+               if (i == RTW89_HE_MU || i == RTW89_VHT_MU) {
+                       val |= BIT(RTW89_PHYSTS_IE13_DL_MU_DEF);
+               } else if (i == RTW89_TRIG_BASE_PPDU) {
+                       val |= BIT(RTW89_PHYSTS_IE13_DL_MU_DEF) |
+                              BIT(RTW89_PHYSTS_IE01_CMN_OFDM);
+               } else if (i >= RTW89_CCK_PKT) {
+                       val |= BIT(RTW89_PHYSTS_IE09_FTR_0);
+
+                       val &= ~(GENMASK(RTW89_PHYSTS_IE07_CMN_EXT_PATH_D,
+                                        RTW89_PHYSTS_IE04_CMN_EXT_PATH_A));
+
+                       if (i == RTW89_CCK_PKT)
+                               val |= BIT(RTW89_PHYSTS_IE01_CMN_OFDM);
+                       else if (i >= RTW89_HT_PKT)
+                               val |= BIT(RTW89_PHYSTS_IE20_DBG_OFDM_FD_USER_SEG_0);
+               }
+
+               rtw89_physts_set_ie_bitmap(rtwdev, i, val, phy_idx);
+       }
 }
 
 static void rtw89_physts_parsing_init(struct rtw89_dev *rtwdev)
index 5b451f1cfaac40d9b88284b07b1579d8b157e7d8..63cc33c16c9a54a8ef2caf60e97f9d3f7003abc8 100644 (file)
@@ -252,6 +252,7 @@ enum rtw89_phy_status_bitmap {
        RTW89_HT_PKT          = 13,
        RTW89_VHT_PKT         = 14,
        RTW89_HE_PKT          = 15,
+       RTW89_EHT_PKT         = 16,
 
        RTW89_PHYSTS_BITMAP_NUM
 };
index f05c81ae586949212044f60362ba78b0f4b3fdcd..255a8635b195dd0199e02797a05e4e2336703eae 100644 (file)
 #define R_PHY_STS_BITMAP_HT 0x076C
 #define R_PHY_STS_BITMAP_VHT 0x0770
 #define R_PHY_STS_BITMAP_HE 0x0774
+#define R_PHY_STS_BITMAP_EHT 0x0788
 #define R_EDCCA_RPTREG_SEL_BE 0x078C
 #define B_EDCCA_RPTREG_SEL_BE_MSK GENMASK(22, 20)
 #define R_PMAC_GNT 0x0980