]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw88: enable TX reports for the management queue
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 11 Jul 2025 08:47:40 +0000 (11:47 +0300)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 15 Jul 2025 02:04:09 +0000 (10:04 +0800)
This is needed for AP mode. Otherwise client sees the network, but
can't connect to it.

REG_FWHW_TXQ_CTRL+1 is set to WLAN_TXQ_RPT_EN (0x1F) in common mac
init function (__rtw8723x_mac_init), but the value was overwritten
from mac table later.

Tables with register values for phy parameters initialization are
copied from vendor driver usually. When table will be regenerated,
manual modifications to it may be lost. To avoid regressions in this
case new callback mac_postinit is introduced, that is called after
parameters from table are set.

Tested on rtl8723cs, that reuses rtw8703b driver.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250711084740.3396766-1-andrej.skvortzov@gmail.com
14 files changed:
drivers/net/wireless/realtek/rtw88/mac.c
drivers/net/wireless/realtek/rtw88/mac.h
drivers/net/wireless/realtek/rtw88/main.c
drivers/net/wireless/realtek/rtw88/main.h
drivers/net/wireless/realtek/rtw88/rtw8703b.c
drivers/net/wireless/realtek/rtw88/rtw8723d.c
drivers/net/wireless/realtek/rtw88/rtw8723x.c
drivers/net/wireless/realtek/rtw88/rtw8723x.h
drivers/net/wireless/realtek/rtw88/rtw8812a.c
drivers/net/wireless/realtek/rtw88/rtw8814a.c
drivers/net/wireless/realtek/rtw88/rtw8821a.c
drivers/net/wireless/realtek/rtw88/rtw8821c.c
drivers/net/wireless/realtek/rtw88/rtw8822b.c
drivers/net/wireless/realtek/rtw88/rtw8822c.c

index 011b81c82f3bafc14d16927ad8acb3bc675dd023..eaa928bab240c7e991175ee2f5958de05fa83069 100644 (file)
@@ -1409,3 +1409,13 @@ int rtw_mac_init(struct rtw_dev *rtwdev)
 
        return 0;
 }
+
+int rtw_mac_postinit(struct rtw_dev *rtwdev)
+{
+       const struct rtw_chip_info *chip = rtwdev->chip;
+
+       if (!chip->ops->mac_postinit)
+               return 0;
+
+       return chip->ops->mac_postinit(rtwdev);
+}
index e92b1483728d5f34fe670e3f3c946200206feaae..b73af90ee1d7f94d5633a12b6405e94972b26d0d 100644 (file)
@@ -38,6 +38,7 @@ void rtw_write_firmware_page(struct rtw_dev *rtwdev, u32 page,
                             const u8 *data, u32 size);
 int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw);
 int rtw_mac_init(struct rtw_dev *rtwdev);
+int rtw_mac_postinit(struct rtw_dev *rtwdev);
 void rtw_mac_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop);
 int rtw_set_trx_fifo_info(struct rtw_dev *rtwdev);
 int rtw_ddma_to_fw_fifo(struct rtw_dev *rtwdev, u32 ocp_src, u32 size);
index 97756bdf57b275255594ec401d224a0a8aa0bdea..b706c5a21a6c54a50ae7a9a4df7c9636bf045a89 100644 (file)
@@ -1412,6 +1412,12 @@ int rtw_power_on(struct rtw_dev *rtwdev)
 
        chip->ops->phy_set_param(rtwdev);
 
