After verification, we can enable hw_scan and crash_trigger simulation by
this patchset. During verification of crash_trigger simulation (patch 4/4),
we find that driver doesn't configure TX power properly in certain
situation, so refine debugfs entry by patch 2/4 and correct TX power by
patch 3/4.
Po-Hao Huang (1):
wifi: rtw89: 8851b: enable hw_scan support
Zong-Zhe Yang (3):
wifi: rtw89: debug: txpwr table access only valid page according to
chip
wifi: rtw89: set TX power without precondition during setting channel
wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
drivers/net/wireless/realtek/rtw89/core.c | 5 ++---
drivers/net/wireless/realtek/rtw89/debug.c | 13 ++++++++++++-
drivers/net/wireless/realtek/rtw89/fw.c | 2 ++
drivers/net/wireless/realtek/rtw89/fw.h | 2 +-
drivers/net/wireless/realtek/rtw89/reg.h | 6 ++++++
5 files changed, 23 insertions(+), 5 deletions(-)
--
2.25.1
From: Zong-Zhe Yang <[email protected]>
We now support RTL8851B which has only single RF path. For chip with
single RF path, TX power page is valid only in single path section.
So, we refine debugfs txpwr table to access TX power page according
to RF path number of runtime chip. It can prevent us from reading
beyond valid sections.
Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
---
drivers/net/wireless/realtek/rtw89/debug.c | 13 ++++++++++++-
drivers/net/wireless/realtek/rtw89/reg.h | 6 ++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 39f6b7f5f6563..1db2d59d33ff7 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -376,6 +376,7 @@ struct txpwr_map {
u8 size;
u32 addr_from;
u32 addr_to;
+ u32 addr_to_1ss;
};
#define __GEN_TXPWR_ENT2(_t, _e0, _e1) \
@@ -413,6 +414,7 @@ static const struct txpwr_map __txpwr_map_byr = {
.size = ARRAY_SIZE(__txpwr_ent_byr),
.addr_from = R_AX_PWR_BY_RATE,
.addr_to = R_AX_PWR_BY_RATE_MAX,
+ .addr_to_1ss = R_AX_PWR_BY_RATE_1SS_MAX,
};
static const struct txpwr_ent __txpwr_ent_lmt[] = {
@@ -468,6 +470,7 @@ static const struct txpwr_map __txpwr_map_lmt = {
.size = ARRAY_SIZE(__txpwr_ent_lmt),
.addr_from = R_AX_PWR_LMT,
.addr_to = R_AX_PWR_LMT_MAX,
+ .addr_to_1ss = R_AX_PWR_LMT_1SS_MAX,
};
static const struct txpwr_ent __txpwr_ent_lmt_ru[] = {
@@ -495,6 +498,7 @@ static const struct txpwr_map __txpwr_map_lmt_ru = {
.size = ARRAY_SIZE(__txpwr_ent_lmt_ru),
.addr_from = R_AX_PWR_RU_LMT,
.addr_to = R_AX_PWR_RU_LMT_MAX,
+ .addr_to_1ss = R_AX_PWR_RU_LMT_1SS_MAX,
};
static u8 __print_txpwr_ent(struct seq_file *m, const struct txpwr_ent *ent,
@@ -527,6 +531,8 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev,
const struct txpwr_map *map)
{
u8 fct = rtwdev->chip->txpwr_factor_mac;
+ u8 path_num = rtwdev->chip->rf_path_num;
+ u32 max_valid_addr;
u32 val, addr;
s8 *buf, tmp;
u8 cur, i;
@@ -536,7 +542,12 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev,
if (!buf)
return -ENOMEM;
- for (addr = map->addr_from; addr <= map->addr_to; addr += 4) {
+ if (path_num == 1)
+ max_valid_addr = map->addr_to_1ss;
+ else
+ max_valid_addr = map->addr_to;
+
+ for (addr = map->addr_from; addr <= max_valid_addr; addr += 4) {
ret = rtw89_mac_txpwr_read32(rtwdev, RTW89_PHY_0, addr, &val);
if (ret)
val = MASKDWORD;
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
index 7c2807345f60d..b6ffa923133d4 100644
--- a/drivers/net/wireless/realtek/rtw89/reg.h
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
@@ -3342,16 +3342,22 @@
#define B_AX_PWR_UL_TB_2T_MASK GENMASK(4, 0)
#define B_AX_PWR_UL_TB_2T_V1_MASK GENMASK(7, 0)
#define R_AX_PWR_BY_RATE_TABLE0 0xD2C0
+#define R_AX_PWR_BY_RATE_TABLE6 0xD2D8
#define R_AX_PWR_BY_RATE_TABLE10 0xD2E8
#define R_AX_PWR_BY_RATE R_AX_PWR_BY_RATE_TABLE0
+#define R_AX_PWR_BY_RATE_1SS_MAX R_AX_PWR_BY_RATE_TABLE6
#define R_AX_PWR_BY_RATE_MAX R_AX_PWR_BY_RATE_TABLE10
#define R_AX_PWR_LMT_TABLE0 0xD2EC
+#define R_AX_PWR_LMT_TABLE9 0xD310
#define R_AX_PWR_LMT_TABLE19 0xD338
#define R_AX_PWR_LMT R_AX_PWR_LMT_TABLE0
+#define R_AX_PWR_LMT_1SS_MAX R_AX_PWR_LMT_TABLE9
#define R_AX_PWR_LMT_MAX R_AX_PWR_LMT_TABLE19
#define R_AX_PWR_RU_LMT_TABLE0 0xD33C
+#define R_AX_PWR_RU_LMT_TABLE5 0xD350
#define R_AX_PWR_RU_LMT_TABLE11 0xD368
#define R_AX_PWR_RU_LMT R_AX_PWR_RU_LMT_TABLE0
+#define R_AX_PWR_RU_LMT_1SS_MAX R_AX_PWR_RU_LMT_TABLE5
#define R_AX_PWR_RU_LMT_MAX R_AX_PWR_RU_LMT_TABLE11
#define R_AX_PWR_MACID_LMT_TABLE0 0xD36C
#define R_AX_PWR_MACID_LMT_TABLE127 0xD568
--
2.25.1
From: Zong-Zhe Yang <[email protected]>
The key condition to check in wrapper of setting TX power is whether entity
is active or not. Before entity is active, we restrict TX power from being
set by outside callers, e.g. SAR/regulatory.
We mark entity as inactive when powering off MAC. Then, we will mark it as
active when we initialize HW channel stuffs after MAC power on. Although we
can get an active entity after leaving idle phase, TX power doesn't be set
well for default channel until stack set target channel for connection. It
causes that RF things cannot use better TX power during this interval.
Below are some cases which may encounter this or a similar situation.
* hw scan process before connection
As described above.
* right after restart hardware process (SER L2)
HW stuffs of target channel is initialized after mac80211 restart
hardware, but we unexpectedly need to wait one more command to set
channel again or to set TX power.
To fix it and improve RF behavior in that interval, during setting channel,
we don't need to check entity state before setting TX power, which actually
is used to restrict outside callers. It means we call chip ops directly to
replace the wrapper call. Then, TX power can be initialized as long as we
initialize/setup HW stuffs on one channel.
Besides, all chips should configure ops of setting TX power, so we remove
trivial check on pointer.
Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
---
drivers/net/wireless/realtek/rtw89/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 101047686fffb..408b5a8e5dd9c 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -336,8 +336,7 @@ void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev)
sub_entity_idx = RTW89_SUB_ENTITY_0;
phy_idx = RTW89_PHY_0;
chan = rtw89_chan_get(rtwdev, sub_entity_idx);
- if (chip->ops->set_txpwr)
- chip->ops->set_txpwr(rtwdev, chan, phy_idx);
+ chip->ops->set_txpwr(rtwdev, chan, phy_idx);
}
void rtw89_set_channel(struct rtw89_dev *rtwdev)
@@ -373,7 +372,7 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev)
chip->ops->set_channel(rtwdev, &chan, mac_idx, phy_idx);
- rtw89_core_set_chip_txpwr(rtwdev);
+ chip->ops->set_txpwr(rtwdev, &chan, phy_idx);
rtw89_chip_set_channel_done(rtwdev, &bak, &chan, mac_idx, phy_idx);
--
2.25.1
On 5/31/23 01:07, Ping-Ke Shih wrote:
> After verification, we can enable hw_scan and crash_trigger simulation by
> this patchset. During verification of crash_trigger simulation (patch 4/4),
> we find that driver doesn't configure TX power properly in certain
> situation, so refine debugfs entry by patch 2/4 and correct TX power by
> patch 3/4.
>
> Po-Hao Huang (1):
> wifi: rtw89: 8851b: enable hw_scan support
>
> Zong-Zhe Yang (3):
> wifi: rtw89: debug: txpwr table access only valid page according to
> chip
> wifi: rtw89: set TX power without precondition during setting channel
> wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
>
> drivers/net/wireless/realtek/rtw89/core.c | 5 ++---
> drivers/net/wireless/realtek/rtw89/debug.c | 13 ++++++++++++-
> drivers/net/wireless/realtek/rtw89/fw.c | 2 ++
> drivers/net/wireless/realtek/rtw89/fw.h | 2 +-
> drivers/net/wireless/realtek/rtw89/reg.h | 6 ++++++
> 5 files changed, 23 insertions(+), 5 deletions(-)
Tested-by: Larry Finger <[email protected]>
Larry