Skip to content

Commit 732dd91

Browse files
Ping-Ke ShihKalle Valo
authored andcommitted
wifi: rtw89: add to dump TX FIFO 0/1 for 8852C
MAC maintains TX FIFO to transmit packets with meta data to BB layer. To debug abnormal transmission, we need to dump the content to dig problem. Since FIFO of 8852C locates on different address with different size and need additional switch to enable read operation, this patch adds the changes accordingly. Signed-off-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d187691 commit 732dd91

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/net/wireless/realtek/rtw89/debug.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,13 +774,34 @@ rtw89_debug_priv_mac_mem_dump_get(struct seq_file *m, void *v)
774774
{
775775
struct rtw89_debugfs_priv *debugfs_priv = m->private;
776776
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
777+
bool grant_read = false;
778+
779+
if (debugfs_priv->mac_mem.sel >= RTW89_MAC_MEM_NUM)
780+
return -ENOENT;
781+
782+
if (rtwdev->chip->chip_id == RTL8852C) {
783+
switch (debugfs_priv->mac_mem.sel) {
784+
case RTW89_MAC_MEM_TXD_FIFO_0_V1:
785+
case RTW89_MAC_MEM_TXD_FIFO_1_V1:
786+
case RTW89_MAC_MEM_TXDATA_FIFO_0:
787+
case RTW89_MAC_MEM_TXDATA_FIFO_1:
788+
grant_read = true;
789+
break;
790+
default:
791+
break;
792+
}
793+
}
777794

778795
mutex_lock(&rtwdev->mutex);
779796
rtw89_leave_ps_mode(rtwdev);
797+
if (grant_read)
798+
rtw89_write32_set(rtwdev, R_AX_TCR1, B_AX_TCR_FORCE_READ_TXDFIFO);
780799
rtw89_debug_dump_mac_mem(m, rtwdev,
781800
debugfs_priv->mac_mem.sel,
782801
debugfs_priv->mac_mem.start,
783802
debugfs_priv->mac_mem.len);
803+
if (grant_read)
804+
rtw89_write32_clr(rtwdev, R_AX_TCR1, B_AX_TCR_FORCE_READ_TXDFIFO);
784805
mutex_unlock(&rtwdev->mutex);
785806

786807
return 0;

drivers/net/wireless/realtek/rtw89/mac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const u32 rtw89_mac_mem_base_addrs[RTW89_MAC_MEM_NUM] = {
3131
[RTW89_MAC_MEM_TXDATA_FIFO_1] = TXDATA_FIFO_1_BASE_ADDR,
3232
[RTW89_MAC_MEM_CPU_LOCAL] = CPU_LOCAL_BASE_ADDR,
3333
[RTW89_MAC_MEM_BSSID_CAM] = BSSID_CAM_BASE_ADDR,
34+
[RTW89_MAC_MEM_TXD_FIFO_0_V1] = TXD_FIFO_0_BASE_ADDR_V1,
35+
[RTW89_MAC_MEM_TXD_FIFO_1_V1] = TXD_FIFO_1_BASE_ADDR_V1,
3436
};
3537

3638
static void rtw89_mac_mem_write(struct rtw89_dev *rtwdev, u32 offset,

drivers/net/wireless/realtek/rtw89/mac.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ enum rtw89_mac_dbg_port_sel {
245245
#define BCN_IE_CAM1_BASE_ADDR 0x188A0000
246246
#define TXD_FIFO_0_BASE_ADDR 0x18856200
247247
#define TXD_FIFO_1_BASE_ADDR 0x188A1080
248+
#define TXD_FIFO_0_BASE_ADDR_V1 0x18856400 /* for 8852C */
249+
#define TXD_FIFO_1_BASE_ADDR_V1 0x188A1080 /* for 8852C */
248250
#define TXDATA_FIFO_0_BASE_ADDR 0x18856000
249251
#define TXDATA_FIFO_1_BASE_ADDR 0x188A1000
250252
#define CPU_LOCAL_BASE_ADDR 0x18003000
@@ -271,6 +273,8 @@ enum rtw89_mac_mem_sel {
271273
RTW89_MAC_MEM_TXDATA_FIFO_1,
272274
RTW89_MAC_MEM_CPU_LOCAL,
273275
RTW89_MAC_MEM_BSSID_CAM,
276+
RTW89_MAC_MEM_TXD_FIFO_0_V1,
277+
RTW89_MAC_MEM_TXD_FIFO_1_V1,
274278

275279
/* keep last */
276280
RTW89_MAC_MEM_NUM,

0 commit comments

Comments
 (0)