+       ret = rtw_mac_postinit(rtwdev);
+       if (ret) {
+               rtw_err(rtwdev, "failed to configure mac in postinit\n");
+               goto err_off;
+       }
+
        ret = rtw_hci_start(rtwdev);
        if (ret) {
                rtw_err(rtwdev, "failed to start hci\n");
index b42538cce35980a9868b65273548785449529838..43ed6d6b42919e34b0ff02c265e6aa3c5c31ddb7 100644 (file)
@@ -858,6 +858,7 @@ struct rtw_chip_ops {
        int (*power_on)(struct rtw_dev *rtwdev);
        void (*power_off)(struct rtw_dev *rtwdev);
        int (*mac_init)(struct rtw_dev *rtwdev);
+       int (*mac_postinit)(struct rtw_dev *rtwdev);
        int (*dump_fw_crash)(struct rtw_dev *rtwdev);
        void (*shutdown)(struct rtw_dev *rtwdev);
        int (*read_efuse)(struct rtw_dev *rtwdev, u8 *map);
index 03475af973b521a48dba5c7590cf878d6bcc3eaa..821c28d9cb5d4ffa8f445bcf61ec636742ef8b62 100644 (file)
@@ -1832,6 +1832,7 @@ static const struct rtw_chip_ops rtw8703b_ops = {
        .power_on               = rtw_power_on,
        .power_off              = rtw_power_off,
        .mac_init               = rtw8723x_mac_init,
+       .mac_postinit           = rtw8723x_mac_postinit,
        .dump_fw_crash          = NULL,
        .shutdown               = NULL,
        .read_efuse             = rtw8703b_read_efuse,
index bf69f5b06ce26916722c205ac45cffc0fcd19d99..8715e0435f173a149874b426e500e105760bb2f9 100644 (file)
@@ -1397,6 +1397,7 @@ static const struct rtw_chip_ops rtw8723d_ops = {
        .query_phy_status       = query_phy_status,
        .set_channel            = rtw8723d_set_channel,
        .mac_init               = rtw8723x_mac_init,
+       .mac_postinit           = rtw8723x_mac_postinit,
        .shutdown               = rtw8723d_shutdown,
        .read_rf                = rtw_phy_read_rf_sipi,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
index 4c77963fdd37098eb9583ff2906615271be5e0ed..3f3e9b0c44e803bd3bd4064dbf26e69e84182319 100644 (file)
@@ -353,7 +353,6 @@ static int __rtw8723x_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 
 static int __rtw8723x_mac_init(struct rtw_dev *rtwdev)
 {
-       rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 1, WLAN_TXQ_RPT_EN);
        rtw_write32(rtwdev, REG_TCR, BIT_TCR_CFG);
 
        rtw_write16(rtwdev, REG_RXFLTMAP0, WLAN_RX_FILTER0);
@@ -370,6 +369,13 @@ static int __rtw8723x_mac_init(struct rtw_dev *rtwdev)
        return 0;
 }
 
+static int __rtw8723x_mac_postinit(struct rtw_dev *rtwdev)
+{
+       rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 1, WLAN_TXQ_RPT_EN);
+
+       return 0;
+}
+
 static void __rtw8723x_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
 {
        u8 ldo_pwr;
@@ -760,6 +766,7 @@ const struct rtw8723x_common rtw8723x_common = {
        .lck = __rtw8723x_lck,
        .read_efuse = __rtw8723x_read_efuse,
        .mac_init = __rtw8723x_mac_init,
+       .mac_postinit = __rtw8723x_mac_postinit,
        .cfg_ldo25 = __rtw8723x_cfg_ldo25,
        .set_tx_power_index = __rtw8723x_set_tx_power_index,
        .efuse_grant = __rtw8723x_efuse_grant,
index a99af527c92cfbd0fa09be78bdb57a410ff0603e..0fc70dfdfc8b25a7c93f384ac932cfda3cab9611 100644 (file)
@@ -137,6 +137,7 @@ struct rtw8723x_common {
        void (*lck)(struct rtw_dev *rtwdev);
        int (*read_efuse)(struct rtw_dev *rtwdev, u8 *log_map);
        int (*mac_init)(struct rtw_dev *rtwdev);
+       int (*mac_postinit)(struct rtw_dev *rtwdev);
        void (*cfg_ldo25)(struct rtw_dev *rtwdev, bool enable);
        void (*set_tx_power_index)(struct rtw_dev *rtwdev);
        void (*efuse_grant)(struct rtw_dev *rtwdev, bool on);
@@ -383,6 +384,11 @@ static inline int rtw8723x_mac_init(struct rtw_dev *rtwdev)
        return rtw8723x_common.mac_init(rtwdev);
 }
 
+static inline int rtw8723x_mac_postinit(struct rtw_dev *rtwdev)
+{
+       return rtw8723x_common.mac_postinit(rtwdev);
+}
+
 static inline void rtw8723x_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
 {
        rtw8723x_common.cfg_ldo25(rtwdev, enable);
index 03b441639611f0d2d6e7bafdbc40b62b8452e714..2078eb6e3628028d9b5119f06ccc376da6800e91 100644 (file)
@@ -919,6 +919,7 @@ static const struct rtw_chip_ops rtw8812a_ops = {
        .query_phy_status       = rtw8812a_query_phy_status,
        .set_channel            = rtw88xxa_set_channel,
        .mac_init               = NULL,
+       .mac_postinit           = NULL,
        .read_rf                = rtw88xxa_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
        .set_antenna            = NULL,
index 4a1f850d05c87d3764dc770e5f8293a9ef3b72dc..ca1079e120235c573efca76c3d0a41ebc9a96eff 100644 (file)
@@ -2055,6 +2055,7 @@ static const struct rtw_chip_ops rtw8814a_ops = {
        .query_phy_status       = rtw8814a_query_phy_status,
        .set_channel            = rtw8814a_set_channel,
        .mac_init               = rtw8814a_mac_init,
+       .mac_postinit           = NULL,
        .read_rf                = rtw_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
        .set_tx_power_index     = rtw8814a_set_tx_power_index,
index 1d02ea400b2e6f7f7b88eede1997e56d71eeeff6..414b77eef07c6cd8b2d9876ac61f7a77fd95b1b7 100644 (file)
@@ -865,6 +865,7 @@ static const struct rtw_chip_ops rtw8821a_ops = {
        .query_phy_status       = rtw8821a_query_phy_status,
        .set_channel            = rtw88xxa_set_channel,
        .mac_init               = NULL,
+       .mac_postinit           = NULL,
        .read_rf                = rtw88xxa_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
        .set_antenna            = NULL,
index a2a358d6033f6128eae72bb41bfcd487f700ab7e..2078b067562e73e8554b937f8a05ebd173afd4b3 100644 (file)
@@ -1663,6 +1663,7 @@ static const struct rtw_chip_ops rtw8821c_ops = {
        .query_phy_status       = query_phy_status,
        .set_channel            = rtw8821c_set_channel,
        .mac_init               = rtw8821c_mac_init,
+       .mac_postinit           = NULL,
        .read_rf                = rtw_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
        .set_antenna            = NULL,
index bb5c41905afe13c6f7374aacfe4321719be982ab..89b6485b229a82bd5c3544cee5338dcff2464f44 100644 (file)
@@ -2154,6 +2154,7 @@ static const struct rtw_chip_ops rtw8822b_ops = {
        .query_phy_status       = query_phy_status,
        .set_channel            = rtw8822b_set_channel,
        .mac_init               = rtw8822b_mac_init,
+       .mac_postinit           = NULL,
        .read_rf                = rtw_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_sipi,
        .set_tx_power_index     = rtw8822b_set_tx_power_index,
index 58c1958e6170de03c5f01f3fb881a98eeb06155a..28c121cf1e683885007563348bf83bcd84bf5d48 100644 (file)
@@ -4964,6 +4964,7 @@ static const struct rtw_chip_ops rtw8822c_ops = {
        .query_phy_status       = query_phy_status,
        .set_channel            = rtw8822c_set_channel,
        .mac_init               = rtw8822c_mac_init,
+       .mac_postinit           = NULL,
        .dump_fw_crash          = rtw8822c_dump_fw_crash,
        .read_rf                = rtw_phy_read_rf,
        .write_rf               = rtw_phy_write_rf_reg_mix,