Commit 4cfad52a authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: enlarge supported length of read_reg debugfs entry

The register ranges of upcoming chips are different from current, and even
existing chips have different ranges, so support longer length to dump
registers. Then, user space can decide the ranges according to chip.

Since arbitrary length (e.g. 7) would be a little complicated, so simply
make length a multiple of 16. The output looks like

18620000h : 8580801f 82828282 82828282 080800fd
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230519031500.21087-6-pkshih@realtek.com
parent 791af3fb
...@@ -30,7 +30,7 @@ struct rtw89_debugfs_priv { ...@@ -30,7 +30,7 @@ struct rtw89_debugfs_priv {
u32 cb_data; u32 cb_data;
struct { struct {
u32 addr; u32 addr;
u8 len; u32 len;
} read_reg; } read_reg;
struct { struct {
u32 addr; u32 addr;
...@@ -164,12 +164,15 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v) ...@@ -164,12 +164,15 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v)
{ {
struct rtw89_debugfs_priv *debugfs_priv = m->private; struct rtw89_debugfs_priv *debugfs_priv = m->private;
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
u32 addr, data; u32 addr, end, data, k;
u8 len; u32 len;
len = debugfs_priv->read_reg.len; len = debugfs_priv->read_reg.len;
addr = debugfs_priv->read_reg.addr; addr = debugfs_priv->read_reg.addr;
if (len > 4)
goto ndata;
switch (len) { switch (len) {
case 1: case 1:
data = rtw89_read8(rtwdev, addr); data = rtw89_read8(rtwdev, addr);
...@@ -187,6 +190,20 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v) ...@@ -187,6 +190,20 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v)
seq_printf(m, "get %d bytes at 0x%08x=0x%08x\n", len, addr, data); seq_printf(m, "get %d bytes at 0x%08x=0x%08x\n", len, addr, data);
return 0;
ndata:
end = addr + len;
for (; addr < end; addr += 16) {
seq_printf(m, "%08xh : ", 0x18600000 + addr);
for (k = 0; k < 16; k += 4) {
data = rtw89_read32(rtwdev, addr + k);
seq_printf(m, "%08x ", data);
}
seq_puts(m, "\n");
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment