i9c
changed/i9c/kmod-redhat-rtw89-5.14.0_284.11.1_dup9.2-1.el9_2
commit
462f20a045
@ -0,0 +1 @@
|
||||
SOURCES/rtw89-redhat-5.14.0_284.11.1_dup9.2.tar.bz2
|
@ -0,0 +1 @@
|
||||
50cd245c5a9208cf5e19c9f656978fe77fadec76 SOURCES/rtw89-redhat-5.14.0_284.11.1_dup9.2.tar.bz2
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,901 @@
|
||||
From be462322de77a0690eda74a1a631c3706a787469 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:21 +0200
|
||||
Subject: [PATCH 003/142] wifi: rtw89: 8852b: add tables for RFK
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 2b379eb443e2a4bd6fb2cbd300e12aeff45cff57
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Sep 28 16:43:30 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add tables for RFK
|
||||
|
||||
These tables are used by RFK to assist to configure PHY and RF registers.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
.../wireless/realtek/rtw89/rtw8852b_rfk_table.c | 794 +++++++++++++++++++++
|
||||
.../wireless/realtek/rtw89/rtw8852b_rfk_table.h | 62 ++
|
||||
2 files changed, 856 insertions(+)
|
||||
create mode 100644 drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.c
|
||||
create mode 100644 drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.h
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.c
|
||||
new file mode 100644
|
||||
index 0000000000000..0b8a210bb10b7
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.c
|
||||
@@ -0,0 +1,794 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
+/* Copyright(c) 2019-2020 Realtek Corporation
|
||||
+ */
|
||||
+
|
||||
+#include "rtw8852b_rfk_table.h"
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_afe_init_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0xC0D4, 0xffffffff, 0x4486888c),
|
||||
+ RTW89_DECL_RFK_WM(0xC0D8, 0xffffffff, 0xc6ba10e0),
|
||||
+ RTW89_DECL_RFK_WM(0xc0dc, 0xffffffff, 0x30c52868),
|
||||
+ RTW89_DECL_RFK_WM(0xc0e0, 0xffffffff, 0x05008128),
|
||||
+ RTW89_DECL_RFK_WM(0xc0e4, 0xffffffff, 0x0000272b),
|
||||
+ RTW89_DECL_RFK_WM(0xC1D4, 0xffffffff, 0x4486888c),
|
||||
+ RTW89_DECL_RFK_WM(0xC1D8, 0xffffffff, 0xc6ba10e0),
|
||||
+ RTW89_DECL_RFK_WM(0xc1dc, 0xffffffff, 0x30c52868),
|
||||
+ RTW89_DECL_RFK_WM(0xc1e0, 0xffffffff, 0x05008128),
|
||||
+ RTW89_DECL_RFK_WM(0xc1e4, 0xffffffff, 0x0000272b),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_afe_init_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_addc_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x20f4, BIT(24), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x20f8, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xff0000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xf00, 0x2),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xf, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xc0, 0x2),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_addc_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_addc_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x20f4, BIT(24), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x20f8, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xff0000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xf00, 0x2),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xf, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x20f0, 0xc0, 0x3),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_addc_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_dadc_en_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, 0x0f000000, 0xf),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, 0x0f000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(16), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x12dc, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x12e8, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_WRF(RF_PATH_A, 0x8f, BIT(13), 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_dadc_en_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_dadc_en_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, 0x0f000000, 0xf),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, 0x0f000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(16), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x32dc, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x32e8, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_WRF(RF_PATH_B, 0x8f, BIT(13), 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_dadc_en_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_dadc_dis_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x12dc, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x12e8, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WRF(RF_PATH_A, 0x8f, BIT(13), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(16), 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_dadc_dis_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_check_dadc_dis_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x32dc, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x32e8, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WRF(RF_PATH_B, 0x8f, BIT(13), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, BIT(16), 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_check_dadc_dis_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s0_1_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x12A0, BIT(15), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x12A0, 0x00007000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x12B8, BIT(30), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, BIT(28), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, 0x80000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC0D8, BIT(16), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc0dc, 0x0c000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0xC004, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc024, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC004, 0x3ff00000, 0x30),
|
||||
+ RTW89_DECL_RFK_WM(0xC004, 0xc0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC004, BIT(17), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc024, BIT(17), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc00c, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc02c, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC004, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc024, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_DELAY(1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s0_1_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s0_2_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0xc0dc, 0x0c000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc00c, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc02c, BIT(2), 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s0_2_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s0_3_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0xC004, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc024, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC0D8, BIT(16), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x12A0, BIT(15), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x12A0, 0x00007000, 0x7),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s0_3_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s1_1_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, BIT(15), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, 0x7000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x32B8, BIT(30), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x030C, BIT(28), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x032C, 0x80000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC1D8, BIT(16), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc1dc, 0x0c000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0xc104, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc124, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc104, 0x3ff00000, 0x30),
|
||||
+ RTW89_DECL_RFK_WM(0xc104, 0xc0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc104, BIT(17), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc124, BIT(17), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc10c, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc12c, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc104, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc124, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_DELAY(1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s1_1_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s1_2_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0xc1dc, 0x0c000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc10c, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0xc12c, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_DELAY(1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s1_2_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dack_s1_3_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0xc104, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xc124, BIT(0), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0xC1D8, BIT(16), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, BIT(15), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, 0x7000, 0x7),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dack_s1_3_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dpk_afe_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x20fc, 0xffff0000, 0x0303),
|
||||
+ RTW89_DECL_RFK_WM(0x12b8, BIT(30), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x32b8, BIT(30), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x030c, 0xff000000, 0x13),
|
||||
+ RTW89_DECL_RFK_WM(0x032c, 0xffff0000, 0x0041),
|
||||
+ RTW89_DECL_RFK_WM(0x12b8, BIT(28), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x58c8, BIT(24), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x78c8, BIT(24), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5864, 0xc0000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x7864, 0xc0000000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x2008, 0x01FFFFFF, 0x1ffffff),
|
||||
+ RTW89_DECL_RFK_WM(0x0c1c, BIT(2), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x0700, BIT(27), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x0c70, 0x000003FF, 0x3ff),
|
||||
+ RTW89_DECL_RFK_WM(0x0c60, 0x00000003, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x0c6c, BIT(0), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x58ac, BIT(27), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x78ac, BIT(27), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x0c3c, BIT(9), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x2344, BIT(31), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x4490, BIT(31), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x12a0, 0x000ff000, 0xbf),
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, 0x000f0000, 0xb),
|
||||
+ RTW89_DECL_RFK_WM(0x0700, 0x07000000, 0x5),
|
||||
+ RTW89_DECL_RFK_WM(0x20fc, 0xffff0000, 0x3333),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, BIT(15), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5800, 0x0000ffff, 0x0000),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, BIT(15), 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7800, 0x0000ffff, 0x0000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dpk_afe_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dpk_afe_restore_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x20fc, 0xffff0000, 0x0303),
|
||||
+ RTW89_DECL_RFK_WM(0x12b8, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x32b8, BIT(30), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x5864, 0xc0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x7864, 0xc0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x2008, 0x01FFFFFF, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0c1c, BIT(2), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0700, BIT(27), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0c70, 0x000003FF, 0x63),
|
||||
+ RTW89_DECL_RFK_WM(0x12a0, 0x000FF000, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x32a0, 0x000FF000, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x0700, 0x07000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x5864, BIT(29), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x7864, BIT(29), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x20fc, 0xffff0000, 0x0000),
|
||||
+ RTW89_DECL_RFK_WM(0x58c8, BIT(24), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x78c8, BIT(24), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0c3c, BIT(9), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, BIT(15), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x58e4, 0x18000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x58e4, 0x18000000, 0x2),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, BIT(15), 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x78e4, 0x18000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x78e4, 0x18000000, 0x2),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dpk_afe_restore_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_dpk_kip_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x8008, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x8088, 0xffffffff, 0x80000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_dpk_kip_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_sys_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x12a8, 0x0000000f, 0x5),
|
||||
+ RTW89_DECL_RFK_WM(0x32a8, 0x0000000f, 0x5),
|
||||
+ RTW89_DECL_RFK_WM(0x12bc, 0x000ffff0, 0x5555),
|
||||
+ RTW89_DECL_RFK_WM(0x32bc, 0x000ffff0, 0x5555),
|
||||
+ RTW89_DECL_RFK_WM(0x0300, 0xff000000, 0x16),
|
||||
+ RTW89_DECL_RFK_WM(0x0304, 0x000000ff, 0x19),
|
||||
+ RTW89_DECL_RFK_WM(0x0314, 0xffff0000, 0x2041),
|
||||
+ RTW89_DECL_RFK_WM(0x0318, 0xffffffff, 0x2041),
|
||||
+ RTW89_DECL_RFK_WM(0x0318, 0xffffffff, 0x20012041),
|
||||
+ RTW89_DECL_RFK_WM(0x0020, 0x00006000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x0024, 0x00006000, 0x3),
|
||||
+ RTW89_DECL_RFK_WM(0x0704, 0xffff0000, 0x601e),
|
||||
+ RTW89_DECL_RFK_WM(0x2704, 0xffff0000, 0x601e),
|
||||
+ RTW89_DECL_RFK_WM(0x0700, 0xf0000000, 0x4),
|
||||
+ RTW89_DECL_RFK_WM(0x2700, 0xf0000000, 0x4),
|
||||
+ RTW89_DECL_RFK_WM(0x0650, 0x3c000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x2650, 0x3c000000, 0x0),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_sys_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_sys_a_defs_2g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x120c, 0x000000ff, 0x33),
|
||||
+ RTW89_DECL_RFK_WM(0x12c0, 0x0ff00000, 0x33),
|
||||
+ RTW89_DECL_RFK_WM(0x58f8, 0x40000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x0304, 0x0000ff00, 0x1e),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_sys_a_defs_2g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_sys_a_defs_5g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x120c, 0x000000ff, 0x44),
|
||||
+ RTW89_DECL_RFK_WM(0x12c0, 0x0ff00000, 0x44),
|
||||
+ RTW89_DECL_RFK_WM(0x58f8, 0x40000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0304, 0x0000ff00, 0x1d),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_sys_a_defs_5g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_sys_b_defs_2g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x32c0, 0x0ff00000, 0x33),
|
||||
+ RTW89_DECL_RFK_WM(0x320c, 0x000000ff, 0x33),
|
||||
+ RTW89_DECL_RFK_WM(0x78f8, 0x40000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x0304, 0x0000ff00, 0x1e),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_sys_b_defs_2g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_sys_b_defs_5g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x32c0, 0x0ff00000, 0x44),
|
||||
+ RTW89_DECL_RFK_WM(0x320c, 0x000000ff, 0x44),
|
||||
+ RTW89_DECL_RFK_WM(0x78f8, 0x40000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x0304, 0x0000ff00, 0x1d),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_sys_b_defs_5g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_init_txpwr_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x566c, 0x00001000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x5800, 0xffffffff, 0x003f807f),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, 0x0000007f, 0x40),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, 0x0fffff00, 0x00040),
|
||||
+ RTW89_DECL_RFK_WM(0x5810, 0xffffffff, 0x59010000),
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0x01ffffff, 0x002d000),
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0xf8000000, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x5818, 0xffffffff, 0x002c1800),
|
||||
+ RTW89_DECL_RFK_WM(0x581c, 0x3fffffff, 0x1dc80280),
|
||||
+ RTW89_DECL_RFK_WM(0x5820, 0xffffffff, 0x00002080),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, 0x10000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x580c, 0x40000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5834, 0x3fffffff, 0x000115f2),
|
||||
+ RTW89_DECL_RFK_WM(0x5838, 0x7fffffff, 0x0000121),
|
||||
+ RTW89_DECL_RFK_WM(0x5854, 0x3fffffff, 0x000115f2),
|
||||
+ RTW89_DECL_RFK_WM(0x5858, 0x7fffffff, 0x0000121),
|
||||
+ RTW89_DECL_RFK_WM(0x5860, 0x80000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x5864, 0x07ffffff, 0x00801ff),
|
||||
+ RTW89_DECL_RFK_WM(0x5898, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x589c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x58a4, 0x000000ff, 0x16),
|
||||
+ RTW89_DECL_RFK_WM(0x58b0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x58b4, 0x7fffffff, 0x0a002000),
|
||||
+ RTW89_DECL_RFK_WM(0x58b8, 0x7fffffff, 0x00007628),
|
||||
+ RTW89_DECL_RFK_WM(0x58bc, 0x07ffffff, 0x7a7807f),
|
||||
+ RTW89_DECL_RFK_WM(0x58c0, 0xfffe0000, 0x003f),
|
||||
+ RTW89_DECL_RFK_WM(0x58c4, 0xffffffff, 0x0003ffff),
|
||||
+ RTW89_DECL_RFK_WM(0x58c8, 0x00ffffff, 0x000000),
|
||||
+ RTW89_DECL_RFK_WM(0x58c8, 0xf0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x58cc, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x58d0, 0x07ffffff, 0x2008101),
|
||||
+ RTW89_DECL_RFK_WM(0x58d4, 0x000000ff, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x58d4, 0x0003fe00, 0x0ff),
|
||||
+ RTW89_DECL_RFK_WM(0x58d4, 0x07fc0000, 0x100),
|
||||
+ RTW89_DECL_RFK_WM(0x58d8, 0xffffffff, 0x8008016c),
|
||||
+ RTW89_DECL_RFK_WM(0x58dc, 0x0001ffff, 0x0807f),
|
||||
+ RTW89_DECL_RFK_WM(0x58dc, 0xfff00000, 0x800),
|
||||
+ RTW89_DECL_RFK_WM(0x58f0, 0x0003ffff, 0x001ff),
|
||||
+ RTW89_DECL_RFK_WM(0x58f4, 0x000fffff, 0x000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_init_txpwr_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_init_txpwr_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x566c, 0x00001000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x7800, 0xffffffff, 0x003f807f),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, 0x0000007f, 0x40),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, 0x0fffff00, 0x00040),
|
||||
+ RTW89_DECL_RFK_WM(0x7810, 0xffffffff, 0x59010000),
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0x01ffffff, 0x002d000),
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0xf8000000, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x7818, 0xffffffff, 0x002c1800),
|
||||
+ RTW89_DECL_RFK_WM(0x781c, 0x3fffffff, 0x1dc80280),
|
||||
+ RTW89_DECL_RFK_WM(0x7820, 0xffffffff, 0x00002080),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, 0x10000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x780c, 0x40000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7834, 0x3fffffff, 0x000115f2),
|
||||
+ RTW89_DECL_RFK_WM(0x7838, 0x7fffffff, 0x0000121),
|
||||
+ RTW89_DECL_RFK_WM(0x7854, 0x3fffffff, 0x000115f2),
|
||||
+ RTW89_DECL_RFK_WM(0x7858, 0x7fffffff, 0x0000121),
|
||||
+ RTW89_DECL_RFK_WM(0x7860, 0x80000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x7864, 0x07ffffff, 0x00801ff),
|
||||
+ RTW89_DECL_RFK_WM(0x7898, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x789c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x78a4, 0x000000ff, 0x16),
|
||||
+ RTW89_DECL_RFK_WM(0x78b0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x78b4, 0x7fffffff, 0x0a002000),
|
||||
+ RTW89_DECL_RFK_WM(0x78b8, 0x7fffffff, 0x00007628),
|
||||
+ RTW89_DECL_RFK_WM(0x78bc, 0x07ffffff, 0x7a7807f),
|
||||
+ RTW89_DECL_RFK_WM(0x78c0, 0xfffe0000, 0x003f),
|
||||
+ RTW89_DECL_RFK_WM(0x78c4, 0xffffffff, 0x0003ffff),
|
||||
+ RTW89_DECL_RFK_WM(0x78c8, 0x00ffffff, 0x000000),
|
||||
+ RTW89_DECL_RFK_WM(0x78c8, 0xf0000000, 0x0),
|
||||
+ RTW89_DECL_RFK_WM(0x78cc, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x78d0, 0x07ffffff, 0x2008101),
|
||||
+ RTW89_DECL_RFK_WM(0x78d4, 0x000000ff, 0x00),
|
||||
+ RTW89_DECL_RFK_WM(0x78d4, 0x0003fe00, 0x0ff),
|
||||
+ RTW89_DECL_RFK_WM(0x78d4, 0x07fc0000, 0x100),
|
||||
+ RTW89_DECL_RFK_WM(0x78d8, 0xffffffff, 0x8008016c),
|
||||
+ RTW89_DECL_RFK_WM(0x78dc, 0x0001ffff, 0x0807f),
|
||||
+ RTW89_DECL_RFK_WM(0x78dc, 0xfff00000, 0x800),
|
||||
+ RTW89_DECL_RFK_WM(0x78f0, 0x0003ffff, 0x001ff),
|
||||
+ RTW89_DECL_RFK_WM(0x78f4, 0x000fffff, 0x000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_init_txpwr_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_init_txpwr_he_tb_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x58a0, 0xffffffff, 0x000000fe),
|
||||
+ RTW89_DECL_RFK_WM(0x58e4, 0x0000007f, 0x1f),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_init_txpwr_he_tb_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_init_txpwr_he_tb_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x78a0, 0xffffffff, 0x000000fe),
|
||||
+ RTW89_DECL_RFK_WM(0x78e4, 0x0000007f, 0x1f),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_init_txpwr_he_tb_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_dck_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x580c, 0x0fff0000, 0x000),
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0x003ff000, 0x0ef),
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0x18000000, 0x0),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_dck_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_dck_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x780c, 0x0fff0000, 0x000),
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0x003ff000, 0x0ef),
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0x18000000, 0x0),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_dck_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_dac_gain_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x58b0, 0x00000400, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x58b0, 0x00000fff, 0x000),
|
||||
+ RTW89_DECL_RFK_WM(0x58b0, 0x00000800, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5a00, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a04, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a08, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a0c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a10, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a14, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a18, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a1c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a20, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a24, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a28, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a2c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a30, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a34, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a38, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a3c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a40, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a44, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a48, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a4c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a50, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a54, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a58, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a5c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a60, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a64, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a68, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a6c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a70, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a74, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a78, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a7c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a80, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a84, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a88, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a8c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a90, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a94, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a98, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5a9c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5aa0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5aa4, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5aa8, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5aac, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5ab0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5ab4, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5ab8, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5abc, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5ac0, 0xffffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_dac_gain_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_dac_gain_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x78b0, 0x00000fff, 0x000),
|
||||
+ RTW89_DECL_RFK_WM(0x78b0, 0x00000800, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7a00, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a04, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a08, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a0c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a10, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a14, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a18, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a1c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a20, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a24, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a28, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a2c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a30, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a34, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a38, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a3c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a40, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a44, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a48, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a4c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a50, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a54, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a58, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a5c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a60, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a64, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a68, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a6c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a70, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a74, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a78, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a7c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a80, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a84, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a88, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a8c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a90, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a94, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a98, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7a9c, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7aa0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7aa4, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7aa8, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7aac, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7ab0, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7ab4, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7ab8, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7abc, 0xffffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7ac0, 0xffffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_dac_gain_defs_b);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_a_defs_2g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5608, 0x07ffffff, 0x0801008),
|
||||
+ RTW89_DECL_RFK_WM(0x560c, 0x07ffffff, 0x0201020),
|
||||
+ RTW89_DECL_RFK_WM(0x5610, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x5614, 0x07ffffff, 0x0804008),
|
||||
+ RTW89_DECL_RFK_WM(0x5618, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x561c, 0x000001ff, 0x008),
|
||||
+ RTW89_DECL_RFK_WM(0x561c, 0xffff0000, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x5620, 0xffffffff, 0x08081e28),
|
||||
+ RTW89_DECL_RFK_WM(0x5624, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x5628, 0xffffffff, 0x08081e28),
|
||||
+ RTW89_DECL_RFK_WM(0x562c, 0x0000ffff, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x581c, 0x00100000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_a_defs_2g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_a_defs_5g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5608, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x560c, 0x07ffffff, 0x0201020),
|
||||
+ RTW89_DECL_RFK_WM(0x5610, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x5614, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x5618, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x561c, 0x000001ff, 0x008),
|
||||
+ RTW89_DECL_RFK_WM(0x561c, 0xffff0000, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x5620, 0xffffffff, 0x08081e08),
|
||||
+ RTW89_DECL_RFK_WM(0x5624, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x5628, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x562c, 0x0000ffff, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x581c, 0x00100000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_a_defs_5g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_b_defs_2g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7608, 0x07ffffff, 0x0801008),
|
||||
+ RTW89_DECL_RFK_WM(0x760c, 0x07ffffff, 0x0201020),
|
||||
+ RTW89_DECL_RFK_WM(0x7610, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x7614, 0x07ffffff, 0x0804008),
|
||||
+ RTW89_DECL_RFK_WM(0x7618, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x761c, 0x000001ff, 0x008),
|
||||
+ RTW89_DECL_RFK_WM(0x761c, 0xffff0000, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x7620, 0xffffffff, 0x08081e28),
|
||||
+ RTW89_DECL_RFK_WM(0x7624, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x7628, 0xffffffff, 0x08081e28),
|
||||
+ RTW89_DECL_RFK_WM(0x762c, 0x0000ffff, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x781c, 0x00100000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_b_defs_2g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_b_defs_5g[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7608, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x760c, 0x07ffffff, 0x0201020),
|
||||
+ RTW89_DECL_RFK_WM(0x7610, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x7614, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x7618, 0x07ffffff, 0x0201008),
|
||||
+ RTW89_DECL_RFK_WM(0x761c, 0x000001ff, 0x008),
|
||||
+ RTW89_DECL_RFK_WM(0x761c, 0xffff0000, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x7620, 0xffffffff, 0x08081e08),
|
||||
+ RTW89_DECL_RFK_WM(0x7624, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x7628, 0xffffffff, 0x08080808),
|
||||
+ RTW89_DECL_RFK_WM(0x762c, 0x0000ffff, 0x0808),
|
||||
+ RTW89_DECL_RFK_WM(0x781c, 0x00100000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_b_defs_5g);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_2g_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01ef27af),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000075),
|
||||
+ RTW89_DECL_RFK_WM(0x5638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x017f13ae),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x0000006e),
|
||||
+ RTW89_DECL_RFK_WM(0x5644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_2g_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_2g_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01ef27af),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000075),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x017f13ae),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x0000006e),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_2g_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g1_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x016037e7),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x0000006f),
|
||||
+ RTW89_DECL_RFK_WM(0x5638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g1_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g1_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x016037e7),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x0000006f),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g1_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g2_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01f053f1),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000070),
|
||||
+ RTW89_DECL_RFK_WM(0x5638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g2_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g2_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01f053f1),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000070),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g2_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g3_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x5604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01c047ee),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000070),
|
||||
+ RTW89_DECL_RFK_WM(0x5638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g3_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_a_5g3_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5630, 0x3fffffff, 0x01c047ee),
|
||||
+ RTW89_DECL_RFK_WM(0x5634, 0x3fffffff, 0x00000070),
|
||||
+ RTW89_DECL_RFK_WM(0x563c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x5640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_a_5g3_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_2g_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x01ff2bb5),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000078),
|
||||
+ RTW89_DECL_RFK_WM(0x7638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x018f2bb0),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000072),
|
||||
+ RTW89_DECL_RFK_WM(0x7644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_2g_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_2g_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x01ff2bb5),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000078),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x018f2bb0),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000072),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_2g_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g1_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x009003da),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x7638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g1_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g1_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x009003da),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g1_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g2_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x013027e6),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x7638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g2_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g2_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x013027e6),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g2_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g3_all_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x80000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7600, 0x3fffffff, 0x3f2d2721),
|
||||
+ RTW89_DECL_RFK_WM(0x7604, 0x003fffff, 0x010101),
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x009003da),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x7638, 0x000fffff, 0x00000),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7644, 0x000fffff, 0x00000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g3_all_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_align_b_5g3_part_defs[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7630, 0x3fffffff, 0x009003da),
|
||||
+ RTW89_DECL_RFK_WM(0x7634, 0x3fffffff, 0x00000069),
|
||||
+ RTW89_DECL_RFK_WM(0x763c, 0x3fffffff, 0x00000000),
|
||||
+ RTW89_DECL_RFK_WM(0x7640, 0x3fffffff, 0x00000000),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_align_b_5g3_part_defs);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_defs_a[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0x00000800, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x581c, 0x20000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x5814, 0x20000000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_defs_a);
|
||||
+
|
||||
+static const struct rtw89_reg5_def rtw8852b_tssi_slope_defs_b[] = {
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0x00000800, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x781c, 0x20000000, 0x1),
|
||||
+ RTW89_DECL_RFK_WM(0x7814, 0x20000000, 0x1),
|
||||
+};
|
||||
+
|
||||
+RTW89_DECLARE_RFK_TBL(rtw8852b_tssi_slope_defs_b);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.h b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.h
|
||||
new file mode 100644
|
||||
index 0000000000000..b4d6e9851ff99
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk_table.h
|
||||
@@ -0,0 +1,62 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
|
||||
+/* Copyright(c) 2019-2020 Realtek Corporation
|
||||
+ */
|
||||
+
|
||||
+#ifndef __RTW89_8852B_RFK_TABLE_H__
|
||||
+#define __RTW89_8852B_RFK_TABLE_H__
|
||||
+
|
||||
+#include "phy.h"
|
||||
+
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_afe_init_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_addc_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_addc_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_dadc_en_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_dadc_en_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_dadc_dis_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_check_dadc_dis_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s0_1_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s0_2_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s0_3_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s1_1_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s1_2_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dack_s1_3_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dpk_afe_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dpk_afe_restore_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_dpk_kip_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_sys_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_sys_a_defs_2g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_sys_a_defs_5g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_sys_b_defs_2g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_sys_b_defs_5g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_init_txpwr_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_init_txpwr_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_init_txpwr_he_tb_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_init_txpwr_he_tb_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_dck_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_dck_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_dac_gain_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_dac_gain_defs_b_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_a_defs_2g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_a_defs_5g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_b_defs_2g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_b_defs_5g_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_2g_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_2g_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g1_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g1_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g2_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g2_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g3_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_a_5g3_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_2g_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_2g_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g1_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g1_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g2_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g2_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g3_all_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_align_b_5g3_part_defs_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_defs_a_tbl;
|
||||
+extern const struct rtw89_rfk_tbl rtw8852b_tssi_slope_defs_b_tbl;
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,699 @@
|
||||
From 5f1454c2fccfd32e630307f83558b11787376c37 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:21 +0200
|
||||
Subject: [PATCH 004/142] wifi: rtw89: phy: make generic txpwr setting
|
||||
functions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 9b43bd1ac0a8e29b678768f93645cc1b39571278
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Wed Sep 28 16:43:31 2022 +0800
|
||||
|
||||
wifi: rtw89: phy: make generic txpwr setting functions
|
||||
|
||||
Previously, we thought control registers or setting things for TX power
|
||||
series may change according to chip. So, setting functions are implemented
|
||||
chip by chip. However, until now, the functions keep the same among chips,
|
||||
at least 8852A, 8852C, and 8852B. There is a sufficient number of chips to
|
||||
share generic setting functions. So, we now remake them including TX power
|
||||
by rate, TX power offset, TX power limit, and TX power limit RU as generic
|
||||
ones in phy.c.
|
||||
|
||||
Besides, there are some code refinements in the generic ones, but almost
|
||||
all of the logic doesn't change.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 4 +
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 167 ++++++++++++++++++++++++--
|
||||
drivers/net/wireless/realtek/rtw89/phy.h | 25 ++--
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 145 +---------------------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.h | 1 -
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 145 +---------------------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.h | 1 -
|
||||
7 files changed, 184 insertions(+), 304 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index db041b32a8c2c..be39d2200e054 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -490,6 +490,8 @@ enum rtw89_bandwidth_section_num {
|
||||
RTW89_BW80_SEC_NUM = 2,
|
||||
};
|
||||
|
||||
+#define RTW89_TXPWR_LMT_PAGE_SIZE 40
|
||||
+
|
||||
struct rtw89_txpwr_limit {
|
||||
s8 cck_20m[RTW89_BF_NUM];
|
||||
s8 cck_40m[RTW89_BF_NUM];
|
||||
@@ -504,6 +506,8 @@ struct rtw89_txpwr_limit {
|
||||
|
||||
#define RTW89_RU_SEC_NUM 8
|
||||
|
||||
+#define RTW89_TXPWR_LMT_RU_PAGE_SIZE 24
|
||||
+
|
||||
struct rtw89_txpwr_limit_ru {
|
||||
s8 ru26[RTW89_RU_SEC_NUM];
|
||||
s8 ru52[RTW89_RU_SEC_NUM];
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index c894a2b614eb1..ac3aa1da5bd1b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -1443,23 +1443,21 @@ void rtw89_phy_write_reg3_tbl(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_write_reg3_tbl);
|
||||
|
||||
-const u8 rtw89_rs_idx_max[] = {
|
||||
+static const u8 rtw89_rs_idx_max[] = {
|
||||
[RTW89_RS_CCK] = RTW89_RATE_CCK_MAX,
|
||||
[RTW89_RS_OFDM] = RTW89_RATE_OFDM_MAX,
|
||||
[RTW89_RS_MCS] = RTW89_RATE_MCS_MAX,
|
||||
[RTW89_RS_HEDCM] = RTW89_RATE_HEDCM_MAX,
|
||||
[RTW89_RS_OFFSET] = RTW89_RATE_OFFSET_MAX,
|
||||
};
|
||||
-EXPORT_SYMBOL(rtw89_rs_idx_max);
|
||||
|
||||
-const u8 rtw89_rs_nss_max[] = {
|
||||
+static const u8 rtw89_rs_nss_max[] = {
|
||||
[RTW89_RS_CCK] = 1,
|
||||
[RTW89_RS_OFDM] = 1,
|
||||
[RTW89_RS_MCS] = RTW89_NSS_MAX,
|
||||
[RTW89_RS_HEDCM] = RTW89_NSS_HEDCM_MAX,
|
||||
[RTW89_RS_OFFSET] = 1,
|
||||
};
|
||||
-EXPORT_SYMBOL(rtw89_rs_nss_max);
|
||||
|
||||
static const u8 _byr_of_rs[] = {
|
||||
[RTW89_RS_CCK] = offsetof(struct rtw89_txpwr_byrate, cck),
|
||||
@@ -1501,6 +1499,7 @@ EXPORT_SYMBOL(rtw89_phy_load_txpwr_byrate);
|
||||
(txpwr_rf) >> (__c->txpwr_factor_rf - __c->txpwr_factor_mac); \
|
||||
})
|
||||
|
||||
+static
|
||||
s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
const struct rtw89_rate_desc *rate_desc)
|
||||
{
|
||||
@@ -1523,7 +1522,6 @@ s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
|
||||
return _phy_txpwr_rf_to_mac(rtwdev, byr[idx]);
|
||||
}
|
||||
-EXPORT_SYMBOL(rtw89_phy_read_txpwr_byrate);
|
||||
|
||||
static u8 rtw89_channel_6g_to_idx(struct rtw89_dev *rtwdev, u8 channel_6g)
|
||||
{
|
||||
@@ -1783,6 +1781,7 @@ static void rtw89_phy_fill_txpwr_limit_160m(struct rtw89_dev *rtwdev,
|
||||
lmt->mcs_40m_2p5[i] = min_t(s8, val_2p5_n[i], val_2p5_p[i]);
|
||||
}
|
||||
|
||||
+static
|
||||
void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit *lmt,
|
||||
@@ -1813,7 +1812,6 @@ void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
}
|
||||
}
|
||||
-EXPORT_SYMBOL(rtw89_phy_fill_txpwr_limit);
|
||||
|
||||
static s8 rtw89_phy_read_txpwr_limit_ru(struct rtw89_dev *rtwdev, u8 band,
|
||||
u8 ru, u8 ntx, u8 ch)
|
||||
@@ -1962,6 +1960,7 @@ rtw89_phy_fill_txpwr_limit_ru_160m(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
}
|
||||
|
||||
+static
|
||||
void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit_ru *lmt_ru,
|
||||
@@ -1992,7 +1991,161 @@ void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
}
|
||||
}
|
||||
-EXPORT_SYMBOL(rtw89_phy_fill_txpwr_limit_ru);
|
||||
+
|
||||
+void rtw89_phy_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ static const u8 rs[] = {
|
||||
+ RTW89_RS_CCK,
|
||||
+ RTW89_RS_OFDM,
|
||||
+ RTW89_RS_MCS,
|
||||
+ RTW89_RS_HEDCM,
|
||||
+ };
|
||||
+ struct rtw89_rate_desc cur;
|
||||
+ u8 band = chan->band_type;
|
||||
+ u8 ch = chan->channel;
|
||||
+ u32 addr, val;
|
||||
+ s8 v[4] = {};
|
||||
+ u8 i;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
+ "[TXPWR] set txpwr byrate with ch=%d\n", ch);
|
||||
+
|
||||
+ BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_CCK] % 4);
|
||||
+ BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_OFDM] % 4);
|
||||
+ BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_MCS] % 4);
|
||||
+ BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_HEDCM] % 4);
|
||||
+
|
||||
+ addr = R_AX_PWR_BY_RATE;
|
||||
+ for (cur.nss = 0; cur.nss <= RTW89_NSS_2; cur.nss++) {
|
||||
+ for (i = 0; i < ARRAY_SIZE(rs); i++) {
|
||||
+ if (cur.nss >= rtw89_rs_nss_max[rs[i]])
|
||||
+ continue;
|
||||
+
|
||||
+ cur.rs = rs[i];
|
||||
+ for (cur.idx = 0; cur.idx < rtw89_rs_idx_max[rs[i]];
|
||||
+ cur.idx++) {
|
||||
+ v[cur.idx % 4] =
|
||||
+ rtw89_phy_read_txpwr_byrate(rtwdev,
|
||||
+ band,
|
||||
+ &cur);
|
||||
+
|
||||
+ if ((cur.idx + 1) % 4)
|
||||
+ continue;
|
||||
+
|
||||
+ val = FIELD_PREP(GENMASK(7, 0), v[0]) |
|
||||
+ FIELD_PREP(GENMASK(15, 8), v[1]) |
|
||||
+ FIELD_PREP(GENMASK(23, 16), v[2]) |
|
||||
+ FIELD_PREP(GENMASK(31, 24), v[3]);
|
||||
+
|
||||
+ rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr,
|
||||
+ val);
|
||||
+ addr += 4;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+EXPORT_SYMBOL(rtw89_phy_set_txpwr_byrate);
|
||||
+
|
||||
+void rtw89_phy_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ struct rtw89_rate_desc desc = {
|
||||
+ .nss = RTW89_NSS_1,
|
||||
+ .rs = RTW89_RS_OFFSET,
|
||||
+ };
|
||||
+ u8 band = chan->band_type;
|
||||
+ s8 v[RTW89_RATE_OFFSET_MAX] = {};
|
||||
+ u32 val;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr offset\n");
|
||||
+
|
||||
+ for (desc.idx = 0; desc.idx < RTW89_RATE_OFFSET_MAX; desc.idx++)
|
||||
+ v[desc.idx] = rtw89_phy_read_txpwr_byrate(rtwdev, band, &desc);
|
||||
+
|
||||
+ BUILD_BUG_ON(RTW89_RATE_OFFSET_MAX != 5);
|
||||
+ val = FIELD_PREP(GENMASK(3, 0), v[0]) |
|
||||
+ FIELD_PREP(GENMASK(7, 4), v[1]) |
|
||||
+ FIELD_PREP(GENMASK(11, 8), v[2]) |
|
||||
+ FIELD_PREP(GENMASK(15, 12), v[3]) |
|
||||
+ FIELD_PREP(GENMASK(19, 16), v[4]);
|
||||
+
|
||||
+ rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_OFST_CTRL,
|
||||
+ GENMASK(19, 0), val);
|
||||
+}
|
||||
+EXPORT_SYMBOL(rtw89_phy_set_txpwr_offset);
|
||||
+
|
||||
+void rtw89_phy_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ struct rtw89_txpwr_limit lmt;
|
||||
+ u8 ch = chan->channel;
|
||||
+ u8 bw = chan->band_width;
|
||||
+ const s8 *ptr;
|
||||
+ u32 addr, val;
|
||||
+ u8 i, j;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
+ "[TXPWR] set txpwr limit with ch=%d bw=%d\n", ch, bw);
|
||||
+
|
||||
+ BUILD_BUG_ON(sizeof(struct rtw89_txpwr_limit) !=
|
||||
+ RTW89_TXPWR_LMT_PAGE_SIZE);
|
||||
+
|
||||
+ addr = R_AX_PWR_LMT;
|
||||
+ for (i = 0; i < RTW89_NTX_NUM; i++) {
|
||||
+ rtw89_phy_fill_txpwr_limit(rtwdev, chan, &lmt, i);
|
||||
+
|
||||
+ ptr = (s8 *)&lmt;
|
||||
+ for (j = 0; j < RTW89_TXPWR_LMT_PAGE_SIZE;
|
||||
+ j += 4, addr += 4, ptr += 4) {
|
||||
+ val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
+ FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
+ FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
+ FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
+
|
||||
+ rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+EXPORT_SYMBOL(rtw89_phy_set_txpwr_limit);
|
||||
+
|
||||
+void rtw89_phy_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ struct rtw89_txpwr_limit_ru lmt_ru;
|
||||
+ u8 ch = chan->channel;
|
||||
+ u8 bw = chan->band_width;
|
||||
+ const s8 *ptr;
|
||||
+ u32 addr, val;
|
||||
+ u8 i, j;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
+ "[TXPWR] set txpwr limit ru with ch=%d bw=%d\n", ch, bw);
|
||||
+
|
||||
+ BUILD_BUG_ON(sizeof(struct rtw89_txpwr_limit_ru) !=
|
||||
+ RTW89_TXPWR_LMT_RU_PAGE_SIZE);
|
||||
+
|
||||
+ addr = R_AX_PWR_RU_LMT;
|
||||
+ for (i = 0; i < RTW89_NTX_NUM; i++) {
|
||||
+ rtw89_phy_fill_txpwr_limit_ru(rtwdev, chan, &lmt_ru, i);
|
||||
+
|
||||
+ ptr = (s8 *)&lmt_ru;
|
||||
+ for (j = 0; j < RTW89_TXPWR_LMT_RU_PAGE_SIZE;
|
||||
+ j += 4, addr += 4, ptr += 4) {
|
||||
+ val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
+ FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
+ FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
+ FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
+
|
||||
+ rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+EXPORT_SYMBOL(rtw89_phy_set_txpwr_limit_ru);
|
||||
|
||||
struct rtw89_phy_iter_ra_data {
|
||||
struct rtw89_dev *rtwdev;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
index ee3bc5e111e16..030a7c904a28d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
@@ -317,9 +317,6 @@ struct rtw89_nbi_reg_def {
|
||||
struct rtw89_reg_def notch2_en;
|
||||
};
|
||||
|
||||
-extern const u8 rtw89_rs_idx_max[RTW89_RS_MAX];
|
||||
-extern const u8 rtw89_rs_nss_max[RTW89_RS_MAX];
|
||||
-
|
||||
static inline void rtw89_phy_write8(struct rtw89_dev *rtwdev,
|
||||
u32 addr, u8 data)
|
||||
{
|
||||
@@ -460,18 +457,20 @@ void rtw89_phy_write32_idx(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
u32 data, enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_load_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_txpwr_table *tbl);
|
||||
-s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
- const struct rtw89_rate_desc *rate_desc);
|
||||
-void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- struct rtw89_txpwr_limit *lmt,
|
||||
- u8 ntx);
|
||||
-void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- struct rtw89_txpwr_limit_ru *lmt_ru,
|
||||
- u8 ntx);
|
||||
s8 rtw89_phy_read_txpwr_limit(struct rtw89_dev *rtwdev, u8 band,
|
||||
u8 bw, u8 ntx, u8 rs, u8 bf, u8 ch);
|
||||
+void rtw89_phy_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx);
|
||||
+void rtw89_phy_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx);
|
||||
+void rtw89_phy_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx);
|
||||
+void rtw89_phy_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_ra_assoc(struct rtw89_dev *rtwdev, struct ieee80211_sta *sta);
|
||||
void rtw89_phy_ra_update(struct rtw89_dev *rtwdev);
|
||||
void rtw89_phy_ra_updata_sta(struct rtw89_dev *rtwdev, struct ieee80211_sta *sta,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index 7841476803535..5678683ec02a5 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -1410,151 +1410,14 @@ static void rtw8852a_set_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
phy_idx);
|
||||
}
|
||||
|
||||
-static void rtw8852a_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
- u8 band = chan->band_type;
|
||||
- u8 ch = chan->channel;
|
||||
- static const u8 rs[] = {
|
||||
- RTW89_RS_CCK,
|
||||
- RTW89_RS_OFDM,
|
||||
- RTW89_RS_MCS,
|
||||
- RTW89_RS_HEDCM,
|
||||
- };
|
||||
- s8 tmp;
|
||||
- u8 i, j;
|
||||
- u32 val, shf, addr = R_AX_PWR_BY_RATE;
|
||||
- struct rtw89_rate_desc cur;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr byrate with ch=%d\n", ch);
|
||||
-
|
||||
- for (cur.nss = 0; cur.nss <= RTW89_NSS_2; cur.nss++) {
|
||||
- for (i = 0; i < ARRAY_SIZE(rs); i++) {
|
||||
- if (cur.nss >= rtw89_rs_nss_max[rs[i]])
|
||||
- continue;
|
||||
-
|
||||
- val = 0;
|
||||
- cur.rs = rs[i];
|
||||
-
|
||||
- for (j = 0; j < rtw89_rs_idx_max[rs[i]]; j++) {
|
||||
- cur.idx = j;
|
||||
- shf = (j % 4) * 8;
|
||||
- tmp = rtw89_phy_read_txpwr_byrate(rtwdev, band,
|
||||
- &cur);
|
||||
- val |= (tmp << shf);
|
||||
-
|
||||
- if ((j + 1) % 4)
|
||||
- continue;
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- val = 0;
|
||||
- addr += 4;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void rtw8852a_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
- u8 band = chan->band_type;
|
||||
- struct rtw89_rate_desc desc = {
|
||||
- .nss = RTW89_NSS_1,
|
||||
- .rs = RTW89_RS_OFFSET,
|
||||
- };
|
||||
- u32 val = 0;
|
||||
- s8 v;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr offset\n");
|
||||
-
|
||||
- for (desc.idx = 0; desc.idx < RTW89_RATE_OFFSET_MAX; desc.idx++) {
|
||||
- v = rtw89_phy_read_txpwr_byrate(rtwdev, band, &desc);
|
||||
- val |= ((v & 0xf) << (4 * desc.idx));
|
||||
- }
|
||||
-
|
||||
- rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_OFST_CTRL,
|
||||
- GENMASK(19, 0), val);
|
||||
-}
|
||||
-
|
||||
-static void rtw8852a_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
-#define __MAC_TXPWR_LMT_PAGE_SIZE 40
|
||||
- u8 ch = chan->channel;
|
||||
- u8 bw = chan->band_width;
|
||||
- struct rtw89_txpwr_limit lmt[NTX_NUM_8852A];
|
||||
- u32 addr, val;
|
||||
- const s8 *ptr;
|
||||
- u8 i, j;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr limit with ch=%d bw=%d\n", ch, bw);
|
||||
-
|
||||
- for (i = 0; i < NTX_NUM_8852A; i++) {
|
||||
- rtw89_phy_fill_txpwr_limit(rtwdev, chan, &lmt[i], i);
|
||||
-
|
||||
- for (j = 0; j < __MAC_TXPWR_LMT_PAGE_SIZE; j += 4) {
|
||||
- addr = R_AX_PWR_LMT + j + __MAC_TXPWR_LMT_PAGE_SIZE * i;
|
||||
- ptr = (s8 *)&lmt[i] + j;
|
||||
-
|
||||
- val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
- FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
- FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
- FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- }
|
||||
- }
|
||||
-#undef __MAC_TXPWR_LMT_PAGE_SIZE
|
||||
-}
|
||||
-
|
||||
-static void rtw8852a_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
-#define __MAC_TXPWR_LMT_RU_PAGE_SIZE 24
|
||||
- u8 ch = chan->channel;
|
||||
- u8 bw = chan->band_width;
|
||||
- struct rtw89_txpwr_limit_ru lmt_ru[NTX_NUM_8852A];
|
||||
- u32 addr, val;
|
||||
- const s8 *ptr;
|
||||
- u8 i, j;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr limit ru with ch=%d bw=%d\n", ch, bw);
|
||||
-
|
||||
- for (i = 0; i < NTX_NUM_8852A; i++) {
|
||||
- rtw89_phy_fill_txpwr_limit_ru(rtwdev, chan, &lmt_ru[i], i);
|
||||
-
|
||||
- for (j = 0; j < __MAC_TXPWR_LMT_RU_PAGE_SIZE; j += 4) {
|
||||
- addr = R_AX_PWR_RU_LMT + j +
|
||||
- __MAC_TXPWR_LMT_RU_PAGE_SIZE * i;
|
||||
- ptr = (s8 *)&lmt_ru[i] + j;
|
||||
-
|
||||
- val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
- FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
- FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
- FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
-#undef __MAC_TXPWR_LMT_RU_PAGE_SIZE
|
||||
-}
|
||||
-
|
||||
static void rtw8852a_set_txpwr(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
- rtw8852a_set_txpwr_byrate(rtwdev, chan, phy_idx);
|
||||
- rtw8852a_set_txpwr_offset(rtwdev, chan, phy_idx);
|
||||
- rtw8852a_set_txpwr_limit(rtwdev, chan, phy_idx);
|
||||
- rtw8852a_set_txpwr_limit_ru(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_byrate(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_offset(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit_ru(rtwdev, chan, phy_idx);
|
||||
}
|
||||
|
||||
static void rtw8852a_set_txpwr_ctrl(struct rtw89_dev *rtwdev,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.h b/drivers/net/wireless/realtek/rtw89/rtw8852a.h
|
||||
index fcff1194c0096..ea82fed7b7bec 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.h
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "core.h"
|
||||
|
||||
#define RF_PATH_NUM_8852A 2
|
||||
-#define NTX_NUM_8852A 2
|
||||
|
||||
enum rtw8852a_pmac_mode {
|
||||
NONE_TEST,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 67653b3e1a356..a6a9fe3d0b565 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2006,75 +2006,6 @@ static void rtw8852c_set_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
phy_idx);
|
||||
}
|
||||
|
||||
-static void rtw8852c_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
- u8 band = chan->band_type;
|
||||
- u8 ch = chan->channel;
|
||||
- static const u8 rs[] = {
|
||||
- RTW89_RS_CCK,
|
||||
- RTW89_RS_OFDM,
|
||||
- RTW89_RS_MCS,
|
||||
- RTW89_RS_HEDCM,
|
||||
- };
|
||||
- s8 tmp;
|
||||
- u8 i, j;
|
||||
- u32 val, shf, addr = R_AX_PWR_BY_RATE;
|
||||
- struct rtw89_rate_desc cur;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr byrate with ch=%d\n", ch);
|
||||
-
|
||||
- for (cur.nss = 0; cur.nss <= RTW89_NSS_2; cur.nss++) {
|
||||
- for (i = 0; i < ARRAY_SIZE(rs); i++) {
|
||||
- if (cur.nss >= rtw89_rs_nss_max[rs[i]])
|
||||
- continue;
|
||||
-
|
||||
- val = 0;
|
||||
- cur.rs = rs[i];
|
||||
-
|
||||
- for (j = 0; j < rtw89_rs_idx_max[rs[i]]; j++) {
|
||||
- cur.idx = j;
|
||||
- shf = (j % 4) * 8;
|
||||
- tmp = rtw89_phy_read_txpwr_byrate(rtwdev, band,
|
||||
- &cur);
|
||||
- val |= (tmp << shf);
|
||||
-
|
||||
- if ((j + 1) % 4)
|
||||
- continue;
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- val = 0;
|
||||
- addr += 4;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void rtw8852c_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
- u8 band = chan->band_type;
|
||||
- struct rtw89_rate_desc desc = {
|
||||
- .nss = RTW89_NSS_1,
|
||||
- .rs = RTW89_RS_OFFSET,
|
||||
- };
|
||||
- u32 val = 0;
|
||||
- s8 v;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr offset\n");
|
||||
-
|
||||
- for (desc.idx = 0; desc.idx < RTW89_RATE_OFFSET_MAX; desc.idx++) {
|
||||
- v = rtw89_phy_read_txpwr_byrate(rtwdev, band, &desc);
|
||||
- val |= ((v & 0xf) << (4 * desc.idx));
|
||||
- }
|
||||
-
|
||||
- rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_OFST_CTRL,
|
||||
- GENMASK(19, 0), val);
|
||||
-}
|
||||
-
|
||||
static void rtw8852c_bb_set_tx_shape_dfir(struct rtw89_dev *rtwdev,
|
||||
u8 tx_shape_idx,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
@@ -2147,83 +2078,15 @@ static void rtw8852c_set_tx_shape(struct rtw89_dev *rtwdev,
|
||||
tx_shape_ofdm);
|
||||
}
|
||||
|
||||
-static void rtw8852c_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
-#define __MAC_TXPWR_LMT_PAGE_SIZE 40
|
||||
- u8 ch = chan->channel;
|
||||
- u8 bw = chan->band_width;
|
||||
- struct rtw89_txpwr_limit lmt[NTX_NUM_8852C];
|
||||
- u32 addr, val;
|
||||
- const s8 *ptr;
|
||||
- u8 i, j;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr limit with ch=%d bw=%d\n", ch, bw);
|
||||
-
|
||||
- for (i = 0; i < NTX_NUM_8852C; i++) {
|
||||
- rtw89_phy_fill_txpwr_limit(rtwdev, chan, &lmt[i], i);
|
||||
-
|
||||
- for (j = 0; j < __MAC_TXPWR_LMT_PAGE_SIZE; j += 4) {
|
||||
- addr = R_AX_PWR_LMT + j + __MAC_TXPWR_LMT_PAGE_SIZE * i;
|
||||
- ptr = (s8 *)&lmt[i] + j;
|
||||
-
|
||||
- val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
- FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
- FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
- FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- }
|
||||
- }
|
||||
-#undef __MAC_TXPWR_LMT_PAGE_SIZE
|
||||
-}
|
||||
-
|
||||
-static void rtw8852c_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
- const struct rtw89_chan *chan,
|
||||
- enum rtw89_phy_idx phy_idx)
|
||||
-{
|
||||
-#define __MAC_TXPWR_LMT_RU_PAGE_SIZE 24
|
||||
- u8 ch = chan->channel;
|
||||
- u8 bw = chan->band_width;
|
||||
- struct rtw89_txpwr_limit_ru lmt_ru[NTX_NUM_8852C];
|
||||
- u32 addr, val;
|
||||
- const s8 *ptr;
|
||||
- u8 i, j;
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
- "[TXPWR] set txpwr limit ru with ch=%d bw=%d\n", ch, bw);
|
||||
-
|
||||
- for (i = 0; i < NTX_NUM_8852C; i++) {
|
||||
- rtw89_phy_fill_txpwr_limit_ru(rtwdev, chan, &lmt_ru[i], i);
|
||||
-
|
||||
- for (j = 0; j < __MAC_TXPWR_LMT_RU_PAGE_SIZE; j += 4) {
|
||||
- addr = R_AX_PWR_RU_LMT + j +
|
||||
- __MAC_TXPWR_LMT_RU_PAGE_SIZE * i;
|
||||
- ptr = (s8 *)&lmt_ru[i] + j;
|
||||
-
|
||||
- val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
- FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
- FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
- FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
-
|
||||
- rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
-#undef __MAC_TXPWR_LMT_RU_PAGE_SIZE
|
||||
-}
|
||||
-
|
||||
static void rtw8852c_set_txpwr(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
- rtw8852c_set_txpwr_byrate(rtwdev, chan, phy_idx);
|
||||
- rtw8852c_set_txpwr_offset(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_byrate(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_offset(rtwdev, chan, phy_idx);
|
||||
rtw8852c_set_tx_shape(rtwdev, chan, phy_idx);
|
||||
- rtw8852c_set_txpwr_limit(rtwdev, chan, phy_idx);
|
||||
- rtw8852c_set_txpwr_limit_ru(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit_ru(rtwdev, chan, phy_idx);
|
||||
}
|
||||
|
||||
static void rtw8852c_set_txpwr_ctrl(struct rtw89_dev *rtwdev,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.h b/drivers/net/wireless/realtek/rtw89/rtw8852c.h
|
||||
index 558dd0f048f2b..ac642808a81ff 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.h
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#define RF_PATH_NUM_8852C 2
|
||||
#define BB_PATH_NUM_8852C 2
|
||||
-#define NTX_NUM_8852C 2
|
||||
|
||||
struct rtw8852c_u_efuse {
|
||||
u8 rsvd[0x38];
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,71 @@
|
||||
From 8095bfd12e379fa826d8ca4e8f12ea17f6e0c04b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:21 +0200
|
||||
Subject: [PATCH 005/142] wifi: rtw89: debug: txpwr_table considers sign
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b902161645879ac820dfbb561667cd08be569538
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Wed Sep 28 16:43:32 2022 +0800
|
||||
|
||||
wifi: rtw89: debug: txpwr_table considers sign
|
||||
|
||||
Previously, value of each field is just shown as unsigned.
|
||||
Now, we start to show them with sign to make things more intuitive
|
||||
during debugging.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/debug.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
index 730e83d54257f..f584fa57c82fa 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
@@ -464,7 +464,7 @@ static const struct txpwr_map __txpwr_map_lmt_ru = {
|
||||
};
|
||||
|
||||
static u8 __print_txpwr_ent(struct seq_file *m, const struct txpwr_ent *ent,
|
||||
- const u8 *buf, const u8 cur)
|
||||
+ const s8 *buf, const u8 cur)
|
||||
{
|
||||
char *fmt;
|
||||
|
||||
@@ -493,8 +493,9 @@ 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 *buf, cur, i;
|
||||
u32 val, addr;
|
||||
+ s8 *buf, tmp;
|
||||
+ u8 cur, i;
|
||||
int ret;
|
||||
|
||||
buf = vzalloc(map->addr_to - map->addr_from + 4);
|
||||
@@ -507,8 +508,11 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev,
|
||||
val = MASKDWORD;
|
||||
|
||||
cur = addr - map->addr_from;
|
||||
- for (i = 0; i < 4; i++, val >>= 8)
|
||||
- buf[cur + i] = FIELD_GET(MASKBYTE0, val) >> fct;
|
||||
+ for (i = 0; i < 4; i++, val >>= 8) {
|
||||
+ /* signed 7 bits, and reserved BIT(7) */
|
||||
+ tmp = sign_extend32(val, 6);
|
||||
+ buf[cur + i] = tmp >> fct;
|
||||
+ }
|
||||
}
|
||||
|
||||
for (cur = 0, i = 0; i < map->size; i++)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,328 @@
|
||||
From f3719ccfd7a42d2da914ce04ca3d17da47fa3d9c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 006/142] wifi: rtw89: 8852b: add chip_ops::set_txpwr
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 08484e1f6e6fd670c722756baea4833436ca8fb5
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Sep 28 16:43:33 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops::set_txpwr
|
||||
|
||||
This chip_ops is to set TX power according to country, channel, rate and
|
||||
so on. Since shared code is used to configure TX power, we only implement
|
||||
specific part in this patch.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-7-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 5 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 200 +++++++++++++++++++++++++-
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.h | 13 ++
|
||||
4 files changed, 218 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 077fddc5fa1ea..0be7d2ac59397 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -4817,6 +4817,7 @@ int rtw89_mac_read_xtal_si(struct rtw89_dev *rtwdev, u8 offset, u8 *val)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+EXPORT_SYMBOL(rtw89_mac_read_xtal_si);
|
||||
|
||||
static
|
||||
void rtw89_mac_pkt_drop_sta(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index ca20bb024b407..6809ff812abb7 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -2991,6 +2991,7 @@
|
||||
|
||||
#define R_AX_PWR_RATE_CTRL 0xD200
|
||||
#define R_AX_PWR_RATE_CTRL_C1 0xF200
|
||||
+#define B_AX_PWR_REF GENMASK(27, 10)
|
||||
#define B_AX_FORCE_PWR_BY_RATE_EN BIT(9)
|
||||
#define B_AX_FORCE_PWR_BY_RATE_VALUE_MASK GENMASK(8, 0)
|
||||
|
||||
@@ -3770,6 +3771,7 @@
|
||||
#define B_DCFO_WEIGHT_MSK GENMASK(27, 24)
|
||||
#define R_DCFO_OPT 0x4494
|
||||
#define B_DCFO_OPT_EN BIT(29)
|
||||
+#define B_TXSHAPE_TRIANGULAR_CFG GENMASK(25, 24)
|
||||
#define R_BANDEDGE 0x4498
|
||||
#define B_BANDEDGE_EN BIT(30)
|
||||
#define R_TXPATH_SEL 0x458C
|
||||
@@ -4003,6 +4005,9 @@
|
||||
#define B_TXPWRB_VAL GENMASK(27, 19)
|
||||
#define R_DPD_OFT_EN 0x5800
|
||||
#define B_DPD_OFT_EN BIT(28)
|
||||
+#define B_DPD_TSSI_CW GENMASK(26, 18)
|
||||
+#define B_DPD_PWR_CW GENMASK(17, 9)
|
||||
+#define B_DPD_REF GENMASK(8, 0)
|
||||
#define R_DPD_OFT_ADDR 0x5804
|
||||
#define B_DPD_OFT_ADDR GENMASK(31, 27)
|
||||
#define R_TXPWRB_H 0x580c
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 9f9908418ee4e..ec6833080b80a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -2,9 +2,14 @@
|
||||
/* Copyright(c) 2019-2022 Realtek Corporation
|
||||
*/
|
||||
|
||||
-#include "core.h"
|
||||
+#include "coex.h"
|
||||
+#include "fw.h"
|
||||
#include "mac.h"
|
||||
+#include "phy.h"
|
||||
#include "reg.h"
|
||||
+#include "rtw8852b.h"
|
||||
+#include "rtw8852b_table.h"
|
||||
+#include "txrx.h"
|
||||
|
||||
static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
[RTW89_QTA_SCC] = {RTW89_QTA_SCC, &rtw89_mac_size.wde_size6,
|
||||
@@ -19,6 +24,195 @@ static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
NULL},
|
||||
};
|
||||
|
||||
+static u32 rtw8852b_bb_cal_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx, s16 ref)
|
||||
+{
|
||||
+ const u16 tssi_16dbm_cw = 0x12c;
|
||||
+ const u8 base_cw_0db = 0x27;
|
||||
+ const s8 ofst_int = 0;
|
||||
+ s16 pwr_s10_3;
|
||||
+ s16 rf_pwr_cw;
|
||||
+ u16 bb_pwr_cw;
|
||||
+ u32 pwr_cw;
|
||||
+ u32 tssi_ofst_cw;
|
||||
+
|
||||
+ pwr_s10_3 = (ref << 1) + (s16)(ofst_int) + (s16)(base_cw_0db << 3);
|
||||
+ bb_pwr_cw = FIELD_GET(GENMASK(2, 0), pwr_s10_3);
|
||||
+ rf_pwr_cw = FIELD_GET(GENMASK(8, 3), pwr_s10_3);
|
||||
+ rf_pwr_cw = clamp_t(s16, rf_pwr_cw, 15, 63);
|
||||
+ pwr_cw = (rf_pwr_cw << 3) | bb_pwr_cw;
|
||||
+
|
||||
+ tssi_ofst_cw = (u32)((s16)tssi_16dbm_cw + (ref << 1) - (16 << 3));
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
+ "[TXPWR] tssi_ofst_cw=%d rf_cw=0x%x bb_cw=0x%x\n",
|
||||
+ tssi_ofst_cw, rf_pwr_cw, bb_pwr_cw);
|
||||
+
|
||||
+ return FIELD_PREP(B_DPD_TSSI_CW, tssi_ofst_cw) |
|
||||
+ FIELD_PREP(B_DPD_PWR_CW, pwr_cw) |
|
||||
+ FIELD_PREP(B_DPD_REF, ref);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_set_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ static const u32 addr[RF_PATH_NUM_8852B] = {0x5800, 0x7800};
|
||||
+ const u32 mask = B_DPD_TSSI_CW | B_DPD_PWR_CW | B_DPD_REF;
|
||||
+ const u8 ofst_ofdm = 0x4;
|
||||
+ const u8 ofst_cck = 0x8;
|
||||
+ const s16 ref_ofdm = 0;
|
||||
+ const s16 ref_cck = 0;
|
||||
+ u32 val;
|
||||
+ u8 i;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr reference\n");
|
||||
+
|
||||
+ rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_CTRL,
|
||||
+ B_AX_PWR_REF, 0x0);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set bb ofdm txpwr ref\n");
|
||||
+ val = rtw8852b_bb_cal_txpwr_ref(rtwdev, phy_idx, ref_ofdm);
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++)
|
||||
+ rtw89_phy_write32_idx(rtwdev, addr[i] + ofst_ofdm, mask, val,
|
||||
+ phy_idx);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set bb cck txpwr ref\n");
|
||||
+ val = rtw8852b_bb_cal_txpwr_ref(rtwdev, phy_idx, ref_cck);
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++)
|
||||
+ rtw89_phy_write32_idx(rtwdev, addr[i] + ofst_cck, mask, val,
|
||||
+ phy_idx);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_bb_set_tx_shape_dfir(struct rtw89_dev *rtwdev,
|
||||
+ u8 tx_shape_idx,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+#define __DFIR_CFG_ADDR(i) (R_TXFIR0 + ((i) << 2))
|
||||
+#define __DFIR_CFG_MASK 0xffffffff
|
||||
+#define __DFIR_CFG_NR 8
|
||||
+#define __DECL_DFIR_PARAM(_name, _val...) \
|
||||
+ static const u32 param_ ## _name[] = {_val}; \
|
||||
+ static_assert(ARRAY_SIZE(param_ ## _name) == __DFIR_CFG_NR)
|
||||
+
|
||||
+ __DECL_DFIR_PARAM(flat,
|
||||
+ 0x023D23FF, 0x0029B354, 0x000FC1C8, 0x00FDB053,
|
||||
+ 0x00F86F9A, 0x06FAEF92, 0x00FE5FCC, 0x00FFDFF5);
|
||||
+ __DECL_DFIR_PARAM(sharp,
|
||||
+ 0x023D83FF, 0x002C636A, 0x0013F204, 0x00008090,
|
||||
+ 0x00F87FB0, 0x06F99F83, 0x00FDBFBA, 0x00003FF5);
|
||||
+ __DECL_DFIR_PARAM(sharp_14,
|
||||
+ 0x023B13FF, 0x001C42DE, 0x00FDB0AD, 0x00F60F6E,
|
||||
+ 0x00FD8F92, 0x0602D011, 0x0001C02C, 0x00FFF00A);
|
||||
+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
+ u8 ch = chan->channel;
|
||||
+ const u32 *param;
|
||||
+ u32 addr;
|
||||
+ int i;
|
||||
+
|
||||
+ if (ch > 14) {
|
||||
+ rtw89_warn(rtwdev,
|
||||
+ "set tx shape dfir by unknown ch: %d on 2G\n", ch);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (ch == 14)
|
||||
+ param = param_sharp_14;
|
||||
+ else
|
||||
+ param = tx_shape_idx == 0 ? param_flat : param_sharp;
|
||||
+
|
||||
+ for (i = 0; i < __DFIR_CFG_NR; i++) {
|
||||
+ addr = __DFIR_CFG_ADDR(i);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
+ "set tx shape dfir: 0x%x: 0x%x\n", addr, param[i]);
|
||||
+ rtw89_phy_write32_idx(rtwdev, addr, __DFIR_CFG_MASK, param[i],
|
||||
+ phy_idx);
|
||||
+ }
|
||||
+
|
||||
+#undef __DECL_DFIR_PARAM
|
||||
+#undef __DFIR_CFG_NR
|
||||
+#undef __DFIR_CFG_MASK
|
||||
+#undef __DECL_CFG_ADDR
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_set_tx_shape(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ u8 band = chan->band_type;
|
||||
+ u8 regd = rtw89_regd_get(rtwdev, band);
|
||||
+ u8 tx_shape_cck = rtw89_8852b_tx_shape[band][RTW89_RS_CCK][regd];
|
||||
+ u8 tx_shape_ofdm = rtw89_8852b_tx_shape[band][RTW89_RS_OFDM][regd];
|
||||
+
|
||||
+ if (band == RTW89_BAND_2G)
|
||||
+ rtw8852b_bb_set_tx_shape_dfir(rtwdev, tx_shape_cck, phy_idx);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DCFO_OPT, B_TXSHAPE_TRIANGULAR_CFG,
|
||||
+ tx_shape_ofdm);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_set_txpwr(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ rtw89_phy_set_txpwr_byrate(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_offset(rtwdev, chan, phy_idx);
|
||||
+ rtw8852b_set_tx_shape(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit(rtwdev, chan, phy_idx);
|
||||
+ rtw89_phy_set_txpwr_limit_ru(rtwdev, chan, phy_idx);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_set_txpwr_ctrl(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ rtw8852b_set_txpwr_ref(rtwdev, phy_idx);
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+void rtw8852b_set_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev,
|
||||
+ s8 pw_ofst, enum rtw89_mac_idx mac_idx)
|
||||
+{
|
||||
+ u32 reg;
|
||||
+
|
||||
+ if (pw_ofst < -16 || pw_ofst > 15) {
|
||||
+ rtw89_warn(rtwdev, "[ULTB] Err pwr_offset=%d\n", pw_ofst);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_CTRL, mac_idx);
|
||||
+ rtw89_write32_set(rtwdev, reg, B_AX_PWR_UL_TB_CTRL_EN);
|
||||
+
|
||||
+ reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_1T, mac_idx);
|
||||
+ rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_1T_MASK, pw_ofst);
|
||||
+
|
||||
+ pw_ofst = max_t(s8, pw_ofst - 3, -16);
|
||||
+ reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_2T, mac_idx);
|
||||
+ rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_1T_MASK, pw_ofst);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+rtw8852b_init_txpwr_unit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = rtw89_mac_txpwr_write32(rtwdev, phy_idx, R_AX_PWR_UL_CTRL2, 0x07763333);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = rtw89_mac_txpwr_write32(rtwdev, phy_idx, R_AX_PWR_COEXT_CTRL, 0x01ebf000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = rtw89_mac_txpwr_write32(rtwdev, phy_idx, R_AX_PWR_UL_CTRL0, 0x0002f8ff);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw8852b_set_txpwr_ul_tb_offset(rtwdev, 0, phy_idx == RTW89_PHY_1 ?
|
||||
+ RTW89_MAC_1 : RTW89_MAC_0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rtw8852b_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -75,10 +269,14 @@ static int rtw8852b_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.enable_bb_rf = rtw8852b_mac_enable_bb_rf,
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
+ .set_txpwr = rtw8852b_set_txpwr,
|
||||
+ .set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
+ .init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
};
|
||||
|
||||
const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.chip_id = RTL8852B,
|
||||
+ .ops = &rtw8852b_chip_ops,
|
||||
.fifo_size = 196608,
|
||||
.dle_scc_rsvd_size = 98304,
|
||||
.dle_mem = rtw8852b_dle_mem_pcie,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.h b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
new file mode 100644
|
||||
index 0000000000000..a5ff269752a30
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
|
||||
+/* Copyright(c) 2019-2022 Realtek Corporation
|
||||
+ */
|
||||
+
|
||||
+#ifndef __RTW89_8852B_H__
|
||||
+#define __RTW89_8852B_H__
|
||||
+
|
||||
+#include "core.h"
|
||||
+
|
||||
+#define RF_PATH_NUM_8852B 2
|
||||
+#define BB_PATH_NUM_8852B 2
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,248 @@
|
||||
From f3987c9e9f194c32ce9d9581f7ff86012c88031f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 007/142] wifi: rtw89: 8852b: add chip_ops to read efuse
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 132dc4fe5b587c0a62fc90d78e7413944fa06669
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Sep 28 16:43:34 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops to read efuse
|
||||
|
||||
efuse stores individual data about a chip itself, such as MAC address,
|
||||
country code, RF and crystal calibration data, and so on. Define a struct
|
||||
to help access efuse content, and copy them into a common struct.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-8-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 106 ++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.h | 75 ++++++++++++++++++
|
||||
2 files changed, 181 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index ec6833080b80a..b80102b1dd7fd 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -24,6 +24,105 @@ static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
NULL},
|
||||
};
|
||||
|
||||
+static void rtw8852be_efuse_parsing(struct rtw89_efuse *efuse,
|
||||
+ struct rtw8852b_efuse *map)
|
||||
+{
|
||||
+ ether_addr_copy(efuse->addr, map->e.mac_addr);
|
||||
+ efuse->rfe_type = map->rfe_type;
|
||||
+ efuse->xtal_cap = map->xtal_k;
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_efuse_parsing_tssi(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_efuse *map)
|
||||
+{
|
||||
+ struct rtw89_tssi_info *tssi = &rtwdev->tssi;
|
||||
+ struct rtw8852b_tssi_offset *ofst[] = {&map->path_a_tssi, &map->path_b_tssi};
|
||||
+ u8 i, j;
|
||||
+
|
||||
+ tssi->thermal[RF_PATH_A] = map->path_a_therm;
|
||||
+ tssi->thermal[RF_PATH_B] = map->path_b_therm;
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ memcpy(tssi->tssi_cck[i], ofst[i]->cck_tssi,
|
||||
+ sizeof(ofst[i]->cck_tssi));
|
||||
+
|
||||
+ for (j = 0; j < TSSI_CCK_CH_GROUP_NUM; j++)
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
+ "[TSSI][EFUSE] path=%d cck[%d]=0x%x\n",
|
||||
+ i, j, tssi->tssi_cck[i][j]);
|
||||
+
|
||||
+ memcpy(tssi->tssi_mcs[i], ofst[i]->bw40_tssi,
|
||||
+ sizeof(ofst[i]->bw40_tssi));
|
||||
+ memcpy(tssi->tssi_mcs[i] + TSSI_MCS_2G_CH_GROUP_NUM,
|
||||
+ ofst[i]->bw40_1s_tssi_5g, sizeof(ofst[i]->bw40_1s_tssi_5g));
|
||||
+
|
||||
+ for (j = 0; j < TSSI_MCS_CH_GROUP_NUM; j++)
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
+ "[TSSI][EFUSE] path=%d mcs[%d]=0x%x\n",
|
||||
+ i, j, tssi->tssi_mcs[i][j]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool _decode_efuse_gain(u8 data, s8 *high, s8 *low)
|
||||
+{
|
||||
+ if (high)
|
||||
+ *high = sign_extend32(FIELD_GET(GENMASK(7, 4), data), 3);
|
||||
+ if (low)
|
||||
+ *low = sign_extend32(FIELD_GET(GENMASK(3, 0), data), 3);
|
||||
+
|
||||
+ return data != 0xff;
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_efuse_parsing_gain_offset(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_efuse *map)
|
||||
+{
|
||||
+ struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain;
|
||||
+ bool valid = false;
|
||||
+
|
||||
+ valid |= _decode_efuse_gain(map->rx_gain_2g_cck,
|
||||
+ &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_2G_CCK],
|
||||
+ &gain->offset[RF_PATH_B][RTW89_GAIN_OFFSET_2G_CCK]);
|
||||
+ valid |= _decode_efuse_gain(map->rx_gain_2g_ofdm,
|
||||
+ &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_2G_OFDM],
|
||||
+ &gain->offset[RF_PATH_B][RTW89_GAIN_OFFSET_2G_OFDM]);
|
||||
+ valid |= _decode_efuse_gain(map->rx_gain_5g_low,
|
||||
+ &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_LOW],
|
||||
+ &gain->offset[RF_PATH_B][RTW89_GAIN_OFFSET_5G_LOW]);
|
||||
+ valid |= _decode_efuse_gain(map->rx_gain_5g_mid,
|
||||
+ &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_MID],
|
||||
+ &gain->offset[RF_PATH_B][RTW89_GAIN_OFFSET_5G_MID]);
|
||||
+ valid |= _decode_efuse_gain(map->rx_gain_5g_high,
|
||||
+ &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_HIGH],
|
||||
+ &gain->offset[RF_PATH_B][RTW89_GAIN_OFFSET_5G_HIGH]);
|
||||
+
|
||||
+ gain->offset_valid = valid;
|
||||
+}
|
||||
+
|
||||
+static int rtw8852b_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map)
|
||||
+{
|
||||
+ struct rtw89_efuse *efuse = &rtwdev->efuse;
|
||||
+ struct rtw8852b_efuse *map;
|
||||
+
|
||||
+ map = (struct rtw8852b_efuse *)log_map;
|
||||
+
|
||||
+ efuse->country_code[0] = map->country_code[0];
|
||||
+ efuse->country_code[1] = map->country_code[1];
|
||||
+ rtw8852b_efuse_parsing_tssi(rtwdev, map);
|
||||
+ rtw8852b_efuse_parsing_gain_offset(rtwdev, map);
|
||||
+
|
||||
+ switch (rtwdev->hci.type) {
|
||||
+ case RTW89_HCI_TYPE_PCIE:
|
||||
+ rtw8852be_efuse_parsing(efuse, map);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static u32 rtw8852b_bb_cal_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, s16 ref)
|
||||
{
|
||||
@@ -269,6 +368,7 @@ static int rtw8852b_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.enable_bb_rf = rtw8852b_mac_enable_bb_rf,
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
+ .read_efuse = rtw8852b_read_efuse,
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
@@ -280,6 +380,12 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.fifo_size = 196608,
|
||||
.dle_scc_rsvd_size = 98304,
|
||||
.dle_mem = rtw8852b_dle_mem_pcie,
|
||||
+ .sec_ctrl_efuse_size = 4,
|
||||
+ .physical_efuse_size = 1216,
|
||||
+ .logical_efuse_size = 2048,
|
||||
+ .limit_efuse_size = 1280,
|
||||
+ .dav_phy_efuse_size = 96,
|
||||
+ .dav_log_efuse_size = 16,
|
||||
.dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
|
||||
BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
|
||||
BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.h b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
index a5ff269752a30..578fe55b66957 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
@@ -10,4 +10,79 @@
|
||||
#define RF_PATH_NUM_8852B 2
|
||||
#define BB_PATH_NUM_8852B 2
|
||||
|
||||
+struct rtw8852b_u_efuse {
|
||||
+ u8 rsvd[0x88];
|
||||
+ u8 mac_addr[ETH_ALEN];
|
||||
+};
|
||||
+
|
||||
+struct rtw8852b_e_efuse {
|
||||
+ u8 mac_addr[ETH_ALEN];
|
||||
+};
|
||||
+
|
||||
+struct rtw8852b_tssi_offset {
|
||||
+ u8 cck_tssi[TSSI_CCK_CH_GROUP_NUM];
|
||||
+ u8 bw40_tssi[TSSI_MCS_2G_CH_GROUP_NUM];
|
||||
+ u8 rsvd[7];
|
||||
+ u8 bw40_1s_tssi_5g[TSSI_MCS_5G_CH_GROUP_NUM];
|
||||
+} __packed;
|
||||
+
|
||||
+struct rtw8852b_efuse {
|
||||
+ u8 rsvd[0x210];
|
||||
+ struct rtw8852b_tssi_offset path_a_tssi;
|
||||
+ u8 rsvd1[10];
|
||||
+ struct rtw8852b_tssi_offset path_b_tssi;
|
||||
+ u8 rsvd2[94];
|
||||
+ u8 channel_plan;
|
||||
+ u8 xtal_k;
|
||||
+ u8 rsvd3;
|
||||
+ u8 iqk_lck;
|
||||
+ u8 rsvd4[5];
|
||||
+ u8 reg_setting:2;
|
||||
+ u8 tx_diversity:1;
|
||||
+ u8 rx_diversity:2;
|
||||
+ u8 ac_mode:1;
|
||||
+ u8 module_type:2;
|
||||
+ u8 rsvd5;
|
||||
+ u8 shared_ant:1;
|
||||
+ u8 coex_type:3;
|
||||
+ u8 ant_iso:1;
|
||||
+ u8 radio_on_off:1;
|
||||
+ u8 rsvd6:2;
|
||||
+ u8 eeprom_version;
|
||||
+ u8 customer_id;
|
||||
+ u8 tx_bb_swing_2g;
|
||||
+ u8 tx_bb_swing_5g;
|
||||
+ u8 tx_cali_pwr_trk_mode;
|
||||
+ u8 trx_path_selection;
|
||||
+ u8 rfe_type;
|
||||
+ u8 country_code[2];
|
||||
+ u8 rsvd7[3];
|
||||
+ u8 path_a_therm;
|
||||
+ u8 path_b_therm;
|
||||
+ u8 rsvd8[2];
|
||||
+ u8 rx_gain_2g_ofdm;
|
||||
+ u8 rsvd9;
|
||||
+ u8 rx_gain_2g_cck;
|
||||
+ u8 rsvd10;
|
||||
+ u8 rx_gain_5g_low;
|
||||
+ u8 rsvd11;
|
||||
+ u8 rx_gain_5g_mid;
|
||||
+ u8 rsvd12;
|
||||
+ u8 rx_gain_5g_high;
|
||||
+ u8 rsvd13[35];
|
||||
+ u8 path_a_cck_pwr_idx[6];
|
||||
+ u8 path_a_bw40_1tx_pwr_idx[5];
|
||||
+ u8 path_a_ofdm_1tx_pwr_idx_diff:4;
|
||||
+ u8 path_a_bw20_1tx_pwr_idx_diff:4;
|
||||
+ u8 path_a_bw20_2tx_pwr_idx_diff:4;
|
||||
+ u8 path_a_bw40_2tx_pwr_idx_diff:4;
|
||||
+ u8 path_a_cck_2tx_pwr_idx_diff:4;
|
||||
+ u8 path_a_ofdm_2tx_pwr_idx_diff:4;
|
||||
+ u8 rsvd14[0xf2];
|
||||
+ union {
|
||||
+ struct rtw8852b_u_efuse u;
|
||||
+ struct rtw8852b_e_efuse e;
|
||||
+ };
|
||||
+} __packed;
|
||||
+
|
||||
#endif
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,273 @@
|
||||
From fe46e3c810d0c4267e9c4e7d097bb7205b5ca9b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 008/142] wifi: rtw89: 8852b: add chip_ops to read phy cap
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 134cf7c01517d5cfaab940cacbb41525659de5f6
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Sep 28 16:43:35 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops to read phy cap
|
||||
|
||||
This efuse region is to store PHY calibration, and it is a separated region
|
||||
from the region that stores MAC address. Then, use these data to configure
|
||||
via chip_ops::power_trim that is a calibration mechanism of TX power.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-9-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 4 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 184 ++++++++++++++++++++++++++
|
||||
2 files changed, 188 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index be39d2200e054..51af91b30fc4d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -84,6 +84,7 @@ enum rtw89_subband {
|
||||
RTW89_CH_6G_BAND_IDX7, /* Ultra-high */
|
||||
|
||||
RTW89_SUBBAND_NR,
|
||||
+ RTW89_SUBBAND_2GHZ_5GHZ_NR = RTW89_CH_5G_BAND_4 + 1,
|
||||
};
|
||||
|
||||
enum rtw89_gain_offset {
|
||||
@@ -2196,6 +2197,7 @@ struct rtw89_sta {
|
||||
|
||||
struct rtw89_efuse {
|
||||
bool valid;
|
||||
+ bool power_k_valid;
|
||||
u8 xtal_cap;
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 rfe_type;
|
||||
@@ -3425,8 +3427,10 @@ struct rtw89_phy_bb_gain_info {
|
||||
|
||||
struct rtw89_phy_efuse_gain {
|
||||
bool offset_valid;
|
||||
+ bool comp_valid;
|
||||
s8 offset[RF_PATH_MAX][RTW89_GAIN_OFFSET_NR]; /* S(8, 0) */
|
||||
s8 offset_base[RTW89_PHY_MAX]; /* S(8, 4) */
|
||||
+ s8 comp[RF_PATH_MAX][RTW89_SUBBAND_NR]; /* S(8, 0) */
|
||||
};
|
||||
|
||||
struct rtw89_dev {
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index b80102b1dd7fd..e9bcea35a72a2 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -123,6 +123,186 @@ static int rtw8852b_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void rtw8852b_phycap_parsing_power_cal(struct rtw89_dev *rtwdev, u8 *phycap_map)
|
||||
+{
|
||||
+#define PWR_K_CHK_OFFSET 0x5E9
|
||||
+#define PWR_K_CHK_VALUE 0xAA
|
||||
+ u32 offset = PWR_K_CHK_OFFSET - rtwdev->chip->phycap_addr;
|
||||
+
|
||||
+ if (phycap_map[offset] == PWR_K_CHK_VALUE)
|
||||
+ rtwdev->efuse.power_k_valid = true;
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_phycap_parsing_tssi(struct rtw89_dev *rtwdev, u8 *phycap_map)
|
||||
+{
|
||||
+ struct rtw89_tssi_info *tssi = &rtwdev->tssi;
|
||||
+ static const u32 tssi_trim_addr[RF_PATH_NUM_8852B] = {0x5D6, 0x5AB};
|
||||
+ u32 addr = rtwdev->chip->phycap_addr;
|
||||
+ bool pg = false;
|
||||
+ u32 ofst;
|
||||
+ u8 i, j;
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ for (j = 0; j < TSSI_TRIM_CH_GROUP_NUM; j++) {
|
||||
+ /* addrs are in decreasing order */
|
||||
+ ofst = tssi_trim_addr[i] - addr - j;
|
||||
+ tssi->tssi_trim[i][j] = phycap_map[ofst];
|
||||
+
|
||||
+ if (phycap_map[ofst] != 0xff)
|
||||
+ pg = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!pg) {
|
||||
+ memset(tssi->tssi_trim, 0, sizeof(tssi->tssi_trim));
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
+ "[TSSI][TRIM] no PG, set all trim info to 0\n");
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++)
|
||||
+ for (j = 0; j < TSSI_TRIM_CH_GROUP_NUM; j++)
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
+ "[TSSI] path=%d idx=%d trim=0x%x addr=0x%x\n",
|
||||
+ i, j, tssi->tssi_trim[i][j],
|
||||
+ tssi_trim_addr[i] - j);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_phycap_parsing_thermal_trim(struct rtw89_dev *rtwdev,
|
||||
+ u8 *phycap_map)
|
||||
+{
|
||||
+ struct rtw89_power_trim_info *info = &rtwdev->pwr_trim;
|
||||
+ static const u32 thm_trim_addr[RF_PATH_NUM_8852B] = {0x5DF, 0x5DC};
|
||||
+ u32 addr = rtwdev->chip->phycap_addr;
|
||||
+ u8 i;
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ info->thermal_trim[i] = phycap_map[thm_trim_addr[i] - addr];
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[THERMAL][TRIM] path=%d thermal_trim=0x%x\n",
|
||||
+ i, info->thermal_trim[i]);
|
||||
+
|
||||
+ if (info->thermal_trim[i] != 0xff)
|
||||
+ info->pg_thermal_trim = true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_thermal_trim(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+#define __thm_setting(raw) \
|
||||
+({ \
|
||||
+ u8 __v = (raw); \
|
||||
+ ((__v & 0x1) << 3) | ((__v & 0x1f) >> 1); \
|
||||
+})
|
||||
+ struct rtw89_power_trim_info *info = &rtwdev->pwr_trim;
|
||||
+ u8 i, val;
|
||||
+
|
||||
+ if (!info->pg_thermal_trim) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[THERMAL][TRIM] no PG, do nothing\n");
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ val = __thm_setting(info->thermal_trim[i]);
|
||||
+ rtw89_write_rf(rtwdev, i, RR_TM2, RR_TM2_OFF, val);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[THERMAL][TRIM] path=%d thermal_setting=0x%x\n",
|
||||
+ i, val);
|
||||
+ }
|
||||
+#undef __thm_setting
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_phycap_parsing_pa_bias_trim(struct rtw89_dev *rtwdev,
|
||||
+ u8 *phycap_map)
|
||||
+{
|
||||
+ struct rtw89_power_trim_info *info = &rtwdev->pwr_trim;
|
||||
+ static const u32 pabias_trim_addr[RF_PATH_NUM_8852B] = {0x5DE, 0x5DB};
|
||||
+ u32 addr = rtwdev->chip->phycap_addr;
|
||||
+ u8 i;
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ info->pa_bias_trim[i] = phycap_map[pabias_trim_addr[i] - addr];
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[PA_BIAS][TRIM] path=%d pa_bias_trim=0x%x\n",
|
||||
+ i, info->pa_bias_trim[i]);
|
||||
+
|
||||
+ if (info->pa_bias_trim[i] != 0xff)
|
||||
+ info->pg_pa_bias_trim = true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_pa_bias_trim(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_power_trim_info *info = &rtwdev->pwr_trim;
|
||||
+ u8 pabias_2g, pabias_5g;
|
||||
+ u8 i;
|
||||
+
|
||||
+ if (!info->pg_pa_bias_trim) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[PA_BIAS][TRIM] no PG, do nothing\n");
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852B; i++) {
|
||||
+ pabias_2g = FIELD_GET(GENMASK(3, 0), info->pa_bias_trim[i]);
|
||||
+ pabias_5g = FIELD_GET(GENMASK(7, 4), info->pa_bias_trim[i]);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[PA_BIAS][TRIM] path=%d 2G=0x%x 5G=0x%x\n",
|
||||
+ i, pabias_2g, pabias_5g);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, i, RR_BIASA, RR_BIASA_TXG, pabias_2g);
|
||||
+ rtw89_write_rf(rtwdev, i, RR_BIASA, RR_BIASA_TXA, pabias_5g);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_phycap_parsing_gain_comp(struct rtw89_dev *rtwdev, u8 *phycap_map)
|
||||
+{
|
||||
+ static const u32 comp_addrs[][RTW89_SUBBAND_2GHZ_5GHZ_NR] = {
|
||||
+ {0x5BB, 0x5BA, 0, 0x5B9, 0x5B8},
|
||||
+ {0x590, 0x58F, 0, 0x58E, 0x58D},
|
||||
+ };
|
||||
+ struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain;
|
||||
+ u32 phycap_addr = rtwdev->chip->phycap_addr;
|
||||
+ bool valid = false;
|
||||
+ int path, i;
|
||||
+ u8 data;
|
||||
+
|
||||
+ for (path = 0; path < 2; path++)
|
||||
+ for (i = 0; i < RTW89_SUBBAND_2GHZ_5GHZ_NR; i++) {
|
||||
+ if (comp_addrs[path][i] == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ data = phycap_map[comp_addrs[path][i] - phycap_addr];
|
||||
+ valid |= _decode_efuse_gain(data, NULL,
|
||||
+ &gain->comp[path][i]);
|
||||
+ }
|
||||
+
|
||||
+ gain->comp_valid = valid;
|
||||
+}
|
||||
+
|
||||
+static int rtw8852b_read_phycap(struct rtw89_dev *rtwdev, u8 *phycap_map)
|
||||
+{
|
||||
+ rtw8852b_phycap_parsing_power_cal(rtwdev, phycap_map);
|
||||
+ rtw8852b_phycap_parsing_tssi(rtwdev, phycap_map);
|
||||
+ rtw8852b_phycap_parsing_thermal_trim(rtwdev, phycap_map);
|
||||
+ rtw8852b_phycap_parsing_pa_bias_trim(rtwdev, phycap_map);
|
||||
+ rtw8852b_phycap_parsing_gain_comp(rtwdev, phycap_map);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_power_trim(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ rtw8852b_thermal_trim(rtwdev);
|
||||
+ rtw8852b_pa_bias_trim(rtwdev);
|
||||
+}
|
||||
+
|
||||
static u32 rtw8852b_bb_cal_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, s16 ref)
|
||||
{
|
||||
@@ -369,6 +549,8 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.enable_bb_rf = rtw8852b_mac_enable_bb_rf,
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
.read_efuse = rtw8852b_read_efuse,
|
||||
+ .read_phycap = rtw8852b_read_phycap,
|
||||
+ .power_trim = rtw8852b_power_trim,
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
@@ -386,6 +568,8 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.limit_efuse_size = 1280,
|
||||
.dav_phy_efuse_size = 96,
|
||||
.dav_log_efuse_size = 16,
|
||||
+ .phycap_addr = 0x580,
|
||||
+ .phycap_size = 128,
|
||||
.dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
|
||||
BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
|
||||
BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,130 @@
|
||||
From 3d7faabd92cfdd785c6591608614bf2663147ee4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 009/142] wifi: rtw89: 8852be: add 8852BE PCI entry
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 9695dc2e4be90315471ea4c672836929f5c403fe
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Sep 28 16:43:36 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852be: add 8852BE PCI entry
|
||||
|
||||
8852BE has two variants with different ID. One is 10ec:b852 that is a main
|
||||
model with 2x2 antenna, and the other is 10ec:b85b that is a 1x1 model.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220928084336.34981-10-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.h | 2 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852be.c | 64 ++++++++++++++++++++++++++
|
||||
2 files changed, 66 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.h b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
index 578fe55b66957..bc0a383c4a390 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
@@ -85,4 +85,6 @@ struct rtw8852b_efuse {
|
||||
};
|
||||
} __packed;
|
||||
|
||||
+extern const struct rtw89_chip_info rtw8852b_chip_info;
|
||||
+
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852be.c b/drivers/net/wireless/realtek/rtw89/rtw8852be.c
|
||||
index 7bf95c38d3eb2..0ef2ca8efeb0e 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852be.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852be.c
|
||||
@@ -7,18 +7,82 @@
|
||||
|
||||
#include "pci.h"
|
||||
#include "reg.h"
|
||||
+#include "rtw8852b.h"
|
||||
|
||||
static const struct rtw89_pci_info rtw8852b_pci_info = {
|
||||
+ .txbd_trunc_mode = MAC_AX_BD_TRUNC,
|
||||
+ .rxbd_trunc_mode = MAC_AX_BD_TRUNC,
|
||||
+ .rxbd_mode = MAC_AX_RXBD_PKT,
|
||||
+ .tag_mode = MAC_AX_TAG_MULTI,
|
||||
+ .tx_burst = MAC_AX_TX_BURST_2048B,
|
||||
+ .rx_burst = MAC_AX_RX_BURST_128B,
|
||||
+ .wd_dma_idle_intvl = MAC_AX_WD_DMA_INTVL_256NS,
|
||||
+ .wd_dma_act_intvl = MAC_AX_WD_DMA_INTVL_256NS,
|
||||
+ .multi_tag_num = MAC_AX_TAG_NUM_8,
|
||||
+ .lbc_en = MAC_AX_PCIE_ENABLE,
|
||||
+ .lbc_tmr = MAC_AX_LBC_TMR_2MS,
|
||||
+ .autok_en = MAC_AX_PCIE_DISABLE,
|
||||
+ .io_rcy_en = MAC_AX_PCIE_DISABLE,
|
||||
+ .io_rcy_tmr = MAC_AX_IO_RCY_ANA_TMR_6MS,
|
||||
+
|
||||
+ .init_cfg_reg = R_AX_PCIE_INIT_CFG1,
|
||||
+ .txhci_en_bit = B_AX_TXHCI_EN,
|
||||
+ .rxhci_en_bit = B_AX_RXHCI_EN,
|
||||
+ .rxbd_mode_bit = B_AX_RXBD_MODE,
|
||||
+ .exp_ctrl_reg = R_AX_PCIE_EXP_CTRL,
|
||||
+ .max_tag_num_mask = B_AX_MAX_TAG_NUM,
|
||||
+ .rxbd_rwptr_clr_reg = R_AX_RXBD_RWPTR_CLR,
|
||||
+ .txbd_rwptr_clr2_reg = 0,
|
||||
.dma_stop1 = {R_AX_PCIE_DMA_STOP1, B_AX_TX_STOP1_MASK_V1},
|
||||
.dma_stop2 = {0},
|
||||
.dma_busy1 = {R_AX_PCIE_DMA_BUSY1, DMA_BUSY1_CHECK_V1},
|
||||
.dma_busy2_reg = 0,
|
||||
.dma_busy3_reg = R_AX_PCIE_DMA_BUSY1,
|
||||
|
||||
+ .rpwm_addr = R_AX_PCIE_HRPWM,
|
||||
+ .cpwm_addr = R_AX_CPWM,
|
||||
.tx_dma_ch_mask = BIT(RTW89_TXCH_ACH4) | BIT(RTW89_TXCH_ACH5) |
|
||||
BIT(RTW89_TXCH_ACH6) | BIT(RTW89_TXCH_ACH7) |
|
||||
BIT(RTW89_TXCH_CH10) | BIT(RTW89_TXCH_CH11),
|
||||
+ .bd_idx_addr_low_power = NULL,
|
||||
+ .dma_addr_set = &rtw89_pci_ch_dma_addr_set,
|
||||
+
|
||||
+ .ltr_set = rtw89_pci_ltr_set,
|
||||
+ .fill_txaddr_info = rtw89_pci_fill_txaddr_info,
|
||||
+ .config_intr_mask = rtw89_pci_config_intr_mask,
|
||||
+ .enable_intr = rtw89_pci_enable_intr,
|
||||
+ .disable_intr = rtw89_pci_disable_intr,
|
||||
+ .recognize_intrs = rtw89_pci_recognize_intrs,
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_driver_info rtw89_8852be_info = {
|
||||
+ .chip = &rtw8852b_chip_info,
|
||||
+ .bus = {
|
||||
+ .pci = &rtw8852b_pci_info,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static const struct pci_device_id rtw89_8852be_id_table[] = {
|
||||
+ {
|
||||
+ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xb852),
|
||||
+ .driver_data = (kernel_ulong_t)&rtw89_8852be_info,
|
||||
+ },
|
||||
+ {
|
||||
+ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xb85b),
|
||||
+ .driver_data = (kernel_ulong_t)&rtw89_8852be_info,
|
||||
+ },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(pci, rtw89_8852be_id_table);
|
||||
+
|
||||
+static struct pci_driver rtw89_8852be_driver = {
|
||||
+ .name = "rtw89_8852be",
|
||||
+ .id_table = rtw89_8852be_id_table,
|
||||
+ .probe = rtw89_pci_probe,
|
||||
+ .remove = rtw89_pci_remove,
|
||||
+ .driver.pm = &rtw89_pm_ops,
|
||||
};
|
||||
+module_pci_driver(rtw89_8852be_driver);
|
||||
|
||||
MODULE_AUTHOR("Realtek Corporation");
|
||||
MODULE_DESCRIPTION("Realtek 802.11ax wireless 8852BE driver");
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 956f19cd6c44e5f95bd8dd3d98f09f32b785d157 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 010/142] wifi: rtw89: 8852c: correct set of IQK backup
|
||||
registers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 68b0ce5bb4002cd657963cb876f0ff51729f9bfc
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Sep 30 21:33:17 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: correct set of IQK backup registers
|
||||
|
||||
IQK can change the values of this register set, so need to backup and
|
||||
restore the values. During we rewrite IQK, the policy is changed. Some
|
||||
values are controlled and filled by IQK, and don't need to restore after
|
||||
IQK. Therefore, remove this kind of registers from this array.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220930133318.6335-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index 006c2cf931116..1e67a565a9e0c 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -22,8 +22,7 @@ static const u32 _tssi_de_mcs_5m[RF_PATH_NUM_8852C] = {0x5828, 0x7828};
|
||||
static const u32 _tssi_de_mcs_10m[RF_PATH_NUM_8852C] = {0x5830, 0x7830};
|
||||
|
||||
static const u32 rtw8852c_backup_bb_regs[] = {
|
||||
- 0x813c, 0x8124, 0x8120, 0xc0d4, 0xc0d8, 0xc0e8, 0x823c, 0x8224, 0x8220,
|
||||
- 0xc1d4, 0xc1d8, 0xc1e8
|
||||
+ 0x8120, 0xc0d4, 0xc0d8, 0xc0e8, 0x8220, 0xc1d4, 0xc1d8, 0xc1e8
|
||||
};
|
||||
|
||||
static const u32 rtw8852c_backup_rf_regs[] = {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 7e4a7fc82e2bcd305444cbf6ab3f5af6546ca0b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:22 +0200
|
||||
Subject: [PATCH 011/142] wifi: rtw89: 8852c: rfk: correct miscoding delay of
|
||||
DPK
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 3be11416204a7aecbdba8c843849f204c631b8e6
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Sep 30 21:33:18 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: rfk: correct miscoding delay of DPK
|
||||
|
||||
Using mdelay() can work well, but calibration causes too much time. Use
|
||||
proper udelay() to get shorter time and the same result.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220930133318.6335-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index 1e67a565a9e0c..b0672b906e7bc 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -1666,7 +1666,7 @@ static u8 _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
ret = read_poll_timeout_atomic(rtw89_phy_read32_mask, val, val == 0x55,
|
||||
10, 20000, false, rtwdev, 0xbff8, MASKBYTE0);
|
||||
- mdelay(10);
|
||||
+ udelay(10);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, MASKBYTE0);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
--
|
||||
2.13.6
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@
|
||||
From 9eed2ff1a8c584acaf9b9553989e3925ad2a5b81 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 013/142] wifi: rtw89: phy: ignore warning of bb gain cfg_type
|
||||
4
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit c6a9d360874a41dc972c44c0949916da55199f85
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Sep 30 21:36:59 2022 +0800
|
||||
|
||||
wifi: rtw89: phy: ignore warning of bb gain cfg_type 4
|
||||
|
||||
The new BB parameters add new cfg_tpe 4 to improve performance of eFEM
|
||||
modules (rfe_type >= 50), but we are using iFEM modules for now, so this
|
||||
warning can be ignored.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220930133659.7789-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index ac3aa1da5bd1b..5645aeb2a8d08 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -1036,6 +1036,7 @@ static void rtw89_phy_config_bb_gain(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
union rtw89_phy_bb_gain_arg arg = { .addr = reg->addr };
|
||||
+ struct rtw89_efuse *efuse = &rtwdev->efuse;
|
||||
|
||||
if (arg.gain_band >= RTW89_BB_GAIN_BAND_NR)
|
||||
return;
|
||||
@@ -1061,6 +1062,11 @@ static void rtw89_phy_config_bb_gain(struct rtw89_dev *rtwdev,
|
||||
case 3:
|
||||
rtw89_phy_cfg_bb_gain_op1db(rtwdev, arg, reg->data);
|
||||
break;
|
||||
+ case 4:
|
||||
+ /* This cfg_type is only used by rfe_type >= 50 with eFEM */
|
||||
+ if (efuse->rfe_type < 50)
|
||||
+ break;
|
||||
+ fallthrough;
|
||||
default:
|
||||
rtw89_warn(rtwdev,
|
||||
"bb gain {0x%x:0x%x} with unknown cfg type: %d\n",
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 411927dca0d2432a83160930fc016d27c4b205b2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 014/142] wifi: rtw89: 8852c: set pin MUX to enable BT firmware
|
||||
log
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d187691ab63f53f199a07904422e0911bc6f9390
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Sep 30 21:44:16 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: set pin MUX to enable BT firmware log
|
||||
|
||||
8852CE is a combo chip, and WiFi driver controls pin MUX. To output BT
|
||||
firmware log to specific hardware pin, set pin MUX to achieve.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220930134417.10282-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 4 ++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 3 +++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 6809ff812abb7..874cca85eaadf 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -229,6 +229,10 @@
|
||||
|
||||
#define R_AX_GPIO0_7_FUNC_SEL 0x02D0
|
||||
|
||||
+#define R_AX_LED1_FUNC_SEL 0x02DC
|
||||
+#define B_AX_PINMUX_EESK_FUNC_SEL_V1_MASK GENMASK(27, 24)
|
||||
+#define PINMUX_EESK_FUNC_SEL_BT_LOG 0x1
|
||||
+
|
||||
#define R_AX_GPIO0_15_EECS_EESK_LED1_PULL_LOW_EN 0x02E4
|
||||
#define B_AX_LED1_PULL_LOW_EN BIT(18)
|
||||
#define B_AX_EESK_PULL_LOW_EN BIT(17)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index a6a9fe3d0b565..a5bcd3fcecb71 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -273,6 +273,9 @@ static int rtw8852c_pwr_on_func(struct rtw89_dev *rtwdev)
|
||||
B_AX_CMAC_DMA_EN | B_AX_PTCLTOP_EN | B_AX_SCHEDULER_EN |
|
||||
B_AX_TMAC_EN | B_AX_RMAC_EN);
|
||||
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_LED1_FUNC_SEL, B_AX_PINMUX_EESK_FUNC_SEL_V1_MASK,
|
||||
+ PINMUX_EESK_FUNC_SEL_BT_LOG);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,110 @@
|
||||
From ae440308591d445eba5ce38d6404b3095fe11239 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 015/142] wifi: rtw89: add to dump TX FIFO 0/1 for 8852C
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 732dd91db3d3a1b7a767598549ffed358c9fbb89
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Sep 30 21:44:17 2022 +0800
|
||||
|
||||
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 <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220930134417.10282-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/debug.c | 21 +++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 4 ++++
|
||||
3 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
index f584fa57c82fa..8f27c883eeabb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
@@ -774,13 +774,34 @@ rtw89_debug_priv_mac_mem_dump_get(struct seq_file *m, void *v)
|
||||
{
|
||||
struct rtw89_debugfs_priv *debugfs_priv = m->private;
|
||||
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
|
||||
+ bool grant_read = false;
|
||||
+
|
||||
+ if (debugfs_priv->mac_mem.sel >= RTW89_MAC_MEM_NUM)
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ if (rtwdev->chip->chip_id == RTL8852C) {
|
||||
+ switch (debugfs_priv->mac_mem.sel) {
|
||||
+ case RTW89_MAC_MEM_TXD_FIFO_0_V1:
|
||||
+ case RTW89_MAC_MEM_TXD_FIFO_1_V1:
|
||||
+ case RTW89_MAC_MEM_TXDATA_FIFO_0:
|
||||
+ case RTW89_MAC_MEM_TXDATA_FIFO_1:
|
||||
+ grant_read = true;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
rtw89_leave_ps_mode(rtwdev);
|
||||
+ if (grant_read)
|
||||
+ rtw89_write32_set(rtwdev, R_AX_TCR1, B_AX_TCR_FORCE_READ_TXDFIFO);
|
||||
rtw89_debug_dump_mac_mem(m, rtwdev,
|
||||
debugfs_priv->mac_mem.sel,
|
||||
debugfs_priv->mac_mem.start,
|
||||
debugfs_priv->mac_mem.len);
|
||||
+ if (grant_read)
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_TCR1, B_AX_TCR_FORCE_READ_TXDFIFO);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
return 0;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 0be7d2ac59397..598568c3f2750 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -31,6 +31,8 @@ const u32 rtw89_mac_mem_base_addrs[RTW89_MAC_MEM_NUM] = {
|
||||
[RTW89_MAC_MEM_TXDATA_FIFO_1] = TXDATA_FIFO_1_BASE_ADDR,
|
||||
[RTW89_MAC_MEM_CPU_LOCAL] = CPU_LOCAL_BASE_ADDR,
|
||||
[RTW89_MAC_MEM_BSSID_CAM] = BSSID_CAM_BASE_ADDR,
|
||||
+ [RTW89_MAC_MEM_TXD_FIFO_0_V1] = TXD_FIFO_0_BASE_ADDR_V1,
|
||||
+ [RTW89_MAC_MEM_TXD_FIFO_1_V1] = TXD_FIFO_1_BASE_ADDR_V1,
|
||||
};
|
||||
|
||||
static void rtw89_mac_mem_write(struct rtw89_dev *rtwdev, u32 offset,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 6f4ada1869a17..a9867ac351da7 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -245,6 +245,8 @@ enum rtw89_mac_dbg_port_sel {
|
||||
#define BCN_IE_CAM1_BASE_ADDR 0x188A0000
|
||||
#define TXD_FIFO_0_BASE_ADDR 0x18856200
|
||||
#define TXD_FIFO_1_BASE_ADDR 0x188A1080
|
||||
+#define TXD_FIFO_0_BASE_ADDR_V1 0x18856400 /* for 8852C */
|
||||
+#define TXD_FIFO_1_BASE_ADDR_V1 0x188A1080 /* for 8852C */
|
||||
#define TXDATA_FIFO_0_BASE_ADDR 0x18856000
|
||||
#define TXDATA_FIFO_1_BASE_ADDR 0x188A1000
|
||||
#define CPU_LOCAL_BASE_ADDR 0x18003000
|
||||
@@ -271,6 +273,8 @@ enum rtw89_mac_mem_sel {
|
||||
RTW89_MAC_MEM_TXDATA_FIFO_1,
|
||||
RTW89_MAC_MEM_CPU_LOCAL,
|
||||
RTW89_MAC_MEM_BSSID_CAM,
|
||||
+ RTW89_MAC_MEM_TXD_FIFO_0_V1,
|
||||
+ RTW89_MAC_MEM_TXD_FIFO_1_V1,
|
||||
|
||||
/* keep last */
|
||||
RTW89_MAC_MEM_NUM,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,138 @@
|
||||
From 9157b32cbe2524cfaea119ff7ac5789d7b2c08e5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 016/142] wifi: rtw89: coex: move chip_ops::btc_bt_aci_imp to a
|
||||
generic code
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 127da1aa61859c1eb27d7fc2d5b936e9e528815d
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Wed Oct 5 16:32:07 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: move chip_ops::btc_bt_aci_imp to a generic code
|
||||
|
||||
This chunk is to set fixed BT LNA2 at level5 when WiFi/BT shared BTG RFC
|
||||
to improve BT anti-interference ability from adjacent channel. Since all
|
||||
chips use the same setting, remove chip_ops::btc_bt_aci_imp.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221005083212.45683-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 9 +++++++--
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 1 -
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 14 --------------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 14 --------------
|
||||
4 files changed, 7 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index bbdfa9ac203cc..f21c73310fdb6 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -1809,13 +1809,18 @@ static void _set_rf_trx_para(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
+ struct rtw89_btc_bt_link_info *b = &bt->link_info;
|
||||
struct rtw89_btc_rf_trx_para para;
|
||||
u32 wl_stb_chg = 0;
|
||||
u8 level_id = 0;
|
||||
|
||||
if (!dm->freerun) {
|
||||
- dm->trx_para_level = 0;
|
||||
- chip->ops->btc_bt_aci_imp(rtwdev);
|
||||
+ /* fix LNA2 = level-5 for BT ACI issue at BTG */
|
||||
+ if ((btc->dm.wl_btg_rx && b->profile_cnt.now != 0) ||
|
||||
+ dm->bt_only == 1)
|
||||
+ dm->trx_para_level = 1;
|
||||
+ else
|
||||
+ dm->trx_para_level = 0;
|
||||
}
|
||||
|
||||
level_id = (u8)dm->trx_para_level;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 51af91b30fc4d..b04e7a54b1e0a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2363,7 +2363,6 @@ struct rtw89_chip_ops {
|
||||
void (*btc_set_wl_pri)(struct rtw89_dev *rtwdev, u8 map, bool state);
|
||||
void (*btc_set_wl_txpwr_ctrl)(struct rtw89_dev *rtwdev, u32 txpwr_val);
|
||||
s8 (*btc_get_bt_rssi)(struct rtw89_dev *rtwdev, s8 val);
|
||||
- void (*btc_bt_aci_imp)(struct rtw89_dev *rtwdev);
|
||||
void (*btc_update_bt_cnt)(struct rtw89_dev *rtwdev);
|
||||
void (*btc_wl_s1_standby)(struct rtw89_dev *rtwdev, bool state);
|
||||
void (*btc_set_policy)(struct rtw89_dev *rtwdev, u16 policy_type);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index 5678683ec02a5..b5aa8697a0982 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -1871,19 +1871,6 @@ static struct rtw89_btc_fbtc_mreg rtw89_btc_8852a_mon_reg[] = {
|
||||
};
|
||||
|
||||
static
|
||||
-void rtw8852a_btc_bt_aci_imp(struct rtw89_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw89_btc *btc = &rtwdev->btc;
|
||||
- struct rtw89_btc_dm *dm = &btc->dm;
|
||||
- struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
- struct rtw89_btc_bt_link_info *b = &bt->link_info;
|
||||
-
|
||||
- /* fix LNA2 = level-5 for BT ACI issue at BTG */
|
||||
- if (btc->dm.wl_btg_rx && b->profile_cnt.now != 0)
|
||||
- dm->trx_para_level = 1;
|
||||
-}
|
||||
-
|
||||
-static
|
||||
void rtw8852a_btc_update_bt_cnt(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
@@ -2041,7 +2028,6 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {
|
||||
.btc_set_wl_pri = rtw8852a_btc_set_wl_pri,
|
||||
.btc_set_wl_txpwr_ctrl = rtw8852a_btc_set_wl_txpwr_ctrl,
|
||||
.btc_get_bt_rssi = rtw8852a_btc_get_bt_rssi,
|
||||
- .btc_bt_aci_imp = rtw8852a_btc_bt_aci_imp,
|
||||
.btc_update_bt_cnt = rtw8852a_btc_update_bt_cnt,
|
||||
.btc_wl_s1_standby = rtw8852a_btc_wl_s1_standby,
|
||||
.btc_set_wl_rx_gain = rtw8852a_btc_set_wl_rx_gain,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index a5bcd3fcecb71..00f564be29e8d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2685,19 +2685,6 @@ static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852c_mon_reg[] = {
|
||||
};
|
||||
|
||||
static
|
||||
-void rtw8852c_btc_bt_aci_imp(struct rtw89_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw89_btc *btc = &rtwdev->btc;
|
||||
- struct rtw89_btc_dm *dm = &btc->dm;
|
||||
- struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
- struct rtw89_btc_bt_link_info *b = &bt->link_info;
|
||||
-
|
||||
- /* fix LNA2 = level-5 for BT ACI issue at BTG */
|
||||
- if (btc->dm.wl_btg_rx && b->profile_cnt.now != 0)
|
||||
- dm->trx_para_level = 1;
|
||||
-}
|
||||
-
|
||||
-static
|
||||
void rtw8852c_btc_update_bt_cnt(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
/* Feature move to firmware */
|
||||
@@ -2893,7 +2880,6 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
|
||||
.btc_set_wl_pri = rtw8852c_btc_set_wl_pri,
|
||||
.btc_set_wl_txpwr_ctrl = rtw8852c_btc_set_wl_txpwr_ctrl,
|
||||
.btc_get_bt_rssi = rtw8852c_btc_get_bt_rssi,
|
||||
- .btc_bt_aci_imp = rtw8852c_btc_bt_aci_imp,
|
||||
.btc_update_bt_cnt = rtw8852c_btc_update_bt_cnt,
|
||||
.btc_wl_s1_standby = rtw8852c_btc_wl_s1_standby,
|
||||
.btc_set_wl_rx_gain = rtw8852c_btc_set_wl_rx_gain,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 84c69de904c9c595ca903b373aac9dea6f93dcb6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 017/142] wifi: rtw89: parse PHY status only when PPDU is
|
||||
to_self
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 0935bb1527d711b1af8e89d4ba200c302fb5ab2b
|
||||
Author: Eric Huang <echuang@realtek.com>
|
||||
Date: Wed Oct 5 16:32:08 2022 +0800
|
||||
|
||||
wifi: rtw89: parse PHY status only when PPDU is to_self
|
||||
|
||||
Without this fix, some non-self packets are used to count CFO (center
|
||||
frequency offset), and average CFO has unstable variation. Then, it causes
|
||||
unexpected performance.
|
||||
|
||||
Signed-off-by: Eric Huang <echuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221005083212.45683-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index a703bb70b8f55..ee2214fd92d04 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -1255,6 +1255,9 @@ static int rtw89_core_rx_parse_phy_sts(struct rtw89_dev *rtwdev,
|
||||
if (phy_ppdu->ie < RTW89_CCK_PKT)
|
||||
return -EINVAL;
|
||||
|
||||
+ if (!phy_ppdu->to_self)
|
||||
+ return 0;
|
||||
+
|
||||
pos = (u8 *)phy_ppdu->buf + PHY_STS_HDR_LEN;
|
||||
end = (u8 *)phy_ppdu->buf + phy_ppdu->len;
|
||||
while (pos < end) {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,79 @@
|
||||
From 096c34d9acbb90e410d5e31e1820fcddd513cdc3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 018/142] wifi: rtw89: 8852b: set proper configuration before
|
||||
loading NCTL
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d0c820cc5bcf768598ca3e9f6e29f3e4e5589827
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 5 16:32:09 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: set proper configuration before loading NCTL
|
||||
|
||||
Before loading RF NCTL table, we need to configure IQK/DPK clock and reset
|
||||
them, and then polling NCTL state ready. Since 8852BE needs additional
|
||||
one setting, add it by this patch. Also, give them proper names.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221005083212.45683-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 12 +++++++-----
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 2 ++
|
||||
2 files changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 5645aeb2a8d08..2db1209e6cd35 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -1368,13 +1368,15 @@ static void rtw89_phy_init_rf_nctl(struct rtw89_dev *rtwdev)
|
||||
int ret;
|
||||
|
||||
/* IQK/DPK clock & reset */
|
||||
- rtw89_phy_write32_set(rtwdev, 0x0c60, 0x3);
|
||||
- rtw89_phy_write32_set(rtwdev, 0x0c6c, 0x1);
|
||||
- rtw89_phy_write32_set(rtwdev, 0x58ac, 0x8000000);
|
||||
- rtw89_phy_write32_set(rtwdev, 0x78ac, 0x8000000);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, 0x3);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_GNT_BT_WGT_EN, 0x1);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P0_PATH_RST, 0x8000000);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P1_PATH_RST, 0x8000000);
|
||||
+ if (chip->chip_id == RTL8852B)
|
||||
+ rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, 0x2);
|
||||
|
||||
/* check 0x8080 */
|
||||
- rtw89_phy_write32(rtwdev, 0x8000, 0x8);
|
||||
+ rtw89_phy_write32(rtwdev, R_NCTL_CFG, 0x8);
|
||||
|
||||
ret = read_poll_timeout(rtw89_phy_nctl_poll, val, val == 0x4, 10,
|
||||
1000, false, rtwdev);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 874cca85eaadf..82af17d7d8d31 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -4039,6 +4039,7 @@
|
||||
#define B_P0_RFM_TX_OPT BIT(6)
|
||||
#define B_P0_RFM_BT_EN BIT(5)
|
||||
#define B_P0_RFM_OUT GENMASK(4, 0)
|
||||
+#define R_P0_PATH_RST 0x58AC
|
||||
#define R_P0_TXDPD 0x58D4
|
||||
#define B_P0_TXDPD GENMASK(31, 28)
|
||||
#define R_P0_TXPW_RSTB 0x58DC
|
||||
@@ -4083,6 +4084,7 @@
|
||||
#define R_P1_RFCTM 0x7864
|
||||
#define R_P1_RFCTM_RDY BIT(26)
|
||||
#define B_P1_RFCTM_VAL GENMASK(25, 20)
|
||||
+#define R_P1_PATH_RST 0x78AC
|
||||
#define R_P1_TXPW_RSTB 0x78DC
|
||||
#define B_P1_TXPW_RSTB_MANON BIT(30)
|
||||
#define B_P1_TXPW_RSTB_TSSI BIT(31)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,81 @@
|
||||
From 52976ab2fc78c32936c31a51972da79f46b8a424 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:23 +0200
|
||||
Subject: [PATCH 019/142] wifi: rtw89: 8852b: add HFC quota arrays
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 3e870b4817333a1a4b01805073da3e00449acf43
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 5 16:32:10 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add HFC quota arrays
|
||||
|
||||
HFC is short for HCI flow control. These arrays are used to set quota
|
||||
according to operating modes, which are SCC or download firmware.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221005083212.45683-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 32 +++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index e9bcea35a72a2..8424038d5338b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -11,6 +11,37 @@
|
||||
#include "rtw8852b_table.h"
|
||||
#include "txrx.h"
|
||||
|
||||
+static const struct rtw89_hfc_ch_cfg rtw8852b_hfc_chcfg_pcie[] = {
|
||||
+ {5, 343, grp_0}, /* ACH 0 */
|
||||
+ {5, 343, grp_0}, /* ACH 1 */
|
||||
+ {5, 343, grp_0}, /* ACH 2 */
|
||||
+ {5, 343, grp_0}, /* ACH 3 */
|
||||
+ {0, 0, grp_0}, /* ACH 4 */
|
||||
+ {0, 0, grp_0}, /* ACH 5 */
|
||||
+ {0, 0, grp_0}, /* ACH 6 */
|
||||
+ {0, 0, grp_0}, /* ACH 7 */
|
||||
+ {4, 344, grp_0}, /* B0MGQ */
|
||||
+ {4, 344, grp_0}, /* B0HIQ */
|
||||
+ {0, 0, grp_0}, /* B1MGQ */
|
||||
+ {0, 0, grp_0}, /* B1HIQ */
|
||||
+ {40, 0, 0} /* FWCMDQ */
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_hfc_pub_cfg rtw8852b_hfc_pubcfg_pcie = {
|
||||
+ 448, /* Group 0 */
|
||||
+ 0, /* Group 1 */
|
||||
+ 448, /* Public Max */
|
||||
+ 0 /* WP threshold */
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_hfc_param_ini rtw8852b_hfc_param_ini_pcie[] = {
|
||||
+ [RTW89_QTA_SCC] = {rtw8852b_hfc_chcfg_pcie, &rtw8852b_hfc_pubcfg_pcie,
|
||||
+ &rtw89_mac_size.hfc_preccfg_pcie, RTW89_HCIFC_POH},
|
||||
+ [RTW89_QTA_DLFW] = {NULL, NULL, &rtw89_mac_size.hfc_preccfg_pcie,
|
||||
+ RTW89_HCIFC_POH},
|
||||
+ [RTW89_QTA_INVALID] = {NULL},
|
||||
+};
|
||||
+
|
||||
static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
[RTW89_QTA_SCC] = {RTW89_QTA_SCC, &rtw89_mac_size.wde_size6,
|
||||
&rtw89_mac_size.ple_size6, &rtw89_mac_size.wde_qt6,
|
||||
@@ -561,6 +592,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.ops = &rtw8852b_chip_ops,
|
||||
.fifo_size = 196608,
|
||||
.dle_scc_rsvd_size = 98304,
|
||||
+ .hfc_param_ini = rtw8852b_hfc_param_ini_pcie,
|
||||
.dle_mem = rtw8852b_dle_mem_pcie,
|
||||
.sec_ctrl_efuse_size = 4,
|
||||
.physical_efuse_size = 1216,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,158 @@
|
||||
From df14c12867748fd17be146dd3d4c8376bbf5812b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 020/142] wifi: rtw89: make generic functions to convert
|
||||
subband gain index
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 6e5125bcbaf810520969c121c7f12f20b8f3987d
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 5 16:32:11 2022 +0800
|
||||
|
||||
wifi: rtw89: make generic functions to convert subband gain index
|
||||
|
||||
The gain tables use different domain index, so we need to convert the index
|
||||
from subband of chandef. Since these conversion functions can share with
|
||||
8852b, make generic functions for further use.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221005083212.45683-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/phy.h | 44 +++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 46 ++-------------------------
|
||||
2 files changed, 46 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
index 030a7c904a28d..1129d462bfbdb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
@@ -374,6 +374,50 @@ static inline u32 rtw89_phy_read32_mask(struct rtw89_dev *rtwdev,
|
||||
return rtw89_read32_mask(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, mask);
|
||||
}
|
||||
|
||||
+static inline
|
||||
+enum rtw89_gain_offset rtw89_subband_to_gain_offset_band_of_ofdm(enum rtw89_subband subband)
|
||||
+{
|
||||
+ switch (subband) {
|
||||
+ default:
|
||||
+ case RTW89_CH_2G:
|
||||
+ return RTW89_GAIN_OFFSET_2G_OFDM;
|
||||
+ case RTW89_CH_5G_BAND_1:
|
||||
+ return RTW89_GAIN_OFFSET_5G_LOW;
|
||||
+ case RTW89_CH_5G_BAND_3:
|
||||
+ return RTW89_GAIN_OFFSET_5G_MID;
|
||||
+ case RTW89_CH_5G_BAND_4:
|
||||
+ return RTW89_GAIN_OFFSET_5G_HIGH;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static inline
|
||||
+enum rtw89_phy_bb_gain_band rtw89_subband_to_bb_gain_band(enum rtw89_subband subband)
|
||||
+{
|
||||
+ switch (subband) {
|
||||
+ default:
|
||||
+ case RTW89_CH_2G:
|
||||
+ return RTW89_BB_GAIN_BAND_2G;
|
||||
+ case RTW89_CH_5G_BAND_1:
|
||||
+ return RTW89_BB_GAIN_BAND_5G_L;
|
||||
+ case RTW89_CH_5G_BAND_3:
|
||||
+ return RTW89_BB_GAIN_BAND_5G_M;
|
||||
+ case RTW89_CH_5G_BAND_4:
|
||||
+ return RTW89_BB_GAIN_BAND_5G_H;
|
||||
+ case RTW89_CH_6G_BAND_IDX0:
|
||||
+ case RTW89_CH_6G_BAND_IDX1:
|
||||
+ return RTW89_BB_GAIN_BAND_6G_L;
|
||||
+ case RTW89_CH_6G_BAND_IDX2:
|
||||
+ case RTW89_CH_6G_BAND_IDX3:
|
||||
+ return RTW89_BB_GAIN_BAND_6G_M;
|
||||
+ case RTW89_CH_6G_BAND_IDX4:
|
||||
+ case RTW89_CH_6G_BAND_IDX5:
|
||||
+ return RTW89_BB_GAIN_BAND_6G_H;
|
||||
+ case RTW89_CH_6G_BAND_IDX6:
|
||||
+ case RTW89_CH_6G_BAND_IDX7:
|
||||
+ return RTW89_BB_GAIN_BAND_6G_UH;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
enum rtw89_rfk_flag {
|
||||
RTW89_RFK_F_WRF = 0,
|
||||
RTW89_RFK_F_WM = 1,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 00f564be29e8d..f6bcac8268166 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -788,40 +788,12 @@ static const struct rtw8852c_bb_gain_op1db bb_gain_op1db_a = {
|
||||
.mask_tia0_lna6 = 0xff000000,
|
||||
};
|
||||
|
||||
-static enum rtw89_phy_bb_gain_band
|
||||
-rtw8852c_mapping_gain_band(enum rtw89_subband subband)
|
||||
-{
|
||||
- switch (subband) {
|
||||
- default:
|
||||
- case RTW89_CH_2G:
|
||||
- return RTW89_BB_GAIN_BAND_2G;
|
||||
- case RTW89_CH_5G_BAND_1:
|
||||
- return RTW89_BB_GAIN_BAND_5G_L;
|
||||
- case RTW89_CH_5G_BAND_3:
|
||||
- return RTW89_BB_GAIN_BAND_5G_M;
|
||||
- case RTW89_CH_5G_BAND_4:
|
||||
- return RTW89_BB_GAIN_BAND_5G_H;
|
||||
- case RTW89_CH_6G_BAND_IDX0:
|
||||
- case RTW89_CH_6G_BAND_IDX1:
|
||||
- return RTW89_BB_GAIN_BAND_6G_L;
|
||||
- case RTW89_CH_6G_BAND_IDX2:
|
||||
- case RTW89_CH_6G_BAND_IDX3:
|
||||
- return RTW89_BB_GAIN_BAND_6G_M;
|
||||
- case RTW89_CH_6G_BAND_IDX4:
|
||||
- case RTW89_CH_6G_BAND_IDX5:
|
||||
- return RTW89_BB_GAIN_BAND_6G_H;
|
||||
- case RTW89_CH_6G_BAND_IDX6:
|
||||
- case RTW89_CH_6G_BAND_IDX7:
|
||||
- return RTW89_BB_GAIN_BAND_6G_UH;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void rtw8852c_set_gain_error(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_subband subband,
|
||||
enum rtw89_rf_path path)
|
||||
{
|
||||
const struct rtw89_phy_bb_gain_info *gain = &rtwdev->bb_gain;
|
||||
- u8 gain_band = rtw8852c_mapping_gain_band(subband);
|
||||
+ u8 gain_band = rtw89_subband_to_bb_gain_band(subband);
|
||||
s32 val;
|
||||
u32 reg;
|
||||
u32 mask;
|
||||
@@ -979,21 +951,7 @@ static void rtw8852c_set_gain_offset(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_RPL_OFST, B_RPL_OFST_MASK, tmp & 0x7f);
|
||||
}
|
||||
|
||||
- switch (chan->subband_type) {
|
||||
- default:
|
||||
- case RTW89_CH_2G:
|
||||
- gain_band = RTW89_GAIN_OFFSET_2G_OFDM;
|
||||
- break;
|
||||
- case RTW89_CH_5G_BAND_1:
|
||||
- gain_band = RTW89_GAIN_OFFSET_5G_LOW;
|
||||
- break;
|
||||
- case RTW89_CH_5G_BAND_3:
|
||||
- gain_band = RTW89_GAIN_OFFSET_5G_MID;
|
||||
- break;
|
||||
- case RTW89_CH_5G_BAND_4:
|
||||
- gain_band = RTW89_GAIN_OFFSET_5G_HIGH;
|
||||
- break;
|
||||
- }
|
||||
+ gain_band = rtw89_subband_to_gain_offset_band_of_ofdm(chan->subband_type);
|
||||
|
||||
offset_q0 = -efuse_gain->offset[path][gain_band];
|
||||
offset_base_q4 = efuse_gain->offset_base[phy_idx];
|
||||
--
|
||||
2.13.6
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,123 @@
|
||||
From 92197f95e056fedad7b200e093ceec5900979903 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 022/142] wifi: rtw89: correct 6 GHz scan behavior
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 54997c24767b51bd762ff942431e8d37b535dc2e
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Oct 7 12:58:59 2022 +0800
|
||||
|
||||
wifi: rtw89: correct 6 GHz scan behavior
|
||||
|
||||
Change active scan behavior to fit 6GHz requirements. There are many
|
||||
different rules on active scan between 6GHz and 2GHz/5GHz, so if the
|
||||
SSID is not specified, do fast passive scanning and limit number of
|
||||
probe requests we send for now until new firmware can support all
|
||||
rules.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221007045900.10823-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 28 ++++++++++++++++++++++------
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 1 +
|
||||
2 files changed, 23 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index 1d57a8c5e97df..dd2dc842681eb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -2567,6 +2567,9 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
struct rtw89_mac_chinfo *ch_info)
|
||||
{
|
||||
struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
|
||||
+ struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
|
||||
+ struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
+ struct cfg80211_scan_request *req = rtwvif->scan_req;
|
||||
struct rtw89_pktofld_info *info;
|
||||
u8 band, probe_count = 0;
|
||||
|
||||
@@ -2578,13 +2581,13 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
ch_info->tx_pwr_idx = 0;
|
||||
ch_info->tx_null = false;
|
||||
ch_info->pause_data = false;
|
||||
+ ch_info->probe_id = RTW89_SCANOFLD_PKT_NONE;
|
||||
|
||||
if (ssid_num) {
|
||||
ch_info->num_pkt = ssid_num;
|
||||
band = rtw89_hw_to_nl80211_band(ch_info->ch_band);
|
||||
|
||||
list_for_each_entry(info, &scan_info->pkt_list[band], list) {
|
||||
- ch_info->probe_id = info->id;
|
||||
ch_info->pkt_id[probe_count] = info->id;
|
||||
if (++probe_count >= ssid_num)
|
||||
break;
|
||||
@@ -2593,9 +2596,16 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
rtw89_err(rtwdev, "SSID num differs from list len\n");
|
||||
}
|
||||
|
||||
+ if (ch_info->ch_band == RTW89_BAND_6G) {
|
||||
+ if (ssid_num == 1 && req->ssids[0].ssid_len == 0) {
|
||||
+ ch_info->tx_pkt = false;
|
||||
+ if (!req->duration_mandatory)
|
||||
+ ch_info->period -= RTW89_DWELL_TIME;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
switch (chan_type) {
|
||||
case RTW89_CHAN_OPERATE:
|
||||
- ch_info->probe_id = RTW89_SCANOFLD_PKT_NONE;
|
||||
ch_info->central_ch = scan_info->op_chan;
|
||||
ch_info->pri_ch = scan_info->op_pri_ch;
|
||||
ch_info->ch_band = scan_info->op_band;
|
||||
@@ -2604,8 +2614,9 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
ch_info->num_pkt = 0;
|
||||
break;
|
||||
case RTW89_CHAN_DFS:
|
||||
- ch_info->period = max_t(u8, ch_info->period,
|
||||
- RTW89_DFS_CHAN_TIME);
|
||||
+ if (ch_info->ch_band != RTW89_BAND_6G)
|
||||
+ ch_info->period = max_t(u8, ch_info->period,
|
||||
+ RTW89_DFS_CHAN_TIME);
|
||||
ch_info->dwell_time = RTW89_DWELL_TIME;
|
||||
break;
|
||||
case RTW89_CHAN_ACTIVE:
|
||||
@@ -2639,8 +2650,13 @@ static int rtw89_hw_scan_add_chan_list(struct rtw89_dev *rtwdev,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- ch_info->period = req->duration_mandatory ?
|
||||
- req->duration : RTW89_CHANNEL_TIME;
|
||||
+ if (req->duration_mandatory)
|
||||
+ ch_info->period = req->duration;
|
||||
+ else if (channel->band == NL80211_BAND_6GHZ)
|
||||
+ ch_info->period = RTW89_CHANNEL_TIME_6G + RTW89_DWELL_TIME;
|
||||
+ else
|
||||
+ ch_info->period = RTW89_CHANNEL_TIME;
|
||||
+
|
||||
ch_info->ch_band = rtw89_nl80211_to_hw_band(channel->band);
|
||||
ch_info->central_ch = channel->hw_value;
|
||||
ch_info->pri_ch = channel->hw_value;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 0047d5d0e9b19..6ef392ef9c6fb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -197,6 +197,7 @@ struct rtw89_h2creg_sch_tx_en {
|
||||
|
||||
#define RTW89_H2C_MAX_SIZE 2048
|
||||
#define RTW89_CHANNEL_TIME 45
|
||||
+#define RTW89_CHANNEL_TIME_6G 20
|
||||
#define RTW89_DFS_CHAN_TIME 105
|
||||
#define RTW89_OFF_CHAN_TIME 100
|
||||
#define RTW89_DWELL_TIME 20
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 33f37d7827e0d87a8680566bcc3fd6f217761944 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 023/142] wifi: rtw89: fix wrong bandwidth settings after scan
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 478132050360a5cf19cc1b3fc9fcf1e56a483481
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Oct 7 12:59:00 2022 +0800
|
||||
|
||||
wifi: rtw89: fix wrong bandwidth settings after scan
|
||||
|
||||
Set channel in driver side to configure Tx power and channel index
|
||||
correctly after scan. Before this, beacons with bandwidth larger than
|
||||
20M bandwidth will be dropped by mac80211 due to frequency mismatch.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221007045900.10823-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index dd2dc842681eb..d3500a70af4dd 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -2775,6 +2775,7 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
|
||||
if (rtwvif->net_type != RTW89_NET_TYPE_NO_LINK)
|
||||
rtw89_store_op_chan(rtwdev, false);
|
||||
+ rtw89_set_channel(rtwdev);
|
||||
}
|
||||
|
||||
void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,143 @@
|
||||
From fb633de5bb45947abf4265e9617d65b71203385c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 024/142] wifi: rtw89: 8852b: add chip_ops::set_channel_help
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d0a95ef3ed86762d2356fd5443bebe7a6ef140c7
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:53:55 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops::set_channel_help
|
||||
|
||||
This chip_ops is to assist set_channel, because we need setup and restore
|
||||
hardware before and after set_channel.
|
||||
|
||||
Before set_channel, we stop transmitting, reset PPDU status, disable TSSI,
|
||||
and disable ADC. After set_channel, do opposite things in reverse order.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 84 +++++++++++++++++++++++++++
|
||||
1 file changed, 84 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index b50fff00b1393..af04a0284b560 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -854,6 +854,30 @@ static void rtw8852b_bb_reset_all(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 1, phy_idx);
|
||||
}
|
||||
|
||||
+static void rtw8852b_bb_reset_en(struct rtw89_dev *rtwdev, enum rtw89_band band,
|
||||
+ enum rtw89_phy_idx phy_idx, bool en)
|
||||
+{
|
||||
+ if (en) {
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
|
||||
+ B_S0_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
|
||||
+ B_S1_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 1, phy_idx);
|
||||
+ if (band == RTW89_BAND_2G)
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x0);
|
||||
+ } else {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x1);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
|
||||
+ B_S0_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
|
||||
+ B_S1_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
|
||||
+ fsleep(1);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 0, phy_idx);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void rtw8852b_set_channel_bb(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -897,6 +921,65 @@ static void rtw8852b_set_channel(struct rtw89_dev *rtwdev,
|
||||
rtw8852b_set_channel_rf(rtwdev, chan, phy_idx);
|
||||
}
|
||||
|
||||
+static void rtw8852b_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
|
||||
+ enum rtw89_rf_path path)
|
||||
+{
|
||||
+ static const u32 tssi_trk[2] = {R_P0_TSSI_TRK, R_P1_TSSI_TRK};
|
||||
+ static const u32 ctrl_bbrst[2] = {R_P0_TXPW_RSTB, R_P1_TXPW_RSTB};
|
||||
+
|
||||
+ if (en) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, ctrl_bbrst[path], B_P0_TXPW_RSTB_MANON, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x0);
|
||||
+ } else {
|
||||
+ rtw89_phy_write32_mask(rtwdev, ctrl_bbrst[path], B_P0_TXPW_RSTB_MANON, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en,
|
||||
+ u8 phy_idx)
|
||||
+{
|
||||
+ if (!rtwdev->dbcc_en) {
|
||||
+ rtw8852b_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
+ rtw8852b_tssi_cont_en(rtwdev, en, RF_PATH_B);
|
||||
+ } else {
|
||||
+ if (phy_idx == RTW89_PHY_0)
|
||||
+ rtw8852b_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
+ else
|
||||
+ rtw8852b_tssi_cont_en(rtwdev, en, RF_PATH_B);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_adc_en(struct rtw89_dev *rtwdev, bool en)
|
||||
+{
|
||||
+ if (en)
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0x0);
|
||||
+ else
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0xf);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
+ struct rtw89_channel_help_params *p,
|
||||
+ const struct rtw89_chan *chan,
|
||||
+ enum rtw89_mac_idx mac_idx,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ if (enter) {
|
||||
+ rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
+ rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
|
||||
+ rtw8852b_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0);
|
||||
+ rtw8852b_adc_en(rtwdev, false);
|
||||
+ fsleep(40);
|
||||
+ rtw8852b_bb_reset_en(rtwdev, chan->band_type, phy_idx, false);
|
||||
+ } else {
|
||||
+ rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
|
||||
+ rtw8852b_adc_en(rtwdev, true);
|
||||
+ rtw8852b_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0);
|
||||
+ rtw8852b_bb_reset_en(rtwdev, chan->band_type, phy_idx, true);
|
||||
+ rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static u32 rtw8852b_bb_cal_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, s16 ref)
|
||||
{
|
||||
@@ -1143,6 +1226,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.enable_bb_rf = rtw8852b_mac_enable_bb_rf,
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
.set_channel = rtw8852b_set_channel,
|
||||
+ .set_channel_help = rtw8852b_set_channel_help,
|
||||
.read_efuse = rtw8852b_read_efuse,
|
||||
.read_phycap = rtw8852b_read_phycap,
|
||||
.power_trim = rtw8852b_power_trim,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,335 @@
|
||||
From f655006252045c5f4009c8e9e5c82317d1a51d17 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 025/142] wifi: rtw89: 8852b: add power on/off functions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b23b36efbdac603c491197dae1d27a3c5ac4b01c
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:53:56 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add power on/off functions
|
||||
|
||||
We need power on function to enable hardware circuits of MAC/BB/RF, and
|
||||
then download firmware and load PHY parameters. After more settings, it
|
||||
starts to work. When it enters idle, use power off function to have the
|
||||
lowest power consumption.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 18 +++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 192 ++++++++++++++++++++++++++
|
||||
3 files changed, 211 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index a9867ac351da7..a6cbafb75a2b8 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -1014,6 +1014,7 @@ enum rtw89_mac_xtal_si_offset {
|
||||
#define XTAL_SI_PON_EI BIT(1)
|
||||
#define XTAL_SI_PON_WEI BIT(0)
|
||||
XTAL_SI_SRAM_CTRL = 0xA1,
|
||||
+#define XTAL_SI_SRAM_DIS BIT(1)
|
||||
#define FULL_BIT_MASK GENMASK(7, 0)
|
||||
};
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 1539973296cd1..376ce7135b388 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -34,6 +34,9 @@
|
||||
#define R_AX_SYS_CLK_CTRL 0x0008
|
||||
#define B_AX_CPU_CLK_EN BIT(14)
|
||||
|
||||
+#define R_AX_SYS_SWR_CTRL1 0x0010
|
||||
+#define B_AX_SYM_CTRL_SPS_PWMFREQ BIT(10)
|
||||
+
|
||||
#define R_AX_SYS_ADIE_PAD_PWR_CTRL 0x0018
|
||||
#define B_AX_SYM_PADPDN_WL_PTA_1P3 BIT(6)
|
||||
#define B_AX_SYM_PADPDN_WL_RFC_1P3 BIT(5)
|
||||
@@ -42,6 +45,9 @@
|
||||
#define B_AX_R_DIS_PRST BIT(6)
|
||||
#define B_AX_WLOCK_1C_BIT6 BIT(5)
|
||||
|
||||
+#define R_AX_AFE_LDO_CTRL 0x0020
|
||||
+#define B_AX_AON_OFF_PC_EN BIT(23)
|
||||
+
|
||||
#define R_AX_EFUSE_CTRL_1 0x0038
|
||||
#define B_AX_EF_PGPD_MASK GENMASK(30, 28)
|
||||
#define B_AX_EF_RDT BIT(27)
|
||||
@@ -118,6 +124,9 @@
|
||||
#define B_AX_R_AX_BG_LPF BIT(2)
|
||||
#define B_AX_R_AX_BG GENMASK(1, 0)
|
||||
|
||||
+#define R_AX_HCI_LDO_CTRL 0x007A
|
||||
+#define B_AX_R_AX_VADJ_MASK GENMASK(3, 0)
|
||||
+
|
||||
#define R_AX_PLATFORM_ENABLE 0x0088
|
||||
#define B_AX_AXIDMA_EN BIT(3)
|
||||
#define B_AX_WCPU_EN BIT(1)
|
||||
@@ -125,6 +134,7 @@
|
||||
|
||||
#define R_AX_WLLPS_CTRL 0x0090
|
||||
#define B_AX_DIS_WLBT_LPSEN_LOPC BIT(1)
|
||||
+#define SW_LPS_OPTION 0x0001A0B2
|
||||
|
||||
#define R_AX_SCOREBOARD 0x00AC
|
||||
#define B_AX_TOGGLE BIT(31)
|
||||
@@ -229,6 +239,9 @@
|
||||
|
||||
#define R_AX_GPIO0_7_FUNC_SEL 0x02D0
|
||||
|
||||
+#define R_AX_EECS_EESK_FUNC_SEL 0x02D8
|
||||
+#define B_AX_PINMUX_EESK_FUNC_SEL_MASK GENMASK(7, 4)
|
||||
+
|
||||
#define R_AX_LED1_FUNC_SEL 0x02DC
|
||||
#define B_AX_PINMUX_EESK_FUNC_SEL_V1_MASK GENMASK(27, 24)
|
||||
#define PINMUX_EESK_FUNC_SEL_BT_LOG 0x1
|
||||
@@ -253,6 +266,10 @@
|
||||
#define B_AX_USB_HCISYS_PWR_STE_MASK GENMASK(3, 2)
|
||||
#define B_AX_PCIE_HCISYS_PWR_STE_MASK GENMASK(1, 0)
|
||||
|
||||
+#define R_AX_SPS_DIG_OFF_CTRL0 0x0400
|
||||
+#define B_AX_C3_L1_MASK GENMASK(5, 4)
|
||||
+#define B_AX_C1_L1_MASK GENMASK(1, 0)
|
||||
+
|
||||
#define R_AX_AFE_OFF_CTRL1 0x0444
|
||||
#define B_AX_S1_LDO_VSEL_F_MASK GENMASK(25, 24)
|
||||
#define B_AX_S1_LDO2PWRCUT_F BIT(23)
|
||||
@@ -449,6 +466,7 @@
|
||||
#define B_AX_DISPATCHER_EN BIT(18)
|
||||
#define B_AX_BBRPT_EN BIT(17)
|
||||
#define B_AX_MAC_SEC_EN BIT(16)
|
||||
+#define B_AX_DMACREG_GCKEN BIT(15)
|
||||
#define B_AX_MAC_UN_EN BIT(15)
|
||||
#define B_AX_H_AXIDMA_EN BIT(14)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index af04a0284b560..f54a4ea3c6b53 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -56,6 +56,194 @@ static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
NULL},
|
||||
};
|
||||
|
||||
+static int rtw8852b_pwr_on_func(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ u32 val32;
|
||||
+ u32 ret;
|
||||
+
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_AFSM_WLSUS_EN |
|
||||
+ B_AX_AFSM_PCIE_SUS_EN);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_DIS_WLBT_PDNSUSEN_SOPC);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_WLLPS_CTRL, B_AX_DIS_WLBT_LPSEN_LOPC);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APDM_HPDN);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
|
||||
+
|
||||
+ ret = read_poll_timeout(rtw89_read32, val32, val32 & B_AX_RDY_SYSPWR,
|
||||
+ 1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_AFE_LDO_CTRL, B_AX_AON_OFF_PC_EN);
|
||||
+ ret = read_poll_timeout(rtw89_read32, val32, val32 & B_AX_AON_OFF_PC_EN,
|
||||
+ 1000, 20000, false, rtwdev, R_AX_AFE_LDO_CTRL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_OFF_CTRL0, B_AX_C1_L1_MASK, 0x1);
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_OFF_CTRL0, B_AX_C3_L1_MASK, 0x3);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFN_ONMAC);
|
||||
+
|
||||
+ ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFN_ONMAC),
|
||||
+ 1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
+ rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
+ rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
+ rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
+
|
||||
+ rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_SDIO_CTRL, B_AX_PCIE_CALIB_EN_V1);
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
|
||||
+
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
|
||||
+ XTAL_SI_GND_SHDN_WL, XTAL_SI_GND_SHDN_WL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
|
||||
+
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
|
||||
+ XTAL_SI_SHDN_WL, XTAL_SI_SHDN_WL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_WEI,
|
||||
+ XTAL_SI_OFF_WEI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_EI,
|
||||
+ XTAL_SI_OFF_EI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_RFC2RF);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_WEI,
|
||||
+ XTAL_SI_PON_WEI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_EI,
|
||||
+ XTAL_SI_PON_EI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SRAM2RFC);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_SRAM_CTRL, 0, XTAL_SI_SRAM_DIS);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_2, 0, XTAL_SI_LDO_LPS);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_4, 0, XTAL_SI_LPS_CAP);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_ISO_EB2CORE);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B15);
|
||||
+
|
||||
+ fsleep(1000);
|
||||
+
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B14);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
|
||||
+
|
||||
+ if (!rtwdev->efuse.valid || rtwdev->efuse.power_k_valid)
|
||||
+ goto func_en;
|
||||
+
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VOL_L1_MASK, 0x9);
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VREFPFM_L_MASK, 0xA);
|
||||
+
|
||||
+ if (rtwdev->hal.cv == CHIP_CBV) {
|
||||
+ rtw89_write32_set(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
|
||||
+ rtw89_write16_mask(rtwdev, R_AX_HCI_LDO_CTRL, B_AX_R_AX_VADJ_MASK, 0xA);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
|
||||
+ }
|
||||
+
|
||||
+func_en:
|
||||
+ rtw89_write32_set(rtwdev, R_AX_DMAC_FUNC_EN,
|
||||
+ B_AX_MAC_FUNC_EN | B_AX_DMAC_FUNC_EN | B_AX_MPDU_PROC_EN |
|
||||
+ B_AX_WD_RLS_EN | B_AX_DLE_WDE_EN | B_AX_TXPKT_CTRL_EN |
|
||||
+ B_AX_STA_SCH_EN | B_AX_DLE_PLE_EN | B_AX_PKT_BUF_EN |
|
||||
+ B_AX_DMAC_TBL_EN | B_AX_PKT_IN_EN | B_AX_DLE_CPUIO_EN |
|
||||
+ B_AX_DISPATCHER_EN | B_AX_BBRPT_EN | B_AX_MAC_SEC_EN |
|
||||
+ B_AX_DMACREG_GCKEN);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_CMAC_FUNC_EN,
|
||||
+ B_AX_CMAC_EN | B_AX_CMAC_TXEN | B_AX_CMAC_RXEN |
|
||||
+ B_AX_FORCE_CMACREG_GCKEN | B_AX_PHYINTF_EN | B_AX_CMAC_DMA_EN |
|
||||
+ B_AX_PTCLTOP_EN | B_AX_SCHEDULER_EN | B_AX_TMAC_EN |
|
||||
+ B_AX_RMAC_EN);
|
||||
+
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_EECS_EESK_FUNC_SEL, B_AX_PINMUX_EESK_FUNC_SEL_MASK,
|
||||
+ PINMUX_EESK_FUNC_SEL_BT_LOG);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rtw8852b_pwr_off_func(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ u32 val32;
|
||||
+ u32 ret;
|
||||
+
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_RFC2RF,
|
||||
+ XTAL_SI_RFC2RF);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_EI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_WEI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S0, 0, XTAL_SI_RF00);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S1, 0, XTAL_SI_RF10);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_SRAM2RFC,
|
||||
+ XTAL_SI_SRAM2RFC);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_EI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_WEI);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
|
||||
+ rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BB_GLB_RSTN | B_AX_FEN_BBRSTB);
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
|
||||
+
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SHDN_WL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
|
||||
+
|
||||
+ ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_GND_SHDN_WL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_OFFMAC);
|
||||
+
|
||||
+ ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFM_OFFMAC),
|
||||
+ 1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rtw89_write32(rtwdev, R_AX_WLLPS_CTRL, SW_LPS_OPTION);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_SWR_CTRL1, B_AX_SYM_CTRL_SPS_PWMFREQ);
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_REG_ZCDC_H_MASK, 0x3);
|
||||
+ rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void rtw8852be_efuse_parsing(struct rtw89_efuse *efuse,
|
||||
struct rtw8852b_efuse *map)
|
||||
{
|
||||
@@ -1233,6 +1421,8 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
+ .pwr_on_func = rtw8852b_pwr_on_func,
|
||||
+ .pwr_off_func = rtw8852b_pwr_off_func,
|
||||
};
|
||||
|
||||
const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
@@ -1242,6 +1432,8 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.dle_scc_rsvd_size = 98304,
|
||||
.hfc_param_ini = rtw8852b_hfc_param_ini_pcie,
|
||||
.dle_mem = rtw8852b_dle_mem_pcie,
|
||||
+ .pwr_on_seq = NULL,
|
||||
+ .pwr_off_seq = NULL,
|
||||
.sec_ctrl_efuse_size = 4,
|
||||
.physical_efuse_size = 1216,
|
||||
.logical_efuse_size = 2048,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,93 @@
|
||||
From e309aa380bd4b29305c760137b89bab98f920be5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 026/142] wifi: rtw89: 8852b: add basic baseband chip_ops
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit a804479839e1cf502a76c407f3e07135ddbe5032
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:53:57 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add basic baseband chip_ops
|
||||
|
||||
chip_ops::bb_reset is to reset baseband state after loading parameters,
|
||||
because its state could be unpredictable at that moment. The other is
|
||||
chip_ops::bb_sethw that is to set some baseband settings not including in
|
||||
parameter tables.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 42 +++++++++++++++++++++++++++
|
||||
1 file changed, 42 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index f54a4ea3c6b53..f13c657f4d68d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1066,6 +1066,46 @@ static void rtw8852b_bb_reset_en(struct rtw89_dev *rtwdev, enum rtw89_band band,
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtw8852b_bb_reset(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P0_TXPW_RSTB, B_P0_TXPW_RSTB_MANON);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P1_TXPW_RSTB, B_P1_TXPW_RSTB_MANON);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
|
||||
+ rtw8852b_bb_reset_all(rtwdev, phy_idx);
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P0_TXPW_RSTB, B_P0_TXPW_RSTB_MANON);
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P1_TXPW_RSTB, B_P1_TXPW_RSTB_MANON);
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_bb_macid_ctrl_init(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ u32 addr;
|
||||
+
|
||||
+ for (addr = R_AX_PWR_MACID_LMT_TABLE0;
|
||||
+ addr <= R_AX_PWR_MACID_LMT_TABLE127; addr += 4)
|
||||
+ rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, 0);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_bb_sethw(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain;
|
||||
+
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P0_EN_SOUND_WO_NDP, B_P0_EN_SOUND_WO_NDP);
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_P1_EN_SOUND_WO_NDP, B_P1_EN_SOUND_WO_NDP);
|
||||
+
|
||||
+ rtw8852b_bb_macid_ctrl_init(rtwdev, RTW89_PHY_0);
|
||||
+
|
||||
+ /* read these registers after loading BB parameters */
|
||||
+ gain->offset_base[RTW89_PHY_0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_P0_RPL1, B_P0_RPL1_BIAS_MASK);
|
||||
+ gain->rssi_base[RTW89_PHY_0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_P1_RPL1, B_P0_RPL1_BIAS_MASK);
|
||||
+}
|
||||
+
|
||||
static void rtw8852b_set_channel_bb(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -1413,6 +1453,8 @@ static int rtw8852b_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.enable_bb_rf = rtw8852b_mac_enable_bb_rf,
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
+ .bb_reset = rtw8852b_bb_reset,
|
||||
+ .bb_sethw = rtw8852b_bb_sethw,
|
||||
.set_channel = rtw8852b_set_channel,
|
||||
.set_channel_help = rtw8852b_set_channel_help,
|
||||
.read_efuse = rtw8852b_read_efuse,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,67 @@
|
||||
From 5348102de57043c51fdad0841b87a652e2bbaa22 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:24 +0200
|
||||
Subject: [PATCH 027/142] wifi: rtw89: 8852b: add chip_ops to get thermal
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 8f88474ce3eca2dd8fb4e08d4b6ab71e76312e3e
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:53:58 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops to get thermal
|
||||
|
||||
Thermal value reflects temperature that will affect RF performance, so
|
||||
we re-calibrate RF characteristics if delta of thermal over a threshold.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index f13c657f4d68d..09374b92f6617 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1397,6 +1397,23 @@ rtw8852b_init_txpwr_unit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static u8 rtw8852b_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path)
|
||||
+{
|
||||
+ if (rtwdev->is_tssi_mode[rf_path]) {
|
||||
+ u32 addr = 0x1c10 + (rf_path << 13);
|
||||
+
|
||||
+ return rtw89_phy_read32_mask(rtwdev, addr, 0x3F000000);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x1);
|
||||
+
|
||||
+ fsleep(200);
|
||||
+
|
||||
+ return rtw89_read_rf(rtwdev, rf_path, RR_TM, RR_TM_VAL);
|
||||
+}
|
||||
+
|
||||
static int rtw8852b_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -1463,6 +1480,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
+ .get_thermal = rtw8852b_get_thermal,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
};
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,385 @@
|
||||
From 7b97ddc16bd5499e045d2398917c82763568e501 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 028/142] wifi: rtw89: 8852b: add chip_ops related to BT
|
||||
coexistence
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 98bf0ddf20fc2d70d11f1af6e041ee4fad1392ac
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:53:59 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops related to BT coexistence
|
||||
|
||||
These chip_ops are used to assist BT coexistence module to control chip
|
||||
specific operations, such as initial, pre-AGC, BT grant, set wifi priority
|
||||
and tx power, RX gain, and get BT counter.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 305 ++++++++++++++++++++++++++
|
||||
2 files changed, 306 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 376ce7135b388..570fb1aee80c3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -3151,6 +3151,7 @@
|
||||
#define BTC_BREAK_PARAM 0xf0ffffff
|
||||
|
||||
#define R_BTC_BT_COEX_MSK_TABLE 0xDA30
|
||||
+#define B_BTC_PRI_MASK_RXCCK_V1 BIT(28)
|
||||
#define B_BTC_PRI_MASK_TX_RESP_V1 BIT(3)
|
||||
|
||||
#define R_AX_BT_COEX_CFG_2 0xDA34
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 09374b92f6617..ee5a29f35db25 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -56,6 +56,44 @@ static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
NULL},
|
||||
};
|
||||
|
||||
+static const struct rtw89_reg3_def rtw8852b_btc_preagc_en_defs[] = {
|
||||
+ {0x46D0, GENMASK(1, 0), 0x3},
|
||||
+ {0x4790, GENMASK(1, 0), 0x3},
|
||||
+ {0x4AD4, GENMASK(31, 0), 0xf},
|
||||
+ {0x4AE0, GENMASK(31, 0), 0xf},
|
||||
+ {0x4688, GENMASK(31, 24), 0x80},
|
||||
+ {0x476C, GENMASK(31, 24), 0x80},
|
||||
+ {0x4694, GENMASK(7, 0), 0x80},
|
||||
+ {0x4694, GENMASK(15, 8), 0x80},
|
||||
+ {0x4778, GENMASK(7, 0), 0x80},
|
||||
+ {0x4778, GENMASK(15, 8), 0x80},
|
||||
+ {0x4AE4, GENMASK(23, 0), 0x780D1E},
|
||||
+ {0x4AEC, GENMASK(23, 0), 0x780D1E},
|
||||
+ {0x469C, GENMASK(31, 26), 0x34},
|
||||
+ {0x49F0, GENMASK(31, 26), 0x34},
|
||||
+};
|
||||
+
|
||||
+static DECLARE_PHY_REG3_TBL(rtw8852b_btc_preagc_en_defs);
|
||||
+
|
||||
+static const struct rtw89_reg3_def rtw8852b_btc_preagc_dis_defs[] = {
|
||||
+ {0x46D0, GENMASK(1, 0), 0x0},
|
||||
+ {0x4790, GENMASK(1, 0), 0x0},
|
||||
+ {0x4AD4, GENMASK(31, 0), 0x60},
|
||||
+ {0x4AE0, GENMASK(31, 0), 0x60},
|
||||
+ {0x4688, GENMASK(31, 24), 0x1a},
|
||||
+ {0x476C, GENMASK(31, 24), 0x1a},
|
||||
+ {0x4694, GENMASK(7, 0), 0x2a},
|
||||
+ {0x4694, GENMASK(15, 8), 0x2a},
|
||||
+ {0x4778, GENMASK(7, 0), 0x2a},
|
||||
+ {0x4778, GENMASK(15, 8), 0x2a},
|
||||
+ {0x4AE4, GENMASK(23, 0), 0x79E99E},
|
||||
+ {0x4AEC, GENMASK(23, 0), 0x79E99E},
|
||||
+ {0x469C, GENMASK(31, 26), 0x26},
|
||||
+ {0x49F0, GENMASK(31, 26), 0x26},
|
||||
+};
|
||||
+
|
||||
+static DECLARE_PHY_REG3_TBL(rtw8852b_btc_preagc_dis_defs);
|
||||
+
|
||||
static int rtw8852b_pwr_on_func(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
u32 val32;
|
||||
@@ -1397,6 +1435,55 @@ rtw8852b_init_txpwr_unit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void rtw8852b_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en)
|
||||
+{
|
||||
+ rtw89_phy_write_reg3_tbl(rtwdev, bt_en ? &rtw8852b_btc_preagc_en_defs_tbl :
|
||||
+ &rtw8852b_btc_preagc_dis_defs_tbl);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_ctrl_btg(struct rtw89_dev *rtwdev, bool btg)
|
||||
+{
|
||||
+ if (btg) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_BT_SHARE_V1,
|
||||
+ B_PATH0_BT_SHARE_V1, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG_PATH_V1,
|
||||
+ B_PATH0_BTG_PATH_V1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_G_LNA6_OP1DB_V1,
|
||||
+ B_PATH1_G_LNA6_OP1DB_V1, 0x20);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_G_TIA0_LNA6_OP1DB_V1,
|
||||
+ B_PATH1_G_TIA0_LNA6_OP1DB_V1, 0x30);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_BT_SHARE_V1,
|
||||
+ B_PATH1_BT_SHARE_V1, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_BTG_PATH_V1,
|
||||
+ B_PATH1_BTG_PATH_V1, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PMAC_GNT, B_PMAC_GNT_P1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_CHBW_MOD_V1, B_BT_SHARE, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_BT_SEG0, 0x2);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_BT_DYN_DC_EST_EN_V1,
|
||||
+ B_BT_DYN_DC_EST_EN_MSK, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_GNT_BT_WGT_EN, B_GNT_BT_WGT_EN, 0x1);
|
||||
+ } else {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_BT_SHARE_V1,
|
||||
+ B_PATH0_BT_SHARE_V1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_BTG_PATH_V1,
|
||||
+ B_PATH0_BTG_PATH_V1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_G_LNA6_OP1DB_V1,
|
||||
+ B_PATH1_G_LNA6_OP1DB_V1, 0x1a);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_G_TIA0_LNA6_OP1DB_V1,
|
||||
+ B_PATH1_G_TIA0_LNA6_OP1DB_V1, 0x2a);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_BT_SHARE_V1,
|
||||
+ B_PATH1_BT_SHARE_V1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_BTG_PATH_V1,
|
||||
+ B_PATH1_BTG_PATH_V1, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PMAC_GNT, B_PMAC_GNT_P1, 0xc);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_CHBW_MOD_V1, B_BT_SHARE, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_BT_SEG0, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_BT_DYN_DC_EST_EN_V1,
|
||||
+ B_BT_DYN_DC_EST_EN_MSK, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_GNT_BT_WGT_EN, B_GNT_BT_WGT_EN, 0x0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static u8 rtw8852b_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path)
|
||||
{
|
||||
if (rtwdev->is_tssi_mode[rf_path]) {
|
||||
@@ -1414,6 +1501,212 @@ static u8 rtw8852b_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_p
|
||||
return rtw89_read_rf(rtwdev, rf_path, RR_TM, RR_TM_VAL);
|
||||
}
|
||||
|
||||
+static void rtw8852b_btc_set_rfe(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ struct rtw89_btc_module *module = &btc->mdinfo;
|
||||
+
|
||||
+ module->rfe_type = rtwdev->efuse.rfe_type;
|
||||
+ module->cv = rtwdev->hal.cv;
|
||||
+ module->bt_solo = 0;
|
||||
+ module->switch_type = BTC_SWITCH_INTERNAL;
|
||||
+
|
||||
+ if (module->rfe_type > 0)
|
||||
+ module->ant.num = module->rfe_type % 2 ? 2 : 3;
|
||||
+ else
|
||||
+ module->ant.num = 2;
|
||||
+
|
||||
+ module->ant.diversity = 0;
|
||||
+ module->ant.isolation = 10;
|
||||
+
|
||||
+ if (module->ant.num == 3) {
|
||||
+ module->ant.type = BTC_ANT_DEDICATED;
|
||||
+ module->bt_pos = BTC_BT_ALONE;
|
||||
+ } else {
|
||||
+ module->ant.type = BTC_ANT_SHARED;
|
||||
+ module->bt_pos = BTC_BT_BTG;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+void rtw8852b_set_trx_mask(struct rtw89_dev *rtwdev, u8 path, u8 group, u32 val)
|
||||
+{
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWE, RFREG_MASK, 0x20000);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWA, RFREG_MASK, group);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWD0, RFREG_MASK, val);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWE, RFREG_MASK, 0x0);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_btc_init_cfg(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ struct rtw89_btc_module *module = &btc->mdinfo;
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ const struct rtw89_mac_ax_coex coex_params = {
|
||||
+ .pta_mode = RTW89_MAC_AX_COEX_RTK_MODE,
|
||||
+ .direction = RTW89_MAC_AX_COEX_INNER,
|
||||
+ };
|
||||
+
|
||||
+ /* PTA init */
|
||||
+ rtw89_mac_coex_init(rtwdev, &coex_params);
|
||||
+
|
||||
+ /* set WL Tx response = Hi-Pri */
|
||||
+ chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_TX_RESP, true);
|
||||
+ chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_BEACON, true);
|
||||
+
|
||||
+ /* set rf gnt debug off */
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_WLSEL, RFREG_MASK, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_WLSEL, RFREG_MASK, 0x0);
|
||||
+
|
||||
+ /* set WL Tx thru in TRX mask table if GNT_WL = 0 && BT_S1 = ss group */
|
||||
+ if (module->ant.type == BTC_ANT_SHARED) {
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_A, BTC_BT_SS_GROUP, 0x5ff);
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_B, BTC_BT_SS_GROUP, 0x5ff);
|
||||
+ /* set path-A(S0) Tx/Rx no-mask if GNT_WL=0 && BT_S1=tx group */
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_A, BTC_BT_TX_GROUP, 0x5ff);
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_B, BTC_BT_TX_GROUP, 0x55f);
|
||||
+ } else { /* set WL Tx stb if GNT_WL = 0 && BT_S1 = ss group for 3-ant */
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_A, BTC_BT_SS_GROUP, 0x5df);
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_B, BTC_BT_SS_GROUP, 0x5df);
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_A, BTC_BT_TX_GROUP, 0x5ff);
|
||||
+ rtw8852b_set_trx_mask(rtwdev, RF_PATH_B, BTC_BT_TX_GROUP, 0x5ff);
|
||||
+ }
|
||||
+
|
||||
+ /* set PTA break table */
|
||||
+ rtw89_write32(rtwdev, R_BTC_BREAK_TABLE, BTC_BREAK_PARAM);
|
||||
+
|
||||
+ /* enable BT counter 0xda40[16,2] = 2b'11 */
|
||||
+ rtw89_write32_set(rtwdev, R_AX_CSR_MODE, B_AX_BT_CNT_RST | B_AX_STATIS_BT_EN);
|
||||
+ btc->cx.wl.status.map.init_ok = true;
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+void rtw8852b_btc_set_wl_pri(struct rtw89_dev *rtwdev, u8 map, bool state)
|
||||
+{
|
||||
+ u32 bitmap;
|
||||
+ u32 reg;
|
||||
+
|
||||
+ switch (map) {
|
||||
+ case BTC_PRI_MASK_TX_RESP:
|
||||
+ reg = R_BTC_BT_COEX_MSK_TABLE;
|
||||
+ bitmap = B_BTC_PRI_MASK_TX_RESP_V1;
|
||||
+ break;
|
||||
+ case BTC_PRI_MASK_BEACON:
|
||||
+ reg = R_AX_WL_PRI_MSK;
|
||||
+ bitmap = B_AX_PTA_WL_PRI_MASK_BCNQ;
|
||||
+ break;
|
||||
+ case BTC_PRI_MASK_RX_CCK:
|
||||
+ reg = R_BTC_BT_COEX_MSK_TABLE;
|
||||
+ bitmap = B_BTC_PRI_MASK_RXCCK_V1;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (state)
|
||||
+ rtw89_write32_set(rtwdev, reg, bitmap);
|
||||
+ else
|
||||
+ rtw89_write32_clr(rtwdev, reg, bitmap);
|
||||
+}
|
||||
+
|
||||
+union rtw8852b_btc_wl_txpwr_ctrl {
|
||||
+ u32 txpwr_val;
|
||||
+ struct {
|
||||
+ union {
|
||||
+ u16 ctrl_all_time;
|
||||
+ struct {
|
||||
+ s16 data:9;
|
||||
+ u16 rsvd:6;
|
||||
+ u16 flag:1;
|
||||
+ } all_time;
|
||||
+ };
|
||||
+ union {
|
||||
+ u16 ctrl_gnt_bt;
|
||||
+ struct {
|
||||
+ s16 data:9;
|
||||
+ u16 rsvd:7;
|
||||
+ } gnt_bt;
|
||||
+ };
|
||||
+ };
|
||||
+} __packed;
|
||||
+
|
||||
+static void
|
||||
+rtw8852b_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val)
|
||||
+{
|
||||
+ union rtw8852b_btc_wl_txpwr_ctrl arg = { .txpwr_val = txpwr_val };
|
||||
+ s32 val;
|
||||
+
|
||||
+#define __write_ctrl(_reg, _msk, _val, _en, _cond) \
|
||||
+do { \
|
||||
+ u32 _wrt = FIELD_PREP(_msk, _val); \
|
||||
+ BUILD_BUG_ON(!!(_msk & _en)); \
|
||||
+ if (_cond) \
|
||||
+ _wrt |= _en; \
|
||||
+ else \
|
||||
+ _wrt &= ~_en; \
|
||||
+ rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, _reg, \
|
||||
+ _msk | _en, _wrt); \
|
||||
+} while (0)
|
||||
+
|
||||
+ switch (arg.ctrl_all_time) {
|
||||
+ case 0xffff:
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ val = arg.all_time.data;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ __write_ctrl(R_AX_PWR_RATE_CTRL, B_AX_FORCE_PWR_BY_RATE_VALUE_MASK,
|
||||
+ val, B_AX_FORCE_PWR_BY_RATE_EN,
|
||||
+ arg.ctrl_all_time != 0xffff);
|
||||
+
|
||||
+ switch (arg.ctrl_gnt_bt) {
|
||||
+ case 0xffff:
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ val = arg.gnt_bt.data;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ __write_ctrl(R_AX_PWR_COEXT_CTRL, B_AX_TXAGC_BT_MASK, val,
|
||||
+ B_AX_TXAGC_BT_EN, arg.ctrl_gnt_bt != 0xffff);
|
||||
+
|
||||
+#undef __write_ctrl
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+s8 rtw8852b_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val)
|
||||
+{
|
||||
+ return clamp_t(s8, val, -100, 0) + 100;
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+void rtw8852b_btc_update_bt_cnt(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ /* Feature move to firmware */
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_btc_wl_s1_standby(struct rtw89_dev *rtwdev, bool state)
|
||||
+{
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x80000);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWA, RFREG_MASK, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWD1, RFREG_MASK, 0x31);
|
||||
+
|
||||
+ /* set WL standby = Rx for GNT_BT_Tx = 1->0 settle issue */
|
||||
+ if (state)
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWD0, RFREG_MASK, 0x579);
|
||||
+ else
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWD0, RFREG_MASK, 0x20);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x0);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_btc_set_wl_rx_gain(struct rtw89_dev *rtwdev, u32 level)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
static int rtw8852b_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -1481,8 +1774,20 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
.get_thermal = rtw8852b_get_thermal,
|
||||
+ .ctrl_btg = rtw8852b_ctrl_btg,
|
||||
+ .bb_ctrl_btc_preagc = rtw8852b_bb_ctrl_btc_preagc,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
+
|
||||
+ .btc_set_rfe = rtw8852b_btc_set_rfe,
|
||||
+ .btc_init_cfg = rtw8852b_btc_init_cfg,
|
||||
+ .btc_set_wl_pri = rtw8852b_btc_set_wl_pri,
|
||||
+ .btc_set_wl_txpwr_ctrl = rtw8852b_btc_set_wl_txpwr_ctrl,
|
||||
+ .btc_get_bt_rssi = rtw8852b_btc_get_bt_rssi,
|
||||
+ .btc_update_bt_cnt = rtw8852b_btc_update_bt_cnt,
|
||||
+ .btc_wl_s1_standby = rtw8852b_btc_wl_s1_standby,
|
||||
+ .btc_set_wl_rx_gain = rtw8852b_btc_set_wl_rx_gain,
|
||||
+ .btc_set_policy = rtw89_btc_set_policy,
|
||||
};
|
||||
|
||||
const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,80 @@
|
||||
From e39ff157ac902c8fe9909db4a7b83c43adb04de3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 029/142] wifi: rtw89: 8852b: add chip_ops to query PPDU
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit bf958f76cf97663d79b4f90a08d38c5b9bb56082
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:54:00 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops to query PPDU
|
||||
|
||||
Add to parse PPDU to get frequency and RSSI of received packets.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-7-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 32 +++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index ee5a29f35db25..abb35553a2b04 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1707,6 +1707,37 @@ static void rtw8852b_btc_set_wl_rx_gain(struct rtw89_dev *rtwdev, u32 level)
|
||||
{
|
||||
}
|
||||
|
||||
+static void rtw8852b_fill_freq_with_ppdu(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
+ struct ieee80211_rx_status *status)
|
||||
+{
|
||||
+ u16 chan = phy_ppdu->chan_idx;
|
||||
+ u8 band;
|
||||
+
|
||||
+ if (chan == 0)
|
||||
+ return;
|
||||
+
|
||||
+ band = chan <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
|
||||
+ status->freq = ieee80211_channel_to_frequency(chan, band);
|
||||
+ status->band = band;
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
+ struct ieee80211_rx_status *status)
|
||||
+{
|
||||
+ u8 path;
|
||||
+ u8 *rx_power = phy_ppdu->rssi;
|
||||
+
|
||||
+ status->signal = RTW89_RSSI_RAW_TO_DBM(max(rx_power[RF_PATH_A], rx_power[RF_PATH_B]));
|
||||
+ for (path = 0; path < rtwdev->chip->rf_path_num; path++) {
|
||||
+ status->chains |= BIT(path);
|
||||
+ status->chain_signal[path] = RTW89_RSSI_RAW_TO_DBM(rx_power[path]);
|
||||
+ }
|
||||
+ if (phy_ppdu->valid)
|
||||
+ rtw8852b_fill_freq_with_ppdu(rtwdev, phy_ppdu, status);
|
||||
+}
|
||||
+
|
||||
static int rtw8852b_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -1775,6 +1806,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.init_txpwr_unit = rtw8852b_init_txpwr_unit,
|
||||
.get_thermal = rtw8852b_get_thermal,
|
||||
.ctrl_btg = rtw8852b_ctrl_btg,
|
||||
+ .query_ppdu = rtw8852b_query_ppdu,
|
||||
.bb_ctrl_btc_preagc = rtw8852b_bb_ctrl_btc_preagc,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,198 @@
|
||||
From bca1ff917141a02a263f4e180b65d7690a526350 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 030/142] wifi: rtw89: 8852b: add chip_ops to configure TX/RX
|
||||
path
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 8915a256538d0e81fe02c5f68368e5787df261d5
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:54:01 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops to configure TX/RX path
|
||||
|
||||
To support variant models, such as 1x1 or 1T2R, we need this chip_ops to
|
||||
change the path accordingly.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-8-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 4 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 112 ++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.h | 3 +
|
||||
3 files changed, 119 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 570fb1aee80c3..5482e32a72d55 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -3666,6 +3666,8 @@
|
||||
#define B_P0_RFMODE_MUX GENMASK(11, 4)
|
||||
#define R_P0_RFMODE_ORI_RX 0x12AC
|
||||
#define B_P0_RFMODE_ORI_RX_ALL GENMASK(23, 12)
|
||||
+#define R_P0_RFMODE_FTM_RX 0x12B0
|
||||
+#define B_P0_RFMODE_FTM_RX GENMASK(11, 0)
|
||||
#define R_P0_NRBW 0x12B8
|
||||
#define B_P0_NRBW_DBG BIT(30)
|
||||
#define R_S0_RXDC 0x12D4
|
||||
@@ -3779,6 +3781,8 @@
|
||||
#define B_P1_RFMODE_MUX GENMASK(11, 4)
|
||||
#define R_P1_RFMODE_ORI_RX 0x32AC
|
||||
#define B_P1_RFMODE_ORI_RX_ALL GENMASK(23, 12)
|
||||
+#define R_P1_RFMODE_FTM_RX 0x32B0
|
||||
+#define B_P1_RFMODE_FTM_RX GENMASK(11, 0)
|
||||
#define R_P1_DBGMOD 0x32B8
|
||||
#define B_P1_DBGMOD_ON BIT(30)
|
||||
#define R_S1_RXDC 0x32D4
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index abb35553a2b04..a5156d7aca5b8 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1484,6 +1484,117 @@ static void rtw8852b_ctrl_btg(struct rtw89_dev *rtwdev, bool btg)
|
||||
}
|
||||
}
|
||||
|
||||
+void rtw8852b_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_rf_path_bit rx_path)
|
||||
+{
|
||||
+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
+ u32 rst_mask0;
|
||||
+ u32 rst_mask1;
|
||||
+
|
||||
+ if (rx_path == RF_A) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_CHBW_MOD_V1, B_ANT_RX_SEG0, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG0, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG1, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_USER_MAX, 4);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 0);
|
||||
+ } else if (rx_path == RF_B) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_CHBW_MOD_V1, B_ANT_RX_SEG0, 2);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG0, 2);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG1, 2);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_USER_MAX, 4);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 0);
|
||||
+ } else if (rx_path == RF_AB) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_CHBW_MOD_V1, B_ANT_RX_SEG0, 3);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG0, 3);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_FC0_BW_V1, B_ANT_RX_1RCCA_SEG1, 3);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_USER_MAX, 4);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 1);
|
||||
+ }
|
||||
+
|
||||
+ rtw8852b_set_gain_offset(rtwdev, chan->subband_type, RTW89_PHY_0);
|
||||
+
|
||||
+ if (chan->band_type == RTW89_BAND_2G &&
|
||||
+ (rx_path == RF_B || rx_path == RF_AB))
|
||||
+ rtw8852b_ctrl_btg(rtwdev, true);
|
||||
+ else
|
||||
+ rtw8852b_ctrl_btg(rtwdev, false);
|
||||
+
|
||||
+ rst_mask0 = B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI;
|
||||
+ rst_mask1 = B_P1_TXPW_RSTB_MANON | B_P1_TXPW_RSTB_TSSI;
|
||||
+ if (rx_path == RF_A) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB, rst_mask0, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB, rst_mask0, 3);
|
||||
+ } else {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB, rst_mask1, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB, rst_mask1, 3);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_bb_ctrl_rf_mode_rx_path(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_rf_path_bit rx_path)
|
||||
+{
|
||||
+ if (rx_path == RF_A) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE,
|
||||
+ B_P0_RFMODE_ORI_TXRX_FTM_TX, 0x1233312);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE_FTM_RX,
|
||||
+ B_P0_RFMODE_FTM_RX, 0x333);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE,
|
||||
+ B_P1_RFMODE_ORI_TXRX_FTM_TX, 0x1111111);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE_FTM_RX,
|
||||
+ B_P1_RFMODE_FTM_RX, 0x111);
|
||||
+ } else if (rx_path == RF_B) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE,
|
||||
+ B_P0_RFMODE_ORI_TXRX_FTM_TX, 0x1111111);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE_FTM_RX,
|
||||
+ B_P0_RFMODE_FTM_RX, 0x111);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE,
|
||||
+ B_P1_RFMODE_ORI_TXRX_FTM_TX, 0x1233312);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE_FTM_RX,
|
||||
+ B_P1_RFMODE_FTM_RX, 0x333);
|
||||
+ } else if (rx_path == RF_AB) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE,
|
||||
+ B_P0_RFMODE_ORI_TXRX_FTM_TX, 0x1233312);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_RFMODE_FTM_RX,
|
||||
+ B_P0_RFMODE_FTM_RX, 0x333);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE,
|
||||
+ B_P1_RFMODE_ORI_TXRX_FTM_TX, 0x1233312);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_RFMODE_FTM_RX,
|
||||
+ B_P1_RFMODE_FTM_RX, 0x333);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_hal *hal = &rtwdev->hal;
|
||||
+ enum rtw89_rf_path_bit rx_path = hal->antenna_rx ? hal->antenna_rx : RF_AB;
|
||||
+
|
||||
+ rtw8852b_bb_ctrl_rx_path(rtwdev, rx_path);
|
||||
+ rtw8852b_bb_ctrl_rf_mode_rx_path(rtwdev, rx_path);
|
||||
+
|
||||
+ if (rtwdev->hal.rx_nss == 1) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 0);
|
||||
+ } else {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 1);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_MOD, 0x0, RTW89_PHY_0);
|
||||
+}
|
||||
+
|
||||
static u8 rtw8852b_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path)
|
||||
{
|
||||
if (rtwdev->is_tssi_mode[rf_path]) {
|
||||
@@ -1808,6 +1919,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.ctrl_btg = rtw8852b_ctrl_btg,
|
||||
.query_ppdu = rtw8852b_query_ppdu,
|
||||
.bb_ctrl_btc_preagc = rtw8852b_bb_ctrl_btc_preagc,
|
||||
+ .cfg_txrx_path = rtw8852b_bb_cfg_txrx_path,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.h b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
index bc0a383c4a390..33f621014e497 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
@@ -87,4 +87,7 @@ struct rtw8852b_efuse {
|
||||
|
||||
extern const struct rtw89_chip_info rtw8852b_chip_info;
|
||||
|
||||
+void rtw8852b_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_rf_path_bit rx_path);
|
||||
+
|
||||
#endif
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,408 @@
|
||||
From a5974f763e36a066e086fb1ad963080d94ad6ecd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 031/142] wifi: rtw89: 8852b: add functions to control BB to
|
||||
assist RF calibrations
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 572fd2ab377b123e52b442d015f9605409a21ad9
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:54:02 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add functions to control BB to assist RF calibrations
|
||||
|
||||
When we are going to do RF calibrations, they need BB helpers to control
|
||||
TX PLCP, power, path and mode. Also, it they need helpers to backup and
|
||||
restore some registers before and after RF calibrations. Then, use flow of
|
||||
RF calibrations will be like backup registers, configure calibration,
|
||||
configure TX parameters, measure calibration result, and finally restore
|
||||
registers.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-9-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 288 ++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.h | 44 ++++
|
||||
2 files changed, 332 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index a5156d7aca5b8..290d83cb83d5a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -56,6 +56,129 @@ static const struct rtw89_dle_mem rtw8852b_dle_mem_pcie[] = {
|
||||
NULL},
|
||||
};
|
||||
|
||||
+static const struct rtw89_reg3_def rtw8852b_pmac_ht20_mcs7_tbl[] = {
|
||||
+ {0x4580, 0x0000ffff, 0x0},
|
||||
+ {0x4580, 0xffff0000, 0x0},
|
||||
+ {0x4584, 0x0000ffff, 0x0},
|
||||
+ {0x4584, 0xffff0000, 0x0},
|
||||
+ {0x4580, 0x0000ffff, 0x1},
|
||||
+ {0x4578, 0x00ffffff, 0x2018b},
|
||||
+ {0x4570, 0x03ffffff, 0x7},
|
||||
+ {0x4574, 0x03ffffff, 0x32407},
|
||||
+ {0x45b8, 0x00000010, 0x0},
|
||||
+ {0x45b8, 0x00000100, 0x0},
|
||||
+ {0x45b8, 0x00000080, 0x0},
|
||||
+ {0x45b8, 0x00000008, 0x0},
|
||||
+ {0x45a0, 0x0000ff00, 0x0},
|
||||
+ {0x45a0, 0xff000000, 0x1},
|
||||
+ {0x45a4, 0x0000ff00, 0x2},
|
||||
+ {0x45a4, 0xff000000, 0x3},
|
||||
+ {0x45b8, 0x00000020, 0x0},
|
||||
+ {0x4568, 0xe0000000, 0x0},
|
||||
+ {0x45b8, 0x00000002, 0x1},
|
||||
+ {0x456c, 0xe0000000, 0x0},
|
||||
+ {0x45b4, 0x00006000, 0x0},
|
||||
+ {0x45b4, 0x00001800, 0x1},
|
||||
+ {0x45b8, 0x00000040, 0x0},
|
||||
+ {0x45b8, 0x00000004, 0x0},
|
||||
+ {0x45b8, 0x00000200, 0x0},
|
||||
+ {0x4598, 0xf8000000, 0x0},
|
||||
+ {0x45b8, 0x00100000, 0x0},
|
||||
+ {0x45a8, 0x00000fc0, 0x0},
|
||||
+ {0x45b8, 0x00200000, 0x0},
|
||||
+ {0x45b0, 0x00000038, 0x0},
|
||||
+ {0x45b0, 0x000001c0, 0x0},
|
||||
+ {0x45a0, 0x000000ff, 0x0},
|
||||
+ {0x45b8, 0x00400000, 0x0},
|
||||
+ {0x4590, 0x000007ff, 0x0},
|
||||
+ {0x45b0, 0x00000e00, 0x0},
|
||||
+ {0x45ac, 0x0000001f, 0x0},
|
||||
+ {0x45b8, 0x00800000, 0x0},
|
||||
+ {0x45a8, 0x0003f000, 0x0},
|
||||
+ {0x45b8, 0x01000000, 0x0},
|
||||
+ {0x45b0, 0x00007000, 0x0},
|
||||
+ {0x45b0, 0x00038000, 0x0},
|
||||
+ {0x45a0, 0x00ff0000, 0x0},
|
||||
+ {0x45b8, 0x02000000, 0x0},
|
||||
+ {0x4590, 0x003ff800, 0x0},
|
||||
+ {0x45b0, 0x001c0000, 0x0},
|
||||
+ {0x45ac, 0x000003e0, 0x0},
|
||||
+ {0x45b8, 0x04000000, 0x0},
|
||||
+ {0x45a8, 0x00fc0000, 0x0},
|
||||
+ {0x45b8, 0x08000000, 0x0},
|
||||
+ {0x45b0, 0x00e00000, 0x0},
|
||||
+ {0x45b0, 0x07000000, 0x0},
|
||||
+ {0x45a4, 0x000000ff, 0x0},
|
||||
+ {0x45b8, 0x10000000, 0x0},
|
||||
+ {0x4594, 0x000007ff, 0x0},
|
||||
+ {0x45b0, 0x38000000, 0x0},
|
||||
+ {0x45ac, 0x00007c00, 0x0},
|
||||
+ {0x45b8, 0x20000000, 0x0},
|
||||
+ {0x45a8, 0x3f000000, 0x0},
|
||||
+ {0x45b8, 0x40000000, 0x0},
|
||||
+ {0x45b4, 0x00000007, 0x0},
|
||||
+ {0x45b4, 0x00000038, 0x0},
|
||||
+ {0x45a4, 0x00ff0000, 0x0},
|
||||
+ {0x45b8, 0x80000000, 0x0},
|
||||
+ {0x4594, 0x003ff800, 0x0},
|
||||
+ {0x45b4, 0x000001c0, 0x0},
|
||||
+ {0x4598, 0xf8000000, 0x0},
|
||||
+ {0x45b8, 0x00100000, 0x0},
|
||||
+ {0x45a8, 0x00000fc0, 0x7},
|
||||
+ {0x45b8, 0x00200000, 0x0},
|
||||
+ {0x45b0, 0x00000038, 0x0},
|
||||
+ {0x45b0, 0x000001c0, 0x0},
|
||||
+ {0x45a0, 0x000000ff, 0x0},
|
||||
+ {0x45b4, 0x06000000, 0x0},
|
||||
+ {0x45b0, 0x00000007, 0x0},
|
||||
+ {0x45b8, 0x00080000, 0x0},
|
||||
+ {0x45a8, 0x0000003f, 0x0},
|
||||
+ {0x457c, 0xffe00000, 0x1},
|
||||
+ {0x4530, 0xffffffff, 0x0},
|
||||
+ {0x4588, 0x00003fff, 0x0},
|
||||
+ {0x4598, 0x000001ff, 0x0},
|
||||
+ {0x4534, 0xffffffff, 0x0},
|
||||
+ {0x4538, 0xffffffff, 0x0},
|
||||
+ {0x453c, 0xffffffff, 0x0},
|
||||
+ {0x4588, 0x0fffc000, 0x0},
|
||||
+ {0x4598, 0x0003fe00, 0x0},
|
||||
+ {0x4540, 0xffffffff, 0x0},
|
||||
+ {0x4544, 0xffffffff, 0x0},
|
||||
+ {0x4548, 0xffffffff, 0x0},
|
||||
+ {0x458c, 0x00003fff, 0x0},
|
||||
+ {0x4598, 0x07fc0000, 0x0},
|
||||
+ {0x454c, 0xffffffff, 0x0},
|
||||
+ {0x4550, 0xffffffff, 0x0},
|
||||
+ {0x4554, 0xffffffff, 0x0},
|
||||
+ {0x458c, 0x0fffc000, 0x0},
|
||||
+ {0x459c, 0x000001ff, 0x0},
|
||||
+ {0x4558, 0xffffffff, 0x0},
|
||||
+ {0x455c, 0xffffffff, 0x0},
|
||||
+ {0x4530, 0xffffffff, 0x4e790001},
|
||||
+ {0x4588, 0x00003fff, 0x0},
|
||||
+ {0x4598, 0x000001ff, 0x1},
|
||||
+ {0x4534, 0xffffffff, 0x0},
|
||||
+ {0x4538, 0xffffffff, 0x4b},
|
||||
+ {0x45ac, 0x38000000, 0x7},
|
||||
+ {0x4588, 0xf0000000, 0x0},
|
||||
+ {0x459c, 0x7e000000, 0x0},
|
||||
+ {0x45b8, 0x00040000, 0x0},
|
||||
+ {0x45b8, 0x00020000, 0x0},
|
||||
+ {0x4590, 0xffc00000, 0x0},
|
||||
+ {0x45b8, 0x00004000, 0x0},
|
||||
+ {0x4578, 0xff000000, 0x0},
|
||||
+ {0x45b8, 0x00000400, 0x0},
|
||||
+ {0x45b8, 0x00000800, 0x0},
|
||||
+ {0x45b8, 0x00001000, 0x0},
|
||||
+ {0x45b8, 0x00002000, 0x0},
|
||||
+ {0x45b4, 0x00018000, 0x0},
|
||||
+ {0x45ac, 0x07800000, 0x0},
|
||||
+ {0x45b4, 0x00000600, 0x2},
|
||||
+ {0x459c, 0x0001fe00, 0x80},
|
||||
+ {0x45ac, 0x00078000, 0x3},
|
||||
+ {0x459c, 0x01fe0000, 0x1},
|
||||
+};
|
||||
+
|
||||
static const struct rtw89_reg3_def rtw8852b_btc_preagc_en_defs[] = {
|
||||
{0x46D0, GENMASK(1, 0), 0x3},
|
||||
{0x4790, GENMASK(1, 0), 0x3},
|
||||
@@ -1435,6 +1558,171 @@ rtw8852b_init_txpwr_unit(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void rtw8852b_bb_set_plcp_tx(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ const struct rtw89_reg3_def *def = rtw8852b_pmac_ht20_mcs7_tbl;
|
||||
+ u8 i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(rtw8852b_pmac_ht20_mcs7_tbl); i++, def++)
|
||||
+ rtw89_phy_write32_mask(rtwdev, def->addr, def->mask, def->data);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_stop_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_bb_pmac_info *tx_info,
|
||||
+ enum rtw89_phy_idx idx)
|
||||
+{
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC Stop Tx");
|
||||
+ if (tx_info->mode == CONT_TX)
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_PRD, B_PMAC_CTX_EN, 0, idx);
|
||||
+ else if (tx_info->mode == PKTS_TX)
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_PRD, B_PMAC_PTX_EN, 0, idx);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_start_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_bb_pmac_info *tx_info,
|
||||
+ enum rtw89_phy_idx idx)
|
||||
+{
|
||||
+ enum rtw8852b_pmac_mode mode = tx_info->mode;
|
||||
+ u32 pkt_cnt = tx_info->tx_cnt;
|
||||
+ u16 period = tx_info->period;
|
||||
+
|
||||
+ if (mode == CONT_TX && !tx_info->is_cck) {
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_PRD, B_PMAC_CTX_EN, 1, idx);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC CTx Start");
|
||||
+ } else if (mode == PKTS_TX) {
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_PRD, B_PMAC_PTX_EN, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_PRD,
|
||||
+ B_PMAC_TX_PRD_MSK, period, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_CNT, B_PMAC_TX_CNT_MSK,
|
||||
+ pkt_cnt, idx);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC PTx Start");
|
||||
+ }
|
||||
+
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_CTRL, B_PMAC_TXEN_DIS, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_TX_CTRL, B_PMAC_TXEN_DIS, 0, idx);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_bb_pmac_info *tx_info,
|
||||
+ enum rtw89_phy_idx idx)
|
||||
+{
|
||||
+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
+
|
||||
+ if (!tx_info->en_pmac_tx) {
|
||||
+ rtw8852b_stop_pmac_tx(rtwdev, tx_info, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0, idx);
|
||||
+ if (chan->band_type == RTW89_BAND_2G)
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_RXCCA, B_RXCCA_DIS);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC Tx Enable");
|
||||
+
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_GNT, B_PMAC_GNT_TXEN, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_GNT, B_PMAC_GNT_RXEN, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_RX_CFG1, B_PMAC_OPT1_MSK, 0x3f, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 1, idx);
|
||||
+ rtw89_phy_write32_set(rtwdev, R_RXCCA, B_RXCCA_DIS);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 1, idx);
|
||||
+
|
||||
+ rtw8852b_start_pmac_tx(rtwdev, tx_info, idx);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
+ u16 tx_cnt, u16 period, u16 tx_time,
|
||||
+ enum rtw89_phy_idx idx)
|
||||
+{
|
||||
+ struct rtw8852b_bb_pmac_info tx_info = {0};
|
||||
+
|
||||
+ tx_info.en_pmac_tx = enable;
|
||||
+ tx_info.is_cck = 0;
|
||||
+ tx_info.mode = PKTS_TX;
|
||||
+ tx_info.tx_cnt = tx_cnt;
|
||||
+ tx_info.period = period;
|
||||
+ tx_info.tx_time = tx_time;
|
||||
+
|
||||
+ rtw8852b_bb_set_pmac_tx(rtwdev, &tx_info, idx);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
+ enum rtw89_phy_idx idx)
|
||||
+{
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC CFG Tx PWR = %d", pwr_dbm);
|
||||
+
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_PWR_EN, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_TXPWR, B_TXPWR_MSK, pwr_dbm, idx);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_cfg_tx_path(struct rtw89_dev *rtwdev, u8 tx_path)
|
||||
+{
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_MOD, 7, RTW89_PHY_0);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "PMAC CFG Tx Path = %d", tx_path);
|
||||
+
|
||||
+ if (tx_path == RF_PATH_A) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXPATH_SEL, B_TXPATH_SEL_MSK, 1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXNSS_MAP, B_TXNSS_MAP_MSK, 0);
|
||||
+ } else if (tx_path == RF_PATH_B) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXPATH_SEL, B_TXPATH_SEL_MSK, 2);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXNSS_MAP, B_TXNSS_MAP_MSK, 0);
|
||||
+ } else if (tx_path == RF_PATH_AB) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXPATH_SEL, B_TXPATH_SEL_MSK, 3);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXNSS_MAP, B_TXNSS_MAP_MSK, 4);
|
||||
+ } else {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "Error Tx Path");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_tx_mode_switch(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx idx, u8 mode)
|
||||
+{
|
||||
+ if (mode != 0)
|
||||
+ return;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_TSSI, "Tx mode switch");
|
||||
+
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_GNT, B_PMAC_GNT_TXEN, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_GNT, B_PMAC_GNT_RXEN, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_RX_CFG1, B_PMAC_OPT1_MSK, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_PMAC_RXMOD, B_PMAC_RXMOD_MSK, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_DPD_EN, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_MOD, 0, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_PWR_EN, 0, idx);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_backup_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
+ struct rtw8852b_bb_tssi_bak *bak)
|
||||
+{
|
||||
+ s32 tmp;
|
||||
+
|
||||
+ bak->tx_path = rtw89_phy_read32_idx(rtwdev, R_TXPATH_SEL, B_TXPATH_SEL_MSK, idx);
|
||||
+ bak->rx_path = rtw89_phy_read32_idx(rtwdev, R_CHBW_MOD_V1, B_ANT_RX_SEG0, idx);
|
||||
+ bak->p0_rfmode = rtw89_phy_read32_idx(rtwdev, R_P0_RFMODE, MASKDWORD, idx);
|
||||
+ bak->p0_rfmode_ftm = rtw89_phy_read32_idx(rtwdev, R_P0_RFMODE_FTM_RX, MASKDWORD, idx);
|
||||
+ bak->p1_rfmode = rtw89_phy_read32_idx(rtwdev, R_P1_RFMODE, MASKDWORD, idx);
|
||||
+ bak->p1_rfmode_ftm = rtw89_phy_read32_idx(rtwdev, R_P1_RFMODE_FTM_RX, MASKDWORD, idx);
|
||||
+ tmp = rtw89_phy_read32_idx(rtwdev, R_TXPWR, B_TXPWR_MSK, idx);
|
||||
+ bak->tx_pwr = sign_extend32(tmp, 8);
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_bb_restore_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
+ const struct rtw8852b_bb_tssi_bak *bak)
|
||||
+{
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_TXPATH_SEL, B_TXPATH_SEL_MSK, bak->tx_path, idx);
|
||||
+ if (bak->tx_path == RF_AB)
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXNSS_MAP, B_TXNSS_MAP_MSK, 0x4);
|
||||
+ else
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_TXNSS_MAP, B_TXNSS_MAP_MSK, 0x0);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_CHBW_MOD_V1, B_ANT_RX_SEG0, bak->rx_path, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_MAC_SEL, B_MAC_SEL_PWR_EN, 1, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_P0_RFMODE, MASKDWORD, bak->p0_rfmode, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_P0_RFMODE_FTM_RX, MASKDWORD, bak->p0_rfmode_ftm, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_P1_RFMODE, MASKDWORD, bak->p1_rfmode, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_P1_RFMODE_FTM_RX, MASKDWORD, bak->p1_rfmode_ftm, idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, R_TXPWR, B_TXPWR_MSK, bak->tx_pwr, idx);
|
||||
+}
|
||||
+
|
||||
static void rtw8852b_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en)
|
||||
{
|
||||
rtw89_phy_write_reg3_tbl(rtwdev, bt_en ? &rtw8852b_btc_preagc_en_defs_tbl :
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.h b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
index 33f621014e497..4f9b3d4768790 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.h
|
||||
@@ -10,6 +10,13 @@
|
||||
#define RF_PATH_NUM_8852B 2
|
||||
#define BB_PATH_NUM_8852B 2
|
||||
|
||||
+enum rtw8852b_pmac_mode {
|
||||
+ NONE_TEST,
|
||||
+ PKTS_TX,
|
||||
+ PKTS_RX,
|
||||
+ CONT_TX
|
||||
+};
|
||||
+
|
||||
struct rtw8852b_u_efuse {
|
||||
u8 rsvd[0x88];
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
@@ -85,9 +92,46 @@ struct rtw8852b_efuse {
|
||||
};
|
||||
} __packed;
|
||||
|
||||
+struct rtw8852b_bb_pmac_info {
|
||||
+ u8 en_pmac_tx:1;
|
||||
+ u8 is_cck:1;
|
||||
+ u8 mode:3;
|
||||
+ u8 rsvd:3;
|
||||
+ u16 tx_cnt;
|
||||
+ u16 period;
|
||||
+ u16 tx_time;
|
||||
+ u8 duty_cycle;
|
||||
+};
|
||||
+
|
||||
+struct rtw8852b_bb_tssi_bak {
|
||||
+ u8 tx_path;
|
||||
+ u8 rx_path;
|
||||
+ u32 p0_rfmode;
|
||||
+ u32 p0_rfmode_ftm;
|
||||
+ u32 p1_rfmode;
|
||||
+ u32 p1_rfmode_ftm;
|
||||
+ s16 tx_pwr; /* S9 */
|
||||
+};
|
||||
+
|
||||
extern const struct rtw89_chip_info rtw8852b_chip_info;
|
||||
|
||||
+void rtw8852b_bb_set_plcp_tx(struct rtw89_dev *rtwdev);
|
||||
+void rtw8852b_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw8852b_bb_pmac_info *tx_info,
|
||||
+ enum rtw89_phy_idx idx);
|
||||
+void rtw8852b_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
+ u16 tx_cnt, u16 period, u16 tx_time,
|
||||
+ enum rtw89_phy_idx idx);
|
||||
+void rtw8852b_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
+ enum rtw89_phy_idx idx);
|
||||
+void rtw8852b_bb_cfg_tx_path(struct rtw89_dev *rtwdev, u8 tx_path);
|
||||
void rtw8852b_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_rf_path_bit rx_path);
|
||||
+void rtw8852b_bb_tx_mode_switch(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx idx, u8 mode);
|
||||
+void rtw8852b_bb_backup_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
+ struct rtw8852b_bb_tssi_bak *bak);
|
||||
+void rtw8852b_bb_restore_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
+ const struct rtw8852b_bb_tssi_bak *bak);
|
||||
|
||||
#endif
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,318 @@
|
||||
From 87292798d046a87163182c53f1f64b31118a2a78 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 032/142] wifi: rtw89: 8852b: add basic attributes of chip_info
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b8fe87b816851d08a31c7c9589855c8535672299
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sun Oct 9 20:54:03 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add basic attributes of chip_info
|
||||
|
||||
Add 8852b specific constant tables and basic attributes containing
|
||||
common chip_ops, firmware name, supported TX/RX NSS, number of CAM,
|
||||
coexistence version, control register set, and so on.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221009125403.19662-10-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 235 ++++++++++++++++++++++++++
|
||||
1 file changed, 235 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 290d83cb83d5a..0918b75ab1d94 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -217,6 +217,150 @@ static const struct rtw89_reg3_def rtw8852b_btc_preagc_dis_defs[] = {
|
||||
|
||||
static DECLARE_PHY_REG3_TBL(rtw8852b_btc_preagc_dis_defs);
|
||||
|
||||
+static const u32 rtw8852b_h2c_regs[RTW89_H2CREG_MAX] = {
|
||||
+ R_AX_H2CREG_DATA0, R_AX_H2CREG_DATA1, R_AX_H2CREG_DATA2,
|
||||
+ R_AX_H2CREG_DATA3
|
||||
+};
|
||||
+
|
||||
+static const u32 rtw8852b_c2h_regs[RTW89_C2HREG_MAX] = {
|
||||
+ R_AX_C2HREG_DATA0, R_AX_C2HREG_DATA1, R_AX_C2HREG_DATA2,
|
||||
+ R_AX_C2HREG_DATA3
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_page_regs rtw8852b_page_regs = {
|
||||
+ .hci_fc_ctrl = R_AX_HCI_FC_CTRL,
|
||||
+ .ch_page_ctrl = R_AX_CH_PAGE_CTRL,
|
||||
+ .ach_page_ctrl = R_AX_ACH0_PAGE_CTRL,
|
||||
+ .ach_page_info = R_AX_ACH0_PAGE_INFO,
|
||||
+ .pub_page_info3 = R_AX_PUB_PAGE_INFO3,
|
||||
+ .pub_page_ctrl1 = R_AX_PUB_PAGE_CTRL1,
|
||||
+ .pub_page_ctrl2 = R_AX_PUB_PAGE_CTRL2,
|
||||
+ .pub_page_info1 = R_AX_PUB_PAGE_INFO1,
|
||||
+ .pub_page_info2 = R_AX_PUB_PAGE_INFO2,
|
||||
+ .wp_page_ctrl1 = R_AX_WP_PAGE_CTRL1,
|
||||
+ .wp_page_ctrl2 = R_AX_WP_PAGE_CTRL2,
|
||||
+ .wp_page_info1 = R_AX_WP_PAGE_INFO1,
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_reg_def rtw8852b_dcfo_comp = {
|
||||
+ R_DCFO_COMP_S0, B_DCFO_COMP_S0_MSK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_imr_info rtw8852b_imr_info = {
|
||||
+ .wdrls_imr_set = B_AX_WDRLS_IMR_SET,
|
||||
+ .wsec_imr_reg = R_AX_SEC_DEBUG,
|
||||
+ .wsec_imr_set = B_AX_IMR_ERROR,
|
||||
+ .mpdu_tx_imr_set = 0,
|
||||
+ .mpdu_rx_imr_set = 0,
|
||||
+ .sta_sch_imr_set = B_AX_STA_SCHEDULER_IMR_SET,
|
||||
+ .txpktctl_imr_b0_reg = R_AX_TXPKTCTL_ERR_IMR_ISR,
|
||||
+ .txpktctl_imr_b0_clr = B_AX_TXPKTCTL_IMR_B0_CLR,
|
||||
+ .txpktctl_imr_b0_set = B_AX_TXPKTCTL_IMR_B0_SET,
|
||||
+ .txpktctl_imr_b1_reg = R_AX_TXPKTCTL_ERR_IMR_ISR_B1,
|
||||
+ .txpktctl_imr_b1_clr = B_AX_TXPKTCTL_IMR_B1_CLR,
|
||||
+ .txpktctl_imr_b1_set = B_AX_TXPKTCTL_IMR_B1_SET,
|
||||
+ .wde_imr_clr = B_AX_WDE_IMR_CLR,
|
||||
+ .wde_imr_set = B_AX_WDE_IMR_SET,
|
||||
+ .ple_imr_clr = B_AX_PLE_IMR_CLR,
|
||||
+ .ple_imr_set = B_AX_PLE_IMR_SET,
|
||||
+ .host_disp_imr_clr = B_AX_HOST_DISP_IMR_CLR,
|
||||
+ .host_disp_imr_set = B_AX_HOST_DISP_IMR_SET,
|
||||
+ .cpu_disp_imr_clr = B_AX_CPU_DISP_IMR_CLR,
|
||||
+ .cpu_disp_imr_set = B_AX_CPU_DISP_IMR_SET,
|
||||
+ .other_disp_imr_clr = B_AX_OTHER_DISP_IMR_CLR,
|
||||
+ .other_disp_imr_set = 0,
|
||||
+ .bbrpt_com_err_imr_reg = R_AX_BBRPT_COM_ERR_IMR_ISR,
|
||||
+ .bbrpt_chinfo_err_imr_reg = R_AX_BBRPT_CHINFO_ERR_IMR_ISR,
|
||||
+ .bbrpt_err_imr_set = 0,
|
||||
+ .bbrpt_dfs_err_imr_reg = R_AX_BBRPT_DFS_ERR_IMR_ISR,
|
||||
+ .ptcl_imr_clr = B_AX_PTCL_IMR_CLR_ALL,
|
||||
+ .ptcl_imr_set = B_AX_PTCL_IMR_SET,
|
||||
+ .cdma_imr_0_reg = R_AX_DLE_CTRL,
|
||||
+ .cdma_imr_0_clr = B_AX_DLE_IMR_CLR,
|
||||
+ .cdma_imr_0_set = B_AX_DLE_IMR_SET,
|
||||
+ .cdma_imr_1_reg = 0,
|
||||
+ .cdma_imr_1_clr = 0,
|
||||
+ .cdma_imr_1_set = 0,
|
||||
+ .phy_intf_imr_reg = R_AX_PHYINFO_ERR_IMR,
|
||||
+ .phy_intf_imr_clr = 0,
|
||||
+ .phy_intf_imr_set = 0,
|
||||
+ .rmac_imr_reg = R_AX_RMAC_ERR_ISR,
|
||||
+ .rmac_imr_clr = B_AX_RMAC_IMR_CLR,
|
||||
+ .rmac_imr_set = B_AX_RMAC_IMR_SET,
|
||||
+ .tmac_imr_reg = R_AX_TMAC_ERR_IMR_ISR,
|
||||
+ .tmac_imr_clr = B_AX_TMAC_IMR_CLR,
|
||||
+ .tmac_imr_set = B_AX_TMAC_IMR_SET,
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_rrsr_cfgs rtw8852b_rrsr_cfgs = {
|
||||
+ .ref_rate = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_REF_RATE_SEL, 0},
|
||||
+ .rsc = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_RSC_MASK, 2},
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_dig_regs rtw8852b_dig_regs = {
|
||||
+ .seg0_pd_reg = R_SEG0R_PD_V1,
|
||||
+ .pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
|
||||
+ .pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1,
|
||||
+ .p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
|
||||
+ .p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
|
||||
+ .p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
|
||||
+ .p1_tia_init = {R_PATH1_TIA_INIT_V1, B_PATH1_TIA_INIT_IDX_MSK_V1},
|
||||
+ .p0_rxb_init = {R_PATH0_RXB_INIT_V1, B_PATH0_RXB_INIT_IDX_MSK_V1},
|
||||
+ .p1_rxb_init = {R_PATH1_RXB_INIT_V1, B_PATH1_RXB_INIT_IDX_MSK_V1},
|
||||
+ .p0_p20_pagcugc_en = {R_PATH0_P20_FOLLOW_BY_PAGCUGC_V2,
|
||||
+ B_PATH0_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
|
||||
+ .p0_s20_pagcugc_en = {R_PATH0_S20_FOLLOW_BY_PAGCUGC_V2,
|
||||
+ B_PATH0_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
|
||||
+ .p1_p20_pagcugc_en = {R_PATH1_P20_FOLLOW_BY_PAGCUGC_V2,
|
||||
+ B_PATH1_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
|
||||
+ .p1_s20_pagcugc_en = {R_PATH1_S20_FOLLOW_BY_PAGCUGC_V2,
|
||||
+ B_PATH1_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_ul[] = {
|
||||
+ {15, 0, 0, 7}, /* 0 -> original */
|
||||
+ {15, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
|
||||
+ {15, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
+ {6, 1, 0, 7},
|
||||
+ {13, 1, 0, 7},
|
||||
+ {13, 1, 0, 7}
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_dl[] = {
|
||||
+ {15, 0, 0, 7}, /* 0 -> original */
|
||||
+ {15, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
+ {15, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
+ {15, 1, 0, 7},
|
||||
+ {15, 1, 0, 7},
|
||||
+ {15, 1, 0, 7}
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852b_mon_reg[] = {
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda24),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda28),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda2c),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda30),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda4c),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda10),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda20),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda34),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xcef4),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0x8424),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd200),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd220),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x980),
|
||||
+ RTW89_DEF_FBTC_MREG(REG_BT_MODEM, 4, 0x178),
|
||||
+};
|
||||
+
|
||||
+static const u8 rtw89_btc_8852b_wl_rssi_thres[BTC_WL_RSSI_THMAX] = {70, 60, 50, 40};
|
||||
+static const u8 rtw89_btc_8852b_bt_rssi_thres[BTC_BT_RSSI_THMAX] = {50, 40, 30, 20};
|
||||
+
|
||||
static int rtw8852b_pwr_on_func(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
u32 val32;
|
||||
@@ -2195,10 +2339,13 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.disable_bb_rf = rtw8852b_mac_disable_bb_rf,
|
||||
.bb_reset = rtw8852b_bb_reset,
|
||||
.bb_sethw = rtw8852b_bb_sethw,
|
||||
+ .read_rf = rtw89_phy_read_rf_v1,
|
||||
+ .write_rf = rtw89_phy_write_rf_v1,
|
||||
.set_channel = rtw8852b_set_channel,
|
||||
.set_channel_help = rtw8852b_set_channel_help,
|
||||
.read_efuse = rtw8852b_read_efuse,
|
||||
.read_phycap = rtw8852b_read_phycap,
|
||||
+ .fem_setup = NULL,
|
||||
.power_trim = rtw8852b_power_trim,
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
@@ -2208,8 +2355,16 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.query_ppdu = rtw8852b_query_ppdu,
|
||||
.bb_ctrl_btc_preagc = rtw8852b_bb_ctrl_btc_preagc,
|
||||
.cfg_txrx_path = rtw8852b_bb_cfg_txrx_path,
|
||||
+ .set_txpwr_ul_tb_offset = rtw8852b_set_txpwr_ul_tb_offset,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
+ .fill_txdesc = rtw89_core_fill_txdesc,
|
||||
+ .fill_txdesc_fwcmd = rtw89_core_fill_txdesc,
|
||||
+ .cfg_ctrl_path = rtw89_mac_cfg_ctrl_path,
|
||||
+ .mac_cfg_gnt = rtw89_mac_cfg_gnt,
|
||||
+ .stop_sch_tx = rtw89_mac_stop_sch_tx,
|
||||
+ .resume_sch_tx = rtw89_mac_resume_sch_tx,
|
||||
+ .h2c_dctl_sec_cam = NULL,
|
||||
|
||||
.btc_set_rfe = rtw8852b_btc_set_rfe,
|
||||
.btc_init_cfg = rtw8852b_btc_init_cfg,
|
||||
@@ -2225,12 +2380,46 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.chip_id = RTL8852B,
|
||||
.ops = &rtw8852b_chip_ops,
|
||||
+ .fw_name = "rtw89/rtw8852b_fw.bin",
|
||||
.fifo_size = 196608,
|
||||
.dle_scc_rsvd_size = 98304,
|
||||
+ .max_amsdu_limit = 3500,
|
||||
+ .dis_2g_40m_ul_ofdma = true,
|
||||
+ .rsvd_ple_ofst = 0x2f800,
|
||||
.hfc_param_ini = rtw8852b_hfc_param_ini_pcie,
|
||||
.dle_mem = rtw8852b_dle_mem_pcie,
|
||||
+ .rf_base_addr = {0xe000, 0xf000},
|
||||
.pwr_on_seq = NULL,
|
||||
.pwr_off_seq = NULL,
|
||||
+ .bb_table = &rtw89_8852b_phy_bb_table,
|
||||
+ .bb_gain_table = &rtw89_8852b_phy_bb_gain_table,
|
||||
+ .rf_table = {&rtw89_8852b_phy_radioa_table,
|
||||
+ &rtw89_8852b_phy_radiob_table,},
|
||||
+ .nctl_table = &rtw89_8852b_phy_nctl_table,
|
||||
+ .byr_table = &rtw89_8852b_byr_table,
|
||||
+ .txpwr_lmt_2g = &rtw89_8852b_txpwr_lmt_2g,
|
||||
+ .txpwr_lmt_5g = &rtw89_8852b_txpwr_lmt_5g,
|
||||
+ .txpwr_lmt_ru_2g = &rtw89_8852b_txpwr_lmt_ru_2g,
|
||||
+ .txpwr_lmt_ru_5g = &rtw89_8852b_txpwr_lmt_ru_5g,
|
||||
+ .txpwr_factor_rf = 2,
|
||||
+ .txpwr_factor_mac = 1,
|
||||
+ .dig_table = NULL,
|
||||
+ .dig_regs = &rtw8852b_dig_regs,
|
||||
+ .tssi_dbw_table = NULL,
|
||||
+ .support_chanctx_num = 0,
|
||||
+ .support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
+ BIT(NL80211_BAND_5GHZ),
|
||||
+ .support_bw160 = false,
|
||||
+ .hw_sec_hdr = false,
|
||||
+ .rf_path_num = 2,
|
||||
+ .tx_nss = 2,
|
||||
+ .rx_nss = 2,
|
||||
+ .acam_num = 128,
|
||||
+ .bcam_num = 10,
|
||||
+ .scam_num = 128,
|
||||
+ .bacam_num = 2,
|
||||
+ .bacam_dynamic_num = 4,
|
||||
+ .bacam_v1 = false,
|
||||
.sec_ctrl_efuse_size = 4,
|
||||
.physical_efuse_size = 1216,
|
||||
.logical_efuse_size = 2048,
|
||||
@@ -2239,6 +2428,52 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.dav_log_efuse_size = 16,
|
||||
.phycap_addr = 0x580,
|
||||
.phycap_size = 128,
|
||||
+ .para_ver = 0,
|
||||
+ .wlcx_desired = 0x05050000,
|
||||
+ .btcx_desired = 0x5,
|
||||
+ .scbd = 0x1,
|
||||
+ .mailbox = 0x1,
|
||||
+ .btc_fwinfo_buf = 1024,
|
||||
+
|
||||
+ .fcxbtcrpt_ver = 1,
|
||||
+ .fcxtdma_ver = 1,
|
||||
+ .fcxslots_ver = 1,
|
||||
+ .fcxcysta_ver = 2,
|
||||
+ .fcxstep_ver = 2,
|
||||
+ .fcxnullsta_ver = 1,
|
||||
+ .fcxmreg_ver = 1,
|
||||
+ .fcxgpiodbg_ver = 1,
|
||||
+ .fcxbtver_ver = 1,
|
||||
+ .fcxbtscan_ver = 1,
|
||||
+ .fcxbtafh_ver = 1,
|
||||
+ .fcxbtdevinfo_ver = 1,
|
||||
+ .afh_guard_ch = 6,
|
||||
+ .wl_rssi_thres = rtw89_btc_8852b_wl_rssi_thres,
|
||||
+ .bt_rssi_thres = rtw89_btc_8852b_bt_rssi_thres,
|
||||
+ .rssi_tol = 2,
|
||||
+ .mon_reg_num = ARRAY_SIZE(rtw89_btc_8852b_mon_reg),
|
||||
+ .mon_reg = rtw89_btc_8852b_mon_reg,
|
||||
+ .rf_para_ulink_num = ARRAY_SIZE(rtw89_btc_8852b_rf_ul),
|
||||
+ .rf_para_ulink = rtw89_btc_8852b_rf_ul,
|
||||
+ .rf_para_dlink_num = ARRAY_SIZE(rtw89_btc_8852b_rf_dl),
|
||||
+ .rf_para_dlink = rtw89_btc_8852b_rf_dl,
|
||||
+ .ps_mode_supported = BIT(RTW89_PS_MODE_RFOFF) |
|
||||
+ BIT(RTW89_PS_MODE_CLK_GATED) |
|
||||
+ BIT(RTW89_PS_MODE_PWR_GATED),
|
||||
+ .low_power_hci_modes = 0,
|
||||
+ .h2c_cctl_func_id = H2C_FUNC_MAC_CCTLINFO_UD,
|
||||
+ .hci_func_en_addr = R_AX_HCI_FUNC_EN,
|
||||
+ .h2c_desc_size = sizeof(struct rtw89_txwd_body),
|
||||
+ .txwd_body_size = sizeof(struct rtw89_txwd_body),
|
||||
+ .h2c_ctrl_reg = R_AX_H2CREG_CTRL,
|
||||
+ .h2c_regs = rtw8852b_h2c_regs,
|
||||
+ .c2h_ctrl_reg = R_AX_C2HREG_CTRL,
|
||||
+ .c2h_regs = rtw8852b_c2h_regs,
|
||||
+ .page_regs = &rtw8852b_page_regs,
|
||||
+ .dcfo_comp = &rtw8852b_dcfo_comp,
|
||||
+ .dcfo_comp_sft = 3,
|
||||
+ .imr_info = &rtw8852b_imr_info,
|
||||
+ .rrsr_cfgs = &rtw8852b_rrsr_cfgs,
|
||||
.dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
|
||||
BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
|
||||
BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,559 @@
|
||||
From c699d8f44de1e938847d9039344ef0eeeb0a9eab Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 033/142] wifi: rtw89: 8852b: rfk: add DACK
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 16be5e3be0e5794b5e7227c63b440f3fdb9c22ce
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 12 16:32:30 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: rfk: add DACK
|
||||
|
||||
DACK (digital-to-analog converters calibration) is used to calibrate DAC
|
||||
to output good quality signals.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221012083234.20224-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 21 ++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 432 ++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h | 1 +
|
||||
3 files changed, 454 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 5482e32a72d55..40b66c071b27d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -3524,6 +3524,7 @@
|
||||
#define B_ANAPAR_ADCCLK BIT(30)
|
||||
#define B_ANAPAR_FLTRST BIT(22)
|
||||
#define B_ANAPAR_CRXBB GENMASK(18, 16)
|
||||
+#define B_ANAPAR_EN BIT(16)
|
||||
#define B_ANAPAR_14 GENMASK(15, 0)
|
||||
#define R_RFE_E_A2 0x0334
|
||||
#define R_RFE_O_SEL_A2 0x0338
|
||||
@@ -4378,6 +4379,8 @@
|
||||
#define B_DACK_S0P3_OK BIT(2)
|
||||
#define R_DACK_DADCK01 0xC084
|
||||
#define B_DACK_DADCK01 GENMASK(31, 24)
|
||||
+#define R_DRCK_FH 0xC094
|
||||
+#define B_DRCK_LAT BIT(9)
|
||||
#define R_DRCK 0xC0C4
|
||||
#define B_DRCK_IDLE BIT(9)
|
||||
#define B_DRCK_EN BIT(6)
|
||||
@@ -4385,15 +4388,28 @@
|
||||
#define R_DRCK_RES 0xC0C8
|
||||
#define B_DRCK_RES GENMASK(19, 15)
|
||||
#define B_DRCK_POL BIT(3)
|
||||
+#define R_DRCK_V1 0xC0CC
|
||||
+#define B_DRCK_V1_SEL BIT(9)
|
||||
+#define B_DRCK_V1_KICK BIT(6)
|
||||
+#define B_DRCK_V1_CV GENMASK(4, 0)
|
||||
+#define R_DRCK_RS 0xC0D0
|
||||
+#define B_DRCK_RS_LPS GENMASK(19, 15)
|
||||
+#define B_DRCK_RS_DONE BIT(3)
|
||||
#define R_PATH0_SAMPL_DLY_T_V1 0xC0D4
|
||||
#define B_PATH0_SAMPL_DLY_T_MSK_V1 GENMASK(27, 26)
|
||||
#define R_P0_CFCH_BW0 0xC0D4
|
||||
#define B_P0_CFCH_BW0 GENMASK(27, 26)
|
||||
#define R_P0_CFCH_BW1 0xC0D8
|
||||
#define B_P0_CFCH_BW1 GENMASK(8, 5)
|
||||
+#define R_ADDCK0D 0xC0F0
|
||||
+#define B_ADDCK0D_VAL2 GENMASK(31, 26)
|
||||
+#define B_ADDCK0D_VAL GENMASK(25, 16)
|
||||
#define R_ADDCK0 0xC0F4
|
||||
+#define B_ADDCK0_TRG BIT(11)
|
||||
#define B_ADDCK0 GENMASK(9, 8)
|
||||
+#define B_ADDCK0_MAN GENMASK(5, 4)
|
||||
#define B_ADDCK0_EN BIT(4)
|
||||
+#define B_ADDCK0_VAL GENMASK(3, 0)
|
||||
#define B_ADDCK0_RST BIT(2)
|
||||
#define R_ADDCK0_RL 0xC0F8
|
||||
#define B_ADDCK0_RLS GENMASK(29, 28)
|
||||
@@ -4434,8 +4450,13 @@
|
||||
#define B_PATH0_BW_SEL_MSK_V1 GENMASK(8, 5)
|
||||
#define R_PATH1_BW_SEL_V1 0xC1D8
|
||||
#define B_PATH1_BW_SEL_MSK_V1 GENMASK(8, 5)
|
||||
+#define R_ADDCK1D 0xC1F0
|
||||
+#define B_ADDCK1D_VAL2 GENMASK(31, 26)
|
||||
+#define B_ADDCK1D_VAL GENMASK(25, 16)
|
||||
#define R_ADDCK1 0xC1F4
|
||||
+#define B_ADDCK1_TRG BIT(11)
|
||||
#define B_ADDCK1 GENMASK(9, 8)
|
||||
+#define B_ADDCK1_MAN GENMASK(5, 4)
|
||||
#define B_ADDCK1_EN BIT(4)
|
||||
#define B_ADDCK1_RST BIT(2)
|
||||
#define R_ADDCK1_RL 0xC1F8
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
index 761544b0dcca1..5c35f4fb38ff5 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "rtw8852b_rfk_table.h"
|
||||
#include "rtw8852b_table.h"
|
||||
|
||||
+#define ADDC_T_AVG 100
|
||||
+
|
||||
static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
u8 val;
|
||||
@@ -30,6 +32,436 @@ static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return val;
|
||||
}
|
||||
|
||||
+static void _afe_init(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ rtw89_write32(rtwdev, R_AX_PHYREG_SET, 0xf);
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_afe_init_defs_tbl);
|
||||
+}
|
||||
+
|
||||
+static void _drck(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ u32 rck_d;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]Ddie RCK start!!!\n");
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_V1, B_DRCK_V1_KICK, 0x1);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(rtw89_phy_read32_mask, val, val, 1, 10000,
|
||||
+ false, rtwdev, R_DRCK_RS, B_DRCK_RS_DONE);
|
||||
+ if (ret)
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DRCK timeout\n");
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_V1, B_DRCK_V1_KICK, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_FH, B_DRCK_LAT, 0x1);
|
||||
+ udelay(1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_FH, B_DRCK_LAT, 0x0);
|
||||
+ rck_d = rtw89_phy_read32_mask(rtwdev, R_DRCK_RS, B_DRCK_RS_LPS);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_V1, B_DRCK_V1_SEL, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DRCK_V1, B_DRCK_V1_CV, rck_d);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]0xc0cc = 0x%x\n",
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DRCK_V1, MASKDWORD));
|
||||
+}
|
||||
+
|
||||
+static void _addck_backup(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0, 0x0);
|
||||
+ dack->addck_d[0][0] = rtw89_phy_read32_mask(rtwdev, R_ADDCKR0, B_ADDCKR0_A0);
|
||||
+ dack->addck_d[0][1] = rtw89_phy_read32_mask(rtwdev, R_ADDCKR0, B_ADDCKR0_A1);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK1, 0x0);
|
||||
+ dack->addck_d[1][0] = rtw89_phy_read32_mask(rtwdev, R_ADDCKR1, B_ADDCKR1_A0);
|
||||
+ dack->addck_d[1][1] = rtw89_phy_read32_mask(rtwdev, R_ADDCKR1, B_ADDCKR1_A1);
|
||||
+}
|
||||
+
|
||||
+static void _addck_reload(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+
|
||||
+ /* S0 */
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0D, B_ADDCK0D_VAL, dack->addck_d[0][0]);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0_VAL, dack->addck_d[0][1] >> 6);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0D, B_ADDCK0D_VAL2, dack->addck_d[0][1] & 0x3f);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0_MAN, 0x3);
|
||||
+
|
||||
+ /* S1 */
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1D, B_ADDCK1D_VAL, dack->addck_d[1][0]);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK0_VAL, dack->addck_d[1][1] >> 6);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1D, B_ADDCK1D_VAL2, dack->addck_d[1][1] & 0x3f);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK1_MAN, 0x3);
|
||||
+}
|
||||
+
|
||||
+static void _dack_backup_s0(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ u8 i;
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_NRBW, B_P0_NRBW_DBG, 0x1);
|
||||
+
|
||||
+ for (i = 0; i < RTW89_DACK_MSBK_NR; i++) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DCOF0, B_DCOF0_V, i);
|
||||
+ dack->msbk_d[0][0][i] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_S0P2, B_DACK_S0M0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DCOF8, B_DCOF8_V, i);
|
||||
+ dack->msbk_d[0][1][i] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_S0P3, B_DACK_S0M1);
|
||||
+ }
|
||||
+
|
||||
+ dack->biask_d[0][0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_BIAS00, B_DACK_BIAS00);
|
||||
+ dack->biask_d[0][1] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_BIAS01, B_DACK_BIAS01);
|
||||
+
|
||||
+ dack->dadck_d[0][0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_DADCK00, B_DACK_DADCK00);
|
||||
+ dack->dadck_d[0][1] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_DADCK01, B_DACK_DADCK01);
|
||||
+}
|
||||
+
|
||||
+static void _dack_backup_s1(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ u8 i;
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_DBGMOD, B_P1_DBGMOD_ON, 0x1);
|
||||
+
|
||||
+ for (i = 0; i < RTW89_DACK_MSBK_NR; i++) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DACK10, B_DACK10, i);
|
||||
+ dack->msbk_d[1][0][i] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK10S, B_DACK10S);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DACK11, B_DACK11, i);
|
||||
+ dack->msbk_d[1][1][i] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK11S, B_DACK11S);
|
||||
+ }
|
||||
+
|
||||
+ dack->biask_d[1][0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_BIAS10, B_DACK_BIAS10);
|
||||
+ dack->biask_d[1][1] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_BIAS11, B_DACK_BIAS11);
|
||||
+
|
||||
+ dack->dadck_d[1][0] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_DADCK10, B_DACK_DADCK10);
|
||||
+ dack->dadck_d[1][1] =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_DADCK11, B_DACK_DADCK11);
|
||||
+}
|
||||
+
|
||||
+static void _check_addc(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
+{
|
||||
+ s32 dc_re = 0, dc_im = 0;
|
||||
+ u32 tmp;
|
||||
+ u32 i;
|
||||
+
|
||||
+ rtw89_rfk_parser_by_cond(rtwdev, path == RF_PATH_A,
|
||||
+ &rtw8852b_check_addc_defs_a_tbl,
|
||||
+ &rtw8852b_check_addc_defs_b_tbl);
|
||||
+
|
||||
+ for (i = 0; i < ADDC_T_AVG; i++) {
|
||||
+ tmp = rtw89_phy_read32_mask(rtwdev, R_DBG32_D, MASKDWORD);
|
||||
+ dc_re += sign_extend32(FIELD_GET(0xfff000, tmp), 11);
|
||||
+ dc_im += sign_extend32(FIELD_GET(0xfff, tmp), 11);
|
||||
+ }
|
||||
+
|
||||
+ dc_re /= ADDC_T_AVG;
|
||||
+ dc_im /= ADDC_T_AVG;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S%d,dc_re = 0x%x,dc_im =0x%x\n", path, dc_re, dc_im);
|
||||
+}
|
||||
+
|
||||
+static void _addck(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* S0 */
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0_MAN, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_SAMPL_DLY_T_V1, 0x30, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_NRBW, B_P0_NRBW_DBG, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_ADCCLK, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_FLTRST, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_FLTRST, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0xf);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_EN, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_SAMPL_DLY_T_V1, BIT(1), 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0x3);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]before S0 ADDCK\n");
|
||||
+ _check_addc(rtwdev, RF_PATH_A);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0_TRG, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0_TRG, 0x0);
|
||||
+ udelay(1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK0, B_ADDCK0, 0x1);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(rtw89_phy_read32_mask, val, val, 1, 10000,
|
||||
+ false, rtwdev, R_ADDCKR0, BIT(0));
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S0 ADDCK timeout\n");
|
||||
+ dack->addck_timeout[0] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]ADDCK ret = %d\n", ret);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]after S0 ADDCK\n");
|
||||
+ _check_addc(rtwdev, RF_PATH_A);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH0_SAMPL_DLY_T_V1, BIT(1), 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_EN, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0xc);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_ADCCLK, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_NRBW, B_P0_NRBW_DBG, 0x0);
|
||||
+
|
||||
+ /* S1 */
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_DBGMOD, B_P1_DBGMOD_ON, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_ADCCLK, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_FLTRST, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_FLTRST, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0xf);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_EN, 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_SAMPL_DLY_T_V1, BIT(1), 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0x3);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]before S1 ADDCK\n");
|
||||
+ _check_addc(rtwdev, RF_PATH_B);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK1_TRG, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK1_TRG, 0x0);
|
||||
+ udelay(1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ADDCK1, B_ADDCK1, 0x1);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(rtw89_phy_read32_mask, val, val, 1, 10000,
|
||||
+ false, rtwdev, R_ADDCKR1, BIT(0));
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S1 ADDCK timeout\n");
|
||||
+ dack->addck_timeout[1] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]ADDCK ret = %d\n", ret);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]after S1 ADDCK\n");
|
||||
+ _check_addc(rtwdev, RF_PATH_B);
|
||||
+
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_PATH1_SAMPL_DLY_T_V1, BIT(1), 0x0);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_EN, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR_PW15, B_ANAPAR_PW15_H, 0xc);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_ANAPAR, B_ANAPAR_ADCCLK, 0x1);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_DBGMOD, B_P1_DBGMOD_ON, 0x0);
|
||||
+}
|
||||
+
|
||||
+static void _check_dadc(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
+{
|
||||
+ rtw89_rfk_parser_by_cond(rtwdev, path == RF_PATH_A,
|
||||
+ &rtw8852b_check_dadc_en_defs_a_tbl,
|
||||
+ &rtw8852b_check_dadc_en_defs_b_tbl);
|
||||
+
|
||||
+ _check_addc(rtwdev, path);
|
||||
+
|
||||
+ rtw89_rfk_parser_by_cond(rtwdev, path == RF_PATH_A,
|
||||
+ &rtw8852b_check_dadc_dis_defs_a_tbl,
|
||||
+ &rtw8852b_check_dadc_dis_defs_b_tbl);
|
||||
+}
|
||||
+
|
||||
+static bool _dack_s0_check_done(struct rtw89_dev *rtwdev, bool part1)
|
||||
+{
|
||||
+ if (part1) {
|
||||
+ if (rtw89_phy_read32_mask(rtwdev, R_DACK_S0P0, B_DACK_S0P0_OK) == 0 ||
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_S0P1, B_DACK_S0P1_OK) == 0)
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ if (rtw89_phy_read32_mask(rtwdev, R_DACK_S0P2, B_DACK_S0P2_OK) == 0 ||
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_S0P3, B_DACK_S0P3_OK) == 0)
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static void _dack_s0(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ bool done;
|
||||
+ int ret;
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s0_1_defs_tbl);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(_dack_s0_check_done, done, done, 1, 10000,
|
||||
+ false, rtwdev, true);
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S0 MSBK timeout\n");
|
||||
+ dack->msbk_timeout[0] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK ret = %d\n", ret);
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s0_2_defs_tbl);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(_dack_s0_check_done, done, done, 1, 10000,
|
||||
+ false, rtwdev, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S0 DADCK timeout\n");
|
||||
+ dack->dadck_timeout[0] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK ret = %d\n", ret);
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s0_3_defs_tbl);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]after S0 DADCK\n");
|
||||
+
|
||||
+ _dack_backup_s0(rtwdev);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P0_NRBW, B_P0_NRBW_DBG, 0x0);
|
||||
+}
|
||||
+
|
||||
+static bool _dack_s1_check_done(struct rtw89_dev *rtwdev, bool part1)
|
||||
+{
|
||||
+ if (part1) {
|
||||
+ if (rtw89_phy_read32_mask(rtwdev, R_DACK_S1P0, B_DACK_S1P0_OK) == 0 &&
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK_S1P1, B_DACK_S1P1_OK) == 0)
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ if (rtw89_phy_read32_mask(rtwdev, R_DACK10S, B_DACK_S1P2_OK) == 0 &&
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DACK11S, B_DACK_S1P3_OK) == 0)
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static void _dack_s1(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ bool done;
|
||||
+ int ret;
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s1_1_defs_tbl);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(_dack_s1_check_done, done, done, 1, 10000,
|
||||
+ false, rtwdev, true);
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S1 MSBK timeout\n");
|
||||
+ dack->msbk_timeout[1] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK ret = %d\n", ret);
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s1_2_defs_tbl);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(_dack_s1_check_done, done, done, 1, 10000,
|
||||
+ false, rtwdev, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S1 DADCK timeout\n");
|
||||
+ dack->dadck_timeout[1] = true;
|
||||
+ }
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK ret = %d\n", ret);
|
||||
+
|
||||
+ rtw89_rfk_parser(rtwdev, &rtw8852b_dack_s1_3_defs_tbl);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]after S1 DADCK\n");
|
||||
+
|
||||
+ _check_dadc(rtwdev, RF_PATH_B);
|
||||
+ _dack_backup_s1(rtwdev);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_P1_DBGMOD, B_P1_DBGMOD_ON, 0x0);
|
||||
+}
|
||||
+
|
||||
+static void _dack(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ _dack_s0(rtwdev);
|
||||
+ _dack_s1(rtwdev);
|
||||
+}
|
||||
+
|
||||
+static void _dack_dump(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ u8 i;
|
||||
+ u8 t;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S0 ADC_DCK ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->addck_d[0][0], dack->addck_d[0][1]);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S1 ADC_DCK ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->addck_d[1][0], dack->addck_d[1][1]);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S0 DAC_DCK ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->dadck_d[0][0], dack->dadck_d[0][1]);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S1 DAC_DCK ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->dadck_d[1][0], dack->dadck_d[1][1]);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S0 biask ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->biask_d[0][0], dack->biask_d[0][1]);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[DACK]S1 biask ic = 0x%x, qc = 0x%x\n",
|
||||
+ dack->biask_d[1][0], dack->biask_d[1][1]);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S0 MSBK ic:\n");
|
||||
+ for (i = 0; i < 0x10; i++) {
|
||||
+ t = dack->msbk_d[0][0][i];
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]0x%x\n", t);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S0 MSBK qc:\n");
|
||||
+ for (i = 0; i < RTW89_DACK_MSBK_NR; i++) {
|
||||
+ t = dack->msbk_d[0][1][i];
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]0x%x\n", t);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S1 MSBK ic:\n");
|
||||
+ for (i = 0; i < RTW89_DACK_MSBK_NR; i++) {
|
||||
+ t = dack->msbk_d[1][0][i];
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]0x%x\n", t);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]S1 MSBK qc:\n");
|
||||
+ for (i = 0; i < RTW89_DACK_MSBK_NR; i++) {
|
||||
+ t = dack->msbk_d[1][1][i];
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]0x%x\n", t);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
+{
|
||||
+ struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
+ u32 rf0_0, rf1_0;
|
||||
+
|
||||
+ dack->dack_done = false;
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK 0x1\n");
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK start!!!\n");
|
||||
+
|
||||
+ rf0_0 = rtw89_read_rf(rtwdev, RF_PATH_A, RR_MOD, RFREG_MASK);
|
||||
+ rf1_0 = rtw89_read_rf(rtwdev, RF_PATH_B, RR_MOD, RFREG_MASK);
|
||||
+ _afe_init(rtwdev);
|
||||
+ _drck(rtwdev);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_MOD, RFREG_MASK, 0x337e1);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_MOD, RFREG_MASK, 0x337e1);
|
||||
+ _addck(rtwdev);
|
||||
+ _addck_backup(rtwdev);
|
||||
+ _addck_reload(rtwdev);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_MODOPT, RFREG_MASK, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_MODOPT, RFREG_MASK, 0x0);
|
||||
+ _dack(rtwdev);
|
||||
+ _dack_dump(rtwdev);
|
||||
+ dack->dack_done = true;
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_MOD, RFREG_MASK, rf0_0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_MOD, RFREG_MASK, rf1_0);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_A, RR_RSV1, RR_RSV1_RST, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, RF_PATH_B, RR_RSV1, RR_RSV1_RST, 0x1);
|
||||
+ dack->dack_cnt++;
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK finish!!!\n");
|
||||
+}
|
||||
+
|
||||
+void rtw8852b_dack(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0);
|
||||
+
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_START);
|
||||
+ _dac_cal(rtwdev, false);
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
+}
|
||||
+
|
||||
static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
enum rtw89_bandwidth bw, bool dav)
|
||||
{
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
index d54256bbc9a0a..bc2ff7380b927 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "core.h"
|
||||
|
||||
+void rtw8852b_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,106 @@
|
||||
From f632e0efad2e9347aba7d5b1df4d0dbb8fa9564d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:25 +0200
|
||||
Subject: [PATCH 034/142] wifi: rtw89: 8852b: rfk: add RCK
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 10298b53bff642e586e5b82616914c9fa3d9a906
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 12 16:32:31 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: rfk: add RCK
|
||||
|
||||
RCK is synchronize RC calibration. Driver triggers this calibration and
|
||||
sets the result to register. This calibration is needed once when interface
|
||||
is going to up.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221012083234.20224-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 43 +++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h | 1 +
|
||||
2 files changed, 44 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
index 5c35f4fb38ff5..1dcb900ef7007 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
@@ -32,6 +32,41 @@ static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return val;
|
||||
}
|
||||
|
||||
+static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
+{
|
||||
+ u32 rf_reg5;
|
||||
+ u32 rck_val;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] ====== S%d RCK ======\n", path);
|
||||
+
|
||||
+ rf_reg5 = rtw89_read_rf(rtwdev, path, RR_RSV1, RFREG_MASK);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] RF0x00 = 0x%05x\n",
|
||||
+ rtw89_read_rf(rtwdev, path, RR_MOD, RFREG_MASK));
|
||||
+
|
||||
+ /* RCK trigger */
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RCKC, RFREG_MASK, 0x00240);
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(rtw89_read_rf, val, val, 2, 30,
|
||||
+ false, rtwdev, path, RR_RCKS, BIT(3));
|
||||
+
|
||||
+ rck_val = rtw89_read_rf(rtwdev, path, RR_RCKC, RR_RCKC_CA);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] rck_val = 0x%x, ret = %d\n",
|
||||
+ rck_val, ret);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RCKC, RFREG_MASK, rck_val);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RSV1, RFREG_MASK, rf_reg5);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] RF 0x1b = 0x%x\n",
|
||||
+ rtw89_read_rf(rtwdev, path, RR_RCKC, RFREG_MASK));
|
||||
+}
|
||||
+
|
||||
static void _afe_init(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
rtw89_write32(rtwdev, R_AX_PHYREG_SET, 0xf);
|
||||
@@ -453,6 +488,14 @@ static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK finish!!!\n");
|
||||
}
|
||||
|
||||
+void rtw8852b_rck(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ u8 path;
|
||||
+
|
||||
+ for (path = 0; path < RF_PATH_NUM_8852B; path++)
|
||||
+ _rck(rtwdev, path);
|
||||
+}
|
||||
+
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
index bc2ff7380b927..84325abc7f2c2 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "core.h"
|
||||
|
||||
+void rtw8852b_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,152 @@
|
||||
From 9c5751f4eedd79a896915d7248106bb7e794b537 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 035/142] wifi: rtw89: 8852b: rfk: add RX DCK
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 212671074ab2f3e33fd5e95392c7356410ad7f8d
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Wed Oct 12 16:32:32 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: rfk: add RX DCK
|
||||
|
||||
RX DCK is receiver DC calibration. With this calibration, we have proper
|
||||
DC offset to reflect correct received signal strength indicator. Do this
|
||||
calibration when bringing up interface and going to run on AP channel.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221012083234.20224-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 75 +++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h | 1 +
|
||||
2 files changed, 76 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
index 1dcb900ef7007..306f6a292c59a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "rtw8852b_rfk_table.h"
|
||||
#include "rtw8852b_table.h"
|
||||
|
||||
+#define RTW8852B_RXDCK_VER 0x1
|
||||
#define ADDC_T_AVG 100
|
||||
|
||||
static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
@@ -32,6 +33,47 @@ static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return val;
|
||||
}
|
||||
|
||||
+static void _set_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
+ enum rtw89_rf_path path)
|
||||
+{
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK1, RR_DCK1_CLR, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_LV, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_LV, 0x1);
|
||||
+ mdelay(1);
|
||||
+}
|
||||
+
|
||||
+static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
+{
|
||||
+ u8 path, dck_tune;
|
||||
+ u32 rf_reg5;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] ****** RXDCK Start (Ver: 0x%x, CV : 0x%x) ******\n",
|
||||
+ RTW8852B_RXDCK_VER, rtwdev->hal.cv);
|
||||
+
|
||||
+ for (path = 0; path < RF_PATH_NUM_8852B; path++) {
|
||||
+ rf_reg5 = rtw89_read_rf(rtwdev, path, RR_RSV1, RFREG_MASK);
|
||||
+ dck_tune = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_FINE);
|
||||
+
|
||||
+ if (rtwdev->is_tssi_mode[path])
|
||||
+ rtw89_phy_write32_mask(rtwdev,
|
||||
+ R_P0_TSSI_TRK + (path << 13),
|
||||
+ B_P0_TSSI_TRK_EN, 0x1);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX);
|
||||
+ _set_rx_dck(rtwdev, phy, path);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, dck_tune);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RSV1, RFREG_MASK, rf_reg5);
|
||||
+
|
||||
+ if (rtwdev->is_tssi_mode[path])
|
||||
+ rtw89_phy_write32_mask(rtwdev,
|
||||
+ R_P0_TSSI_TRK + (path << 13),
|
||||
+ B_P0_TSSI_TRK_EN, 0x0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
{
|
||||
u32 rf_reg5;
|
||||
@@ -488,6 +530,24 @@ static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK finish!!!\n");
|
||||
}
|
||||
|
||||
+static void _wait_rx_mode(struct rtw89_dev *rtwdev, u8 kpath)
|
||||
+{
|
||||
+ u32 rf_mode;
|
||||
+ u8 path;
|
||||
+ int ret;
|
||||
+
|
||||
+ for (path = 0; path < RF_PATH_MAX; path++) {
|
||||
+ if (!(kpath & BIT(path)))
|
||||
+ continue;
|
||||
+
|
||||
+ ret = read_poll_timeout_atomic(rtw89_read_rf, rf_mode,
|
||||
+ rf_mode != 2, 2, 5000, false,
|
||||
+ rtwdev, path, RR_MOD, RR_MOD_MASK);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RFK] Wait S%d to Rx mode!! (ret = %d)\n", path, ret);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void rtw8852b_rck(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
u8 path;
|
||||
@@ -505,6 +565,21 @@ void rtw8852b_dack(struct rtw89_dev *rtwdev)
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
+void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0);
|
||||
+ u32 tx_en;
|
||||
+
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
+ rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
+ _wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
+
|
||||
+ _rx_dck(rtwdev, phy_idx);
|
||||
+
|
||||
+ rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
+}
|
||||
+
|
||||
static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
enum rtw89_bandwidth bw, bool dav)
|
||||
{
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
index 84325abc7f2c2..24e492484d274 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.h
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
void rtw8852b_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev);
|
||||
+void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852b_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
--
|
||||
2.13.6
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,93 @@
|
||||
From facc5c5a95613e256dac7e121532ebc8d0278e8f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 039/142] wifi: rtw89: 8852b: add chip_ops related to RF
|
||||
calibration
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit ef8acbcac6816e4caf20934932b4881d775c6f37
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Oct 14 14:02:35 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add chip_ops related to RF calibration
|
||||
|
||||
Since RF calibrations are added, add chip_ops to call them. These chip_ops
|
||||
include initial, full calibration, configuration when switching band and
|
||||
scanning, and track work in period of 2 seconds.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221014060237.29050-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 42 +++++++++++++++++++++++++++
|
||||
1 file changed, 42 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 0918b75ab1d94..0df044b1c392a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1513,6 +1513,43 @@ static void rtw8852b_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtw8852b_rfk_init(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ rtwdev->is_tssi_mode[RF_PATH_A] = false;
|
||||
+ rtwdev->is_tssi_mode[RF_PATH_B] = false;
|
||||
+
|
||||
+ rtw8852b_dpk_init(rtwdev);
|
||||
+ rtw8852b_rck(rtwdev);
|
||||
+ rtw8852b_dack(rtwdev);
|
||||
+ rtw8852b_rx_dck(rtwdev, RTW89_PHY_0);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_rfk_channel(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
|
||||
+
|
||||
+ rtw8852b_rx_dck(rtwdev, phy_idx);
|
||||
+ rtw8852b_iqk(rtwdev, phy_idx);
|
||||
+ rtw8852b_tssi(rtwdev, phy_idx, true);
|
||||
+ rtw8852b_dpk(rtwdev, phy_idx);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_phy_idx phy_idx)
|
||||
+{
|
||||
+ rtw8852b_tssi_scan(rtwdev, phy_idx);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_rfk_scan(struct rtw89_dev *rtwdev, bool start)
|
||||
+{
|
||||
+ rtw8852b_wifi_scan_notify(rtwdev, start, RTW89_PHY_0);
|
||||
+}
|
||||
+
|
||||
+static void rtw8852b_rfk_track(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ rtw8852b_dpk_track(rtwdev);
|
||||
+}
|
||||
+
|
||||
static u32 rtw8852b_bb_cal_txpwr_ref(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, s16 ref)
|
||||
{
|
||||
@@ -2346,6 +2383,11 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.read_efuse = rtw8852b_read_efuse,
|
||||
.read_phycap = rtw8852b_read_phycap,
|
||||
.fem_setup = NULL,
|
||||
+ .rfk_init = rtw8852b_rfk_init,
|
||||
+ .rfk_channel = rtw8852b_rfk_channel,
|
||||
+ .rfk_band_changed = rtw8852b_rfk_band_changed,
|
||||
+ .rfk_scan = rtw8852b_rfk_scan,
|
||||
+ .rfk_track = rtw8852b_rfk_track,
|
||||
.power_trim = rtw8852b_power_trim,
|
||||
.set_txpwr = rtw8852b_set_txpwr,
|
||||
.set_txpwr_ctrl = rtw8852b_set_txpwr_ctrl,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,70 @@
|
||||
From 70297ae944cd34309365bcfe5a061b0bb64b4aae Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 040/142] wifi: rtw89: phy: add dummy C2H handler to avoid
|
||||
warning message
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 3b66519b023b9de3239576b938bbdf43f95bc862
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Oct 14 14:02:36 2022 +0800
|
||||
|
||||
wifi: rtw89: phy: add dummy C2H handler to avoid warning message
|
||||
|
||||
The C2H class 2 function 3 is to report retry count of low rate, but driver
|
||||
doesn't implement yet, so add a dummy case to avoid message:
|
||||
|
||||
rtw89_8852be 0000:03:00.0: c2h class 2 not support
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221014060237.29050-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 4 ++++
|
||||
drivers/net/wireless/realtek/rtw89/phy.h | 9 +++++++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 13b16ec0d8077..0bd2a0cea7ff1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -2276,6 +2276,10 @@ void rtw89_phy_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
if (func < RTW89_PHY_C2H_FUNC_RA_MAX)
|
||||
handler = rtw89_phy_c2h_ra_handler[func];
|
||||
break;
|
||||
+ case RTW89_PHY_C2H_CLASS_DM:
|
||||
+ if (func == RTW89_PHY_C2H_DM_FUNC_LOWRT_RTY)
|
||||
+ return;
|
||||
+ fallthrough;
|
||||
default:
|
||||
rtw89_info(rtwdev, "c2h class %d not support\n", class);
|
||||
return;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
index 1e122b1498ba1..995c13f6f906c 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
@@ -114,6 +114,15 @@ enum rtw89_phy_c2h_ra_func {
|
||||
RTW89_PHY_C2H_FUNC_RA_MAX,
|
||||
};
|
||||
|
||||
+enum rtw89_phy_c2h_dm_func {
|
||||
+ RTW89_PHY_C2H_DM_FUNC_FW_TEST,
|
||||
+ RTW89_PHY_C2H_DM_FUNC_FW_TRIG_TX_RPT,
|
||||
+ RTW89_PHY_C2H_DM_FUNC_SIGB,
|
||||
+ RTW89_PHY_C2H_DM_FUNC_LOWRT_RTY,
|
||||
+ RTW89_PHY_C2H_DM_FUNC_MCC_DIG,
|
||||
+ RTW89_PHY_C2H_DM_FUNC_NUM,
|
||||
+};
|
||||
+
|
||||
enum rtw89_phy_c2h_class {
|
||||
RTW89_PHY_C2H_CLASS_RUA,
|
||||
RTW89_PHY_C2H_CLASS_RA,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,88 @@
|
||||
From 1c92b04d8de44d85791160d5889ddc9e2b12e3de Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 041/142] wifi: rtw89: 8852b: add 8852be to Makefile and
|
||||
Kconfig
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b5db4ef38e21dd9b6b95ae96cea5032b00e04f24
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Oct 14 14:02:37 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: add 8852be to Makefile and Kconfig
|
||||
|
||||
Now, basic materials for 8852be are ready, so add 8852be to Kconfig and
|
||||
Makefile. Current version can support STA, AP and monitor modes.
|
||||
|
||||
We still fine tune some features, such as BT coexistence, performance, and
|
||||
power consumption.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221014060237.29050-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/Kconfig | 14 ++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/Makefile | 9 +++++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/Kconfig b/drivers/net/wireless/realtek/rtw89/Kconfig
|
||||
index 93e09400aac49..2b20cf8bbf3aa 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/Kconfig
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/Kconfig
|
||||
@@ -19,6 +19,9 @@ config RTW89_PCI
|
||||
config RTW89_8852A
|
||||
tristate
|
||||
|
||||
+config RTW89_8852B
|
||||
+ tristate
|
||||
+
|
||||
config RTW89_8852C
|
||||
tristate
|
||||
|
||||
@@ -33,6 +36,17 @@ config RTW89_8852AE
|
||||
|
||||
802.11ax PCIe wireless network (Wi-Fi 6) adapter
|
||||
|
||||
+config RTW89_8852BE
|
||||
+ tristate "Realtek 8852BE PCI wireless network (Wi-Fi 6) adapter"
|
||||
+ depends on PCI
|
||||
+ select RTW89_CORE
|
||||
+ select RTW89_PCI
|
||||
+ select RTW89_8852B
|
||||
+ help
|
||||
+ Select this option will enable support for 8852BE chipset
|
||||
+
|
||||
+ 802.11ax PCIe wireless network (Wi-Fi 6) adapter
|
||||
+
|
||||
config RTW89_8852CE
|
||||
tristate "Realtek 8852CE PCI wireless network (Wi-Fi 6E) adapter"
|
||||
depends on PCI
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/Makefile b/drivers/net/wireless/realtek/rtw89/Makefile
|
||||
index a87f2aff4def2..ec0f5da65d6a1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/Makefile
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/Makefile
|
||||
@@ -24,6 +24,15 @@ rtw89_8852a-objs := rtw8852a.o \
|
||||
obj-$(CONFIG_RTW89_8852AE) += rtw89_8852ae.o
|
||||
rtw89_8852ae-objs := rtw8852ae.o
|
||||
|
||||
+obj-$(CONFIG_RTW89_8852B) += rtw89_8852b.o
|
||||
+rtw89_8852b-objs := rtw8852b.o \
|
||||
+ rtw8852b_table.o \
|
||||
+ rtw8852b_rfk.o \
|
||||
+ rtw8852b_rfk_table.o
|
||||
+
|
||||
+obj-$(CONFIG_RTW89_8852BE) += rtw89_8852be.o
|
||||
+rtw89_8852be-objs := rtw8852be.o
|
||||
+
|
||||
obj-$(CONFIG_RTW89_8852C) += rtw89_8852c.o
|
||||
rtw89_8852c-objs := rtw8852c.o \
|
||||
rtw8852c_table.o \
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,128 @@
|
||||
From ebee051e5d5c1fae6266c442d53e72a2bb3988db Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 042/142] wifi: rtw89: fw: adapt to new firmware format of
|
||||
dynamic header
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 4feda7f317cb7e4b6fcdaffb0d1ad363ee28fdea
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Thu Oct 20 13:25:49 2022 +0800
|
||||
|
||||
wifi: rtw89: fw: adapt to new firmware format of dynamic header
|
||||
|
||||
Since firmware size is limited, we create variant firmwares for variant
|
||||
application areas. To help driver to know firmware's capabilities, firmware
|
||||
dynamic header is introduced to have more information, such as firmware
|
||||
features and firmware compile flags.
|
||||
|
||||
Since this driver rtw89 only uses single one specific firmware at runtime,
|
||||
this patch is just to ignore this dynamic header, not actually use the
|
||||
content.
|
||||
|
||||
This patch can be backward compatible, and no this kind of firmware is
|
||||
added to linux-firmware yet, so I can prepare this in advance.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221020052549.33783-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 22 +++++++++++++++++++---
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 12 ++++++++++++
|
||||
2 files changed, 31 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index d3500a70af4dd..e9f84d43ce0c9 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -85,15 +85,31 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, const u8 *fw, u32 len,
|
||||
{
|
||||
struct rtw89_fw_hdr_section_info *section_info;
|
||||
const u8 *fw_end = fw + len;
|
||||
+ const u8 *fwdynhdr;
|
||||
const u8 *bin;
|
||||
+ u32 base_hdr_len;
|
||||
u32 i;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
info->section_num = GET_FW_HDR_SEC_NUM(fw);
|
||||
- info->hdr_len = RTW89_FW_HDR_SIZE +
|
||||
- info->section_num * RTW89_FW_SECTION_HDR_SIZE;
|
||||
+ base_hdr_len = RTW89_FW_HDR_SIZE +
|
||||
+ info->section_num * RTW89_FW_SECTION_HDR_SIZE;
|
||||
+ info->dynamic_hdr_en = GET_FW_HDR_DYN_HDR(fw);
|
||||
+
|
||||
+ if (info->dynamic_hdr_en) {
|
||||
+ info->hdr_len = GET_FW_HDR_LEN(fw);
|
||||
+ info->dynamic_hdr_len = info->hdr_len - base_hdr_len;
|
||||
+ fwdynhdr = fw + base_hdr_len;
|
||||
+ if (GET_FW_DYNHDR_LEN(fwdynhdr) != info->dynamic_hdr_len) {
|
||||
+ rtw89_err(rtwdev, "[ERR]invalid fw dynamic header len\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ info->hdr_len = base_hdr_len;
|
||||
+ info->dynamic_hdr_len = 0;
|
||||
+ }
|
||||
|
||||
bin = fw + info->hdr_len;
|
||||
|
||||
@@ -534,7 +550,7 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type)
|
||||
goto fwdl_err;
|
||||
}
|
||||
|
||||
- ret = rtw89_fw_download_hdr(rtwdev, fw, info.hdr_len);
|
||||
+ ret = rtw89_fw_download_hdr(rtwdev, fw, info.hdr_len - info.dynamic_hdr_len);
|
||||
if (ret) {
|
||||
ret = -EBUSY;
|
||||
goto fwdl_err;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 6ef392ef9c6fb..8563efa5f6411 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -176,6 +176,8 @@ struct rtw89_fw_hdr_section_info {
|
||||
struct rtw89_fw_bin_info {
|
||||
u8 section_num;
|
||||
u32 hdr_len;
|
||||
+ bool dynamic_hdr_en;
|
||||
+ u32 dynamic_hdr_len;
|
||||
struct rtw89_fw_hdr_section_info section_info[FWDL_SECTION_MAX_NUM];
|
||||
};
|
||||
|
||||
@@ -495,6 +497,8 @@ static inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), GENMASK(23, 16))
|
||||
#define GET_FW_HDR_SUBINDEX(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), GENMASK(31, 24))
|
||||
+#define GET_FW_HDR_LEN(fwhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwhdr) + 3), GENMASK(23, 16))
|
||||
#define GET_FW_HDR_MONTH(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 4), GENMASK(7, 0))
|
||||
#define GET_FW_HDR_DATE(fwhdr) \
|
||||
@@ -507,8 +511,16 @@ static inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 5), GENMASK(31, 0))
|
||||
#define GET_FW_HDR_SEC_NUM(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 6), GENMASK(15, 8))
|
||||
+#define GET_FW_HDR_DYN_HDR(fwhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwhdr) + 7), BIT(16))
|
||||
#define GET_FW_HDR_CMD_VERSERION(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 7), GENMASK(31, 24))
|
||||
+
|
||||
+#define GET_FW_DYNHDR_LEN(fwdynhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwdynhdr)), GENMASK(31, 0))
|
||||
+#define GET_FW_DYNHDR_COUNT(fwdynhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwdynhdr) + 1), GENMASK(31, 0))
|
||||
+
|
||||
static inline void SET_FW_HDR_PART_SIZE(void *fwhdr, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)fwhdr + 7, val, GENMASK(15, 0));
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,64 @@
|
||||
From d7eadb913ff78209ccac0aa347d484478ea2388f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:26 +0200
|
||||
Subject: [PATCH 043/142] wifi: rtw89: declare support bands with const
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit a29dba478b6f4e8d3fbfe0b2f097cad1e0b93cf6
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Thu Oct 20 13:27:01 2022 +0800
|
||||
|
||||
wifi: rtw89: declare support bands with const
|
||||
|
||||
They are just default declarations and we won't modify them directly.
|
||||
Instead, we actually do moification on their memdup now. So, they
|
||||
should be declared with const.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221020052702.33988-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index ee2214fd92d04..08bcdf5084743 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -171,7 +171,7 @@ bool rtw89_ra_report_to_bitrate(struct rtw89_dev *rtwdev, u8 rpt_rate, u16 *bitr
|
||||
return true;
|
||||
}
|
||||
|
||||
-static struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
+static const struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
.band = NL80211_BAND_2GHZ,
|
||||
.channels = rtw89_channels_2ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_2ghz),
|
||||
@@ -181,7 +181,7 @@ static struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
.vht_cap = {0},
|
||||
};
|
||||
|
||||
-static struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
+static const struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
.band = NL80211_BAND_5GHZ,
|
||||
.channels = rtw89_channels_5ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_5ghz),
|
||||
@@ -193,7 +193,7 @@ static struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
.vht_cap = {0},
|
||||
};
|
||||
|
||||
-static struct ieee80211_supported_band rtw89_sband_6ghz = {
|
||||
+static const struct ieee80211_supported_band rtw89_sband_6ghz = {
|
||||
.band = NL80211_BAND_6GHZ,
|
||||
.channels = rtw89_channels_6ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_6ghz),
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 04d625bd28b099ff6205b5211c6514ce7b0bfd56 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 044/142] wifi: rtw89: 8852c: make table of RU mask constant
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit e69ae29e00cec66609bd555398aa4f59f2a9ae84
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Thu Oct 20 13:27:02 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: make table of RU mask constant
|
||||
|
||||
This table must be constant, so change it as expectation.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221020052702.33988-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index f6bcac8268166..7e208a8fdf4bb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -1683,12 +1683,12 @@ static void rtw8852c_set_channel_bb(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
+ static const u32 ru_alloc_msk[2] = {B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY0,
|
||||
+ B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY1};
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
bool cck_en = chan->band_type == RTW89_BAND_2G;
|
||||
u8 pri_ch_idx = chan->pri_ch_idx;
|
||||
u32 mask, reg;
|
||||
- u32 ru_alloc_msk[2] = {B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY0,
|
||||
- B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY1};
|
||||
u8 ntx_path;
|
||||
|
||||
if (chan->band_type == RTW89_BAND_2G)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,79 @@
|
||||
From 8486f00b56da2f777031732bad52a3e68f308720 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 045/142] wifi: rtw89: add BW info for both TX and RX in
|
||||
phy_info
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 25f49617b5c9c9afa829030f14606be6351d4771
|
||||
Author: Eric Huang <echuang@realtek.com>
|
||||
Date: Fri Oct 21 17:16:01 2022 +0800
|
||||
|
||||
wifi: rtw89: add BW info for both TX and RX in phy_info
|
||||
|
||||
In order to debug performance issue intuitively, add bandwidth information
|
||||
into debugfs entry phy_info. After applying this patch, it looks like:
|
||||
|
||||
TX rate [0]: HE 2SS MCS-11 GI:0.8 BW:80 (hw_rate=0x19b) ==> agg_wait=1 (3500)
|
||||
RX rate [0]: HE 2SS MCS-9 GI:0.8 BW:80 (hw_rate=0x199)
|
||||
|
||||
Signed-off-by: Eric Huang <echuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221021091601.39884-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/debug.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
index 8f27c883eeabb..cd44d9aa37ca0 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
@@ -51,6 +51,22 @@ struct rtw89_debugfs_priv {
|
||||
};
|
||||
};
|
||||
|
||||
+static const u16 rtw89_rate_info_bw_to_mhz_map[] = {
|
||||
+ [RATE_INFO_BW_20] = 20,
|
||||
+ [RATE_INFO_BW_40] = 40,
|
||||
+ [RATE_INFO_BW_80] = 80,
|
||||
+ [RATE_INFO_BW_160] = 160,
|
||||
+ [RATE_INFO_BW_320] = 320,
|
||||
+};
|
||||
+
|
||||
+static u16 rtw89_rate_info_bw_to_mhz(enum rate_info_bw bw)
|
||||
+{
|
||||
+ if (bw < ARRAY_SIZE(rtw89_rate_info_bw_to_mhz_map))
|
||||
+ return rtw89_rate_info_bw_to_mhz_map[bw];
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rtw89_debugfs_single_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct rtw89_debugfs_priv *debugfs_priv = m->private;
|
||||
@@ -2379,6 +2395,7 @@ static void rtw89_sta_info_get_iter(void *data, struct ieee80211_sta *sta)
|
||||
else
|
||||
seq_printf(m, "Legacy %d", rate->legacy);
|
||||
seq_printf(m, "%s", rtwsta->ra_report.might_fallback_legacy ? " FB_G" : "");
|
||||
+ seq_printf(m, " BW:%u", rtw89_rate_info_bw_to_mhz(rate->bw));
|
||||
seq_printf(m, "\t(hw_rate=0x%x)", rtwsta->ra_report.hw_rate);
|
||||
seq_printf(m, "\t==> agg_wait=%d (%d)\n", rtwsta->max_agg_wait,
|
||||
sta->deflink.agg.max_rc_amsdu_len);
|
||||
@@ -2404,6 +2421,7 @@ static void rtw89_sta_info_get_iter(void *data, struct ieee80211_sta *sta)
|
||||
he_gi_str[rate->he_gi] : "N/A");
|
||||
break;
|
||||
}
|
||||
+ seq_printf(m, " BW:%u", rtw89_rate_info_bw_to_mhz(status->bw));
|
||||
seq_printf(m, "\t(hw_rate=0x%x)\n", rtwsta->rx_hw_rate);
|
||||
|
||||
rssi = ewma_rssi_read(&rtwsta->avg_rssi);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,46 @@
|
||||
From c332db533d9559a6da86939e1378ccfaedea3090 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 046/142] wifi: rtw89: check if sta's mac_id is valid under
|
||||
AP/TDLS
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 46245bc42aff5e67b0498fa365a4baeaaaaeda86
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Fri Oct 21 17:18:28 2022 +0800
|
||||
|
||||
wifi: rtw89: check if sta's mac_id is valid under AP/TDLS
|
||||
|
||||
Add boundary check of mac_id when adding sta under AP/TDLS.
|
||||
And, return -ENOSPC if the acquired mac_id is invalid.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221021091828.40157-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 08bcdf5084743..45babf1a857d1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -2413,6 +2413,8 @@ int rtw89_core_sta_add(struct rtw89_dev *rtwdev,
|
||||
} else if (vif->type == NL80211_IFTYPE_AP || sta->tdls) {
|
||||
rtwsta->mac_id = rtw89_core_acquire_bit_map(rtwdev->mac_id_map,
|
||||
RTW89_MAX_MAC_ID_NUM);
|
||||
+ if (rtwsta->mac_id == RTW89_MAX_MAC_ID_NUM)
|
||||
+ return -ENOSPC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,124 @@
|
||||
From ebf2cfc3ca05dfc0e9b0497f6412271efe4b87d1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 047/142] wifi: rtw89: collect and send RF parameters to
|
||||
firmware for WoWLAN
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d9112042d9942648825d3ebe837dd33dbd7c6ddb
|
||||
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Date: Thu Oct 27 13:27:01 2022 +0800
|
||||
|
||||
wifi: rtw89: collect and send RF parameters to firmware for WoWLAN
|
||||
|
||||
For WoWLAN mode, we only collect and send RF parameters to Firmware
|
||||
without writing RF registers. So we add one function to practice it.
|
||||
|
||||
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 2 +-
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 31 +++++++++++++++++++++++++++++--
|
||||
drivers/net/wireless/realtek/rtw89/phy.h | 2 +-
|
||||
3 files changed, 31 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 45babf1a857d1..c285707b21bb1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -2962,7 +2962,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
|
||||
return ret;
|
||||
|
||||
rtw89_phy_init_bb_reg(rtwdev);
|
||||
- rtw89_phy_init_rf_reg(rtwdev);
|
||||
+ rtw89_phy_init_rf_reg(rtwdev, false);
|
||||
|
||||
rtw89_btc_ntfy_init(rtwdev, BTC_MODE_NORMAL);
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 0bd2a0cea7ff1..944bb0f2ee633 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -801,6 +801,11 @@ bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_write_rf_v1);
|
||||
|
||||
+static bool rtw89_chip_rf_v1(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ return rtwdev->chip->ops->write_rf == rtw89_phy_write_rf_v1;
|
||||
+}
|
||||
+
|
||||
static void rtw89_phy_bb_reset(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -1123,6 +1128,24 @@ static int rtw89_phy_config_rf_reg_fw(struct rtw89_dev *rtwdev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static void rtw89_phy_config_rf_reg_noio(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_reg2_def *reg,
|
||||
+ enum rtw89_rf_path rf_path,
|
||||
+ void *extra_data)
|
||||
+{
|
||||
+ u32 addr = reg->addr;
|
||||
+
|
||||
+ if (addr == 0xfe || addr == 0xfd || addr == 0xfc || addr == 0xfb ||
|
||||
+ addr == 0xfa || addr == 0xf9)
|
||||
+ return;
|
||||
+
|
||||
+ if (rtw89_chip_rf_v1(rtwdev) && addr < 0x100)
|
||||
+ return;
|
||||
+
|
||||
+ rtw89_phy_cofig_rf_reg_store(rtwdev, reg, rf_path,
|
||||
+ (struct rtw89_fw_h2c_rf_reg_info *)extra_data);
|
||||
+}
|
||||
+
|
||||
static void rtw89_phy_config_rf_reg(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path,
|
||||
@@ -1335,7 +1358,7 @@ static u32 rtw89_phy_nctl_poll(struct rtw89_dev *rtwdev)
|
||||
return rtw89_phy_read32(rtwdev, 0x8080);
|
||||
}
|
||||
|
||||
-void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||||
+void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio)
|
||||
{
|
||||
void (*config)(struct rtw89_dev *rtwdev, const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path, void *data);
|
||||
@@ -1351,7 +1374,11 @@ void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||||
for (path = RF_PATH_A; path < chip->rf_path_num; path++) {
|
||||
rf_table = chip->rf_table[path];
|
||||
rf_reg_info->rf_path = rf_table->rf_path;
|
||||
- config = rf_table->config ? rf_table->config : rtw89_phy_config_rf_reg;
|
||||
+ if (noio)
|
||||
+ config = rtw89_phy_config_rf_reg_noio;
|
||||
+ else
|
||||
+ config = rf_table->config ? rf_table->config :
|
||||
+ rtw89_phy_config_rf_reg;
|
||||
rtw89_phy_init_reg(rtwdev, rf_table, config, (void *)rf_reg_info);
|
||||
if (rtw89_phy_config_rf_reg_fw(rtwdev, rf_reg_info))
|
||||
rtw89_warn(rtwdev, "rf path %d reg h2c config failed\n",
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
index 995c13f6f906c..dac69a02e8687 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
@@ -500,7 +500,7 @@ bool rtw89_phy_write_rf(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
u32 addr, u32 mask, u32 data);
|
||||
void rtw89_phy_init_bb_reg(struct rtw89_dev *rtwdev);
|
||||
-void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev);
|
||||
+void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio);
|
||||
void rtw89_phy_config_rf_reg_v1(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,101 @@
|
||||
From 472c46f9a617348fa8a8ba19dc50e1727c95a58e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 048/142] wifi: rtw89: move enable_cpu/disable_cpu into
|
||||
fw_download
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 5f05bdb0a770b5d03d3453c0b0743bb3dcd1a2ba
|
||||
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Date: Thu Oct 27 13:27:02 2022 +0800
|
||||
|
||||
wifi: rtw89: move enable_cpu/disable_cpu into fw_download
|
||||
|
||||
For WoWLAN mode, we need to download WoWLAN firmware by calling
|
||||
fw_download(). Another, to disable/enable WiFi CPU is needed before
|
||||
calling fw_download. Since Firmware runs on WiFi CPU, it is intuitive
|
||||
to combine enable_cpu/disable_cpu functions into fw_download.
|
||||
|
||||
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 5 +++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 10 ++--------
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 2 ++
|
||||
3 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index e9f84d43ce0c9..d09d593c1107a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -531,6 +531,11 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type)
|
||||
u8 val;
|
||||
int ret;
|
||||
|
||||
+ rtw89_mac_disable_cpu(rtwdev);
|
||||
+ ret = rtw89_mac_enable_cpu(rtwdev, 0, true);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
if (!fw || !len) {
|
||||
rtw89_err(rtwdev, "fw type %d isn't recognized\n", type);
|
||||
return -ENOENT;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 598568c3f2750..54be8b24e3991 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -3114,7 +3114,7 @@ static void rtw89_disable_fw_watchdog(struct rtw89_dev *rtwdev)
|
||||
rtw89_mac_mem_write(rtwdev, R_AX_WDT_STATUS, val32, RTW89_MAC_MEM_CPU_LOCAL);
|
||||
}
|
||||
|
||||
-static void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev)
|
||||
+void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
clear_bit(RTW89_FLAG_FW_RDY, rtwdev->flags);
|
||||
|
||||
@@ -3129,8 +3129,7 @@ static void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev)
|
||||
rtw89_write32_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
|
||||
}
|
||||
|
||||
-static int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason,
|
||||
- bool dlfw)
|
||||
+int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw)
|
||||
{
|
||||
u32 val;
|
||||
int ret;
|
||||
@@ -3269,11 +3268,6 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- rtw89_mac_disable_cpu(rtwdev);
|
||||
- ret = rtw89_mac_enable_cpu(rtwdev, 0, true);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
ret = rtw89_fw_download(rtwdev, RTW89_FW_NORMAL);
|
||||
if (ret)
|
||||
return ret;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index a6cbafb75a2b8..6e03f5e4ae246 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -815,6 +815,8 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,
|
||||
struct ieee80211_vif *vif);
|
||||
int rtw89_mac_remove_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
|
||||
+void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev);
|
||||
+int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw);
|
||||
int rtw89_mac_enable_bb_rf(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_disable_bb_rf(struct rtw89_dev *rtwdev);
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,134 @@
|
||||
From 288c91045ee2e42a86a159d788cda82682e4a6d9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:27 +0200
|
||||
Subject: [PATCH 049/142] wifi: rtw89: add function to adjust and restore PLE
|
||||
quota
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 7a68ec3da79ea702fdeeb94c31f743fd37446a32
|
||||
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Date: Thu Oct 27 13:27:03 2022 +0800
|
||||
|
||||
wifi: rtw89: add function to adjust and restore PLE quota
|
||||
|
||||
PLE RX quota, which is the setting of RX buffer, is needed to be adjusted
|
||||
dynamically for WoWLAN mode, and restored when back to normal mode.
|
||||
The action is not needed for rtw8852c chip.
|
||||
|
||||
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 32 +++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 4 ++++
|
||||
4 files changed, 39 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 90bf7bdb60628..10ccb047d6a06 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2389,6 +2389,7 @@ enum rtw89_dma_ch {
|
||||
enum rtw89_qta_mode {
|
||||
RTW89_QTA_SCC,
|
||||
RTW89_QTA_DLFW,
|
||||
+ RTW89_QTA_WOW,
|
||||
|
||||
/* keep last */
|
||||
RTW89_QTA_INVALID,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 54be8b24e3991..2ca500e11d3a3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -1306,6 +1306,8 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
|
||||
.ple_qt47 = {525, 0, 32, 20, 1034, 13, 1199, 0, 1053, 62, 160, 1037,},
|
||||
/* PCIE 64 */
|
||||
.ple_qt58 = {147, 0, 16, 20, 157, 13, 229, 0, 172, 14, 24, 0,},
|
||||
+ /* 8852A PCIE WOW */
|
||||
+ .ple_qt_52a_wow = {264, 0, 32, 20, 64, 13, 1005, 0, 64, 128, 120,},
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_mac_size);
|
||||
|
||||
@@ -1476,6 +1478,36 @@ static void ple_quota_cfg(struct rtw89_dev *rtwdev,
|
||||
SET_QUOTA(tx_rpt, PLE, 11);
|
||||
}
|
||||
|
||||
+int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow)
|
||||
+{
|
||||
+ const struct rtw89_ple_quota *min_cfg, *max_cfg;
|
||||
+ const struct rtw89_dle_mem *cfg;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (rtwdev->chip->chip_id == RTL8852C)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (rtwdev->mac.qta_mode != RTW89_QTA_SCC) {
|
||||
+ rtw89_err(rtwdev, "[ERR]support SCC mode only\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (wow)
|
||||
+ cfg = get_dle_mem_cfg(rtwdev, RTW89_QTA_WOW);
|
||||
+ else
|
||||
+ cfg = get_dle_mem_cfg(rtwdev, RTW89_QTA_SCC);
|
||||
+ if (!cfg) {
|
||||
+ rtw89_err(rtwdev, "[ERR]get_dle_mem_cfg\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ min_cfg = cfg->ple_min_qt;
|
||||
+ max_cfg = cfg->ple_max_qt;
|
||||
+ SET_QUOTA(cma0_dma, PLE, 6);
|
||||
+ SET_QUOTA(cma1_dma, PLE, 7);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
#undef SET_QUOTA
|
||||
|
||||
static void dle_quota_cfg(struct rtw89_dev *rtwdev,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 6e03f5e4ae246..20211c4e62db5 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -719,6 +719,7 @@ struct rtw89_mac_size_set {
|
||||
const struct rtw89_ple_quota ple_qt46;
|
||||
const struct rtw89_ple_quota ple_qt47;
|
||||
const struct rtw89_ple_quota ple_qt58;
|
||||
+ const struct rtw89_ple_quota ple_qt_52a_wow;
|
||||
};
|
||||
|
||||
extern const struct rtw89_mac_size_set rtw89_mac_size;
|
||||
@@ -1026,5 +1027,6 @@ void rtw89_mac_pkt_drop_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
u16 rtw89_mac_dle_buf_req(struct rtw89_dev *rtwdev, u16 buf_len, bool wd);
|
||||
int rtw89_mac_set_cpuio(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_cpuio_ctrl *ctrl_para, bool wd);
|
||||
+int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow);
|
||||
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index b5aa8697a0982..375e84f5fe5c1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -48,6 +48,10 @@ static const struct rtw89_dle_mem rtw8852a_dle_mem_pcie[] = {
|
||||
&rtw89_mac_size.ple_size0, &rtw89_mac_size.wde_qt0,
|
||||
&rtw89_mac_size.wde_qt0, &rtw89_mac_size.ple_qt4,
|
||||
&rtw89_mac_size.ple_qt5},
|
||||
+ [RTW89_QTA_WOW] = {RTW89_QTA_WOW, &rtw89_mac_size.wde_size0,
|
||||
+ &rtw89_mac_size.ple_size0, &rtw89_mac_size.wde_qt0,
|
||||
+ &rtw89_mac_size.wde_qt0, &rtw89_mac_size.ple_qt4,
|
||||
+ &rtw89_mac_size.ple_qt_52a_wow},
|
||||
[RTW89_QTA_DLFW] = {RTW89_QTA_DLFW, &rtw89_mac_size.wde_size4,
|
||||
&rtw89_mac_size.ple_size4, &rtw89_mac_size.wde_qt4,
|
||||
&rtw89_mac_size.wde_qt4, &rtw89_mac_size.ple_qt13,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,290 @@
|
||||
From 6b51a4f8b619605160ba9dc387b391c87a8d879c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:28 +0200
|
||||
Subject: [PATCH 050/142] wifi: rtw89: add drop tx packet function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 41d567699283b86ce7443a5bf07114f1bde8e203
|
||||
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Date: Thu Oct 27 13:27:04 2022 +0800
|
||||
|
||||
wifi: rtw89: add drop tx packet function
|
||||
|
||||
When entering WoWLAN mode, we need to drop all transmit packets,
|
||||
including those in mac buffer, to avoid memory leakage, so implement
|
||||
the drop_tx function.
|
||||
|
||||
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 3 ++
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 9 ++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 20 +++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 75 +++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 13 +++++
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 13 +++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 2 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 2 +
|
||||
8 files changed, 137 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 10ccb047d6a06..6b6bb3260fff4 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2624,6 +2624,8 @@ struct rtw89_chip_info {
|
||||
u32 rsvd_ple_ofst;
|
||||
const struct rtw89_hfc_param_ini *hfc_param_ini;
|
||||
const struct rtw89_dle_mem *dle_mem;
|
||||
+ u8 wde_qempty_acq_num;
|
||||
+ u8 wde_qempty_mgq_sel;
|
||||
u32 rf_base_addr[2];
|
||||
u8 support_chanctx_num;
|
||||
u8 support_bands;
|
||||
@@ -2949,6 +2951,7 @@ struct rtw89_pkt_drop_params {
|
||||
u8 port;
|
||||
u8 mbssid;
|
||||
bool tf_trs;
|
||||
+ u32 macid_band_sel[4];
|
||||
};
|
||||
|
||||
struct rtw89_pkt_stat {
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index d09d593c1107a..fa7439edec8f5 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -2902,6 +2902,7 @@ int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
|
||||
case RTW89_PKT_DROP_SEL_MACID_BK_ONCE:
|
||||
case RTW89_PKT_DROP_SEL_MACID_VI_ONCE:
|
||||
case RTW89_PKT_DROP_SEL_MACID_VO_ONCE:
|
||||
+ case RTW89_PKT_DROP_SEL_BAND_ONCE:
|
||||
break;
|
||||
default:
|
||||
rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
@@ -2917,6 +2918,14 @@ int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
|
||||
RTW89_SET_FWCMD_PKT_DROP_PORT(skb->data, params->port);
|
||||
RTW89_SET_FWCMD_PKT_DROP_MBSSID(skb->data, params->mbssid);
|
||||
RTW89_SET_FWCMD_PKT_DROP_ROLE_A_INFO_TF_TRS(skb->data, params->tf_trs);
|
||||
+ RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_0(skb->data,
|
||||
+ params->macid_band_sel[0]);
|
||||
+ RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_1(skb->data,
|
||||
+ params->macid_band_sel[1]);
|
||||
+ RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_2(skb->data,
|
||||
+ params->macid_band_sel[2]);
|
||||
+ RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_3(skb->data,
|
||||
+ params->macid_band_sel[3]);
|
||||
|
||||
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
H2C_CAT_MAC,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 8563efa5f6411..3845581d5d284 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -1873,6 +1873,26 @@ static inline void RTW89_SET_FWCMD_PKT_DROP_ROLE_A_INFO_TF_TRS(void *cmd, u32 va
|
||||
le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(15, 8));
|
||||
}
|
||||
|
||||
+static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_0(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_1(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_2(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_3(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 5, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
enum rtw89_btc_btf_h2c_class {
|
||||
BTFC_SET = 0x10,
|
||||
BTFC_GET = 0x11,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 2ca500e11d3a3..6bf6ad62ff7a6 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -1335,6 +1335,60 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
|
||||
return cfg;
|
||||
}
|
||||
|
||||
+static bool mac_is_txq_empty(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_mac_dle_dfi_qempty qempty;
|
||||
+ u32 qnum, qtmp, val32, msk32;
|
||||
+ int i, j, ret;
|
||||
+
|
||||
+ qnum = rtwdev->chip->wde_qempty_acq_num;
|
||||
+ qempty.dle_type = DLE_CTRL_TYPE_WDE;
|
||||
+
|
||||
+ for (i = 0; i < qnum; i++) {
|
||||
+ qempty.grpsel = i;
|
||||
+ ret = dle_dfi_qempty(rtwdev, &qempty);
|
||||
+ if (ret) {
|
||||
+ rtw89_warn(rtwdev, "dle dfi acq empty %d\n", ret);
|
||||
+ return false;
|
||||
+ }
|
||||
+ qtmp = qempty.qempty;
|
||||
+ for (j = 0 ; j < QEMP_ACQ_GRP_MACID_NUM; j++) {
|
||||
+ val32 = FIELD_GET(QEMP_ACQ_GRP_QSEL_MASK, qtmp);
|
||||
+ if (val32 != QEMP_ACQ_GRP_QSEL_MASK)
|
||||
+ return false;
|
||||
+ qtmp >>= QEMP_ACQ_GRP_QSEL_SH;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ qempty.grpsel = rtwdev->chip->wde_qempty_mgq_sel;
|
||||
+ ret = dle_dfi_qempty(rtwdev, &qempty);
|
||||
+ if (ret) {
|
||||
+ rtw89_warn(rtwdev, "dle dfi mgq empty %d\n", ret);
|
||||
+ return false;
|
||||
+ }
|
||||
+ msk32 = B_CMAC0_MGQ_NORMAL | B_CMAC0_MGQ_NO_PWRSAV | B_CMAC0_CPUMGQ;
|
||||
+ if ((qempty.qempty & msk32) != msk32)
|
||||
+ return false;
|
||||
+
|
||||
+ if (rtwdev->dbcc_en) {
|
||||
+ msk32 |= B_CMAC1_MGQ_NORMAL | B_CMAC1_MGQ_NO_PWRSAV | B_CMAC1_CPUMGQ;
|
||||
+ if ((qempty.qempty & msk32) != msk32)
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ msk32 = B_AX_WDE_EMPTY_QTA_DMAC_WLAN_CPU | B_AX_WDE_EMPTY_QTA_DMAC_DATA_CPU |
|
||||
+ B_AX_PLE_EMPTY_QTA_DMAC_WLAN_CPU | B_AX_PLE_EMPTY_QTA_DMAC_H2C |
|
||||
+ B_AX_WDE_EMPTY_QUE_OTHERS | B_AX_PLE_EMPTY_QUE_DMAC_MPDU_TX |
|
||||
+ B_AX_WDE_EMPTY_QTA_DMAC_CPUIO | B_AX_PLE_EMPTY_QTA_DMAC_CPUIO |
|
||||
+ B_AX_WDE_EMPTY_QUE_DMAC_PKTIN | B_AX_WDE_EMPTY_QTA_DMAC_HIF |
|
||||
+ B_AX_PLE_EMPTY_QUE_DMAC_SEC_TX | B_AX_WDE_EMPTY_QTA_DMAC_PKTIN |
|
||||
+ B_AX_PLE_EMPTY_QTA_DMAC_B0_TXPL | B_AX_PLE_EMPTY_QTA_DMAC_B1_TXPL |
|
||||
+ B_AX_PLE_EMPTY_QTA_DMAC_MPDU_TX;
|
||||
+ val32 = rtw89_read32(rtwdev, R_AX_DLE_EMPTY0);
|
||||
+
|
||||
+ return (val32 & msk32) == msk32;
|
||||
+}
|
||||
+
|
||||
static inline u32 dle_used_size(const struct rtw89_dle_size *wde,
|
||||
const struct rtw89_dle_size *ple)
|
||||
{
|
||||
@@ -4891,3 +4945,24 @@ void rtw89_mac_pkt_drop_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
rtw89_mac_pkt_drop_vif_iter,
|
||||
rtwvif);
|
||||
}
|
||||
+
|
||||
+int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_mac_idx band)
|
||||
+{
|
||||
+ struct rtw89_pkt_drop_params params = {0};
|
||||
+ bool empty;
|
||||
+ int i, ret = 0, try_cnt = 3;
|
||||
+
|
||||
+ params.mac_band = band;
|
||||
+ params.sel = RTW89_PKT_DROP_SEL_BAND_ONCE;
|
||||
+
|
||||
+ for (i = 0; i < try_cnt; i++) {
|
||||
+ ret = read_poll_timeout(mac_is_txq_empty, empty, empty, 50,
|
||||
+ 50000, false, rtwdev);
|
||||
+ if (ret)
|
||||
+ rtw89_fw_h2c_pkt_drop(rtwdev, ¶ms);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 20211c4e62db5..e3b4c7830f440 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -420,6 +420,17 @@ enum rtw89_mac_bf_rrsc_rate {
|
||||
#define S_AX_PLE_PAGE_SEL_128 1
|
||||
#define S_AX_PLE_PAGE_SEL_256 2
|
||||
|
||||
+#define B_CMAC0_MGQ_NORMAL BIT(2)
|
||||
+#define B_CMAC0_MGQ_NO_PWRSAV BIT(3)
|
||||
+#define B_CMAC0_CPUMGQ BIT(4)
|
||||
+#define B_CMAC1_MGQ_NORMAL BIT(10)
|
||||
+#define B_CMAC1_MGQ_NO_PWRSAV BIT(11)
|
||||
+#define B_CMAC1_CPUMGQ BIT(12)
|
||||
+
|
||||
+#define QEMP_ACQ_GRP_MACID_NUM 8
|
||||
+#define QEMP_ACQ_GRP_QSEL_SH 4
|
||||
+#define QEMP_ACQ_GRP_QSEL_MASK 0xF
|
||||
+
|
||||
#define SDIO_LOCAL_BASE_ADDR 0x80000000
|
||||
|
||||
#define PWR_CMD_WRITE 0
|
||||
@@ -1028,5 +1039,7 @@ u16 rtw89_mac_dle_buf_req(struct rtw89_dev *rtwdev, u16 buf_len, bool wd);
|
||||
int rtw89_mac_set_cpuio(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_cpuio_ctrl *ctrl_para, bool wd);
|
||||
int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow);
|
||||
+int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev,
|
||||
+ enum rtw89_mac_idx band);
|
||||
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 2b938d11d2381..33f2b67bfca37 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -545,6 +545,19 @@
|
||||
#define B_AX_WDE_EMPTY_QUE_CMAC0_MBH BIT(1)
|
||||
#define B_AX_WDE_EMPTY_QUE_CMAC0_ALL_AC BIT(0)
|
||||
|
||||
+#define R_AX_DLE_EMPTY1 0x8434
|
||||
+#define B_AX_PLE_EMPTY_QTA_DMAC_WDRLS BIT(20)
|
||||
+#define B_AX_PLE_EMPTY_QTA_CMAC1_DMA_BBRPT BIT(19)
|
||||
+#define B_AX_PLE_EMPTY_QTA_CMAC1_DMA_RX BIT(18)
|
||||
+#define B_AX_PLE_EMPTY_QTA_CMAC0_DMA_RX BIT(17)
|
||||
+#define B_AX_PLE_EMPTY_QTA_DMAC_C2H BIT(16)
|
||||
+#define B_AX_PLE_EMPTY_QUE_DMAC_PLRLS BIT(5)
|
||||
+#define B_AX_PLE_EMPTY_QUE_DMAC_CPUIO BIT(4)
|
||||
+#define B_AX_PLE_EMPTY_QUE_DMAC_SEC_RX BIT(3)
|
||||
+#define B_AX_PLE_EMPTY_QUE_DMAC_MPDU_RX BIT(2)
|
||||
+#define B_AX_PLE_EMPTY_QUE_DMAC_HDP BIT(1)
|
||||
+#define B_AX_WDE_EMPTY_QUE_DMAC_WDRLS BIT(0)
|
||||
+
|
||||
#define R_AX_DMAC_ERR_IMR 0x8520
|
||||
#define B_AX_DLE_CPUIO_ERR_INT_EN BIT(10)
|
||||
#define B_AX_APB_BRIDGE_ERR_INT_EN BIT(9)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index 375e84f5fe5c1..7995d720dc921 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -2049,6 +2049,8 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.rsvd_ple_ofst = 0x6f800,
|
||||
.hfc_param_ini = rtw8852a_hfc_param_ini_pcie,
|
||||
.dle_mem = rtw8852a_dle_mem_pcie,
|
||||
+ .wde_qempty_acq_num = 16,
|
||||
+ .wde_qempty_mgq_sel = 16,
|
||||
.rf_base_addr = {0xc000, 0xd000},
|
||||
.pwr_on_seq = pwr_on_seq_8852a,
|
||||
.pwr_off_seq = pwr_off_seq_8852a,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 7e208a8fdf4bb..93332feabc44d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2855,6 +2855,8 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
.rsvd_ple_ofst = 0x6f800,
|
||||
.hfc_param_ini = rtw8852c_hfc_param_ini_pcie,
|
||||
.dle_mem = rtw8852c_dle_mem_pcie,
|
||||
+ .wde_qempty_acq_num = 16,
|
||||
+ .wde_qempty_mgq_sel = 16,
|
||||
.rf_base_addr = {0xe000, 0xf000},
|
||||
.pwr_on_seq = NULL,
|
||||
.pwr_off_seq = NULL,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,531 @@
|
||||
From 7a7f454f262baf9e8b33235790d1ee482afbc1cd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:28 +0200
|
||||
Subject: [PATCH 051/142] wifi: rtw89: add related H2C for WoWLAN mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit ee88d748f1ace450cc0e8ca6a93cb11e7e8d6ad9
|
||||
Author: Chin-Yen Lee <timlee@realtek.com>
|
||||
Date: Thu Oct 27 13:27:05 2022 +0800
|
||||
|
||||
wifi: rtw89: add related H2C for WoWLAN mode
|
||||
|
||||
In this patch we define some H2C, which will be called during suspend
|
||||
flow, to enable WoWLAN function provided by WoWLAN firmware.
|
||||
|
||||
These H2C includes keep alive used to send null packet to AP periodically
|
||||
to avoid being disconnected by AP, disconnect detection used to configure
|
||||
how we check if AP is offline, wake up control used to decide which WiFi
|
||||
events could trigger resume flow, and global control used to enable WoWLAN
|
||||
function.
|
||||
|
||||
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 30 ++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 229 ++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 160 +++++++++++++++++++++
|
||||
3 files changed, 419 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 6b6bb3260fff4..d20cb3ae89e98 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -477,6 +477,20 @@ enum rtw89_regulation_type {
|
||||
RTW89_REGD_NUM,
|
||||
};
|
||||
|
||||
+enum rtw89_fw_pkt_ofld_type {
|
||||
+ RTW89_PKT_OFLD_TYPE_PROBE_RSP = 0,
|
||||
+ RTW89_PKT_OFLD_TYPE_PS_POLL = 1,
|
||||
+ RTW89_PKT_OFLD_TYPE_NULL_DATA = 2,
|
||||
+ RTW89_PKT_OFLD_TYPE_QOS_NULL = 3,
|
||||
+ RTW89_PKT_OFLD_TYPE_CTS2SELF = 4,
|
||||
+ RTW89_PKT_OFLD_TYPE_ARP_RSP = 5,
|
||||
+ RTW89_PKT_OFLD_TYPE_NDP = 6,
|
||||
+ RTW89_PKT_OFLD_TYPE_EAPOL_KEY = 7,
|
||||
+ RTW89_PKT_OFLD_TYPE_SA_QUERY = 8,
|
||||
+ RTW89_PKT_OFLD_TYPE_PROBE_REQ = 12,
|
||||
+ RTW89_PKT_OFLD_TYPE_NUM,
|
||||
+};
|
||||
+
|
||||
struct rtw89_txpwr_byrate {
|
||||
s8 cck[RTW89_RATE_CCK_MAX];
|
||||
s8 ofdm[RTW89_RATE_OFDM_MAX];
|
||||
@@ -636,6 +650,13 @@ enum rtw89_sc_offset {
|
||||
RTW89_SC_40_LOWER = 10,
|
||||
};
|
||||
|
||||
+enum rtw89_wow_flags {
|
||||
+ RTW89_WOW_FLAG_EN_MAGIC_PKT,
|
||||
+ RTW89_WOW_FLAG_EN_REKEY_PKT,
|
||||
+ RTW89_WOW_FLAG_EN_DISCONNECT,
|
||||
+ RTW89_WOW_FLAG_NUM,
|
||||
+};
|
||||
+
|
||||
struct rtw89_chan {
|
||||
u8 channel;
|
||||
u8 primary_channel;
|
||||
@@ -3453,6 +3474,13 @@ struct rtw89_phy_efuse_gain {
|
||||
s8 comp[RF_PATH_MAX][RTW89_SUBBAND_NR]; /* S(8, 0) */
|
||||
};
|
||||
|
||||
+struct rtw89_wow_param {
|
||||
+ struct ieee80211_vif *wow_vif;
|
||||
+ DECLARE_BITMAP(flags, RTW89_WOW_FLAG_NUM);
|
||||
+ u8 pattern_cnt;
|
||||
+ struct list_head pkt_list;
|
||||
+};
|
||||
+
|
||||
struct rtw89_dev {
|
||||
struct ieee80211_hw *hw;
|
||||
struct device *dev;
|
||||
@@ -3541,6 +3569,8 @@ struct rtw89_dev {
|
||||
enum rtw89_ps_mode ps_mode;
|
||||
bool lps_enabled;
|
||||
|
||||
+ struct rtw89_wow_param wow;
|
||||
+
|
||||
/* napi structure */
|
||||
struct net_device netdev;
|
||||
struct napi_struct napi;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index fa7439edec8f5..c8f32a471e520 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -869,6 +869,56 @@ int rtw89_fw_h2c_fw_log(struct rtw89_dev *rtwdev, bool enable)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int rtw89_fw_h2c_add_wow_fw_ofld(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ enum rtw89_fw_pkt_ofld_type type,
|
||||
+ u8 *id)
|
||||
+{
|
||||
+ struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct rtw89_pktofld_info *info;
|
||||
+ struct sk_buff *skb;
|
||||
+ int ret;
|
||||
+
|
||||
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
+ if (!info)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ switch (type) {
|
||||
+ case RTW89_PKT_OFLD_TYPE_PS_POLL:
|
||||
+ skb = ieee80211_pspoll_get(rtwdev->hw, vif);
|
||||
+ break;
|
||||
+ case RTW89_PKT_OFLD_TYPE_PROBE_RSP:
|
||||
+ skb = ieee80211_proberesp_get(rtwdev->hw, vif);
|
||||
+ break;
|
||||
+ case RTW89_PKT_OFLD_TYPE_NULL_DATA:
|
||||
+ skb = ieee80211_nullfunc_get(rtwdev->hw, vif, -1, false);
|
||||
+ break;
|
||||
+ case RTW89_PKT_OFLD_TYPE_QOS_NULL:
|
||||
+ skb = ieee80211_nullfunc_get(rtwdev->hw, vif, -1, true);
|
||||
+ break;
|
||||
+ default:
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (!skb)
|
||||
+ goto err;
|
||||
+
|
||||
+ list_add_tail(&info->list, &rtw_wow->pkt_list);
|
||||
+ ret = rtw89_fw_h2c_add_pkt_offload(rtwdev, &info->id, skb);
|
||||
+ kfree_skb(skb);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ *id = info->id;
|
||||
+ return 0;
|
||||
+
|
||||
+err:
|
||||
+ kfree(info);
|
||||
+ return -ENOMEM;
|
||||
+}
|
||||
+
|
||||
#define H2C_GENERAL_PKT_LEN 6
|
||||
#define H2C_GENERAL_PKT_ID_UND 0xff
|
||||
int rtw89_fw_h2c_general_pkt(struct rtw89_dev *rtwdev, u8 macid)
|
||||
@@ -2945,3 +2995,182 @@ int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
|
||||
dev_kfree_skb_any(skb);
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+#define H2C_KEEP_ALIVE_LEN 4
|
||||
+int rtw89_fw_h2c_keep_alive(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
+ bool enable)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ u8 pkt_id = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (enable) {
|
||||
+ ret = rtw89_fw_h2c_add_wow_fw_ofld(rtwdev, rtwvif,
|
||||
+ RTW89_PKT_OFLD_TYPE_NULL_DATA, &pkt_id);
|
||||
+ if (ret)
|
||||
+ return -EPERM;
|
||||
+ }
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_KEEP_ALIVE_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_KEEP_ALIVE_LEN);
|
||||
+
|
||||
+ RTW89_SET_KEEP_ALIVE_ENABLE(skb->data, enable);
|
||||
+ RTW89_SET_KEEP_ALIVE_PKT_NULL_ID(skb->data, pkt_id);
|
||||
+ RTW89_SET_KEEP_ALIVE_PERIOD(skb->data, 5);
|
||||
+ RTW89_SET_KEEP_ALIVE_MACID(skb->data, rtwvif->mac_id);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MAC_WOW,
|
||||
+ H2C_FUNC_KEEP_ALIVE, 0, 1,
|
||||
+ H2C_KEEP_ALIVE_LEN);
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+fail:
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#define H2C_DISCONNECT_DETECT_LEN 8
|
||||
+int rtw89_fw_h2c_disconnect_detect(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif, bool enable)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct sk_buff *skb;
|
||||
+ u8 macid = rtwvif->mac_id;
|
||||
+ int ret;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_DISCONNECT_DETECT_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_DISCONNECT_DETECT_LEN);
|
||||
+
|
||||
+ if (test_bit(RTW89_WOW_FLAG_EN_DISCONNECT, rtw_wow->flags)) {
|
||||
+ RTW89_SET_DISCONNECT_DETECT_ENABLE(skb->data, enable);
|
||||
+ RTW89_SET_DISCONNECT_DETECT_DISCONNECT(skb->data, !enable);
|
||||
+ RTW89_SET_DISCONNECT_DETECT_MAC_ID(skb->data, macid);
|
||||
+ RTW89_SET_DISCONNECT_DETECT_CHECK_PERIOD(skb->data, 100);
|
||||
+ RTW89_SET_DISCONNECT_DETECT_TRY_PKT_COUNT(skb->data, 5);
|
||||
+ }
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MAC_WOW,
|
||||
+ H2C_FUNC_DISCONNECT_DETECT, 0, 1,
|
||||
+ H2C_DISCONNECT_DETECT_LEN);
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+fail:
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#define H2C_WOW_GLOBAL_LEN 8
|
||||
+int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
+ bool enable)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ u8 macid = rtwvif->mac_id;
|
||||
+ int ret;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_WOW_GLOBAL_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_WOW_GLOBAL_LEN);
|
||||
+
|
||||
+ RTW89_SET_WOW_GLOBAL_ENABLE(skb->data, enable);
|
||||
+ RTW89_SET_WOW_GLOBAL_MAC_ID(skb->data, macid);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MAC_WOW,
|
||||
+ H2C_FUNC_WOW_GLOBAL, 0, 1,
|
||||
+ H2C_WOW_GLOBAL_LEN);
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+fail:
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#define H2C_WAKEUP_CTRL_LEN 4
|
||||
+int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ bool enable)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct sk_buff *skb;
|
||||
+ u8 macid = rtwvif->mac_id;
|
||||
+ int ret;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_WAKEUP_CTRL_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_WAKEUP_CTRL_LEN);
|
||||
+
|
||||
+ if (rtw_wow->pattern_cnt)
|
||||
+ RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(skb->data, enable);
|
||||
+ if (test_bit(RTW89_WOW_FLAG_EN_MAGIC_PKT, rtw_wow->flags))
|
||||
+ RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(skb->data, enable);
|
||||
+ if (test_bit(RTW89_WOW_FLAG_EN_DISCONNECT, rtw_wow->flags))
|
||||
+ RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(skb->data, enable);
|
||||
+
|
||||
+ RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(skb->data, macid);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MAC_WOW,
|
||||
+ H2C_FUNC_WAKEUP_CTRL, 0, 1,
|
||||
+ H2C_WAKEUP_CTRL_LEN);
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+fail:
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 3845581d5d284..25dd7bf8e730d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -1893,6 +1893,146 @@ static inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_3(void *cmd, u32 val)
|
||||
le32p_replace_bits((__le32 *)cmd + 5, val, GENMASK(31, 0));
|
||||
}
|
||||
|
||||
+static inline void RTW89_SET_KEEP_ALIVE_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_KEEP_ALIVE_PKT_NULL_ID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_KEEP_ALIVE_PERIOD(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(24, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_KEEP_ALIVE_MACID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_EN(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(1));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_DISCONNECT(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_MAC_ID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_CHECK_PERIOD(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_TRY_PKT_COUNT(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_LIMIT(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_DROP_ALL_PKT(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(1));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_RX_PARSE_AFTER_WAKE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_WAKE_BAR_PULLED(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(3));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_MAC_ID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_PAIRWISE_SEC_ALGO(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_GROUP_SEC_ALGO(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_GLOBAL_REMOTECTRL_INFO_CONTENT(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(1));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_HW_UNICAST_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_FW_UNICAST_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(3));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(4));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_REKEYP_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(5));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_EAP_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(6));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_ALL_DATA_ENABLE(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(7));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
enum rtw89_btc_btf_h2c_class {
|
||||
BTFC_SET = 0x10,
|
||||
BTFC_GET = 0x11,
|
||||
@@ -2709,6 +2849,14 @@ struct rtw89_fw_h2c_rf_reg_info {
|
||||
#define H2C_FUNC_LOG_CFG 0x0
|
||||
#define H2C_FUNC_MAC_GENERAL_PKT 0x1
|
||||
|
||||
+/* CLASS 1 - WOW */
|
||||
+#define H2C_CL_MAC_WOW 0x1
|
||||
+#define H2C_FUNC_KEEP_ALIVE 0x0
|
||||
+#define H2C_FUNC_DISCONNECT_DETECT 0x1
|
||||
+#define H2C_FUNC_WOW_GLOBAL 0x2
|
||||
+#define H2C_FUNC_WAKEUP_CTRL 0x8
|
||||
+#define H2C_FUNC_WOW_CAM_UPD 0xC
|
||||
+
|
||||
/* CLASS 2 - PS */
|
||||
#define H2C_CL_MAC_PS 0x2
|
||||
#define H2C_FUNC_MAC_LPS_PARM 0x0
|
||||
@@ -2878,6 +3026,18 @@ int rtw89_fw_h2c_p2p_act(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
u8 act, u8 noa_id);
|
||||
int rtw89_fw_h2c_tsf32_toggle(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool en);
|
||||
+int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
+ bool enable);
|
||||
+int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif, bool enable);
|
||||
+int rtw89_fw_h2c_keep_alive(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
+ bool enable);
|
||||
+int rtw89_fw_h2c_disconnect_detect(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif, bool enable);
|
||||
+int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
+ bool enable);
|
||||
+int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif, bool enable);
|
||||
|
||||
static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
--
|
||||
2.13.6
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,528 @@
|
||||
From 88f0524e1cdff80fcf2f547400d9fa369190cff9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:28 +0200
|
||||
Subject: [PATCH 053/142] wifi: rtw89: add WoWLAN pattern match support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d2b68e95b5bc97d81d150a46447167bf21bd555f
|
||||
Author: Chin-Yen Lee <timlee@realtek.com>
|
||||
Date: Thu Oct 27 13:27:07 2022 +0800
|
||||
|
||||
wifi: rtw89: add WoWLAN pattern match support
|
||||
|
||||
Pattern match is an option of WoWLAN to allow the device to be woken up
|
||||
from suspend mode when receiving packets matched user-designed patterns.
|
||||
|
||||
The patterns are written into hardware via WoWLAN firmware in suspend
|
||||
flow if users have set up them. If packets matched designed pattern are
|
||||
received, WoWLAN firmware will send an interrupt and then wake up the
|
||||
device.
|
||||
|
||||
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221027052707.14605-8-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 18 ++
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 52 ++++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 67 ++++++++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 3 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 3 +
|
||||
drivers/net/wireless/realtek/rtw89/util.h | 11 ++
|
||||
drivers/net/wireless/realtek/rtw89/wow.c | 228 +++++++++++++++++++++++++-
|
||||
7 files changed, 381 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 9f80359e27aa2..b60de6662548b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -3489,9 +3489,27 @@ struct rtw89_phy_efuse_gain {
|
||||
s8 comp[RF_PATH_MAX][RTW89_SUBBAND_NR]; /* S(8, 0) */
|
||||
};
|
||||
|
||||
+#define RTW89_MAX_PATTERN_NUM 18
|
||||
+#define RTW89_MAX_PATTERN_MASK_SIZE 4
|
||||
+#define RTW89_MAX_PATTERN_SIZE 128
|
||||
+
|
||||
+struct rtw89_wow_cam_info {
|
||||
+ bool r_w;
|
||||
+ u8 idx;
|
||||
+ u32 mask[RTW89_MAX_PATTERN_MASK_SIZE];
|
||||
+ u16 crc;
|
||||
+ bool negative_pattern_match;
|
||||
+ bool skip_mac_hdr;
|
||||
+ bool uc;
|
||||
+ bool mc;
|
||||
+ bool bc;
|
||||
+ bool valid;
|
||||
+};
|
||||
+
|
||||
struct rtw89_wow_param {
|
||||
struct ieee80211_vif *wow_vif;
|
||||
DECLARE_BITMAP(flags, RTW89_WOW_FLAG_NUM);
|
||||
+ struct rtw89_wow_cam_info patterns[RTW89_MAX_PATTERN_NUM];
|
||||
u8 pattern_cnt;
|
||||
struct list_head pkt_list;
|
||||
};
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index c8f32a471e520..2763149586e27 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -3174,3 +3174,55 @@ int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+#define H2C_WOW_CAM_UPD_LEN 24
|
||||
+int rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_wow_cam_info *cam_info)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ int ret;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_WOW_CAM_UPD_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_WOW_CAM_UPD_LEN);
|
||||
+
|
||||
+ RTW89_SET_WOW_CAM_UPD_R_W(skb->data, cam_info->r_w);
|
||||
+ RTW89_SET_WOW_CAM_UPD_IDX(skb->data, cam_info->idx);
|
||||
+ if (cam_info->valid) {
|
||||
+ RTW89_SET_WOW_CAM_UPD_WKFM1(skb->data, cam_info->mask[0]);
|
||||
+ RTW89_SET_WOW_CAM_UPD_WKFM2(skb->data, cam_info->mask[1]);
|
||||
+ RTW89_SET_WOW_CAM_UPD_WKFM3(skb->data, cam_info->mask[2]);
|
||||
+ RTW89_SET_WOW_CAM_UPD_WKFM4(skb->data, cam_info->mask[3]);
|
||||
+ RTW89_SET_WOW_CAM_UPD_CRC(skb->data, cam_info->crc);
|
||||
+ RTW89_SET_WOW_CAM_UPD_NEGATIVE_PATTERN_MATCH(skb->data,
|
||||
+ cam_info->negative_pattern_match);
|
||||
+ RTW89_SET_WOW_CAM_UPD_SKIP_MAC_HDR(skb->data,
|
||||
+ cam_info->skip_mac_hdr);
|
||||
+ RTW89_SET_WOW_CAM_UPD_UC(skb->data, cam_info->uc);
|
||||
+ RTW89_SET_WOW_CAM_UPD_MC(skb->data, cam_info->mc);
|
||||
+ RTW89_SET_WOW_CAM_UPD_BC(skb->data, cam_info->bc);
|
||||
+ }
|
||||
+ RTW89_SET_WOW_CAM_UPD_VALID(skb->data, cam_info->valid);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MAC_WOW,
|
||||
+ H2C_FUNC_WOW_CAM_UPD, 0, 1,
|
||||
+ H2C_WOW_CAM_UPD_LEN);
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+fail:
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 25dd7bf8e730d..509a3eac5ffe3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -2033,6 +2033,71 @@ static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(void *h2c, u32 val)
|
||||
le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
}
|
||||
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_R_W(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, BIT(0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_IDX(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 1));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_WKFM1(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_WKFM2(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 2, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_WKFM3(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 3, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_WKFM4(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 4, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_CRC(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, GENMASK(15, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_NEGATIVE_PATTERN_MATCH(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(22));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_SKIP_MAC_HDR(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(23));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_UC(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_MC(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(25));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_BC(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(26));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_WOW_CAM_UPD_VALID(void *h2c, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)h2c + 5, val, BIT(31));
|
||||
+}
|
||||
+
|
||||
enum rtw89_btc_btf_h2c_class {
|
||||
BTFC_SET = 0x10,
|
||||
BTFC_GET = 0x11,
|
||||
@@ -3039,6 +3104,8 @@ int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif *rtwvif, bool enable);
|
||||
|
||||
+int rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_wow_cam_info *cam_info);
|
||||
static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index becce3b48f518..4cea5fb4327d7 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -1993,6 +1993,9 @@ static void rtw8852a_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
#ifdef CONFIG_PM
|
||||
static const struct wiphy_wowlan_support rtw_wowlan_stub_8852a = {
|
||||
.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
|
||||
+ .n_patterns = RTW89_MAX_PATTERN_NUM,
|
||||
+ .pattern_max_len = RTW89_MAX_PATTERN_SIZE,
|
||||
+ .pattern_min_len = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index acb0e2e0adbac..6619ba7307199 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2799,6 +2799,9 @@ static int rtw8852c_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
#ifdef CONFIG_PM
|
||||
static const struct wiphy_wowlan_support rtw_wowlan_stub_8852c = {
|
||||
.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
|
||||
+ .n_patterns = RTW89_MAX_PATTERN_NUM,
|
||||
+ .pattern_max_len = RTW89_MAX_PATTERN_SIZE,
|
||||
+ .pattern_min_len = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/util.h b/drivers/net/wireless/realtek/rtw89/util.h
|
||||
index 1ae80b7561daa..e2ed4565025dd 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/util.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/util.h
|
||||
@@ -44,4 +44,15 @@ static inline s32 s32_div_u32_round_closest(s32 dividend, u32 divisor)
|
||||
return s32_div_u32_round_down(dividend + divisor / 2, divisor, NULL);
|
||||
}
|
||||
|
||||
+static inline void ether_addr_copy_mask(u8 *dst, const u8 *src, u8 mask)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ eth_zero_addr(dst);
|
||||
+ for (i = 0; i < ETH_ALEN; i++) {
|
||||
+ if (mask & BIT(i))
|
||||
+ dst[i] = src[i];
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
index 3d30083fcb9a8..7de4dd047d6b3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
@@ -162,6 +162,227 @@ static void rtw89_wow_vif_iter(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvi
|
||||
}
|
||||
}
|
||||
|
||||
+static u16 __rtw89_cal_crc16(u8 data, u16 crc)
|
||||
+{
|
||||
+ u8 shift_in, data_bit;
|
||||
+ u8 crc_bit4, crc_bit11, crc_bit15;
|
||||
+ u16 crc_result;
|
||||
+ int index;
|
||||
+
|
||||
+ for (index = 0; index < 8; index++) {
|
||||
+ crc_bit15 = crc & BIT(15) ? 1 : 0;
|
||||
+ data_bit = data & BIT(index) ? 1 : 0;
|
||||
+ shift_in = crc_bit15 ^ data_bit;
|
||||
+
|
||||
+ crc_result = crc << 1;
|
||||
+
|
||||
+ if (shift_in == 0)
|
||||
+ crc_result &= ~BIT(0);
|
||||
+ else
|
||||
+ crc_result |= BIT(0);
|
||||
+
|
||||
+ crc_bit11 = (crc & BIT(11) ? 1 : 0) ^ shift_in;
|
||||
+
|
||||
+ if (crc_bit11 == 0)
|
||||
+ crc_result &= ~BIT(12);
|
||||
+ else
|
||||
+ crc_result |= BIT(12);
|
||||
+
|
||||
+ crc_bit4 = (crc & BIT(4) ? 1 : 0) ^ shift_in;
|
||||
+
|
||||
+ if (crc_bit4 == 0)
|
||||
+ crc_result &= ~BIT(5);
|
||||
+ else
|
||||
+ crc_result |= BIT(5);
|
||||
+
|
||||
+ crc = crc_result;
|
||||
+ }
|
||||
+ return crc;
|
||||
+}
|
||||
+
|
||||
+static u16 rtw89_calc_crc(u8 *pdata, int length)
|
||||
+{
|
||||
+ u16 crc = 0xffff;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < length; i++)
|
||||
+ crc = __rtw89_cal_crc16(pdata[i], crc);
|
||||
+
|
||||
+ /* get 1' complement */
|
||||
+ return ~crc;
|
||||
+}
|
||||
+
|
||||
+static int rtw89_wow_pattern_get_type(struct rtw89_vif *rtwvif,
|
||||
+ struct rtw89_wow_cam_info *rtw_pattern,
|
||||
+ const u8 *pattern, u8 da_mask)
|
||||
+{
|
||||
+ u8 da[ETH_ALEN];
|
||||
+
|
||||
+ ether_addr_copy_mask(da, pattern, da_mask);
|
||||
+
|
||||
+ /* Each pattern is divided into different kinds by DA address
|
||||
+ * a. DA is broadcast address: set bc = 0;
|
||||
+ * b. DA is multicast address: set mc = 0
|
||||
+ * c. DA is unicast address same as dev's mac address: set uc = 0
|
||||
+ * d. DA is unmasked. Also called wildcard type: set uc = bc = mc = 0
|
||||
+ * e. Others is invalid type.
|
||||
+ */
|
||||
+
|
||||
+ if (is_broadcast_ether_addr(da))
|
||||
+ rtw_pattern->bc = true;
|
||||
+ else if (is_multicast_ether_addr(da))
|
||||
+ rtw_pattern->mc = true;
|
||||
+ else if (ether_addr_equal(da, rtwvif->mac_addr) &&
|
||||
+ da_mask == GENMASK(5, 0))
|
||||
+ rtw_pattern->uc = true;
|
||||
+ else if (!da_mask) /*da_mask == 0 mean wildcard*/
|
||||
+ return 0;
|
||||
+ else
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rtw89_wow_pattern_generate(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ const struct cfg80211_pkt_pattern *pkt_pattern,
|
||||
+ struct rtw89_wow_cam_info *rtw_pattern)
|
||||
+{
|
||||
+ u8 mask_hw[RTW89_MAX_PATTERN_MASK_SIZE * 4] = {0};
|
||||
+ u8 content[RTW89_MAX_PATTERN_SIZE] = {0};
|
||||
+ const u8 *mask;
|
||||
+ const u8 *pattern;
|
||||
+ u8 mask_len;
|
||||
+ u16 count;
|
||||
+ u32 len;
|
||||
+ int i, ret;
|
||||
+
|
||||
+ pattern = pkt_pattern->pattern;
|
||||
+ len = pkt_pattern->pattern_len;
|
||||
+ mask = pkt_pattern->mask;
|
||||
+ mask_len = DIV_ROUND_UP(len, 8);
|
||||
+ memset(rtw_pattern, 0, sizeof(*rtw_pattern));
|
||||
+
|
||||
+ ret = rtw89_wow_pattern_get_type(rtwvif, rtw_pattern, pattern,
|
||||
+ mask[0] & GENMASK(5, 0));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* translate mask from os to mask for hw
|
||||
+ * pattern from OS uses 'ethenet frame', like this:
|
||||
+ * | 6 | 6 | 2 | 20 | Variable | 4 |
|
||||
+ * |--------+--------+------+-----------+------------+-----|
|
||||
+ * | 802.3 Mac Header | IP Header | TCP Packet | FCS |
|
||||
+ * | DA | SA | Type |
|
||||
+ *
|
||||
+ * BUT, packet catched by our HW is in '802.11 frame', begin from LLC
|
||||
+ * | 24 or 30 | 6 | 2 | 20 | Variable | 4 |
|
||||
+ * |-------------------+--------+------+-----------+------------+-----|
|
||||
+ * | 802.11 MAC Header | LLC | IP Header | TCP Packet | FCS |
|
||||
+ * | Others | Tpye |
|
||||
+ *
|
||||
+ * Therefore, we need translate mask_from_OS to mask_to_hw.
|
||||
+ * We should left-shift mask by 6 bits, then set the new bit[0~5] = 0,
|
||||
+ * because new mask[0~5] means 'SA', but our HW packet begins from LLC,
|
||||
+ * bit[0~5] corresponds to first 6 Bytes in LLC, they just don't match.
|
||||
+ */
|
||||
+
|
||||
+ /* Shift 6 bits */
|
||||
+ for (i = 0; i < mask_len - 1; i++) {
|
||||
+ mask_hw[i] = u8_get_bits(mask[i], GENMASK(7, 6)) |
|
||||
+ u8_get_bits(mask[i + 1], GENMASK(5, 0)) << 2;
|
||||
+ }
|
||||
+ mask_hw[i] = u8_get_bits(mask[i], GENMASK(7, 6));
|
||||
+
|
||||
+ /* Set bit 0-5 to zero */
|
||||
+ mask_hw[0] &= ~GENMASK(5, 0);
|
||||
+
|
||||
+ memcpy(rtw_pattern->mask, mask_hw, sizeof(rtw_pattern->mask));
|
||||
+
|
||||
+ /* To get the wake up pattern from the mask.
|
||||
+ * We do not count first 12 bits which means
|
||||
+ * DA[6] and SA[6] in the pattern to match HW design.
|
||||
+ */
|
||||
+ count = 0;
|
||||
+ for (i = 12; i < len; i++) {
|
||||
+ if ((mask[i / 8] >> (i % 8)) & 0x01) {
|
||||
+ content[count] = pattern[i];
|
||||
+ count++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ rtw_pattern->crc = rtw89_calc_crc(content, count);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rtw89_wow_parse_patterns(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ struct cfg80211_wowlan *wowlan)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct rtw89_wow_cam_info *rtw_pattern = rtw_wow->patterns;
|
||||
+ int i;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!wowlan->n_patterns || !wowlan->patterns)
|
||||
+ return 0;
|
||||
+
|
||||
+ for (i = 0; i < wowlan->n_patterns; i++) {
|
||||
+ rtw_pattern = &rtw_wow->patterns[i];
|
||||
+ ret = rtw89_wow_pattern_generate(rtwdev, rtwvif,
|
||||
+ &wowlan->patterns[i],
|
||||
+ rtw_pattern);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to generate pattern(%d)\n", i);
|
||||
+ rtw_wow->pattern_cnt = 0;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ rtw_pattern->r_w = true;
|
||||
+ rtw_pattern->idx = i;
|
||||
+ rtw_pattern->negative_pattern_match = false;
|
||||
+ rtw_pattern->skip_mac_hdr = true;
|
||||
+ rtw_pattern->valid = true;
|
||||
+ }
|
||||
+ rtw_wow->pattern_cnt = wowlan->n_patterns;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rtw89_wow_pattern_clear_cam(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct rtw89_wow_cam_info *rtw_pattern = rtw_wow->patterns;
|
||||
+ int i = 0;
|
||||
+
|
||||
+ for (i = 0; i < rtw_wow->pattern_cnt; i++) {
|
||||
+ rtw_pattern = &rtw_wow->patterns[i];
|
||||
+ rtw_pattern->valid = false;
|
||||
+ rtw89_fw_wow_cam_update(rtwdev, rtw_pattern);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw89_wow_pattern_write(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+ struct rtw89_wow_cam_info *rtw_pattern = rtw_wow->patterns;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < rtw_wow->pattern_cnt; i++)
|
||||
+ rtw89_fw_wow_cam_update(rtwdev, rtw_pattern + i);
|
||||
+}
|
||||
+
|
||||
+static void rtw89_wow_pattern_clear(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
+
|
||||
+ rtw89_wow_pattern_clear_cam(rtwdev);
|
||||
+
|
||||
+ rtw_wow->pattern_cnt = 0;
|
||||
+ memset(rtw_wow->patterns, 0, sizeof(rtw_wow->patterns));
|
||||
+}
|
||||
+
|
||||
static void rtw89_wow_clear_wakeups(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
@@ -188,7 +409,8 @@ static int rtw89_wow_set_wakeups(struct rtw89_dev *rtwdev,
|
||||
if (!rtw_wow->wow_vif)
|
||||
return -EPERM;
|
||||
|
||||
- return 0;
|
||||
+ rtwvif = (struct rtw89_vif *)rtw_wow->wow_vif->drv_priv;
|
||||
+ return rtw89_wow_parse_patterns(rtwdev, rtwvif, wowlan);
|
||||
}
|
||||
|
||||
static int rtw89_wow_cfg_wake(struct rtw89_dev *rtwdev, bool wow)
|
||||
@@ -442,6 +664,8 @@ static int rtw89_wow_fw_start(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)rtw_wow->wow_vif->drv_priv;
|
||||
int ret;
|
||||
|
||||
+ rtw89_wow_pattern_write(rtwdev);
|
||||
+
|
||||
ret = rtw89_fw_h2c_keep_alive(rtwdev, rtwvif, true);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "wow: failed to enable keep alive\n");
|
||||
@@ -476,6 +700,8 @@ static int rtw89_wow_fw_stop(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)rtw_wow->wow_vif->drv_priv;
|
||||
int ret;
|
||||
|
||||
+ rtw89_wow_pattern_clear(rtwdev);
|
||||
+
|
||||
ret = rtw89_fw_h2c_keep_alive(rtwdev, rtwvif, false);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "wow: failed to disable keep alive\n");
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 8e1bbb183af8e5f145278505297cf0f68415c33e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:28 +0200
|
||||
Subject: [PATCH 054/142] wifi: rtw89: 8852b: Fix spelling mistake KIP_RESOTRE
|
||||
-> KIP_RESTORE
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 8fa681703175ba0ea283dd564a64edaef3472ee6
|
||||
Author: Colin Ian King <colin.i.king@gmail.com>
|
||||
Date: Thu Oct 20 08:26:46 2022 +0100
|
||||
|
||||
wifi: rtw89: 8852b: Fix spelling mistake KIP_RESOTRE -> KIP_RESTORE
|
||||
|
||||
Ther is a spelling mistake in a rtw89_debug message. Fix it.
|
||||
|
||||
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
|
||||
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221020072646.1513307-1-colin.i.king@gmail.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
index 8fd01502ac5be..722ae34b09c1f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
|
||||
@@ -1754,7 +1754,7 @@ static void _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
id == 0x14 ? "PWR_CAL" :
|
||||
id == 0x15 ? "DPK_RXAGC" :
|
||||
id == 0x16 ? "KIP_PRESET" :
|
||||
- id == 0x17 ? "KIP_RESOTRE" : "DPK_TXAGC",
|
||||
+ id == 0x17 ? "KIP_RESTORE" : "DPK_TXAGC",
|
||||
dpk_cmd);
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,726 @@
|
||||
From 2fe1e68742cda8fe71e1d59b14e34121d1f2a764 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:28 +0200
|
||||
Subject: [PATCH 055/142] wifi: rtw89: dump dispatch status via debug port
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d6197c9121dd72f35e5702aa55ee5c1583e0bfdb
|
||||
Author: Chia-Yuan Li <leo.li@realtek.com>
|
||||
Date: Wed Nov 2 09:42:59 2022 +0800
|
||||
|
||||
wifi: rtw89: dump dispatch status via debug port
|
||||
|
||||
Dispatch is a component to decide packets forward to host, DMAC or
|
||||
HAXIDMA. It contains CDT standing for CPU dispatcher, HDT standing
|
||||
for host dispatcher, WDE standing for descriptor engine and PLE standing
|
||||
for payload engine. STF is one kind of modes, it can be used if packet
|
||||
send to hardware and doesn't need release report.
|
||||
|
||||
These debug port information can help to clarify the reason if
|
||||
packets stuck in dispatch.
|
||||
|
||||
Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221102014300.14091-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/debug.c | 575 +++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 45 +++
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 5 +
|
||||
3 files changed, 625 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
index cd44d9aa37ca0..afd10e91d3ea5 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
|
||||
@@ -1114,6 +1114,303 @@ static const struct rtw89_mac_dbg_port_info dbg_port_ptcl_c1 = {
|
||||
.rd_msk = B_AX_PTCL_DBG_INFO_MASK
|
||||
};
|
||||
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_tx0_5 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0xD,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_tx6 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x5,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_tx7 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x9,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_tx8 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x3,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_tx9_C = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x1,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_txD = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx0 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0xB,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx1 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x4,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx3 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x8,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx4 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x7,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx5_8 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x1,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_tx9 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x3,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_txA_C = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_rx0 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x8,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_rx1_2 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_rx3 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x6,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_rx4 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_hdt_rx5 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 2,
|
||||
+ .sel_msk = B_AX_DISPATCHER_DBG_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_rx_p0_0 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x3,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_rx_p0_1 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x6,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_rx_p0_2 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x0,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_cdt_rx_p1 = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x8,
|
||||
+ .end = 0xE,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_stf_ctrl = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x5,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_addr_ctrl = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x6,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_wde_intf = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0xF,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_ple_intf = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x9,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
+static const struct rtw89_mac_dbg_port_info dbg_port_dspt_flow_ctrl = {
|
||||
+ .sel_addr = R_AX_DISPATCHER_DBG_PORT,
|
||||
+ .sel_byte = 1,
|
||||
+ .sel_msk = B_AX_DISPATCHER_CH_SEL_MASK,
|
||||
+ .srt = 0x0,
|
||||
+ .end = 0x3,
|
||||
+ .rd_addr = R_AX_DBG_PORT_SEL,
|
||||
+ .rd_byte = 4,
|
||||
+ .rd_msk = B_AX_DEBUG_ST_MASK
|
||||
+};
|
||||
+
|
||||
static const struct rtw89_mac_dbg_port_info dbg_port_sch_c0 = {
|
||||
.sel_addr = R_AX_SCH_DBG_SEL,
|
||||
.sel_byte = 1,
|
||||
@@ -1603,6 +1900,7 @@ rtw89_debug_mac_dbg_port_sel(struct seq_file *m,
|
||||
struct rtw89_dev *rtwdev, u32 sel)
|
||||
{
|
||||
const struct rtw89_mac_dbg_port_info *info;
|
||||
+ u32 index;
|
||||
u32 val32;
|
||||
u16 val16;
|
||||
u8 val8;
|
||||
@@ -1878,6 +2176,235 @@ rtw89_debug_mac_dbg_port_sel(struct seq_file *m,
|
||||
info = &dbg_port_pktinfo;
|
||||
seq_puts(m, "Enable pktinfo dump.\n");
|
||||
break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX0:
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_DBG_CTRL,
|
||||
+ B_AX_DBG_SEL0, 0x80);
|
||||
+ rtw89_write32_mask(rtwdev, R_AX_SYS_STATUS1,
|
||||
+ B_AX_SEL_0XC0_MASK, 1);
|
||||
+ fallthrough;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX1:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX2:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX3:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX4:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX5:
|
||||
+ info = &dbg_port_dspt_hdt_tx0_5;
|
||||
+ index = sel - RTW89_DBG_PORT_SEL_DSPT_HDT_TX0;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, index);
|
||||
+ seq_printf(m, "Enable Dispatcher hdt tx%x dump.\n", index);
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX6:
|
||||
+ info = &dbg_port_dspt_hdt_tx6;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 6);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt tx6 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX7:
|
||||
+ info = &dbg_port_dspt_hdt_tx7;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 7);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt tx7 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX8:
|
||||
+ info = &dbg_port_dspt_hdt_tx8;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 8);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt tx8 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TX9:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TXA:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TXB:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TXC:
|
||||
+ info = &dbg_port_dspt_hdt_tx9_C;
|
||||
+ index = sel + 9 - RTW89_DBG_PORT_SEL_DSPT_HDT_TX9;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, index);
|
||||
+ seq_printf(m, "Enable Dispatcher hdt tx%x dump.\n", index);
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_TXD:
|
||||
+ info = &dbg_port_dspt_hdt_txD;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 0);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 0xD);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt txD dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX0:
|
||||
+ info = &dbg_port_dspt_cdt_tx0;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 0);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt tx0 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX1:
|
||||
+ info = &dbg_port_dspt_cdt_tx1;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 1);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt tx1 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX3:
|
||||
+ info = &dbg_port_dspt_cdt_tx3;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 3);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt tx3 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX4:
|
||||
+ info = &dbg_port_dspt_cdt_tx4;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 4);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt tx4 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX5:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX6:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX7:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX8:
|
||||
+ info = &dbg_port_dspt_cdt_tx5_8;
|
||||
+ index = sel + 5 - RTW89_DBG_PORT_SEL_DSPT_CDT_TX5;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, index);
|
||||
+ seq_printf(m, "Enable Dispatcher cdt tx%x dump.\n", index);
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TX9:
|
||||
+ info = &dbg_port_dspt_cdt_tx9;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 9);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt tx9 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TXA:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TXB:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_TXC:
|
||||
+ info = &dbg_port_dspt_cdt_txA_C;
|
||||
+ index = sel + 0xA - RTW89_DBG_PORT_SEL_DSPT_CDT_TXA;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 1);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, index);
|
||||
+ seq_printf(m, "Enable Dispatcher cdt tx%x dump.\n", index);
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX0:
|
||||
+ info = &dbg_port_dspt_hdt_rx0;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 2);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 0);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt rx0 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX1:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX2:
|
||||
+ info = &dbg_port_dspt_hdt_rx1_2;
|
||||
+ index = sel + 1 - RTW89_DBG_PORT_SEL_DSPT_HDT_RX1;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 2);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, index);
|
||||
+ seq_printf(m, "Enable Dispatcher hdt rx%x dump.\n", index);
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX3:
|
||||
+ info = &dbg_port_dspt_hdt_rx3;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 2);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 3);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt rx3 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX4:
|
||||
+ info = &dbg_port_dspt_hdt_rx4;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 2);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 4);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt rx4 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_HDT_RX5:
|
||||
+ info = &dbg_port_dspt_hdt_rx5;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 2);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 5);
|
||||
+ seq_puts(m, "Enable Dispatcher hdt rx5 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_0:
|
||||
+ info = &dbg_port_dspt_cdt_rx_p0_0;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 3);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 0);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt rx part0 0 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0:
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_1:
|
||||
+ info = &dbg_port_dspt_cdt_rx_p0_1;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 3);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 1);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt rx part0 1 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_2:
|
||||
+ info = &dbg_port_dspt_cdt_rx_p0_2;
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 3);
|
||||
+ rtw89_write16_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_CH_SEL_MASK, 2);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt rx part0 2 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P1:
|
||||
+ info = &dbg_port_dspt_cdt_rx_p1;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 3);
|
||||
+ seq_puts(m, "Enable Dispatcher cdt rx part1 dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_STF_CTRL:
|
||||
+ info = &dbg_port_dspt_stf_ctrl;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 4);
|
||||
+ seq_puts(m, "Enable Dispatcher stf control dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_ADDR_CTRL:
|
||||
+ info = &dbg_port_dspt_addr_ctrl;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 5);
|
||||
+ seq_puts(m, "Enable Dispatcher addr control dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_WDE_INTF:
|
||||
+ info = &dbg_port_dspt_wde_intf;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 6);
|
||||
+ seq_puts(m, "Enable Dispatcher wde interface dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_PLE_INTF:
|
||||
+ info = &dbg_port_dspt_ple_intf;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 7);
|
||||
+ seq_puts(m, "Enable Dispatcher ple interface dump.\n");
|
||||
+ break;
|
||||
+ case RTW89_DBG_PORT_SEL_DSPT_FLOW_CTRL:
|
||||
+ info = &dbg_port_dspt_flow_ctrl;
|
||||
+ rtw89_write8_mask(rtwdev, info->sel_addr,
|
||||
+ B_AX_DISPATCHER_INTN_SEL_MASK, 8);
|
||||
+ seq_puts(m, "Enable Dispatcher flow control dump.\n");
|
||||
+ break;
|
||||
case RTW89_DBG_PORT_SEL_PCIE_TXDMA:
|
||||
info = &dbg_port_pcie_txdma;
|
||||
val32 = rtw89_read32(rtwdev, R_AX_DBG_CTRL);
|
||||
@@ -1956,6 +2483,10 @@ static bool is_dbg_port_valid(struct rtw89_dev *rtwdev, u32 sel)
|
||||
sel >= RTW89_DBG_PORT_SEL_WDE_BUFMGN_FREEPG &&
|
||||
sel <= RTW89_DBG_PORT_SEL_PKTINFO)
|
||||
return false;
|
||||
+ if (rtw89_mac_check_mac_en(rtwdev, 0, RTW89_DMAC_SEL) &&
|
||||
+ sel >= RTW89_DBG_PORT_SEL_DSPT_HDT_TX0 &&
|
||||
+ sel <= RTW89_DBG_PORT_SEL_DSPT_FLOW_CTRL)
|
||||
+ return false;
|
||||
if (rtw89_mac_check_mac_en(rtwdev, 0, RTW89_CMAC_SEL) &&
|
||||
sel >= RTW89_DBG_PORT_SEL_PTCL_C0 &&
|
||||
sel <= RTW89_DBG_PORT_SEL_TXTF_INFOH_C0)
|
||||
@@ -2026,6 +2557,50 @@ static int rtw89_debug_mac_dbg_port_dump(struct rtw89_dev *rtwdev,
|
||||
case_DBG_SEL(PLE_QUEMGN_QLNKTBL);
|
||||
case_DBG_SEL(PLE_QUEMGN_QEMPTY);
|
||||
case_DBG_SEL(PKTINFO);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX0);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX1);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX2);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX3);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX4);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX5);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX6);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX7);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX8);
|
||||
+ case_DBG_SEL(DSPT_HDT_TX9);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXA);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXB);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXC);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXD);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXE);
|
||||
+ case_DBG_SEL(DSPT_HDT_TXF);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX0);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX1);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX3);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX4);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX5);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX6);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX7);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX8);
|
||||
+ case_DBG_SEL(DSPT_CDT_TX9);
|
||||
+ case_DBG_SEL(DSPT_CDT_TXA);
|
||||
+ case_DBG_SEL(DSPT_CDT_TXB);
|
||||
+ case_DBG_SEL(DSPT_CDT_TXC);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX0);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX1);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX2);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX3);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX4);
|
||||
+ case_DBG_SEL(DSPT_HDT_RX5);
|
||||
+ case_DBG_SEL(DSPT_CDT_RX_P0);
|
||||
+ case_DBG_SEL(DSPT_CDT_RX_P0_0);
|
||||
+ case_DBG_SEL(DSPT_CDT_RX_P0_1);
|
||||
+ case_DBG_SEL(DSPT_CDT_RX_P0_2);
|
||||
+ case_DBG_SEL(DSPT_CDT_RX_P1);
|
||||
+ case_DBG_SEL(DSPT_STF_CTRL);
|
||||
+ case_DBG_SEL(DSPT_ADDR_CTRL);
|
||||
+ case_DBG_SEL(DSPT_WDE_INTF);
|
||||
+ case_DBG_SEL(DSPT_PLE_INTF);
|
||||
+ case_DBG_SEL(DSPT_FLOW_CTRL);
|
||||
case_DBG_SEL(PCIE_TXDMA);
|
||||
case_DBG_SEL(PCIE_RXDMA);
|
||||
case_DBG_SEL(PCIE_CVT);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 34f7d51be3f97..46d9cad2b5ec8 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -211,6 +211,51 @@ enum rtw89_mac_dbg_port_sel {
|
||||
RTW89_DBG_PORT_SEL_PLE_QUEMGN_QLNKTBL,
|
||||
RTW89_DBG_PORT_SEL_PLE_QUEMGN_QEMPTY,
|
||||
RTW89_DBG_PORT_SEL_PKTINFO,
|
||||
+ /* DISPATCHER related */
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX0,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX1,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX2,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX3,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX4,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX5,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX6,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX7,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX8,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TX9,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXA,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXB,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXC,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXD,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXE,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_TXF,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX0,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX1,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX3,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX4,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX5,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX6,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX7,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX8,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TX9,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TXA,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TXB,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_TXC,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX0,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX1,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX2,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX3,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX4,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_HDT_RX5,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_0,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_1,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_2,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P1,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_STF_CTRL,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_ADDR_CTRL,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_WDE_INTF,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_PLE_INTF,
|
||||
+ RTW89_DBG_PORT_SEL_DSPT_FLOW_CTRL,
|
||||
/* PCIE related */
|
||||
RTW89_DBG_PORT_SEL_PCIE_TXDMA,
|
||||
RTW89_DBG_PORT_SEL_PCIE_RXDMA,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 2f6358244934f..8a1cb8f4aa16c 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -952,6 +952,11 @@
|
||||
B_AX_STF_OQT_OVERFLOW_ERR_INT_EN | \
|
||||
B_AX_STF_OQT_UNDERFLOW_ERR_INT_EN)
|
||||
|
||||
+#define R_AX_DISPATCHER_DBG_PORT 0x8860
|
||||
+#define B_AX_DISPATCHER_DBG_SEL_MASK GENMASK(11, 8)
|
||||
+#define B_AX_DISPATCHER_INTN_SEL_MASK GENMASK(7, 4)
|
||||
+#define B_AX_DISPATCHER_CH_SEL_MASK GENMASK(3, 0)
|
||||
+
|
||||
#define R_AX_RX_FUNCTION_STOP 0x8920
|
||||
#define B_AX_HDR_RX_STOP BIT(0)
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@
|
||||
From 42a885f1bd88f81ea13cc0ab0db0533a9ac0e046 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 057/142] wifi: rtw89: 8852b: change debug mask of message of
|
||||
no TX resource
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 901c247f9687b5aecc950a931a3b0e1930d02bfd
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Tue Nov 8 09:42:30 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: change debug mask of message of no TX resource
|
||||
|
||||
8852B has smaller TX FIFO than others in WiFi chip, so it would be buffer
|
||||
full frequently, but it doesn't affect TX performance. However, it shows
|
||||
verbose debug messages with RTW89_DBG_UNEXP mask that is used to indicate
|
||||
abnormal behavior, so change debug mask to RTW89_DBG_TXRX for 8852B.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221108014230.11068-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/pci.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
index 07a2e23759f0b..7aa0af18cdd50 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
@@ -971,8 +971,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
|
||||
struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
|
||||
struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
u32 bd_cnt, wd_cnt, min_cnt = 0;
|
||||
struct rtw89_pci_rx_ring *rx_ring;
|
||||
+ enum rtw89_debug_mask debug_mask;
|
||||
u32 cnt;
|
||||
|
||||
rx_ring = &rtwpci->rx_rings[RTW89_RXCH_RPQ];
|
||||
@@ -996,10 +998,20 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
||||
bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
|
||||
wd_cnt = wd_ring->curr_num;
|
||||
min_cnt = min(bd_cnt, wd_cnt);
|
||||
- if (min_cnt == 0)
|
||||
- rtw89_debug(rtwdev, rtwpci->low_power ? RTW89_DBG_TXRX : RTW89_DBG_UNEXP,
|
||||
+ if (min_cnt == 0) {
|
||||
+ /* This message can be frequently shown in low power mode or
|
||||
+ * high traffic with 8852B, and we have recognized it as normal
|
||||
+ * behavior, so print with mask RTW89_DBG_TXRX in these situations.
|
||||
+ */
|
||||
+ if (rtwpci->low_power || chip->chip_id == RTL8852B)
|
||||
+ debug_mask = RTW89_DBG_TXRX;
|
||||
+ else
|
||||
+ debug_mask = RTW89_DBG_UNEXP;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, debug_mask,
|
||||
"still no tx resource after reclaim: wd_cnt=%d bd_cnt=%d\n",
|
||||
wd_cnt, bd_cnt);
|
||||
+ }
|
||||
|
||||
out_unlock:
|
||||
spin_unlock_bh(&rtwpci->trx_lock);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,65 @@
|
||||
From bb94a58ca685310dad2072683b97365647dd4389 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 058/142] wifi: rtw89: Fix some error handling path in
|
||||
rtw89_wow_enable()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 61ec34dee266f1cea092986d861a2cb136571199
|
||||
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Date: Sun Nov 13 16:42:21 2022 +0100
|
||||
|
||||
wifi: rtw89: Fix some error handling path in rtw89_wow_enable()
|
||||
|
||||
'ret' is not updated after several function calls in rtw89_wow_enable().
|
||||
This prevent error handling from working.
|
||||
|
||||
Add the missing assignments.
|
||||
|
||||
Fixes: 19e28c7fcc74 ("wifi: rtw89: add WoWLAN function support")
|
||||
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/32320176eeff1c635baeea25ef0e87d116859e65.1668354083.git.christophe.jaillet@wanadoo.fr
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/wow.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
index 7de4dd047d6b3..b2b826b2e09ae 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
|
||||
@@ -744,13 +744,13 @@ static int rtw89_wow_enable(struct rtw89_dev *rtwdev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
- rtw89_wow_swap_fw(rtwdev, true);
|
||||
+ ret = rtw89_wow_swap_fw(rtwdev, true);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "wow: failed to swap to wow fw\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
- rtw89_wow_fw_start(rtwdev);
|
||||
+ ret = rtw89_wow_fw_start(rtwdev);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "wow: failed to let wow fw start\n");
|
||||
goto out;
|
||||
@@ -758,7 +758,7 @@ static int rtw89_wow_enable(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw89_wow_enter_lps(rtwdev);
|
||||
|
||||
- rtw89_wow_enable_trx_post(rtwdev);
|
||||
+ ret = rtw89_wow_enable_trx_post(rtwdev);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "wow: failed to enable trx_post\n");
|
||||
goto out;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,81 @@
|
||||
From 8cfacd18e7402d31dbab5b3c384000bc2ecac77e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 059/142] wifi: rtw89: 8852b: correct TX power controlled by
|
||||
BT-coexistence
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 79ca91a3c1f1e5d871f393791e7538f9386a7711
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Thu Nov 17 14:18:32 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: correct TX power controlled by BT-coexistence
|
||||
|
||||
When coexistence mechanism is under free-run mode, it could adjust WiFi
|
||||
and BT TX power to avoid interference with each other. For other cases,
|
||||
it should keep original TX power from regular predefined tables, so
|
||||
set correct values to 255 for these cases.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221117061832.42057-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 30 +++++++++++++--------------
|
||||
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 0df044b1c392a..85dfc1ebb0d97 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -318,27 +318,27 @@ static const struct rtw89_dig_regs rtw8852b_dig_regs = {
|
||||
};
|
||||
|
||||
static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_ul[] = {
|
||||
- {15, 0, 0, 7}, /* 0 -> original */
|
||||
- {15, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
|
||||
- {15, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
+ {255, 0, 0, 7}, /* 0 -> original */
|
||||
+ {255, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
|
||||
+ {255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
{6, 1, 0, 7},
|
||||
{13, 1, 0, 7},
|
||||
{13, 1, 0, 7}
|
||||
};
|
||||
|
||||
static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_dl[] = {
|
||||
- {15, 0, 0, 7}, /* 0 -> original */
|
||||
- {15, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
- {15, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
- {15, 1, 0, 7},
|
||||
- {15, 1, 0, 7},
|
||||
- {15, 1, 0, 7}
|
||||
+ {255, 0, 0, 7}, /* 0 -> original */
|
||||
+ {255, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
|
||||
+ {255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
|
||||
+ {255, 1, 0, 7},
|
||||
+ {255, 1, 0, 7},
|
||||
+ {255, 1, 0, 7}
|
||||
};
|
||||
|
||||
static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852b_mon_reg[] = {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,121 @@
|
||||
From 13b86e2e28b89197dc98c888c343f221e0960b81 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 060/142] wifi: rtw89: read CFO from FD or preamble CFO field
|
||||
of phy status ie_type 1 accordingly
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 10cd4092f67eaf0cade4f50c68ecb055d4ee3a93
|
||||
Author: Eric Huang <echuang@realtek.com>
|
||||
Date: Thu Nov 17 14:30:00 2022 +0800
|
||||
|
||||
wifi: rtw89: read CFO from FD or preamble CFO field of phy status ie_type 1 accordingly
|
||||
|
||||
Add macro to get FD(frequency domain) CFO field from ie_type 1, and correct
|
||||
the naming for preamble CFO field. Each IC could assign the CFO source to
|
||||
either FD CFO or preamble CFO in chip_info. Based on the suggestion from HW
|
||||
designer, rtw8852b and its derived versions will have better CFO tracking
|
||||
performance with FD CFO.
|
||||
|
||||
Signed-off-by: Eric Huang <echuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221117063001.42967-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 6 +++++-
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/txrx.h | 4 +++-
|
||||
6 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 1ebb2743ff4c4..f1bf4c4471039 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -1196,7 +1196,11 @@ static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev, u8 *addr,
|
||||
if (phy_ppdu->rate < RTW89_HW_RATE_OFDM6)
|
||||
return;
|
||||
/* sign conversion for S(12,2) */
|
||||
- cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_CFO(addr), 11);
|
||||
+ if (rtwdev->chip->cfo_src_fd)
|
||||
+ cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_FD_CFO(addr), 11);
|
||||
+ else
|
||||
+ cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_PREMB_CFO(addr), 11);
|
||||
+
|
||||
rtw89_phy_cfo_parse(rtwdev, cfo, phy_ppdu);
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index b60de6662548b..ba4ccbde5ecf9 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2755,6 +2755,7 @@ struct rtw89_chip_info {
|
||||
u32 c2h_ctrl_reg;
|
||||
const u32 *c2h_regs;
|
||||
const struct rtw89_page_regs *page_regs;
|
||||
+ bool cfo_src_fd;
|
||||
const struct rtw89_reg_def *dcfo_comp;
|
||||
u8 dcfo_comp_sft;
|
||||
const struct rtw89_imr_info *imr_info;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index 4cea5fb4327d7..f38a330698e9a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -2143,6 +2143,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.c2h_ctrl_reg = R_AX_C2HREG_CTRL,
|
||||
.c2h_regs = rtw8852a_c2h_regs,
|
||||
.page_regs = &rtw8852a_page_regs,
|
||||
+ .cfo_src_fd = false,
|
||||
.dcfo_comp = &rtw8852a_dcfo_comp,
|
||||
.dcfo_comp_sft = 3,
|
||||
.imr_info = &rtw8852a_imr_info,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 85dfc1ebb0d97..22b3c86ee7d86 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -2512,6 +2512,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.c2h_ctrl_reg = R_AX_C2HREG_CTRL,
|
||||
.c2h_regs = rtw8852b_c2h_regs,
|
||||
.page_regs = &rtw8852b_page_regs,
|
||||
+ .cfo_src_fd = true,
|
||||
.dcfo_comp = &rtw8852b_dcfo_comp,
|
||||
.dcfo_comp_sft = 3,
|
||||
.imr_info = &rtw8852b_imr_info,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 6619ba7307199..01e6358fa1a29 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2953,6 +2953,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
.c2h_ctrl_reg = R_AX_C2HREG_CTRL_V1,
|
||||
.c2h_regs = rtw8852c_c2h_regs,
|
||||
.page_regs = &rtw8852c_page_regs,
|
||||
+ .cfo_src_fd = false,
|
||||
.dcfo_comp = &rtw8852c_dcfo_comp,
|
||||
.dcfo_comp_sft = 5,
|
||||
.imr_info = &rtw8852c_imr_info,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/txrx.h b/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
index b889e7bf34c0c..9d4c6b6fa1250 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
@@ -298,7 +298,9 @@
|
||||
le32_get_bits(*((const __le32 *)ie), GENMASK(11, 5))
|
||||
#define RTW89_GET_PHY_STS_IE01_CH_IDX(ie) \
|
||||
le32_get_bits(*((const __le32 *)ie), GENMASK(23, 16))
|
||||
-#define RTW89_GET_PHY_STS_IE01_CFO(ie) \
|
||||
+#define RTW89_GET_PHY_STS_IE01_FD_CFO(ie) \
|
||||
+ le32_get_bits(*((const __le32 *)(ie) + 1), GENMASK(19, 8))
|
||||
+#define RTW89_GET_PHY_STS_IE01_PREMB_CFO(ie) \
|
||||
le32_get_bits(*((const __le32 *)(ie) + 1), GENMASK(31, 20))
|
||||
|
||||
enum rtw89_tx_channel {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,334 @@
|
||||
From ea32d2f7300d94511f2c43afac2ce59ac395b30c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 061/142] wifi: rtw89: switch BANDEDGE and TX_SHAPE based on
|
||||
OFDMA trigger frame
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 29136c95fdc5d9bbfb56131408388fefdba4ed95
|
||||
Author: Eric Huang <echuang@realtek.com>
|
||||
Date: Thu Nov 17 14:30:01 2022 +0800
|
||||
|
||||
wifi: rtw89: switch BANDEDGE and TX_SHAPE based on OFDMA trigger frame
|
||||
|
||||
There are some registers for transmit waveform control, two of them used
|
||||
in this change are for BANDEDGE and TX_SHAPE control. BANDEDGE controls
|
||||
whether to apply band edge filter to transmit waveform. TX_SHAPE controls
|
||||
whether to apply triangular mask to transmit waveform. It is found for
|
||||
some chip, these two should be turned off during OFDMA UL traffic for
|
||||
better performance.
|
||||
|
||||
Signed-off-by: Eric Huang <echuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221117063001.42967-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 2 +
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 9 ++
|
||||
drivers/net/wireless/realtek/rtw89/debug.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 127 +++++++++++++++++++++++++-
|
||||
drivers/net/wireless/realtek/rtw89/phy.h | 5 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 +
|
||||
8 files changed, 146 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index f1bf4c4471039..2ea38376bd2bb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -2237,6 +2237,7 @@ static void rtw89_track_work(struct work_struct *work)
|
||||
rtw89_phy_ra_update(rtwdev);
|
||||
rtw89_phy_cfo_track(rtwdev);
|
||||
rtw89_phy_tx_path_div_track(rtwdev);
|
||||
+ rtw89_phy_ul_tb_ctrl_track(rtwdev);
|
||||
|
||||
if (rtwdev->lps_enabled && !rtwdev->btc.lps)
|
||||
rtw89_enter_lps_track(rtwdev);
|
||||
@@ -2560,6 +2561,7 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
|
||||
rtw89_btc_ntfy_role_info(rtwdev, rtwvif, rtwsta,
|
||||
BTC_ROLE_MSTS_STA_CONN_END);
|
||||
rtw89_core_get_no_ul_ofdma_htc(rtwdev, &rtwsta->htc_template);
|
||||
+ rtw89_phy_ul_tb_assoc(rtwdev, rtwvif);
|
||||
}
|
||||
|
||||
return ret;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index ba4ccbde5ecf9..62d834dbff67b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2261,6 +2261,8 @@ struct rtw89_vif {
|
||||
bool wowlan_magic;
|
||||
bool is_hesta;
|
||||
bool last_a_ctrl;
|
||||
+ bool dyn_tb_bedge_en;
|
||||
+ u8 def_tri_idx;
|
||||
struct work_struct update_beacon_work;
|
||||
struct rtw89_addr_cam_entry addr_cam;
|
||||
struct rtw89_bssid_cam_entry bssid_cam;
|
||||
@@ -2646,6 +2648,11 @@ struct rtw89_dig_regs {
|
||||
struct rtw89_reg_def p1_s20_pagcugc_en;
|
||||
};
|
||||
|
||||
+struct rtw89_phy_ul_tb_info {
|
||||
+ bool dyn_tb_tri_en;
|
||||
+ u8 def_if_bandedge;
|
||||
+};
|
||||
+
|
||||
struct rtw89_chip_info {
|
||||
enum rtw89_core_chip_id chip_id;
|
||||
const struct rtw89_chip_ops *ops;
|
||||
@@ -2663,6 +2670,7 @@ struct rtw89_chip_info {
|
||||
u8 support_chanctx_num;
|
||||
u8 support_bands;
|
||||
bool support_bw160;
|
||||
+ bool support_ul_tb_ctrl;
|
||||
bool hw_sec_hdr;
|
||||
u8 rf_path_num;
|
||||
u8 tx_nss;
|
||||
@@ -3585,6 +3593,7 @@ struct rtw89_dev {
|
||||
struct rtw89_phy_ch_info ch_info;
|
||||
struct rtw89_phy_bb_gain_info bb_gain;
|
||||
struct rtw89_phy_efuse_gain efuse_gain;
|
||||
+ struct rtw89_phy_ul_tb_info ul_tb_info;
|
||||
|
||||
struct delayed_work track_work;
|
||||
struct delayed_work coex_act1_work;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/debug.h b/drivers/net/wireless/realtek/rtw89/debug.h
|
||||
index e7971583acbc9..d1de5e600836c 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/debug.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/debug.h
|
||||
@@ -27,6 +27,7 @@ enum rtw89_debug_mask {
|
||||
RTW89_DBG_SAR = BIT(16),
|
||||
RTW89_DBG_STATE = BIT(17),
|
||||
RTW89_DBG_WOW = BIT(18),
|
||||
+ RTW89_DBG_UL_TB = BIT(19),
|
||||
|
||||
RTW89_DBG_UNEXP = BIT(31),
|
||||
};
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 944bb0f2ee633..017710c580c72 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright(c) 2019-2020 Realtek Corporation
|
||||
*/
|
||||
|
||||
+#include "coex.h"
|
||||
#include "debug.h"
|
||||
#include "fw.h"
|
||||
#include "mac.h"
|
||||
@@ -9,7 +10,7 @@
|
||||
#include "ps.h"
|
||||
#include "reg.h"
|
||||
#include "sar.h"
|
||||
-#include "coex.h"
|
||||
+#include "util.h"
|
||||
|
||||
static u16 get_max_amsdu_len(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_ra_report *report)
|
||||
@@ -2794,6 +2795,129 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val,
|
||||
cfo->packet_count++;
|
||||
}
|
||||
|
||||
+void rtw89_phy_ul_tb_assoc(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
+{
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
+ struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
+
|
||||
+ if (!chip->support_ul_tb_ctrl)
|
||||
+ return;
|
||||
+
|
||||
+ rtwvif->def_tri_idx =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_DCFO_OPT, B_TXSHAPE_TRIANGULAR_CFG);
|
||||
+
|
||||
+ if (chip->chip_id == RTL8852B && rtwdev->hal.cv > CHIP_CBV)
|
||||
+ rtwvif->dyn_tb_bedge_en = false;
|
||||
+ else if (chan->band_type >= RTW89_BAND_5G &&
|
||||
+ chan->band_width >= RTW89_CHANNEL_WIDTH_40)
|
||||
+ rtwvif->dyn_tb_bedge_en = true;
|
||||
+ else
|
||||
+ rtwvif->dyn_tb_bedge_en = false;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] def_if_bandedge=%d, def_tri_idx=%d\n",
|
||||
+ ul_tb_info->def_if_bandedge, rtwvif->def_tri_idx);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] dyn_tb_begde_en=%d, dyn_tb_tri_en=%d\n",
|
||||
+ rtwvif->dyn_tb_bedge_en, ul_tb_info->dyn_tb_tri_en);
|
||||
+}
|
||||
+
|
||||
+struct rtw89_phy_ul_tb_check_data {
|
||||
+ bool valid;
|
||||
+ bool high_tf_client;
|
||||
+ bool low_tf_client;
|
||||
+ bool dyn_tb_bedge_en;
|
||||
+ u8 def_tri_idx;
|
||||
+};
|
||||
+
|
||||
+static
|
||||
+void rtw89_phy_ul_tb_ctrl_check(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ struct rtw89_phy_ul_tb_check_data *ul_tb_data)
|
||||
+{
|
||||
+ struct rtw89_traffic_stats *stats = &rtwdev->stats;
|
||||
+ struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
|
||||
+
|
||||
+ if (rtwvif->wifi_role != RTW89_WIFI_ROLE_STATION)
|
||||
+ return;
|
||||
+
|
||||
+ if (!vif->cfg.assoc)
|
||||
+ return;
|
||||
+
|
||||
+ if (stats->rx_tf_periodic > UL_TB_TF_CNT_L2H_TH)
|
||||
+ ul_tb_data->high_tf_client = true;
|
||||
+ else if (stats->rx_tf_periodic < UL_TB_TF_CNT_H2L_TH)
|
||||
+ ul_tb_data->low_tf_client = true;
|
||||
+
|
||||
+ ul_tb_data->valid = true;
|
||||
+ ul_tb_data->def_tri_idx = rtwvif->def_tri_idx;
|
||||
+ ul_tb_data->dyn_tb_bedge_en = rtwvif->dyn_tb_bedge_en;
|
||||
+}
|
||||
+
|
||||
+void rtw89_phy_ul_tb_ctrl_track(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
+ struct rtw89_phy_ul_tb_check_data ul_tb_data = {};
|
||||
+ struct rtw89_vif *rtwvif;
|
||||
+
|
||||
+ if (!chip->support_ul_tb_ctrl)
|
||||
+ return;
|
||||
+
|
||||
+ if (rtwdev->total_sta_assoc != 1)
|
||||
+ return;
|
||||
+
|
||||
+ rtw89_for_each_rtwvif(rtwdev, rtwvif)
|
||||
+ rtw89_phy_ul_tb_ctrl_check(rtwdev, rtwvif, &ul_tb_data);
|
||||
+
|
||||
+ if (!ul_tb_data.valid)
|
||||
+ return;
|
||||
+
|
||||
+ if (ul_tb_data.dyn_tb_bedge_en) {
|
||||
+ if (ul_tb_data.high_tf_client) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN, 0);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] Turn off if_bandedge\n");
|
||||
+ } else if (ul_tb_data.low_tf_client) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN,
|
||||
+ ul_tb_info->def_if_bandedge);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] Set to default if_bandedge = %d\n",
|
||||
+ ul_tb_info->def_if_bandedge);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (ul_tb_info->dyn_tb_tri_en) {
|
||||
+ if (ul_tb_data.high_tf_client) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DCFO_OPT,
|
||||
+ B_TXSHAPE_TRIANGULAR_CFG, 0);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] Turn off Tx triangle\n");
|
||||
+ } else if (ul_tb_data.low_tf_client) {
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_DCFO_OPT,
|
||||
+ B_TXSHAPE_TRIANGULAR_CFG,
|
||||
+ ul_tb_data.def_tri_idx);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
+ "[ULTB] Set to default tx_shap_idx = %d\n",
|
||||
+ ul_tb_data.def_tri_idx);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rtw89_phy_ul_tb_info_init(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
+
|
||||
+ if (!chip->support_ul_tb_ctrl)
|
||||
+ return;
|
||||
+
|
||||
+ ul_tb_info->dyn_tb_tri_en = true;
|
||||
+ ul_tb_info->def_if_bandedge =
|
||||
+ rtw89_phy_read32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN);
|
||||
+}
|
||||
+
|
||||
static void rtw89_phy_stat_thermal_update(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_phy_stat *phystat = &rtwdev->phystat;
|
||||
@@ -3980,6 +4104,7 @@ void rtw89_phy_dm_init(struct rtw89_dev *rtwdev)
|
||||
rtw89_physts_parsing_init(rtwdev);
|
||||
rtw89_phy_dig_init(rtwdev);
|
||||
rtw89_phy_cfo_init(rtwdev);
|
||||
+ rtw89_phy_ul_tb_info_init(rtwdev);
|
||||
|
||||
rtw89_phy_init_rf_nctl(rtwdev);
|
||||
rtw89_chip_rfk_init(rtwdev);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
index dac69a02e8687..21233f094644b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||||
@@ -64,6 +64,9 @@
|
||||
#define MAX_CFO_TOLERANCE 30
|
||||
#define CFO_TF_CNT_TH 300
|
||||
|
||||
+#define UL_TB_TF_CNT_L2H_TH 100
|
||||
+#define UL_TB_TF_CNT_H2L_TH 70
|
||||
+
|
||||
#define CCX_MAX_PERIOD 2097
|
||||
#define CCX_MAX_PERIOD_UNIT 32
|
||||
#define MS_TO_4US_RATIO 250
|
||||
@@ -550,5 +553,7 @@ void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif
|
||||
void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_mac_idx mac_idx,
|
||||
enum rtw89_tssi_bandedge_cfg bandedge_cfg);
|
||||
+void rtw89_phy_ul_tb_assoc(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
+void rtw89_phy_ul_tb_ctrl_track(struct rtw89_dev *rtwdev);
|
||||
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index f38a330698e9a..eff6519cf0191 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -2082,6 +2082,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
BIT(NL80211_BAND_5GHZ),
|
||||
.support_bw160 = false,
|
||||
+ .support_ul_tb_ctrl = false,
|
||||
.hw_sec_hdr = false,
|
||||
.rf_path_num = 2,
|
||||
.tx_nss = 2,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 22b3c86ee7d86..2d4d572dc601f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -2452,6 +2452,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
BIT(NL80211_BAND_5GHZ),
|
||||
.support_bw160 = false,
|
||||
+ .support_ul_tb_ctrl = true,
|
||||
.hw_sec_hdr = false,
|
||||
.rf_path_num = 2,
|
||||
.tx_nss = 2,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 01e6358fa1a29..9bc98fd5d4ac2 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2891,6 +2891,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
BIT(NL80211_BAND_5GHZ) |
|
||||
BIT(NL80211_BAND_6GHZ),
|
||||
.support_bw160 = true,
|
||||
+ .support_ul_tb_ctrl = false,
|
||||
.hw_sec_hdr = true,
|
||||
.rf_path_num = 2,
|
||||
.tx_nss = 2,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,95 @@
|
||||
From 100a5e9b3f924d1840b8be0134fb0fc7e93a9c1f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:29 +0200
|
||||
Subject: [PATCH 062/142] wifi: rtw89: avoid inaccessible IO operations during
|
||||
doing change_interface()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit ac3a9f1838d8f5e5f9c8b6e2582b65c48a1e7bc1
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Thu Nov 17 16:52:35 2022 +0800
|
||||
|
||||
wifi: rtw89: avoid inaccessible IO operations during doing change_interface()
|
||||
|
||||
During doing change_interface(), hardware is power-off, so some components
|
||||
are inaccessible and return error. This causes things unexpected, and we
|
||||
don't have a warning message for that. So, ignore some IO operations in
|
||||
this situation, and add a warning message to indicate something wrong.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221117085235.53777-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 7 +++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac80211.c | 11 ++++++++++-
|
||||
3 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 62d834dbff67b..1b0acb1c5450e 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2968,6 +2968,7 @@ enum rtw89_flags {
|
||||
RTW89_FLAG_CRASH_SIMULATING,
|
||||
RTW89_FLAG_WOWLAN,
|
||||
RTW89_FLAG_FORBIDDEN_TRACK_WROK,
|
||||
+ RTW89_FLAG_CHANGING_INTERFACE,
|
||||
|
||||
NUM_OF_RTW89_FLAGS,
|
||||
};
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index ecd603a881345..6587cdf6ba624 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -3600,6 +3600,13 @@ int rtw89_mac_set_macid_pause(struct rtw89_dev *rtwdev, u8 macid, bool pause)
|
||||
u8 grp = macid >> 5;
|
||||
int ret;
|
||||
|
||||
+ /* If this is called by change_interface() in the case of P2P, it could
|
||||
+ * be power-off, so ignore this operation.
|
||||
+ */
|
||||
+ if (test_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags) &&
|
||||
+ !test_bit(RTW89_FLAG_POWERON, rtwdev->flags))
|
||||
+ return 0;
|
||||
+
|
||||
ret = rtw89_mac_check_mac_en(rtwdev, RTW89_MAC_0, RTW89_CMAC_SEL);
|
||||
if (ret)
|
||||
return ret;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
index 6e79bf899901d..ce980d2f22c46 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
@@ -174,6 +174,9 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
||||
enum nl80211_iftype type, bool p2p)
|
||||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
+ int ret;
|
||||
+
|
||||
+ set_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_STATE, "change vif %pM (%d)->(%d), p2p (%d)->(%d)\n",
|
||||
vif->addr, vif->type, type, vif->p2p, p2p);
|
||||
@@ -183,7 +186,13 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
||||
vif->type = type;
|
||||
vif->p2p = p2p;
|
||||
|
||||
- return rtw89_ops_add_interface(hw, vif);
|
||||
+ ret = rtw89_ops_add_interface(hw, vif);
|
||||
+ if (ret)
|
||||
+ rtw89_warn(rtwdev, "failed to change interface %d\n", ret);
|
||||
+
|
||||
+ clear_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static void rtw89_ops_configure_filter(struct ieee80211_hw *hw,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,65 @@
|
||||
From 58994c76089440e2b4b4c24c565fcb6a2fa16ef8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 063/142] wifi: rtw89: enable mac80211 virtual monitor
|
||||
interface
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit cd9b6b3baf5278c73c91e242d41387684fc7f8d8
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Fri Nov 25 15:24:14 2022 +0800
|
||||
|
||||
wifi: rtw89: enable mac80211 virtual monitor interface
|
||||
|
||||
For running with mac80211 channel context ops and using only as monitor,
|
||||
we need to enable WANT_MONITOR_VIF to let mac80211 process virtual monitor
|
||||
interface. Then, we are able to set channel on the monitor from user space.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221125072416.94752-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 2ea38376bd2bb..2db9eb6556565 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -1405,6 +1405,9 @@ static void rtw89_vif_rx_stats_iter(void *data, u8 *mac,
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
const u8 *bssid = iter_data->bssid;
|
||||
|
||||
+ if (!vif->bss_conf.bssid)
|
||||
+ return;
|
||||
+
|
||||
if (ieee80211_is_trigger(hdr->frame_control)) {
|
||||
rtw89_stats_trigger_frame(rtwdev, vif, skb);
|
||||
return;
|
||||
@@ -2386,6 +2389,8 @@ void rtw89_vif_type_mapping(struct ieee80211_vif *vif, bool assoc)
|
||||
rtwvif->self_role = RTW89_SELF_ROLE_CLIENT;
|
||||
rtwvif->addr_cam.sec_ent_mode = RTW89_ADDR_CAM_SEC_NORMAL;
|
||||
break;
|
||||
+ case NL80211_IFTYPE_MONITOR:
|
||||
+ break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
@@ -3269,6 +3274,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
|
||||
ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
|
||||
ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
|
||||
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
|
||||
+ ieee80211_hw_set(hw, WANT_MONITOR_VIF);
|
||||
|
||||
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,124 @@
|
||||
From 77e1e15e7e995bfe5a34df7831f8772e4cd2a178 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 064/142] wifi: rtw89: add HE radiotap for monitor mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 51e8ed4e44b5efcf8da2c1f3478e52120a12cdf8
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Nov 25 15:24:15 2022 +0800
|
||||
|
||||
wifi: rtw89: add HE radiotap for monitor mode
|
||||
|
||||
With basic HE radiotap, we can check data rate in sniffer data. To store
|
||||
the radiotap data, we reserve headroom of aligned 64 bytes, and then
|
||||
update HE radiotap in monitor mode, so it doesn't affect performance in
|
||||
normal mode.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221125072416.94752-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 22 ++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 18 ++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/pci.c | 2 +-
|
||||
3 files changed, 41 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 2db9eb6556565..3647998014408 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -1480,6 +1480,27 @@ static void rtw89_core_hw_to_sband_rate(struct ieee80211_rx_status *rx_status)
|
||||
rx_status->rate_idx -= 4;
|
||||
}
|
||||
|
||||
+static void rtw89_core_update_radiotap(struct rtw89_dev *rtwdev,
|
||||
+ struct sk_buff *skb,
|
||||
+ struct ieee80211_rx_status *rx_status)
|
||||
+{
|
||||
+ static const struct ieee80211_radiotap_he known_he = {
|
||||
+ .data1 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN |
|
||||
+ IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN),
|
||||
+ .data2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN),
|
||||
+ };
|
||||
+ struct ieee80211_radiotap_he *he;
|
||||
+
|
||||
+ if (!(rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR))
|
||||
+ return;
|
||||
+
|
||||
+ if (rx_status->encoding == RX_ENC_HE) {
|
||||
+ rx_status->flag |= RX_FLAG_RADIOTAP_HE;
|
||||
+ he = skb_push(skb, sizeof(*he));
|
||||
+ *he = known_he;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
struct rtw89_rx_desc_info *desc_info,
|
||||
@@ -1494,6 +1515,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_core_hw_to_sband_rate(rx_status);
|
||||
rtw89_core_rx_stats(rtwdev, phy_ppdu, desc_info, skb_ppdu);
|
||||
+ rtw89_core_update_radiotap(rtwdev, skb_ppdu, rx_status);
|
||||
/* In low power mode, it does RX in thread context. */
|
||||
local_bh_disable();
|
||||
ieee80211_rx_napi(rtwdev->hw, NULL, skb_ppdu, napi);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 1b0acb1c5450e..0be8f7bd3ca2d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -35,6 +35,7 @@ extern const struct ieee80211_ops rtw89_ops;
|
||||
#define RSSI_FACTOR 1
|
||||
#define RTW89_RSSI_RAW_TO_DBM(rssi) ((s8)((rssi) >> RSSI_FACTOR) - MAX_RSSI)
|
||||
#define RTW89_TX_DIV_RSSI_RAW_TH (2 << RSSI_FACTOR)
|
||||
+#define RTW89_RADIOTAP_ROOM ALIGN(sizeof(struct ieee80211_radiotap_he), 64)
|
||||
|
||||
#define RTW89_HTC_MASK_VARIANT GENMASK(1, 0)
|
||||
#define RTW89_HTC_VARIANT_HE 3
|
||||
@@ -4383,6 +4384,23 @@ static inline struct rtw89_fw_suit *rtw89_fw_suit_get(struct rtw89_dev *rtwdev,
|
||||
return &fw_info->normal;
|
||||
}
|
||||
|
||||
+static inline struct sk_buff *rtw89_alloc_skb_for_rx(struct rtw89_dev *rtwdev,
|
||||
+ unsigned int length)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ if (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR) {
|
||||
+ skb = dev_alloc_skb(length + RTW89_RADIOTAP_ROOM);
|
||||
+ if (!skb)
|
||||
+ return NULL;
|
||||
+
|
||||
+ skb_reserve(skb, RTW89_RADIOTAP_ROOM);
|
||||
+ return skb;
|
||||
+ }
|
||||
+
|
||||
+ return dev_alloc_skb(length);
|
||||
+}
|
||||
+
|
||||
int rtw89_core_tx_write(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, struct sk_buff *skb, int *qsel);
|
||||
int rtw89_h2c_tx(struct rtw89_dev *rtwdev,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
index 7aa0af18cdd50..1c4500ba777c6 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
|
||||
@@ -267,7 +267,7 @@ static u32 rtw89_pci_rxbd_deliver_skbs(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_core_query_rxdesc(rtwdev, desc_info, skb->data, rxinfo_size);
|
||||
|
||||
- new = dev_alloc_skb(desc_info->pkt_size);
|
||||
+ new = rtw89_alloc_skb_for_rx(rtwdev, desc_info->pkt_size);
|
||||
if (!new)
|
||||
goto err_sync_device;
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,73 @@
|
||||
From 3a1164abcbfc5ac67995674982d792986ed70d07 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 065/142] wifi: rtw89: 8852b: turn off PoP function in monitor
|
||||
mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit a215b2b7055f02d8f7666f457d442e77097bb604
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Nov 25 15:24:16 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: turn off PoP function in monitor mode
|
||||
|
||||
PoP stands for Packet on Packet that can improve performance in noisy
|
||||
environment, but it could get RX stuck suddenly. In normal mode, firmware
|
||||
can help to resolve the stuck, but firmware doesn't work in monitor mode.
|
||||
Therefore, turn off PoP to avoid RX stuck.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221125072416.94752-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 7 +++++++
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index dbe06542f443f..f2634062f377d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -4236,6 +4236,8 @@
|
||||
#define R_P1_NBIIDX 0x4770
|
||||
#define B_P1_NBIIDX_VAL GENMASK(11, 0)
|
||||
#define B_P1_NBIIDX_NOTCH_EN BIT(12)
|
||||
+#define R_PKT_CTRL 0x47D4
|
||||
+#define B_PKT_POP_EN BIT(8)
|
||||
#define R_SEG0R_PD 0x481C
|
||||
#define R_SEG0R_PD_V1 0x4860
|
||||
#define B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1 BIT(30)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 2d4d572dc601f..b635ac1d1ca2f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -1411,6 +1411,12 @@ static void rtw8852b_bb_sethw(struct rtw89_dev *rtwdev)
|
||||
rtw89_phy_read32_mask(rtwdev, R_P1_RPL1, B_P0_RPL1_BIAS_MASK);
|
||||
}
|
||||
|
||||
+static void rtw8852b_bb_set_pop(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ if (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR)
|
||||
+ rtw89_phy_write32_clr(rtwdev, R_PKT_CTRL, B_PKT_POP_EN);
|
||||
+}
|
||||
+
|
||||
static void rtw8852b_set_channel_bb(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -1441,6 +1447,7 @@ static void rtw8852b_set_channel_bb(struct rtw89_dev *rtwdev, const struct rtw89
|
||||
rtw89_phy_write32_mask(rtwdev, R_MAC_PIN_SEL, B_CH_IDX_SEG0,
|
||||
chan->primary_channel);
|
||||
rtw8852b_5m_mask(rtwdev, chan, phy_idx);
|
||||
+ rtw8852b_bb_set_pop(rtwdev);
|
||||
rtw8852b_bb_reset_all(rtwdev, phy_idx);
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,164 @@
|
||||
From 667cb1ba6f6d0d5b9fa6de81270f9f60ff8ad71a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 066/142] wifi: rtw89: rfk: rename rtw89_mcc_info to
|
||||
rtw89_rfk_mcc_info
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 38f25dec521edfa289fa0b829676927b13fede91
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:25 2022 +0800
|
||||
|
||||
wifi: rtw89: rfk: rename rtw89_mcc_info to rtw89_rfk_mcc_info
|
||||
|
||||
The `rtw89_mcc_info mcc` is only for RFK MCC stuffs instead of common
|
||||
MCC management info. Replace it with `rtw89_rfk_mcc_info rfk_mcc` to
|
||||
avoid confusion and reserve `struct rtw89_mcc_info mcc` for MCC management
|
||||
code.
|
||||
|
||||
(No logic changes.)
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 4 ++--
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 10 +++++-----
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 4 ++--
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 20 ++++++++++----------
|
||||
4 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 0be8f7bd3ca2d..d0efeeabcb773 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -3032,7 +3032,7 @@ struct rtw89_dack_info {
|
||||
#define RTW89_IQK_CHS_NR 2
|
||||
#define RTW89_IQK_PATH_NR 4
|
||||
|
||||
-struct rtw89_mcc_info {
|
||||
+struct rtw89_rfk_mcc_info {
|
||||
u8 ch[RTW89_IQK_CHS_NR];
|
||||
u8 band[RTW89_IQK_CHS_NR];
|
||||
u8 table_idx;
|
||||
@@ -3578,7 +3578,7 @@ struct rtw89_dev {
|
||||
struct rtw89_dack_info dack;
|
||||
struct rtw89_iqk_info iqk;
|
||||
struct rtw89_dpk_info dpk;
|
||||
- struct rtw89_mcc_info mcc;
|
||||
+ struct rtw89_rfk_mcc_info rfk_mcc;
|
||||
struct rtw89_lck_info lck;
|
||||
struct rtw89_rx_dck_info rx_dck;
|
||||
bool is_tssi_mode[RF_PATH_MAX];
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index 2763149586e27..315f5c3a51dfc 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -2263,7 +2263,7 @@ int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev,
|
||||
int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
- struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
|
||||
+ struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
|
||||
struct rtw89_fw_h2c_rf_get_mccch *mccch;
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
@@ -2276,10 +2276,10 @@ int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev)
|
||||
skb_put(skb, sizeof(*mccch));
|
||||
mccch = (struct rtw89_fw_h2c_rf_get_mccch *)skb->data;
|
||||
|
||||
- mccch->ch_0 = cpu_to_le32(mcc_info->ch[0]);
|
||||
- mccch->ch_1 = cpu_to_le32(mcc_info->ch[1]);
|
||||
- mccch->band_0 = cpu_to_le32(mcc_info->band[0]);
|
||||
- mccch->band_1 = cpu_to_le32(mcc_info->band[1]);
|
||||
+ mccch->ch_0 = cpu_to_le32(rfk_mcc->ch[0]);
|
||||
+ mccch->ch_1 = cpu_to_le32(rfk_mcc->ch[1]);
|
||||
+ mccch->band_0 = cpu_to_le32(rfk_mcc->band[0]);
|
||||
+ mccch->band_1 = cpu_to_le32(rfk_mcc->band[1]);
|
||||
mccch->current_channel = cpu_to_le32(chan->channel);
|
||||
mccch->current_band_type = cpu_to_le32(chan->band_type);
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index 9bc98fd5d4ac2..a87482cc25f58 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -1832,11 +1832,11 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
|
||||
static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
- struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
|
||||
+ struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
|
||||
|
||||
rtwdev->is_tssi_mode[RF_PATH_A] = false;
|
||||
rtwdev->is_tssi_mode[RF_PATH_B] = false;
|
||||
- memset(mcc_info, 0, sizeof(*mcc_info));
|
||||
+ memset(rfk_mcc, 0, sizeof(*rfk_mcc));
|
||||
rtw8852c_lck_init(rtwdev);
|
||||
|
||||
rtw8852c_rck(rtwdev);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index b0672b906e7bc..60cd676fe22c9 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -1030,9 +1030,9 @@ static bool _iqk_nbtxk(struct rtw89_dev *rtwdev,
|
||||
|
||||
static bool _lok_finetune_check(struct rtw89_dev *rtwdev, u8 path)
|
||||
{
|
||||
- struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
|
||||
+ struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
- u8 idx = mcc_info->table_idx;
|
||||
+ u8 idx = rfk_mcc->table_idx;
|
||||
bool is_fail1, is_fail2;
|
||||
u32 val;
|
||||
u32 core_i;
|
||||
@@ -1375,10 +1375,10 @@ static void _iqk_afebb_restore(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _iqk_preset(struct rtw89_dev *rtwdev, u8 path)
|
||||
{
|
||||
- struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
|
||||
+ struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
|
||||
u8 idx = 0;
|
||||
|
||||
- idx = mcc_info->table_idx;
|
||||
+ idx = rfk_mcc->table_idx;
|
||||
rtw89_phy_write32_mask(rtwdev, R_COEF_SEL + (path << 8), B_COEF_SEL_IQC, idx);
|
||||
rtw89_phy_write32_mask(rtwdev, R_CFIR_LUT + (path << 8), B_CFIR_LUT_G3, idx);
|
||||
rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
@@ -3824,20 +3824,20 @@ void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
- struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
|
||||
- u8 idx = mcc_info->table_idx;
|
||||
+ struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
|
||||
+ u8 idx = rfk_mcc->table_idx;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RTW89_IQK_CHS_NR; i++) {
|
||||
- if (mcc_info->ch[idx] == 0)
|
||||
+ if (rfk_mcc->ch[idx] == 0)
|
||||
break;
|
||||
if (++idx >= RTW89_IQK_CHS_NR)
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
- mcc_info->table_idx = idx;
|
||||
- mcc_info->ch[idx] = chan->channel;
|
||||
- mcc_info->band[idx] = chan->band_type;
|
||||
+ rfk_mcc->table_idx = idx;
|
||||
+ rfk_mcc->ch[idx] = chan->channel;
|
||||
+ rfk_mcc->band[idx] = chan->band_type;
|
||||
}
|
||||
|
||||
void rtw8852c_rck(struct rtw89_dev *rtwdev)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,170 @@
|
||||
From 5e16e95dd7bc9379701e4f3c9ca091ca19149c26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 067/142] wifi: rtw89: check if atomic before queuing c2h
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 860e8263ae92667a2002163886fd2ebd8c67f699
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:26 2022 +0800
|
||||
|
||||
wifi: rtw89: check if atomic before queuing c2h
|
||||
|
||||
Before queuing C2H work, we check atomicity of the C2H's handler first now.
|
||||
If atomic or lock-free, handle it directly; otherwise, handle it with mutex
|
||||
in work as previous. This prepares for MAC MCC C2Hs which require to be
|
||||
processed directly. And, their handlers will be functions which can be
|
||||
considered atomic.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 47 +++++++++++++++++++++++++++++---
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 14 ++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 10 +++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 1 +
|
||||
4 files changed, 68 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index 315f5c3a51dfc..ce71fc1a04a02 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -11,6 +11,9 @@
|
||||
#include "phy.h"
|
||||
#include "reg.h"
|
||||
|
||||
+static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
|
||||
+ struct sk_buff *skb);
|
||||
+
|
||||
static struct sk_buff *rtw89_fw_h2c_alloc_skb(struct rtw89_dev *rtwdev, u32 len,
|
||||
bool header)
|
||||
{
|
||||
@@ -2382,8 +2385,43 @@ void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
+static void rtw89_fw_c2h_parse_attr(struct sk_buff *c2h)
|
||||
+{
|
||||
+ struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(c2h);
|
||||
+
|
||||
+ attr->category = RTW89_GET_C2H_CATEGORY(c2h->data);
|
||||
+ attr->class = RTW89_GET_C2H_CLASS(c2h->data);
|
||||
+ attr->func = RTW89_GET_C2H_FUNC(c2h->data);
|
||||
+ attr->len = RTW89_GET_C2H_LEN(c2h->data);
|
||||
+}
|
||||
+
|
||||
+static bool rtw89_fw_c2h_chk_atomic(struct rtw89_dev *rtwdev,
|
||||
+ struct sk_buff *c2h)
|
||||
+{
|
||||
+ struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(c2h);
|
||||
+ u8 category = attr->category;
|
||||
+ u8 class = attr->class;
|
||||
+ u8 func = attr->func;
|
||||
+
|
||||
+ switch (category) {
|
||||
+ default:
|
||||
+ return false;
|
||||
+ case RTW89_C2H_CAT_MAC:
|
||||
+ return rtw89_mac_c2h_chk_atomic(rtwdev, class, func);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h)
|
||||
{
|
||||
+ rtw89_fw_c2h_parse_attr(c2h);
|
||||
+ if (!rtw89_fw_c2h_chk_atomic(rtwdev, c2h))
|
||||
+ goto enqueue;
|
||||
+
|
||||
+ rtw89_fw_c2h_cmd_handle(rtwdev, c2h);
|
||||
+ dev_kfree_skb_any(c2h);
|
||||
+ return;
|
||||
+
|
||||
+enqueue:
|
||||
skb_queue_tail(&rtwdev->c2h_queue, c2h);
|
||||
ieee80211_queue_work(rtwdev->hw, &rtwdev->c2h_work);
|
||||
}
|
||||
@@ -2391,10 +2429,11 @@ void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h)
|
||||
static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
- u8 category = RTW89_GET_C2H_CATEGORY(skb->data);
|
||||
- u8 class = RTW89_GET_C2H_CLASS(skb->data);
|
||||
- u8 func = RTW89_GET_C2H_FUNC(skb->data);
|
||||
- u16 len = RTW89_GET_C2H_LEN(skb->data);
|
||||
+ struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(skb);
|
||||
+ u8 category = attr->category;
|
||||
+ u8 class = attr->class;
|
||||
+ u8 func = attr->func;
|
||||
+ u16 len = attr->len;
|
||||
bool dump = true;
|
||||
|
||||
if (!test_bit(RTW89_FLAG_RUNNING, rtwdev->flags))
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 509a3eac5ffe3..d76d0c80f0256 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -2778,6 +2778,20 @@ static inline void RTW89_SET_FWCMD_TSF32_TOGL_EARLY(void *cmd, u32 val)
|
||||
#define RTW89_GET_C2H_LEN(c2h) \
|
||||
le32_get_bits(*((const __le32 *)(c2h) + 1), GENMASK(13, 0))
|
||||
|
||||
+struct rtw89_fw_c2h_attr {
|
||||
+ u8 category;
|
||||
+ u8 class;
|
||||
+ u8 func;
|
||||
+ u16 len;
|
||||
+};
|
||||
+
|
||||
+static inline struct rtw89_fw_c2h_attr *RTW89_SKB_C2H_CB(struct sk_buff *skb)
|
||||
+{
|
||||
+ static_assert(sizeof(skb->cb) >= sizeof(struct rtw89_fw_c2h_attr));
|
||||
+
|
||||
+ return (struct rtw89_fw_c2h_attr *)skb->cb;
|
||||
+}
|
||||
+
|
||||
#define RTW89_GET_C2H_LOG_SRT_PRT(c2h) (char *)((__le32 *)(c2h) + 2)
|
||||
#define RTW89_GET_C2H_LOG_LEN(len) ((len) - RTW89_C2H_HEADER_LEN)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 6587cdf6ba624..098637a848953 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -4208,6 +4208,16 @@ void (* const rtw89_mac_c2h_info_handler[])(struct rtw89_dev *rtwdev,
|
||||
[RTW89_MAC_C2H_FUNC_BCN_CNT] = rtw89_mac_c2h_bcn_cnt,
|
||||
};
|
||||
|
||||
+bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, u8 class, u8 func)
|
||||
+{
|
||||
+ switch (class) {
|
||||
+ default:
|
||||
+ return false;
|
||||
+ case RTW89_MAC_C2H_CLASS_MCC:
|
||||
+ return true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void rtw89_mac_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
u32 len, u8 class, u8 func)
|
||||
{
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 045e8ec61a41e..82b9e81fe4744 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -894,6 +894,7 @@ static inline int rtw89_chip_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
|
||||
u32 rtw89_mac_get_err_status(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_set_err_status(struct rtw89_dev *rtwdev, u32 err);
|
||||
+bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, u8 class, u8 func);
|
||||
void rtw89_mac_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
u32 len, u8 class, u8 func);
|
||||
int rtw89_mac_setup_phycap(struct rtw89_dev *rtwdev);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,156 @@
|
||||
From 54cf47d424e54c02da1ac09766a86a09e13be7d9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 068/142] wifi: rtw89: introduce helpers to wait/complete on
|
||||
condition
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 22b10cdb73921cfb28ccde5ce8b47d7fc434e7c6
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:27 2022 +0800
|
||||
|
||||
wifi: rtw89: introduce helpers to wait/complete on condition
|
||||
|
||||
MCC (multi-channel concurrency) related H2Cs (host to chip commands)
|
||||
require to wait for C2H (chip to host events) responses to judge the
|
||||
execution result and data. We introduce helpers to assist this process.
|
||||
Besides, we would like the helpers to be generic for use in driver even
|
||||
outside of MCC H2C/C2H, so we make a independent patch for them.
|
||||
|
||||
In the following, I describe the things first.
|
||||
```
|
||||
(A) C2H is generated by FW, and then transferred upto driver. Hence,
|
||||
driver cannot get it immediately without a bit waitting/blocking.
|
||||
For this, we choose to use wait_for_completion_*() instead of
|
||||
busy polling.
|
||||
(B) From the driver management perspective, a scenario, e.g. MCC,
|
||||
may have mulitple kind of H2C functions requiring this process
|
||||
to wait for corresponding C2Hs. But, the driver management flow
|
||||
uses mutex to protect each behavior. So, one scenario triggers
|
||||
one H2C function at one time. To avoid rampant instances of
|
||||
struct completion for each H2C function, we choose to use one
|
||||
struct completion with one condition flag for one scenario.
|
||||
(C) C2Hs, which H2Cs will be waitting for, cannot be ordered with
|
||||
driver management flow, i.e. cannot enqueue work to the same
|
||||
ordered workqueue and cannot lock by the same mutex, to prevent
|
||||
H2C side from getting no C2H responses. So, those C2Hs are parsed
|
||||
in interrupt context directly as done in previous commit.
|
||||
(D) Following (C), the above underline H2Cs and C2Hs will be handled
|
||||
in different contexts without sync. So, we use atomic_cmpxchg()
|
||||
to compare and change the condition in atomic.
|
||||
```
|
||||
|
||||
So, we introduce struct rtw89_wait_info which combines struct completion
|
||||
and atomic_t. Then, the below are the descriptions for helper functions.
|
||||
* rtw89_wait_for_cond() to wait for a completion based on a condition.
|
||||
* rtw89_complete_cond() to complete a given condition and carry data.
|
||||
Each rtw89_wait_info instance independently determines the meaning of
|
||||
its waitting conditions. But, RTW89_WAIT_COND_IDLE (UINT_MAX) is reserved.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 35 +++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 25 ++++++++++++++++++++++
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 3647998014408..4ec3c982ff4e0 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -2974,6 +2974,41 @@ void rtw89_core_update_beacon_work(struct work_struct *work)
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
+int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond)
|
||||
+{
|
||||
+ struct completion *cmpl = &wait->completion;
|
||||
+ unsigned long timeout;
|
||||
+ unsigned int cur;
|
||||
+
|
||||
+ cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond);
|
||||
+ if (cur != RTW89_WAIT_COND_IDLE)
|
||||
+ return -EBUSY;
|
||||
+
|
||||
+ timeout = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT);
|
||||
+ if (timeout == 0) {
|
||||
+ atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
+
|
||||
+ if (wait->data.err)
|
||||
+ return -EFAULT;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
|
||||
+ const struct rtw89_completion_data *data)
|
||||
+{
|
||||
+ unsigned int cur;
|
||||
+
|
||||
+ cur = atomic_cmpxchg(&wait->cond, cond, RTW89_WAIT_COND_IDLE);
|
||||
+ if (cur != cond)
|
||||
+ return;
|
||||
+
|
||||
+ wait->data = *data;
|
||||
+ complete(&wait->completion);
|
||||
+}
|
||||
+
|
||||
int rtw89_core_start(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index d0efeeabcb773..a9b9b1c901c18 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2812,6 +2812,28 @@ struct rtw89_mac_info {
|
||||
u8 cpwm_seq_num;
|
||||
};
|
||||
|
||||
+#define RTW89_COMPLETION_BUF_SIZE 24
|
||||
+#define RTW89_WAIT_COND_IDLE UINT_MAX
|
||||
+
|
||||
+struct rtw89_completion_data {
|
||||
+ bool err;
|
||||
+ u8 buf[RTW89_COMPLETION_BUF_SIZE];
|
||||
+};
|
||||
+
|
||||
+struct rtw89_wait_info {
|
||||
+ atomic_t cond;
|
||||
+ struct completion completion;
|
||||
+ struct rtw89_completion_data data;
|
||||
+};
|
||||
+
|
||||
+#define RTW89_WAIT_FOR_COND_TIMEOUT msecs_to_jiffies(100)
|
||||
+
|
||||
+static inline void rtw89_init_wait(struct rtw89_wait_info *wait)
|
||||
+{
|
||||
+ init_completion(&wait->completion);
|
||||
+ atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
|
||||
+}
|
||||
+
|
||||
enum rtw89_fw_type {
|
||||
RTW89_FW_NORMAL = 1,
|
||||
RTW89_FW_WOWLAN = 3,
|
||||
@@ -4469,6 +4491,9 @@ int rtw89_regd_init(struct rtw89_dev *rtwdev,
|
||||
void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request);
|
||||
void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_traffic_stats *stats);
|
||||
+int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond);
|
||||
+void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
|
||||
+ const struct rtw89_completion_data *data);
|
||||
int rtw89_core_start(struct rtw89_dev *rtwdev);
|
||||
void rtw89_core_stop(struct rtw89_dev *rtwdev);
|
||||
void rtw89_core_update_beacon_work(struct work_struct *work);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,408 @@
|
||||
From 604e6fcc512294e76cc6f6f1ad8ca8d5e8c24e8c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:30 +0200
|
||||
Subject: [PATCH 069/142] wifi: rtw89: mac: process MCC related C2H
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit ef9dff4cb491210518ad3d249919a0971eff601b
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:28 2022 +0800
|
||||
|
||||
wifi: rtw89: mac: process MCC related C2H
|
||||
|
||||
Process C2H(s) related to MCC (multi-channel concurrency). These handling,
|
||||
which either call rtw89_complete_cond() or show message in debug mode, can
|
||||
be considered atomic/lock-free. So, they should be safe to be processed
|
||||
directly after C2H pre-check in previous patch.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 2 +
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 5 +
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 68 ++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 171 ++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 34 ++++++
|
||||
5 files changed, 280 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 4ec3c982ff4e0..18b4361505229 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -3132,6 +3132,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
|
||||
mutex_init(&rtwdev->rf_mutex);
|
||||
rtwdev->total_sta_assoc = 0;
|
||||
|
||||
+ rtw89_init_wait(&rtwdev->mcc.wait);
|
||||
+
|
||||
INIT_WORK(&rtwdev->c2h_work, rtw89_fw_c2h_work);
|
||||
INIT_WORK(&rtwdev->ips_work, rtw89_ips_work);
|
||||
skb_queue_head_init(&rtwdev->c2h_queue);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index a9b9b1c901c18..f4603c2ce8f13 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -3547,6 +3547,10 @@ struct rtw89_wow_param {
|
||||
struct list_head pkt_list;
|
||||
};
|
||||
|
||||
+struct rtw89_mcc_info {
|
||||
+ struct rtw89_wait_info wait;
|
||||
+};
|
||||
+
|
||||
struct rtw89_dev {
|
||||
struct ieee80211_hw *hw;
|
||||
struct device *dev;
|
||||
@@ -3557,6 +3561,7 @@ struct rtw89_dev {
|
||||
const struct rtw89_chip_info *chip;
|
||||
const struct rtw89_pci_info *pci_info;
|
||||
struct rtw89_hal hal;
|
||||
+ struct rtw89_mcc_info mcc;
|
||||
struct rtw89_mac_info mac;
|
||||
struct rtw89_fw_info fw;
|
||||
struct rtw89_hci_info hci;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index d76d0c80f0256..5fb8faad9c67f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -2859,6 +2859,55 @@ static inline struct rtw89_fw_c2h_attr *RTW89_SKB_C2H_CB(struct sk_buff *skb)
|
||||
#define RTW89_GET_MAC_C2H_SCANOFLD_BAND(c2h) \
|
||||
le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(25, 24))
|
||||
|
||||
+#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(1, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(15, 8))
|
||||
+
|
||||
+#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_GROUP(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(1, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_RETURN(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(7, 2))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_FUNC(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(15, 8))
|
||||
+
|
||||
+struct rtw89_mac_mcc_tsf_rpt {
|
||||
+ u32 macid_x;
|
||||
+ u32 macid_y;
|
||||
+ u32 tsf_x_low;
|
||||
+ u32 tsf_x_high;
|
||||
+ u32 tsf_y_low;
|
||||
+ u32 tsf_y_high;
|
||||
+};
|
||||
+
|
||||
+static_assert(sizeof(struct rtw89_mac_mcc_tsf_rpt) <= RTW89_COMPLETION_BUF_SIZE);
|
||||
+
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_X(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(7, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_Y(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(15, 8))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_GROUP(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(17, 16))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_X(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 1), GENMASK(31, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_X(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_Y(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(31, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_Y(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 4), GENMASK(31, 0))
|
||||
+
|
||||
+#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_STATUS(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(5, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_GROUP(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(7, 6))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_MACID(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h)), GENMASK(15, 8))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_LOW(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 1), GENMASK(31, 0))
|
||||
+#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_HIGH(c2h) \
|
||||
+ le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 0))
|
||||
+
|
||||
#define RTW89_FW_HDR_SIZE 32
|
||||
#define RTW89_FW_SECTION_HDR_SIZE 16
|
||||
|
||||
@@ -2980,6 +3029,25 @@ struct rtw89_fw_h2c_rf_reg_info {
|
||||
#define H2C_CL_BA_CAM 0xc
|
||||
#define H2C_FUNC_MAC_BA_CAM 0x0
|
||||
|
||||
+/* CLASS 14 - MCC */
|
||||
+#define H2C_CL_MCC 0xe
|
||||
+enum rtw89_mcc_h2c_func {
|
||||
+ H2C_FUNC_ADD_MCC = 0x0,
|
||||
+ H2C_FUNC_START_MCC = 0x1,
|
||||
+ H2C_FUNC_STOP_MCC = 0x2,
|
||||
+ H2C_FUNC_DEL_MCC_GROUP = 0x3,
|
||||
+ H2C_FUNC_RESET_MCC_GROUP = 0x4,
|
||||
+ H2C_FUNC_MCC_REQ_TSF = 0x5,
|
||||
+ H2C_FUNC_MCC_MACID_BITMAP = 0x6,
|
||||
+ H2C_FUNC_MCC_SYNC = 0x7,
|
||||
+ H2C_FUNC_MCC_SET_DURATION = 0x8,
|
||||
+
|
||||
+ NUM_OF_RTW89_MCC_H2C_FUNC,
|
||||
+};
|
||||
+
|
||||
+#define RTW89_MCC_WAIT_COND(group, func) \
|
||||
+ ((group) * NUM_OF_RTW89_MCC_H2C_FUNC + (func))
|
||||
+
|
||||
#define H2C_CAT_OUTSRC 0x2
|
||||
|
||||
#define H2C_CL_OUTSRC_RA 0x1
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 098637a848953..d80050c2e9b30 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -4187,6 +4187,164 @@ rtw89_mac_c2h_tsf32_toggle_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
|
||||
{
|
||||
}
|
||||
|
||||
+static void
|
||||
+rtw89_mac_c2h_mcc_rcv_ack(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len)
|
||||
+{
|
||||
+ u8 group = RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h->data);
|
||||
+ u8 func = RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h->data);
|
||||
+
|
||||
+ switch (func) {
|
||||
+ case H2C_FUNC_ADD_MCC:
|
||||
+ case H2C_FUNC_START_MCC:
|
||||
+ case H2C_FUNC_STOP_MCC:
|
||||
+ case H2C_FUNC_DEL_MCC_GROUP:
|
||||
+ case H2C_FUNC_RESET_MCC_GROUP:
|
||||
+ case H2C_FUNC_MCC_REQ_TSF:
|
||||
+ case H2C_FUNC_MCC_MACID_BITMAP:
|
||||
+ case H2C_FUNC_MCC_SYNC:
|
||||
+ case H2C_FUNC_MCC_SET_DURATION:
|
||||
+ break;
|
||||
+ default:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "invalid MCC C2H RCV ACK: func %d\n", func);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "MCC C2H RCV ACK: group %d, func %d\n", group, func);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+rtw89_mac_c2h_mcc_req_ack(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len)
|
||||
+{
|
||||
+ u8 group = RTW89_GET_MAC_C2H_MCC_REQ_ACK_GROUP(c2h->data);
|
||||
+ u8 func = RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_FUNC(c2h->data);
|
||||
+ u8 retcode = RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_RETURN(c2h->data);
|
||||
+ struct rtw89_completion_data data = {};
|
||||
+ unsigned int cond;
|
||||
+ bool next = false;
|
||||
+
|
||||
+ switch (func) {
|
||||
+ case H2C_FUNC_MCC_REQ_TSF:
|
||||
+ next = true;
|
||||
+ break;
|
||||
+ case H2C_FUNC_MCC_MACID_BITMAP:
|
||||
+ case H2C_FUNC_MCC_SYNC:
|
||||
+ case H2C_FUNC_MCC_SET_DURATION:
|
||||
+ break;
|
||||
+ case H2C_FUNC_ADD_MCC:
|
||||
+ case H2C_FUNC_START_MCC:
|
||||
+ case H2C_FUNC_STOP_MCC:
|
||||
+ case H2C_FUNC_DEL_MCC_GROUP:
|
||||
+ case H2C_FUNC_RESET_MCC_GROUP:
|
||||
+ default:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "invalid MCC C2H REQ ACK: func %d\n", func);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "MCC C2H REQ ACK: group %d, func %d, return code %d\n",
|
||||
+ group, func, retcode);
|
||||
+
|
||||
+ if (!retcode && next)
|
||||
+ return;
|
||||
+
|
||||
+ data.err = !!retcode;
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, func);
|
||||
+ rtw89_complete_cond(&rtwdev->mcc.wait, cond, &data);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+rtw89_mac_c2h_mcc_tsf_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len)
|
||||
+{
|
||||
+ u8 group = RTW89_GET_MAC_C2H_MCC_TSF_RPT_GROUP(c2h->data);
|
||||
+ struct rtw89_completion_data data = {};
|
||||
+ struct rtw89_mac_mcc_tsf_rpt *rpt;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ rpt = (struct rtw89_mac_mcc_tsf_rpt *)data.buf;
|
||||
+ rpt->macid_x = RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_X(c2h->data);
|
||||
+ rpt->macid_y = RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_Y(c2h->data);
|
||||
+ rpt->tsf_x_low = RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_X(c2h->data);
|
||||
+ rpt->tsf_x_high = RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_X(c2h->data);
|
||||
+ rpt->tsf_y_low = RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_Y(c2h->data);
|
||||
+ rpt->tsf_y_high = RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_Y(c2h->data);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_MCC_REQ_TSF);
|
||||
+ rtw89_complete_cond(&rtwdev->mcc.wait, cond, &data);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+rtw89_mac_c2h_mcc_status_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len)
|
||||
+{
|
||||
+ u8 group = RTW89_GET_MAC_C2H_MCC_STATUS_RPT_GROUP(c2h->data);
|
||||
+ u8 macid = RTW89_GET_MAC_C2H_MCC_STATUS_RPT_MACID(c2h->data);
|
||||
+ u8 status = RTW89_GET_MAC_C2H_MCC_STATUS_RPT_STATUS(c2h->data);
|
||||
+ u32 tsf_low = RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_LOW(c2h->data);
|
||||
+ u32 tsf_high = RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_HIGH(c2h->data);
|
||||
+ struct rtw89_completion_data data = {};
|
||||
+ unsigned int cond;
|
||||
+ bool rsp = true;
|
||||
+ bool err;
|
||||
+ u8 func;
|
||||
+
|
||||
+ switch (status) {
|
||||
+ case RTW89_MAC_MCC_ADD_ROLE_OK:
|
||||
+ case RTW89_MAC_MCC_ADD_ROLE_FAIL:
|
||||
+ func = H2C_FUNC_ADD_MCC;
|
||||
+ err = status == RTW89_MAC_MCC_ADD_ROLE_FAIL;
|
||||
+ break;
|
||||
+ case RTW89_MAC_MCC_START_GROUP_OK:
|
||||
+ case RTW89_MAC_MCC_START_GROUP_FAIL:
|
||||
+ func = H2C_FUNC_START_MCC;
|
||||
+ err = status == RTW89_MAC_MCC_START_GROUP_FAIL;
|
||||
+ break;
|
||||
+ case RTW89_MAC_MCC_STOP_GROUP_OK:
|
||||
+ case RTW89_MAC_MCC_STOP_GROUP_FAIL:
|
||||
+ func = H2C_FUNC_STOP_MCC;
|
||||
+ err = status == RTW89_MAC_MCC_STOP_GROUP_FAIL;
|
||||
+ break;
|
||||
+ case RTW89_MAC_MCC_DEL_GROUP_OK:
|
||||
+ case RTW89_MAC_MCC_DEL_GROUP_FAIL:
|
||||
+ func = H2C_FUNC_DEL_MCC_GROUP;
|
||||
+ err = status == RTW89_MAC_MCC_DEL_GROUP_FAIL;
|
||||
+ break;
|
||||
+ case RTW89_MAC_MCC_RESET_GROUP_OK:
|
||||
+ case RTW89_MAC_MCC_RESET_GROUP_FAIL:
|
||||
+ func = H2C_FUNC_RESET_MCC_GROUP;
|
||||
+ err = status == RTW89_MAC_MCC_RESET_GROUP_FAIL;
|
||||
+ break;
|
||||
+ case RTW89_MAC_MCC_SWITCH_CH_OK:
|
||||
+ case RTW89_MAC_MCC_SWITCH_CH_FAIL:
|
||||
+ case RTW89_MAC_MCC_TXNULL0_OK:
|
||||
+ case RTW89_MAC_MCC_TXNULL0_FAIL:
|
||||
+ case RTW89_MAC_MCC_TXNULL1_OK:
|
||||
+ case RTW89_MAC_MCC_TXNULL1_FAIL:
|
||||
+ case RTW89_MAC_MCC_SWITCH_EARLY:
|
||||
+ case RTW89_MAC_MCC_TBTT:
|
||||
+ case RTW89_MAC_MCC_DURATION_START:
|
||||
+ case RTW89_MAC_MCC_DURATION_END:
|
||||
+ rsp = false;
|
||||
+ break;
|
||||
+ default:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "invalid MCC C2H STS RPT: status %d\n", status);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "MCC C2H STS RPT: group %d, macid %d, status %d, tsf {%d, %d}\n",
|
||||
+ group, macid, status, tsf_low, tsf_high);
|
||||
+
|
||||
+ if (!rsp)
|
||||
+ return;
|
||||
+
|
||||
+ data.err = err;
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, func);
|
||||
+ rtw89_complete_cond(&rtwdev->mcc.wait, cond, &data);
|
||||
+}
|
||||
+
|
||||
static
|
||||
void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *c2h, u32 len) = {
|
||||
@@ -4208,6 +4366,15 @@ void (* const rtw89_mac_c2h_info_handler[])(struct rtw89_dev *rtwdev,
|
||||
[RTW89_MAC_C2H_FUNC_BCN_CNT] = rtw89_mac_c2h_bcn_cnt,
|
||||
};
|
||||
|
||||
+static
|
||||
+void (* const rtw89_mac_c2h_mcc_handler[])(struct rtw89_dev *rtwdev,
|
||||
+ struct sk_buff *c2h, u32 len) = {
|
||||
+ [RTW89_MAC_C2H_FUNC_MCC_RCV_ACK] = rtw89_mac_c2h_mcc_rcv_ack,
|
||||
+ [RTW89_MAC_C2H_FUNC_MCC_REQ_ACK] = rtw89_mac_c2h_mcc_req_ack,
|
||||
+ [RTW89_MAC_C2H_FUNC_MCC_TSF_RPT] = rtw89_mac_c2h_mcc_tsf_rpt,
|
||||
+ [RTW89_MAC_C2H_FUNC_MCC_STATUS_RPT] = rtw89_mac_c2h_mcc_status_rpt,
|
||||
+};
|
||||
+
|
||||
bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, u8 class, u8 func)
|
||||
{
|
||||
switch (class) {
|
||||
@@ -4233,6 +4400,10 @@ void rtw89_mac_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
if (func < RTW89_MAC_C2H_FUNC_OFLD_MAX)
|
||||
handler = rtw89_mac_c2h_ofld_handler[func];
|
||||
break;
|
||||
+ case RTW89_MAC_C2H_CLASS_MCC:
|
||||
+ if (func < NUM_OF_RTW89_MAC_C2H_FUNC_MCC)
|
||||
+ handler = rtw89_mac_c2h_mcc_handler[func];
|
||||
+ break;
|
||||
case RTW89_MAC_C2H_CLASS_FWDBG:
|
||||
return;
|
||||
default:
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 82b9e81fe4744..adb0c86a98d3e 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -368,6 +368,15 @@ enum rtw89_mac_c2h_info_func {
|
||||
RTW89_MAC_C2H_FUNC_INFO_MAX,
|
||||
};
|
||||
|
||||
+enum rtw89_mac_c2h_mcc_func {
|
||||
+ RTW89_MAC_C2H_FUNC_MCC_RCV_ACK = 0,
|
||||
+ RTW89_MAC_C2H_FUNC_MCC_REQ_ACK = 1,
|
||||
+ RTW89_MAC_C2H_FUNC_MCC_TSF_RPT = 2,
|
||||
+ RTW89_MAC_C2H_FUNC_MCC_STATUS_RPT = 3,
|
||||
+
|
||||
+ NUM_OF_RTW89_MAC_C2H_FUNC_MCC,
|
||||
+};
|
||||
+
|
||||
enum rtw89_mac_c2h_class {
|
||||
RTW89_MAC_C2H_CLASS_INFO,
|
||||
RTW89_MAC_C2H_CLASS_OFLD,
|
||||
@@ -378,6 +387,31 @@ enum rtw89_mac_c2h_class {
|
||||
RTW89_MAC_C2H_CLASS_MAX,
|
||||
};
|
||||
|
||||
+enum rtw89_mac_mcc_status {
|
||||
+ RTW89_MAC_MCC_ADD_ROLE_OK = 0,
|
||||
+ RTW89_MAC_MCC_START_GROUP_OK = 1,
|
||||
+ RTW89_MAC_MCC_STOP_GROUP_OK = 2,
|
||||
+ RTW89_MAC_MCC_DEL_GROUP_OK = 3,
|
||||
+ RTW89_MAC_MCC_RESET_GROUP_OK = 4,
|
||||
+ RTW89_MAC_MCC_SWITCH_CH_OK = 5,
|
||||
+ RTW89_MAC_MCC_TXNULL0_OK = 6,
|
||||
+ RTW89_MAC_MCC_TXNULL1_OK = 7,
|
||||
+
|
||||
+ RTW89_MAC_MCC_SWITCH_EARLY = 10,
|
||||
+ RTW89_MAC_MCC_TBTT = 11,
|
||||
+ RTW89_MAC_MCC_DURATION_START = 12,
|
||||
+ RTW89_MAC_MCC_DURATION_END = 13,
|
||||
+
|
||||
+ RTW89_MAC_MCC_ADD_ROLE_FAIL = 20,
|
||||
+ RTW89_MAC_MCC_START_GROUP_FAIL = 21,
|
||||
+ RTW89_MAC_MCC_STOP_GROUP_FAIL = 22,
|
||||
+ RTW89_MAC_MCC_DEL_GROUP_FAIL = 23,
|
||||
+ RTW89_MAC_MCC_RESET_GROUP_FAIL = 24,
|
||||
+ RTW89_MAC_MCC_SWITCH_CH_FAIL = 25,
|
||||
+ RTW89_MAC_MCC_TXNULL0_FAIL = 26,
|
||||
+ RTW89_MAC_MCC_TXNULL1_FAIL = 27,
|
||||
+};
|
||||
+
|
||||
struct rtw89_mac_ax_coex {
|
||||
#define RTW89_MAC_AX_COEX_RTK_MODE 0
|
||||
#define RTW89_MAC_AX_COEX_CSR_MODE 1
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,761 @@
|
||||
From c52fb5f9e8d95773c3aba11af16d1e198a54ad6b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 070/142] wifi: rtw89: fw: implement MCC related H2C
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit c008c4b011baa26b9545f7be10e746c97409d45b
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:29 2022 +0800
|
||||
|
||||
wifi: rtw89: fw: implement MCC related H2C
|
||||
|
||||
These MCC H2C(s) require to wait for MCC C2H to determine if the
|
||||
execution is successful. Through rtw89_wait_for_cond(), we make
|
||||
them wait for either a completion with data from MCC C2H handlers,
|
||||
which calls rtw89_complete_cond(), or timeout.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 329 ++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 369 +++++++++++++++++++++++++++++++-
|
||||
2 files changed, 697 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index ce71fc1a04a02..cc8efd4ea57f8 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -3265,3 +3265,332 @@ int rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
|
||||
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+static int rtw89_h2c_tx_and_wait(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
+ struct rtw89_wait_info *wait, unsigned int cond)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
+ if (ret) {
|
||||
+ rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+ return -EBUSY;
|
||||
+ }
|
||||
+
|
||||
+ return rtw89_wait_for_cond(wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_ADD_MCC_LEN 16
|
||||
+int rtw89_fw_h2c_add_mcc(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_add_req *p)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_ADD_MCC_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for add mcc\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_ADD_MCC_LEN);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_MACID(skb->data, p->macid);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG0(skb->data, p->central_ch_seg0);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG1(skb->data, p->central_ch_seg1);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_PRIMARY_CH(skb->data, p->primary_ch);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_BANDWIDTH(skb->data, p->bandwidth);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_GROUP(skb->data, p->group);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_C2H_RPT(skb->data, p->c2h_rpt);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_DIS_TX_NULL(skb->data, p->dis_tx_null);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_DIS_SW_RETRY(skb->data, p->dis_sw_retry);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_IN_CURR_CH(skb->data, p->in_curr_ch);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_SW_RETRY_COUNT(skb->data, p->sw_retry_count);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_TX_NULL_EARLY(skb->data, p->tx_null_early);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_BTC_IN_2G(skb->data, p->btc_in_2g);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_PTA_EN(skb->data, p->pta_en);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_RFK_BY_PASS(skb->data, p->rfk_by_pass);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_CH_BAND_TYPE(skb->data, p->ch_band_type);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_DURATION(skb->data, p->duration);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_COURTESY_EN(skb->data, p->courtesy_en);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_COURTESY_NUM(skb->data, p->courtesy_num);
|
||||
+ RTW89_SET_FWCMD_ADD_MCC_COURTESY_TARGET(skb->data, p->courtesy_target);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_ADD_MCC, 0, 0,
|
||||
+ H2C_ADD_MCC_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(p->group, H2C_FUNC_ADD_MCC);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_START_MCC_LEN 12
|
||||
+int rtw89_fw_h2c_start_mcc(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_start_req *p)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_START_MCC_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for start mcc\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_START_MCC_LEN);
|
||||
+ RTW89_SET_FWCMD_START_MCC_GROUP(skb->data, p->group);
|
||||
+ RTW89_SET_FWCMD_START_MCC_BTC_IN_GROUP(skb->data, p->btc_in_group);
|
||||
+ RTW89_SET_FWCMD_START_MCC_OLD_GROUP_ACTION(skb->data, p->old_group_action);
|
||||
+ RTW89_SET_FWCMD_START_MCC_OLD_GROUP(skb->data, p->old_group);
|
||||
+ RTW89_SET_FWCMD_START_MCC_NOTIFY_CNT(skb->data, p->notify_cnt);
|
||||
+ RTW89_SET_FWCMD_START_MCC_NOTIFY_RXDBG_EN(skb->data, p->notify_rxdbg_en);
|
||||
+ RTW89_SET_FWCMD_START_MCC_MACID(skb->data, p->macid);
|
||||
+ RTW89_SET_FWCMD_START_MCC_TSF_LOW(skb->data, p->tsf_low);
|
||||
+ RTW89_SET_FWCMD_START_MCC_TSF_HIGH(skb->data, p->tsf_high);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_START_MCC, 0, 0,
|
||||
+ H2C_START_MCC_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(p->group, H2C_FUNC_START_MCC);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_STOP_MCC_LEN 4
|
||||
+int rtw89_fw_h2c_stop_mcc(struct rtw89_dev *rtwdev, u8 group, u8 macid,
|
||||
+ bool prev_groups)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_STOP_MCC_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for stop mcc\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_STOP_MCC_LEN);
|
||||
+ RTW89_SET_FWCMD_STOP_MCC_MACID(skb->data, macid);
|
||||
+ RTW89_SET_FWCMD_STOP_MCC_GROUP(skb->data, group);
|
||||
+ RTW89_SET_FWCMD_STOP_MCC_PREV_GROUPS(skb->data, prev_groups);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_STOP_MCC, 0, 0,
|
||||
+ H2C_STOP_MCC_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_STOP_MCC);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_DEL_MCC_GROUP_LEN 4
|
||||
+int rtw89_fw_h2c_del_mcc_group(struct rtw89_dev *rtwdev, u8 group,
|
||||
+ bool prev_groups)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_DEL_MCC_GROUP_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for del mcc group\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_DEL_MCC_GROUP_LEN);
|
||||
+ RTW89_SET_FWCMD_DEL_MCC_GROUP_GROUP(skb->data, group);
|
||||
+ RTW89_SET_FWCMD_DEL_MCC_GROUP_PREV_GROUPS(skb->data, prev_groups);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_DEL_MCC_GROUP, 0, 0,
|
||||
+ H2C_DEL_MCC_GROUP_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_DEL_MCC_GROUP);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_RESET_MCC_GROUP_LEN 4
|
||||
+int rtw89_fw_h2c_reset_mcc_group(struct rtw89_dev *rtwdev, u8 group)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_RESET_MCC_GROUP_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for reset mcc group\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_RESET_MCC_GROUP_LEN);
|
||||
+ RTW89_SET_FWCMD_RESET_MCC_GROUP_GROUP(skb->data, group);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_RESET_MCC_GROUP, 0, 0,
|
||||
+ H2C_RESET_MCC_GROUP_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_RESET_MCC_GROUP);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_MCC_REQ_TSF_LEN 4
|
||||
+int rtw89_fw_h2c_mcc_req_tsf(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_tsf_req *req,
|
||||
+ struct rtw89_mac_mcc_tsf_rpt *rpt)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct rtw89_mac_mcc_tsf_rpt *tmp;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+ int ret;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_MCC_REQ_TSF_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for mcc req tsf\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_MCC_REQ_TSF_LEN);
|
||||
+ RTW89_SET_FWCMD_MCC_REQ_TSF_GROUP(skb->data, req->group);
|
||||
+ RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_X(skb->data, req->macid_x);
|
||||
+ RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_Y(skb->data, req->macid_y);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_MCC_REQ_TSF, 0, 0,
|
||||
+ H2C_MCC_REQ_TSF_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(req->group, H2C_FUNC_MCC_REQ_TSF);
|
||||
+ ret = rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ tmp = (struct rtw89_mac_mcc_tsf_rpt *)wait->data.buf;
|
||||
+ *rpt = *tmp;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define H2C_MCC_MACID_BITMAP_DSC_LEN 4
|
||||
+int rtw89_fw_h2c_mcc_macid_bitamp(struct rtw89_dev *rtwdev, u8 group, u8 macid,
|
||||
+ u8 *bitmap)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+ u8 map_len;
|
||||
+ u8 h2c_len;
|
||||
+
|
||||
+ BUILD_BUG_ON(RTW89_MAX_MAC_ID_NUM % 8);
|
||||
+ map_len = RTW89_MAX_MAC_ID_NUM / 8;
|
||||
+ h2c_len = H2C_MCC_MACID_BITMAP_DSC_LEN + map_len;
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, h2c_len);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for mcc macid bitmap\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, h2c_len);
|
||||
+ RTW89_SET_FWCMD_MCC_MACID_BITMAP_GROUP(skb->data, group);
|
||||
+ RTW89_SET_FWCMD_MCC_MACID_BITMAP_MACID(skb->data, macid);
|
||||
+ RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP_LENGTH(skb->data, map_len);
|
||||
+ RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP(skb->data, bitmap, map_len);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_MCC_MACID_BITMAP, 0, 0,
|
||||
+ h2c_len);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_MCC_MACID_BITMAP);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_MCC_SYNC_LEN 4
|
||||
+int rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source,
|
||||
+ u8 target, u8 offset)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_MCC_SYNC_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for mcc sync\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_MCC_SYNC_LEN);
|
||||
+ RTW89_SET_FWCMD_MCC_SYNC_GROUP(skb->data, group);
|
||||
+ RTW89_SET_FWCMD_MCC_SYNC_MACID_SOURCE(skb->data, source);
|
||||
+ RTW89_SET_FWCMD_MCC_SYNC_MACID_TARGET(skb->data, target);
|
||||
+ RTW89_SET_FWCMD_MCC_SYNC_SYNC_OFFSET(skb->data, offset);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_MCC_SYNC, 0, 0,
|
||||
+ H2C_MCC_SYNC_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(group, H2C_FUNC_MCC_SYNC);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
+
|
||||
+#define H2C_MCC_SET_DURATION_LEN 20
|
||||
+int rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_duration *p)
|
||||
+{
|
||||
+ struct rtw89_wait_info *wait = &rtwdev->mcc.wait;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int cond;
|
||||
+
|
||||
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_MCC_SET_DURATION_LEN);
|
||||
+ if (!skb) {
|
||||
+ rtw89_err(rtwdev,
|
||||
+ "failed to alloc skb for mcc set duration\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ skb_put(skb, H2C_MCC_SET_DURATION_LEN);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_GROUP(skb->data, p->group);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_BTC_IN_GROUP(skb->data, p->btc_in_group);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_START_MACID(skb->data, p->start_macid);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_X(skb->data, p->macid_x);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_Y(skb->data, p->macid_y);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_LOW(skb->data,
|
||||
+ p->start_tsf_low);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_HIGH(skb->data,
|
||||
+ p->start_tsf_high);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_X(skb->data, p->duration_x);
|
||||
+ RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_Y(skb->data, p->duration_y);
|
||||
+
|
||||
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
+ H2C_CAT_MAC,
|
||||
+ H2C_CL_MCC,
|
||||
+ H2C_FUNC_MCC_SET_DURATION, 0, 0,
|
||||
+ H2C_MCC_SET_DURATION_LEN);
|
||||
+
|
||||
+ cond = RTW89_MCC_WAIT_COND(p->group, H2C_FUNC_MCC_SET_DURATION);
|
||||
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
+}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 5fb8faad9c67f..46d57414f24e2 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -2767,6 +2767,355 @@ static inline void RTW89_SET_FWCMD_TSF32_TOGL_EARLY(void *cmd, u32 val)
|
||||
le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 16));
|
||||
}
|
||||
|
||||
+enum rtw89_fw_mcc_c2h_rpt_cfg {
|
||||
+ RTW89_FW_MCC_C2H_RPT_OFF = 0,
|
||||
+ RTW89_FW_MCC_C2H_RPT_FAIL_ONLY = 1,
|
||||
+ RTW89_FW_MCC_C2H_RPT_ALL = 2,
|
||||
+};
|
||||
+
|
||||
+struct rtw89_fw_mcc_add_req {
|
||||
+ u8 macid;
|
||||
+ u8 central_ch_seg0;
|
||||
+ u8 central_ch_seg1;
|
||||
+ u8 primary_ch;
|
||||
+ enum rtw89_bandwidth bandwidth: 4;
|
||||
+ u32 group: 2;
|
||||
+ u32 c2h_rpt: 2;
|
||||
+ u32 dis_tx_null: 1;
|
||||
+ u32 dis_sw_retry: 1;
|
||||
+ u32 in_curr_ch: 1;
|
||||
+ u32 sw_retry_count: 3;
|
||||
+ u32 tx_null_early: 4;
|
||||
+ u32 btc_in_2g: 1;
|
||||
+ u32 pta_en: 1;
|
||||
+ u32 rfk_by_pass: 1;
|
||||
+ u32 ch_band_type: 2;
|
||||
+ u32 rsvd0: 9;
|
||||
+ u32 duration;
|
||||
+ u8 courtesy_en;
|
||||
+ u8 courtesy_num;
|
||||
+ u8 courtesy_target;
|
||||
+ u8 rsvd1;
|
||||
+};
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_MACID(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG0(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG1(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_PRIMARY_CH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_BANDWIDTH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(3, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(5, 4));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_C2H_RPT(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(7, 6));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_DIS_TX_NULL(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_DIS_SW_RETRY(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(9));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_IN_CURR_CH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(10));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_SW_RETRY_COUNT(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(13, 11));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_TX_NULL_EARLY(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(17, 14));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_BTC_IN_2G(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(18));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_PTA_EN(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(19));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_RFK_BY_PASS(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, BIT(20));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_CH_BAND_TYPE(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(22, 21));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_DURATION(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_EN(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 3, val, BIT(0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_NUM(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_TARGET(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+struct rtw89_fw_mcc_start_req {
|
||||
+ u32 group: 2;
|
||||
+ u32 btc_in_group: 1;
|
||||
+ u32 old_group_action: 2;
|
||||
+ u32 old_group: 2;
|
||||
+ u32 rsvd0: 9;
|
||||
+ u32 notify_cnt: 3;
|
||||
+ u32 rsvd1: 2;
|
||||
+ u32 notify_rxdbg_en: 1;
|
||||
+ u32 rsvd2: 2;
|
||||
+ u32 macid: 8;
|
||||
+ u32 tsf_low;
|
||||
+ u32 tsf_high;
|
||||
+};
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_BTC_IN_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP_ACTION(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(4, 3));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(6, 5));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_CNT(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(18, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_RXDBG_EN(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, BIT(21));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_MACID(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_TSF_LOW(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_START_MCC_TSF_HIGH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_STOP_MCC_MACID(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_STOP_MCC_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(9, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_STOP_MCC_PREV_GROUPS(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, BIT(10));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_PREV_GROUPS(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_RESET_MCC_GROUP_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+struct rtw89_fw_mcc_tsf_req {
|
||||
+ u8 group: 2;
|
||||
+ u8 rsvd0: 6;
|
||||
+ u8 macid_x;
|
||||
+ u8 macid_y;
|
||||
+ u8 rsvd1;
|
||||
+};
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_X(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_Y(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_MACID(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP_LENGTH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP(void *cmd,
|
||||
+ u8 *bitmap, u8 len)
|
||||
+{
|
||||
+ memcpy((__le32 *)cmd + 1, bitmap, len);
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SYNC_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_SOURCE(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_TARGET(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SYNC_SYNC_OFFSET(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+struct rtw89_fw_mcc_duration {
|
||||
+ u32 group: 2;
|
||||
+ u32 btc_in_group: 1;
|
||||
+ u32 rsvd0: 5;
|
||||
+ u32 start_macid: 8;
|
||||
+ u32 macid_x: 8;
|
||||
+ u32 macid_y: 8;
|
||||
+ u32 start_tsf_low;
|
||||
+ u32 start_tsf_high;
|
||||
+ u32 duration_x;
|
||||
+ u32 duration_y;
|
||||
+};
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_BTC_IN_GROUP(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, BIT(2));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_MACID(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_X(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
|
||||
+}
|
||||
+
|
||||
+static inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_Y(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_LOW(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_HIGH(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_X(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+inline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_Y(void *cmd, u32 val)
|
||||
+{
|
||||
+ le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
|
||||
+}
|
||||
+
|
||||
#define RTW89_C2H_HEADER_LEN 8
|
||||
|
||||
#define RTW89_GET_C2H_CATEGORY(c2h) \
|
||||
@@ -3185,9 +3534,27 @@ int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool enable);
|
||||
int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif *rtwvif, bool enable);
|
||||
-
|
||||
int rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_wow_cam_info *cam_info);
|
||||
+int rtw89_fw_h2c_add_mcc(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_add_req *p);
|
||||
+int rtw89_fw_h2c_start_mcc(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_start_req *p);
|
||||
+int rtw89_fw_h2c_stop_mcc(struct rtw89_dev *rtwdev, u8 group, u8 macid,
|
||||
+ bool prev_groups);
|
||||
+int rtw89_fw_h2c_del_mcc_group(struct rtw89_dev *rtwdev, u8 group,
|
||||
+ bool prev_groups);
|
||||
+int rtw89_fw_h2c_reset_mcc_group(struct rtw89_dev *rtwdev, u8 group);
|
||||
+int rtw89_fw_h2c_mcc_req_tsf(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_tsf_req *req,
|
||||
+ struct rtw89_mac_mcc_tsf_rpt *rpt);
|
||||
+int rtw89_fw_h2c_mcc_macid_bitamp(struct rtw89_dev *rtwdev, u8 group, u8 macid,
|
||||
+ u8 *bitmap);
|
||||
+int rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source,
|
||||
+ u8 target, u8 offset);
|
||||
+int rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev,
|
||||
+ const struct rtw89_fw_mcc_duration *p);
|
||||
+
|
||||
static inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,215 @@
|
||||
From 6966dfe9d6fbe635c89a6ec969de064eac15e60e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 071/142] wifi: rtw89: link rtw89_vif and chanctx stuffs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 75ee07b03fc6ec0a7ac7407f9ea7b3e981efb28f
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Tue Nov 29 16:31:30 2022 +0800
|
||||
|
||||
wifi: rtw89: link rtw89_vif and chanctx stuffs
|
||||
|
||||
First, introduce struct rtw89_sub_entity for chanctx related stuffs.
|
||||
Second, add enum rtw89_sub_entity_idx to rtw89_vif for vif operation
|
||||
to access its/right chanctx stuffs after future multi-channel support.
|
||||
|
||||
Besides, RTW89_SUB_ENTITY_0 is the default chanctx entry throughout
|
||||
driver, i.e. it's used for things which may not have a target chanctx
|
||||
yet. So, we need to ensure that RTW89_SUB_ENTITY_0 is always working.
|
||||
If there is at least one alive chanctx, then one of them must take
|
||||
RTW89_SUB_ENTITY_0. If no alive chanctx, RTW89_SUB_ENTITY_0 will be
|
||||
filled by rtw89_config_default_chandef().
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221129083130.45708-7-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/chan.c | 40 ++++++++++++++++++++++++---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 20 +++++++++-----
|
||||
drivers/net/wireless/realtek/rtw89/mac80211.c | 1 +
|
||||
3 files changed, 50 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/chan.c b/drivers/net/wireless/realtek/rtw89/chan.c
|
||||
index a4f61c2f65123..90596806bc93f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/chan.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/chan.c
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "chan.h"
|
||||
#include "debug.h"
|
||||
+#include "util.h"
|
||||
|
||||
static enum rtw89_subband rtw89_get_subband_type(enum rtw89_band band,
|
||||
u8 center_chan)
|
||||
@@ -108,8 +109,8 @@ bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *new)
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
- struct rtw89_chan *chan = &hal->chan[idx];
|
||||
- struct rtw89_chan_rcd *rcd = &hal->chan_rcd[idx];
|
||||
+ struct rtw89_chan *chan = &hal->sub[idx].chan;
|
||||
+ struct rtw89_chan_rcd *rcd = &hal->sub[idx].rcd;
|
||||
bool band_changed;
|
||||
|
||||
rcd->prev_primary_channel = chan->primary_channel;
|
||||
@@ -127,7 +128,7 @@ static void __rtw89_config_entity_chandef(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
- hal->chandef[idx] = *chandef;
|
||||
+ hal->sub[idx].chandef = *chandef;
|
||||
|
||||
if (from_stack)
|
||||
set_bit(idx, hal->entity_map);
|
||||
@@ -195,6 +196,7 @@ int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
|
||||
rtw89_config_entity_chandef(rtwdev, idx, &ctx->def);
|
||||
rtw89_set_channel(rtwdev);
|
||||
cfg->idx = idx;
|
||||
+ hal->sub[idx].cfg = cfg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -203,8 +205,34 @@ void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv;
|
||||
+ struct rtw89_vif *rtwvif;
|
||||
+ u8 drop, roll;
|
||||
|
||||
- clear_bit(cfg->idx, hal->entity_map);
|
||||
+ drop = cfg->idx;
|
||||
+ if (drop != RTW89_SUB_ENTITY_0)
|
||||
+ goto out;
|
||||
+
|
||||
+ roll = find_next_bit(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY, drop + 1);
|
||||
+
|
||||
+ /* Follow rtw89_config_default_chandef() when rtw89_entity_recalc(). */
|
||||
+ if (roll == NUM_OF_RTW89_SUB_ENTITY)
|
||||
+ goto out;
|
||||
+
|
||||
+ /* RTW89_SUB_ENTITY_0 is going to release, and another exists.
|
||||
+ * Make another roll down to RTW89_SUB_ENTITY_0 to replace.
|
||||
+ */
|
||||
+ hal->sub[roll].cfg->idx = RTW89_SUB_ENTITY_0;
|
||||
+ hal->sub[RTW89_SUB_ENTITY_0] = hal->sub[roll];
|
||||
+
|
||||
+ rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
||||
+ if (rtwvif->sub_entity_idx == roll)
|
||||
+ rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
|
||||
+ }
|
||||
+
|
||||
+ drop = roll;
|
||||
+
|
||||
+out:
|
||||
+ clear_bit(drop, hal->entity_map);
|
||||
rtw89_set_channel(rtwdev);
|
||||
}
|
||||
|
||||
@@ -225,6 +253,9 @@ int rtw89_chanctx_ops_assign_vif(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif *rtwvif,
|
||||
struct ieee80211_chanctx_conf *ctx)
|
||||
{
|
||||
+ struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv;
|
||||
+
|
||||
+ rtwvif->sub_entity_idx = cfg->idx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -232,4 +263,5 @@ void rtw89_chanctx_ops_unassign_vif(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif *rtwvif,
|
||||
struct ieee80211_chanctx_conf *ctx)
|
||||
{
|
||||
+ rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
|
||||
}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index f4603c2ce8f13..2badb96d2ae35 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2240,6 +2240,8 @@ struct rtw89_phy_rate_pattern {
|
||||
struct rtw89_vif {
|
||||
struct list_head list;
|
||||
struct rtw89_dev *rtwdev;
|
||||
+ enum rtw89_sub_entity_idx sub_entity_idx;
|
||||
+
|
||||
u8 mac_id;
|
||||
u8 port;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
@@ -2953,6 +2955,13 @@ enum rtw89_entity_mode {
|
||||
RTW89_ENTITY_MODE_SCC,
|
||||
};
|
||||
|
||||
+struct rtw89_sub_entity {
|
||||
+ struct cfg80211_chan_def chandef;
|
||||
+ struct rtw89_chan chan;
|
||||
+ struct rtw89_chan_rcd rcd;
|
||||
+ struct rtw89_chanctx_cfg *cfg;
|
||||
+};
|
||||
+
|
||||
struct rtw89_hal {
|
||||
u32 rx_fltr;
|
||||
u8 cv;
|
||||
@@ -2966,13 +2975,10 @@ struct rtw89_hal {
|
||||
bool support_igi;
|
||||
|
||||
DECLARE_BITMAP(entity_map, NUM_OF_RTW89_SUB_ENTITY);
|
||||
- struct cfg80211_chan_def chandef[NUM_OF_RTW89_SUB_ENTITY];
|
||||
+ struct rtw89_sub_entity sub[NUM_OF_RTW89_SUB_ENTITY];
|
||||
|
||||
bool entity_active;
|
||||
enum rtw89_entity_mode entity_mode;
|
||||
-
|
||||
- struct rtw89_chan chan[NUM_OF_RTW89_SUB_ENTITY];
|
||||
- struct rtw89_chan_rcd chan_rcd[NUM_OF_RTW89_SUB_ENTITY];
|
||||
};
|
||||
|
||||
#define RTW89_MAX_MAC_ID_NUM 128
|
||||
@@ -4138,7 +4144,7 @@ const struct cfg80211_chan_def *rtw89_chandef_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
- return &hal->chandef[idx];
|
||||
+ return &hal->sub[idx].chandef;
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -4147,7 +4153,7 @@ const struct rtw89_chan *rtw89_chan_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
- return &hal->chan[idx];
|
||||
+ return &hal->sub[idx].chan;
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -4156,7 +4162,7 @@ const struct rtw89_chan_rcd *rtw89_chan_rcd_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
- return &hal->chan_rcd[idx];
|
||||
+ return &hal->sub[idx].rcd;
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_fem_setup(struct rtw89_dev *rtwdev)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
index ce980d2f22c46..1a99267d710d4 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
@@ -131,6 +131,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
|
||||
rtwvif->bcn_hit_cond = 0;
|
||||
rtwvif->mac_idx = RTW89_MAC_0;
|
||||
rtwvif->phy_idx = RTW89_PHY_0;
|
||||
+ rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
|
||||
rtwvif->hit_rule = 0;
|
||||
ether_addr_copy(rtwvif->mac_addr, vif->addr);
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,139 @@
|
||||
From 0309d8097defcf106e57a2d235dae23de664a81e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 072/142] wifi: rtw89: don't request partial firmware if
|
||||
SECURITY_LOADPIN_ENFORCE
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 3ddfe3bdd3cf199676737fbd8cb7878b962acd2a
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Fri Dec 2 14:05:20 2022 +0800
|
||||
|
||||
wifi: rtw89: don't request partial firmware if SECURITY_LOADPIN_ENFORCE
|
||||
|
||||
Kernel logs on platform enabling SECURITY_LOADPIN_ENFORCE
|
||||
------
|
||||
```
|
||||
LoadPin: firmware old-api-denied obj=<unknown> pid=810 cmdline="modprobe -q -- rtw89_8852ce"
|
||||
rtw89_8852ce 0000:01:00.0: loading /lib/firmware/rtw89/rtw8852c_fw.bin failed with error -1
|
||||
rtw89_8852ce 0000:01:00.0: Direct firmware load for rtw89/rtw8852c_fw.bin failed with error -1
|
||||
rtw89_8852ce 0000:01:00.0: failed to early request firmware: -1
|
||||
```
|
||||
|
||||
Trace
|
||||
------
|
||||
```
|
||||
request_partial_firmware_into_buf()
|
||||
> _request_firmware()
|
||||
>> fw_get_filesystem_firmware()
|
||||
>>> kernel_read_file_from_path_initns()
|
||||
>>>> kernel_read_file()
|
||||
>>>>> security_kernel_read_file()
|
||||
// It will iterate enabled LSMs' hooks for kernel_read_file.
|
||||
// With loadpin, it hooks loadpin_read_file.
|
||||
```
|
||||
|
||||
If SECURITY_LOADPIN_ENFORCE is enabled, doing kernel_read_file() on partial
|
||||
files will be denied and return -EPERM (-1). Then, the outer API based on it,
|
||||
e.g. request_partial_firmware_into_buf(), will get the error.
|
||||
|
||||
In the case, we cannot get the firmware stuffs right, even though there might
|
||||
be no error other than a permission issue on reading a partial file. So we have
|
||||
to request full firmware if SECURITY_LOADPIN_ENFORCE is enabled. It makes us
|
||||
still have a chance to do early firmware work on this kind of platforms.
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202060521.501512-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 30 +++++++++++++++++++++---------
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 15 +++++++++++++++
|
||||
2 files changed, 36 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index cc8efd4ea57f8..e81aac935721a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -277,25 +277,37 @@ void rtw89_early_fw_feature_recognize(struct device *device,
|
||||
const struct rtw89_chip_info *chip,
|
||||
u32 *early_feat_map)
|
||||
{
|
||||
- union {
|
||||
- struct rtw89_mfw_hdr mfw_hdr;
|
||||
- u8 fw_hdr[RTW89_FW_HDR_SIZE];
|
||||
- } buf = {};
|
||||
+ union rtw89_compat_fw_hdr buf = {};
|
||||
const struct firmware *firmware;
|
||||
+ bool full_req = false;
|
||||
u32 ver_code;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
- ret = request_partial_firmware_into_buf(&firmware, chip->fw_name,
|
||||
- device, &buf, sizeof(buf), 0);
|
||||
+ /* If SECURITY_LOADPIN_ENFORCE is enabled, reading partial files will
|
||||
+ * be denied (-EPERM). Then, we don't get right firmware things as
|
||||
+ * expected. So, in this case, we have to request full firmware here.
|
||||
+ */
|
||||
+ if (IS_ENABLED(CONFIG_SECURITY_LOADPIN_ENFORCE))
|
||||
+ full_req = true;
|
||||
+
|
||||
+ if (full_req)
|
||||
+ ret = request_firmware(&firmware, chip->fw_name, device);
|
||||
+ else
|
||||
+ ret = request_partial_firmware_into_buf(&firmware, chip->fw_name,
|
||||
+ device, &buf, sizeof(buf),
|
||||
+ 0);
|
||||
+
|
||||
if (ret) {
|
||||
dev_err(device, "failed to early request firmware: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
- ver_code = buf.mfw_hdr.sig != RTW89_MFW_SIG ?
|
||||
- RTW89_FW_HDR_VER_CODE(&buf.fw_hdr) :
|
||||
- RTW89_MFW_HDR_VER_CODE(&buf.mfw_hdr);
|
||||
+ if (full_req)
|
||||
+ ver_code = rtw89_compat_fw_hdr_ver_code(firmware->data);
|
||||
+ else
|
||||
+ ver_code = rtw89_compat_fw_hdr_ver_code(&buf);
|
||||
+
|
||||
if (!ver_code)
|
||||
goto out;
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 46d57414f24e2..5c4c7de1b4f5d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -3291,6 +3291,21 @@ struct fwcmd_hdr {
|
||||
__le32 hdr1;
|
||||
};
|
||||
|
||||
+union rtw89_compat_fw_hdr {
|
||||
+ struct rtw89_mfw_hdr mfw_hdr;
|
||||
+ u8 fw_hdr[RTW89_FW_HDR_SIZE];
|
||||
+};
|
||||
+
|
||||
+static inline u32 rtw89_compat_fw_hdr_ver_code(const void *fw_buf)
|
||||
+{
|
||||
+ const union rtw89_compat_fw_hdr *compat = (typeof(compat))fw_buf;
|
||||
+
|
||||
+ if (compat->mfw_hdr.sig == RTW89_MFW_SIG)
|
||||
+ return RTW89_MFW_HDR_VER_CODE(&compat->mfw_hdr);
|
||||
+ else
|
||||
+ return RTW89_FW_HDR_VER_CODE(&compat->fw_hdr);
|
||||
+}
|
||||
+
|
||||
#define RTW89_H2C_RF_PAGE_SIZE 500
|
||||
#define RTW89_H2C_RF_PAGE_NUM 3
|
||||
struct rtw89_fw_h2c_rf_reg_info {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,181 @@
|
||||
From 77ea9f18933b7c4dac76e658206be0153796566c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 073/142] wifi: rtw89: request full firmware only once if it's
|
||||
early requested
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 13eb07e0be1b95f1e1fab721fb0f38117edfe80b
|
||||
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Date: Fri Dec 2 14:05:21 2022 +0800
|
||||
|
||||
wifi: rtw89: request full firmware only once if it's early requested
|
||||
|
||||
Under some condition, we now have to do early request full firmware when
|
||||
rtw89_early_fw_feature_recognize(). In this case, we can avoid requesting
|
||||
full firmware twice during probing driver. So, we pass out full firmware
|
||||
from rtw89_early_fw_feature_recognize() if it's requested successfully.
|
||||
And then, if firmware is settled, we have no need to request full firmware
|
||||
again during normal initizating flow.
|
||||
|
||||
Setting firmware flow is updated to be as the following.
|
||||
|
||||
platform | early recognizing | normally initizating
|
||||
-----------------------------------------------------------------------
|
||||
deny reading | request full FW | (no more FW requesting)
|
||||
partial file | | (obtain FW from early pahse)
|
||||
-----------------------------------------------------------------------
|
||||
able to read | request partial FW | async request full FW
|
||||
partial file | (quite small chunk) |
|
||||
|
||||
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202060521.501512-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 6 +++++-
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 28 +++++++++++++++++++++++-----
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 7 ++++---
|
||||
3 files changed, 32 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index 18b4361505229..e99eccf11c762 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -3423,6 +3423,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
u32 bus_data_size,
|
||||
const struct rtw89_chip_info *chip)
|
||||
{
|
||||
+ const struct firmware *firmware;
|
||||
struct ieee80211_hw *hw;
|
||||
struct rtw89_dev *rtwdev;
|
||||
struct ieee80211_ops *ops;
|
||||
@@ -3430,7 +3431,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
u32 early_feat_map = 0;
|
||||
bool no_chanctx;
|
||||
|
||||
- rtw89_early_fw_feature_recognize(device, chip, &early_feat_map);
|
||||
+ firmware = rtw89_early_fw_feature_recognize(device, chip, &early_feat_map);
|
||||
|
||||
ops = kmemdup(&rtw89_ops, sizeof(rtw89_ops), GFP_KERNEL);
|
||||
if (!ops)
|
||||
@@ -3457,6 +3458,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
rtwdev->dev = device;
|
||||
rtwdev->ops = ops;
|
||||
rtwdev->chip = chip;
|
||||
+ rtwdev->fw.firmware = firmware;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_FW, "probe driver %s chanctx\n",
|
||||
no_chanctx ? "without" : "with");
|
||||
@@ -3465,6 +3467,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
|
||||
err:
|
||||
kfree(ops);
|
||||
+ release_firmware(firmware);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_alloc_ieee80211_hw);
|
||||
@@ -3472,6 +3475,7 @@ EXPORT_SYMBOL(rtw89_alloc_ieee80211_hw);
|
||||
void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
kfree(rtwdev->ops);
|
||||
+ release_firmware(rtwdev->fw.firmware);
|
||||
ieee80211_free_hw(rtwdev->hw);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_free_ieee80211_hw);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index e81aac935721a..3b7af8faca505 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -273,9 +273,10 @@ static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
}
|
||||
|
||||
-void rtw89_early_fw_feature_recognize(struct device *device,
|
||||
- const struct rtw89_chip_info *chip,
|
||||
- u32 *early_feat_map)
|
||||
+const struct firmware *
|
||||
+rtw89_early_fw_feature_recognize(struct device *device,
|
||||
+ const struct rtw89_chip_info *chip,
|
||||
+ u32 *early_feat_map)
|
||||
{
|
||||
union rtw89_compat_fw_hdr buf = {};
|
||||
const struct firmware *firmware;
|
||||
@@ -300,7 +301,7 @@ void rtw89_early_fw_feature_recognize(struct device *device,
|
||||
|
||||
if (ret) {
|
||||
dev_err(device, "failed to early request firmware: %d\n", ret);
|
||||
- return;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
if (full_req)
|
||||
@@ -322,7 +323,11 @@ void rtw89_early_fw_feature_recognize(struct device *device,
|
||||
}
|
||||
|
||||
out:
|
||||
+ if (full_req)
|
||||
+ return firmware;
|
||||
+
|
||||
release_firmware(firmware);
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
int rtw89_fw_recognize(struct rtw89_dev *rtwdev)
|
||||
@@ -629,6 +634,13 @@ int rtw89_load_firmware(struct rtw89_dev *rtwdev)
|
||||
fw->rtwdev = rtwdev;
|
||||
init_completion(&fw->completion);
|
||||
|
||||
+ if (fw->firmware) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_FW,
|
||||
+ "full firmware has been early requested\n");
|
||||
+ complete_all(&fw->completion);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
ret = request_firmware_nowait(THIS_MODULE, true, fw_name, rtwdev->dev,
|
||||
GFP_KERNEL, fw, rtw89_load_firmware_cb);
|
||||
if (ret) {
|
||||
@@ -645,8 +657,14 @@ void rtw89_unload_firmware(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw89_wait_firmware_completion(rtwdev);
|
||||
|
||||
- if (fw->firmware)
|
||||
+ if (fw->firmware) {
|
||||
release_firmware(fw->firmware);
|
||||
+
|
||||
+ /* assign NULL back in case rtw89_free_ieee80211_hw()
|
||||
+ * try to release the same one again.
|
||||
+ */
|
||||
+ fw->firmware = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
#define H2C_CAM_LEN 60
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 5c4c7de1b4f5d..4d2f9ea9e0022 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -3444,9 +3444,10 @@ struct rtw89_fw_h2c_rf_get_mccch {
|
||||
|
||||
int rtw89_fw_check_rdy(struct rtw89_dev *rtwdev);
|
||||
int rtw89_fw_recognize(struct rtw89_dev *rtwdev);
|
||||
-void rtw89_early_fw_feature_recognize(struct device *device,
|
||||
- const struct rtw89_chip_info *chip,
|
||||
- u32 *early_feat_map);
|
||||
+const struct firmware *
|
||||
+rtw89_early_fw_feature_recognize(struct device *device,
|
||||
+ const struct rtw89_chip_info *chip,
|
||||
+ u32 *early_feat_map);
|
||||
int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type);
|
||||
int rtw89_load_firmware(struct rtw89_dev *rtwdev);
|
||||
void rtw89_unload_firmware(struct rtw89_dev *rtwdev);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,139 @@
|
||||
From b0fabf2886facde82214f4cc791db13b9020f242 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 074/142] wifi: rtw89: add mac TSF sync function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit fb2b8cec81d75b2b20bdbc2fca7a60a68bc78aac
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Dec 2 14:15:24 2022 +0800
|
||||
|
||||
wifi: rtw89: add mac TSF sync function
|
||||
|
||||
If the interface is in AP/P2P GO mode, we adjust the TSF with random
|
||||
offset to avoid TBTT of different vifs to overlap and collide.
|
||||
For every new interface added, we adjust the value and resync for all
|
||||
interfaces.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202061527.505668-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 44 ++++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 17 ++++++++++++
|
||||
3 files changed, 63 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index d80050c2e9b30..a80690d0bf485 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -3913,6 +3913,49 @@ static void rtw89_mac_port_cfg_tbtt_shift(struct rtw89_dev *rtwdev,
|
||||
B_AX_TBTT_SHIFT_OFST_MASK, val);
|
||||
}
|
||||
|
||||
+static void rtw89_mac_port_tsf_sync(struct rtw89_dev *rtwdev,
|
||||
+ struct rtw89_vif *rtwvif,
|
||||
+ struct rtw89_vif *rtwvif_src, u8 offset,
|
||||
+ int *n_offset)
|
||||
+{
|
||||
+ u32 val, reg;
|
||||
+
|
||||
+ if (rtwvif->net_type != RTW89_NET_TYPE_AP_MODE || rtwvif == rtwvif_src)
|
||||
+ return;
|
||||
+
|
||||
+ /* adjust offset randomly to avoid beacon conflict */
|
||||
+ offset = offset - offset / 4 + get_random_u32() % (offset / 2);
|
||||
+ val = RTW89_PORT_OFFSET_MS_TO_32US((*n_offset)++, offset);
|
||||
+ reg = rtw89_mac_reg_by_idx(R_AX_PORT0_TSF_SYNC + rtwvif->port * 4,
|
||||
+ rtwvif->mac_idx);
|
||||
+
|
||||
+ rtw89_write32_mask(rtwdev, reg, B_AX_SYNC_PORT_SRC, rtwvif_src->port);
|
||||
+ rtw89_write32_mask(rtwdev, reg, B_AX_SYNC_PORT_OFFSET_VAL, val);
|
||||
+ rtw89_write32_set(rtwdev, reg, B_AX_SYNC_NOW);
|
||||
+}
|
||||
+
|
||||
+static void rtw89_mac_port_tsf_resync_all(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw89_vif *src = NULL, *tmp;
|
||||
+ u8 offset = 100, vif_aps = 0;
|
||||
+ int n_offset = 1;
|
||||
+
|
||||
+ rtw89_for_each_rtwvif(rtwdev, tmp) {
|
||||
+ if (!src || tmp->net_type == RTW89_NET_TYPE_INFRA)
|
||||
+ src = tmp;
|
||||
+ if (tmp->net_type == RTW89_NET_TYPE_AP_MODE)
|
||||
+ vif_aps++;
|
||||
+ }
|
||||
+
|
||||
+ if (vif_aps == 0)
|
||||
+ return;
|
||||
+
|
||||
+ offset /= (vif_aps + 1);
|
||||
+
|
||||
+ rtw89_for_each_rtwvif(rtwdev, tmp)
|
||||
+ rtw89_mac_port_tsf_sync(rtwdev, tmp, src, offset, &n_offset);
|
||||
+}
|
||||
+
|
||||
int rtw89_mac_vif_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
int ret;
|
||||
@@ -3991,6 +4034,7 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
rtw89_mac_port_cfg_bss_color(rtwdev, rtwvif);
|
||||
rtw89_mac_port_cfg_mbssid(rtwdev, rtwvif);
|
||||
rtw89_mac_port_cfg_func_en(rtwdev, rtwvif);
|
||||
+ rtw89_mac_port_tsf_resync_all(rtwdev);
|
||||
fsleep(BCN_ERLY_SET_DLY);
|
||||
rtw89_mac_port_cfg_bcn_early(rtwdev, rtwvif);
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index adb0c86a98d3e..766ca6934d33a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -168,6 +168,8 @@ enum rtw89_mac_ax_l0_to_l1_event {
|
||||
MAC_AX_L0_TO_L1_EVENT_MAX = 15,
|
||||
};
|
||||
|
||||
+#define RTW89_PORT_OFFSET_MS_TO_32US(n, shift_ms) ((n) * (shift_ms) * 1000 / 32)
|
||||
+
|
||||
enum rtw89_mac_dbg_port_sel {
|
||||
/* CMAC 0 related */
|
||||
RTW89_DBG_PORT_SEL_PTCL_C0 = 0,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index f2634062f377d..5324e645728bb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -2048,6 +2048,23 @@
|
||||
#define B_AX_PTCL_TOP_ERR_IND BIT(1)
|
||||
#define B_AX_SCHEDULE_TOP_ERR_IND BIT(0)
|
||||
|
||||
+#define R_AX_PORT0_TSF_SYNC 0xC2A0
|
||||
+#define R_AX_PORT0_TSF_SYNC_C1 0xE2A0
|
||||
+#define R_AX_PORT1_TSF_SYNC 0xC2A4
|
||||
+#define R_AX_PORT1_TSF_SYNC_C1 0xE2A4
|
||||
+#define R_AX_PORT2_TSF_SYNC 0xC2A8
|
||||
+#define R_AX_PORT2_TSF_SYNC_C1 0xE2A8
|
||||
+#define R_AX_PORT3_TSF_SYNC 0xC2AC
|
||||
+#define R_AX_PORT3_TSF_SYNC_C1 0xE2AC
|
||||
+#define R_AX_PORT4_TSF_SYNC 0xC2B0
|
||||
+#define R_AX_PORT4_TSF_SYNC_C1 0xE2B0
|
||||
+#define B_AX_SYNC_NOW BIT(30)
|
||||
+#define B_AX_SYNC_ONCE BIT(29)
|
||||
+#define B_AX_SYNC_AUTO BIT(28)
|
||||
+#define B_AX_SYNC_PORT_SRC GENMASK(26, 24)
|
||||
+#define B_AX_SYNC_PORT_OFFSET_SIGN BIT(18)
|
||||
+#define B_AX_SYNC_PORT_OFFSET_VAL GENMASK(17, 0)
|
||||
+
|
||||
#define R_AX_MACID_SLEEP_0 0xC2C0
|
||||
#define R_AX_MACID_SLEEP_0_C1 0xE2C0
|
||||
#define B_AX_MACID31_0_SLEEP_SH 0
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,102 @@
|
||||
From 217bcd1810fc615699c139a8e771c909ecc6f530 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:31 +0200
|
||||
Subject: [PATCH 075/142] wifi: rtw89: stop mac port function when stop_ap()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit d592b9f742643f07db53ac34baf6bbd3ce9478dc
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Dec 2 14:15:25 2022 +0800
|
||||
|
||||
wifi: rtw89: stop mac port function when stop_ap()
|
||||
|
||||
Disable hardware beacon related functions when ap stops. So hardware won't
|
||||
transmit beacons while interface is already removed.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202061527.505668-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 16 +++++++++++++---
|
||||
drivers/net/wireless/realtek/rtw89/mac.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/mac80211.c | 1 +
|
||||
3 files changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index a80690d0bf485..12cbf41590bbe 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -3877,11 +3877,16 @@ static void rtw89_mac_port_cfg_hiq_drop(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void rtw89_mac_port_cfg_func_en(struct rtw89_dev *rtwdev,
|
||||
- struct rtw89_vif *rtwvif)
|
||||
+ struct rtw89_vif *rtwvif, bool enable)
|
||||
{
|
||||
const struct rtw89_port_reg *p = &rtw_port_base;
|
||||
|
||||
- rtw89_write32_port_set(rtwdev, rtwvif, p->port_cfg, B_AX_PORT_FUNC_EN);
|
||||
+ if (enable)
|
||||
+ rtw89_write32_port_set(rtwdev, rtwvif, p->port_cfg,
|
||||
+ B_AX_PORT_FUNC_EN);
|
||||
+ else
|
||||
+ rtw89_write32_port_clr(rtwdev, rtwvif, p->port_cfg,
|
||||
+ B_AX_PORT_FUNC_EN);
|
||||
}
|
||||
|
||||
static void rtw89_mac_port_cfg_bcn_early(struct rtw89_dev *rtwdev,
|
||||
@@ -4033,7 +4038,7 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
rtw89_mac_port_cfg_tbtt_shift(rtwdev, rtwvif);
|
||||
rtw89_mac_port_cfg_bss_color(rtwdev, rtwvif);
|
||||
rtw89_mac_port_cfg_mbssid(rtwdev, rtwvif);
|
||||
- rtw89_mac_port_cfg_func_en(rtwdev, rtwvif);
|
||||
+ rtw89_mac_port_cfg_func_en(rtwdev, rtwvif, true);
|
||||
rtw89_mac_port_tsf_resync_all(rtwdev);
|
||||
fsleep(BCN_ERLY_SET_DLY);
|
||||
rtw89_mac_port_cfg_bcn_early(rtwdev, rtwvif);
|
||||
@@ -4085,6 +4090,11 @@ void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,
|
||||
rtw89_write32_set(rtwdev, reg, B_AX_RXTRIG_RU26_DIS);
|
||||
}
|
||||
|
||||
+void rtw89_mac_stop_ap(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
+{
|
||||
+ rtw89_mac_port_cfg_func_en(rtwdev, rtwvif, false);
|
||||
+}
|
||||
+
|
||||
int rtw89_mac_add_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
int ret;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
index 766ca6934d33a..f0b684b205f10 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
|
||||
@@ -908,6 +908,7 @@ int rtw89_mac_add_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
|
||||
int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,
|
||||
struct ieee80211_vif *vif);
|
||||
+void rtw89_mac_stop_ap(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
int rtw89_mac_remove_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
|
||||
void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
index 1a99267d710d4..0c86d416b7ad2 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
@@ -454,6 +454,7 @@ void rtw89_ops_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
+ rtw89_mac_stop_ap(rtwdev, rtwvif);
|
||||
rtw89_fw_h2c_assoc_cmac_tbl(rtwdev, vif, NULL);
|
||||
rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,52 @@
|
||||
From dc93a468c0aed51fde75346bbffc07f5ce74ee2a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 076/142] wifi: rtw89: fix unsuccessful interface_add flow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 8fc5d4338620b81b1b265c725b38aced8acf8d72
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Dec 2 14:15:26 2022 +0800
|
||||
|
||||
wifi: rtw89: fix unsuccessful interface_add flow
|
||||
|
||||
Remove according vifs from list if we couldn't set this interface up.
|
||||
Otherwise the rtwvif_list could contain unreferenced objects.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202061527.505668-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac80211.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
index 0c86d416b7ad2..f9b95c52916bb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
||||
@@ -125,6 +125,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
|
||||
RTW89_PORT_NUM);
|
||||
if (rtwvif->port == RTW89_PORT_NUM) {
|
||||
ret = -ENOSPC;
|
||||
+ list_del_init(&rtwvif->list);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -138,6 +139,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
|
||||
ret = rtw89_mac_add_vif(rtwdev, rtwvif);
|
||||
if (ret) {
|
||||
rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port);
|
||||
+ list_del_init(&rtwvif->list);
|
||||
goto out;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 8f22795cdfed6df6fa0533e3c2042533e63e46da Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 077/142] wifi: rtw89: add join info upon create interface
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit a0e78d5c6082fc953fef5af7293be0145c67dba4
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Fri Dec 2 14:15:27 2022 +0800
|
||||
|
||||
wifi: rtw89: add join info upon create interface
|
||||
|
||||
To support multiple vifs, fw need more information of each role.
|
||||
Send this info to make things work as expected.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221202061527.505668-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/mac.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
index 12cbf41590bbe..cf9a0a3120a79 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
||||
@@ -3980,6 +3980,10 @@ int rtw89_mac_vif_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ ret = rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
ret = rtw89_cam_init(rtwdev, rtwvif);
|
||||
if (ret)
|
||||
return ret;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,128 @@
|
||||
From fd4c8ece088984b50f2a64424be974cb4af96441 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 078/142] wifi: rtw89: consider ER SU as a TX capability
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 25ed1a172298eed1cab329792d8e4d7363a411fc
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Dec 9 09:21:10 2022 +0800
|
||||
|
||||
wifi: rtw89: consider ER SU as a TX capability
|
||||
|
||||
ER (Extended Range) SU is to have a larger coverage. We set this as a RA
|
||||
capability, and then firmware can choose ER SU to transmit packets to
|
||||
reception at cell edge. For 8852C, it needs to fill this capability in
|
||||
TXWD, so update rtw89_build_txwd_info0_v1().
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221209012110.7242-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.c | 13 ++++++++++++-
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/txrx.h | 2 ++
|
||||
4 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
index e99eccf11c762..2e4ba8e42d392 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||||
@@ -689,7 +689,9 @@ rtw89_core_tx_update_data_info(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_core_tx_request *tx_req)
|
||||
{
|
||||
struct ieee80211_vif *vif = tx_req->vif;
|
||||
+ struct ieee80211_sta *sta = tx_req->sta;
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
+ struct rtw89_sta *rtwsta = sta_to_rtwsta_safe(sta);
|
||||
struct rtw89_phy_rate_pattern *rate_pattern = &rtwvif->rate_pattern;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
|
||||
@@ -707,6 +709,7 @@ rtw89_core_tx_update_data_info(struct rtw89_dev *rtwdev,
|
||||
desc_info->qsel = qsel;
|
||||
desc_info->mac_id = rtw89_core_tx_get_mac_id(rtwdev, tx_req);
|
||||
desc_info->port = desc_info->hiq ? rtwvif->port : 0;
|
||||
+ desc_info->er_cap = rtwsta ? rtwsta->er_cap : false;
|
||||
|
||||
/* enable wd_info for AMPDU */
|
||||
desc_info->en_wd_info = true;
|
||||
@@ -1006,7 +1009,9 @@ static __le32 rtw89_build_txwd_info0(struct rtw89_tx_desc_info *desc_info)
|
||||
static __le32 rtw89_build_txwd_info0_v1(struct rtw89_tx_desc_info *desc_info)
|
||||
{
|
||||
u32 dword = FIELD_PREP(RTW89_TXWD_INFO0_DISDATAFB, desc_info->dis_data_fb) |
|
||||
- FIELD_PREP(RTW89_TXWD_INFO0_MULTIPORT_ID, desc_info->port);
|
||||
+ FIELD_PREP(RTW89_TXWD_INFO0_MULTIPORT_ID, desc_info->port) |
|
||||
+ FIELD_PREP(RTW89_TXWD_INFO0_DATA_ER, desc_info->er_cap) |
|
||||
+ FIELD_PREP(RTW89_TXWD_INFO0_DATA_BW_ER, 0);
|
||||
|
||||
return cpu_to_le32(dword);
|
||||
}
|
||||
@@ -2585,6 +2590,12 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
|
||||
rtw89_mac_bf_monitor_calc(rtwdev, sta, false);
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) {
|
||||
+ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
|
||||
+
|
||||
+ if (bss_conf->he_support &&
|
||||
+ !(bss_conf->he_oper.params & IEEE80211_HE_OPERATION_ER_SU_DISABLE))
|
||||
+ rtwsta->er_cap = true;
|
||||
+
|
||||
rtw89_btc_ntfy_role_info(rtwdev, rtwvif, rtwsta,
|
||||
BTC_ROLE_MSTS_STA_CONN_END);
|
||||
rtw89_core_get_no_ul_ofdma_htc(rtwdev, &rtwsta->htc_template);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 2badb96d2ae35..800ede1d69c75 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -816,6 +816,7 @@ struct rtw89_tx_desc_info {
|
||||
#define RTW89_MGMT_HW_SEQ_MODE 1
|
||||
bool hiq;
|
||||
u8 port;
|
||||
+ bool er_cap;
|
||||
};
|
||||
|
||||
struct rtw89_core_tx_request {
|
||||
@@ -2194,6 +2195,7 @@ struct rtw89_sec_cam_entry {
|
||||
struct rtw89_sta {
|
||||
u8 mac_id;
|
||||
bool disassoc;
|
||||
+ bool er_cap;
|
||||
struct rtw89_dev *rtwdev;
|
||||
struct rtw89_vif *rtwvif;
|
||||
struct rtw89_ra_info ra;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 017710c580c72..5dc617a0a47a7 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -367,6 +367,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
ra->bw_cap = bw_mode;
|
||||
+ ra->er_cap = rtwsta->er_cap;
|
||||
ra->mode_ctrl = mode;
|
||||
ra->macid = rtwsta->mac_id;
|
||||
ra->stbc_cap = stbc_en;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/txrx.h b/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
index 9d4c6b6fa1250..98eb9607cd218 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/txrx.h
|
||||
@@ -75,7 +75,9 @@
|
||||
#define RTW89_TXWD_INFO0_DATA_BW GENMASK(29, 28)
|
||||
#define RTW89_TXWD_INFO0_GI_LTF GENMASK(27, 25)
|
||||
#define RTW89_TXWD_INFO0_DATA_RATE GENMASK(24, 16)
|
||||
+#define RTW89_TXWD_INFO0_DATA_ER BIT(15)
|
||||
#define RTW89_TXWD_INFO0_DISDATAFB BIT(10)
|
||||
+#define RTW89_TXWD_INFO0_DATA_BW_ER BIT(8)
|
||||
#define RTW89_TXWD_INFO0_MULTIPORT_ID GENMASK(6, 4)
|
||||
|
||||
/* TX WD INFO DWORD 1 */
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,116 @@
|
||||
From 01cfb2843b75edc4f1589ecad4275590fa011446 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 079/142] wifi: rtw89: fw: adapt to new firmware format of
|
||||
security section
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 18ddf102d4b8768cd058105168f29f96cd0c6d2d
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Dec 9 09:22:15 2022 +0800
|
||||
|
||||
wifi: rtw89: fw: adapt to new firmware format of security section
|
||||
|
||||
Normally, system image should ensure firmware integrity, but we provide
|
||||
an advance feature to ensure this by security section along with firmware.
|
||||
To enable this feature, custom ID is programmed into efuse, and driver
|
||||
will download proper security section to firmware.
|
||||
|
||||
Since I don't have this kind hardware modules on hand yet, but new format
|
||||
is used by newer firmware. Therefore, I prepare this patch in advance to
|
||||
consider size of security section as a factor of checking rule of firmware
|
||||
size, but don't actually download security section to firmware.
|
||||
|
||||
This patch is backward compatible, so it will be safe to have this change
|
||||
before adding an new format firmware to linux-firmware repository.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221209012215.7342-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 11 ++++++++++-
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 13 +++++++++++--
|
||||
2 files changed, 21 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index 3b7af8faca505..fddad1c21e3d3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -91,6 +91,7 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, const u8 *fw, u32 len,
|
||||
const u8 *fwdynhdr;
|
||||
const u8 *bin;
|
||||
u32 base_hdr_len;
|
||||
+ u32 mssc_len = 0;
|
||||
u32 i;
|
||||
|
||||
if (!info)
|
||||
@@ -120,6 +121,14 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, const u8 *fw, u32 len,
|
||||
fw += RTW89_FW_HDR_SIZE;
|
||||
section_info = info->section_info;
|
||||
for (i = 0; i < info->section_num; i++) {
|
||||
+ section_info->type = GET_FWSECTION_HDR_SECTIONTYPE(fw);
|
||||
+ if (section_info->type == FWDL_SECURITY_SECTION_TYPE) {
|
||||
+ section_info->mssc = GET_FWSECTION_HDR_MSSC(fw);
|
||||
+ mssc_len += section_info->mssc * FWDL_SECURITY_SIGLEN;
|
||||
+ } else {
|
||||
+ section_info->mssc = 0;
|
||||
+ }
|
||||
+
|
||||
section_info->len = GET_FWSECTION_HDR_SEC_SIZE(fw);
|
||||
if (GET_FWSECTION_HDR_CHECKSUM(fw))
|
||||
section_info->len += FWDL_SECTION_CHKSUM_LEN;
|
||||
@@ -132,7 +141,7 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, const u8 *fw, u32 len,
|
||||
section_info++;
|
||||
}
|
||||
|
||||
- if (fw_end != bin) {
|
||||
+ if (fw_end != bin + mssc_len) {
|
||||
rtw89_err(rtwdev, "[ERR]fw bin size\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 4d2f9ea9e0022..4326e0ede54b8 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -171,6 +171,8 @@ struct rtw89_fw_hdr_section_info {
|
||||
const u8 *addr;
|
||||
u32 len;
|
||||
u32 dladdr;
|
||||
+ u32 mssc;
|
||||
+ u8 type;
|
||||
};
|
||||
|
||||
struct rtw89_fw_bin_info {
|
||||
@@ -480,14 +482,21 @@ static inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
|
||||
#define FW_EDCA_PARAM_CWMIN_MSK GENMASK(11, 8)
|
||||
#define FW_EDCA_PARAM_AIFS_MSK GENMASK(7, 0)
|
||||
|
||||
+#define FWDL_SECURITY_SECTION_TYPE 9
|
||||
+#define FWDL_SECURITY_SIGLEN 512
|
||||
+
|
||||
+#define GET_FWSECTION_HDR_DL_ADDR(fwhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwhdr)), GENMASK(31, 0))
|
||||
+#define GET_FWSECTION_HDR_SECTIONTYPE(fwhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwhdr) + 1), GENMASK(27, 24))
|
||||
#define GET_FWSECTION_HDR_SEC_SIZE(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), GENMASK(23, 0))
|
||||
#define GET_FWSECTION_HDR_CHECKSUM(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), BIT(28))
|
||||
#define GET_FWSECTION_HDR_REDL(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), BIT(29))
|
||||
-#define GET_FWSECTION_HDR_DL_ADDR(fwhdr) \
|
||||
- le32_get_bits(*((const __le32 *)(fwhdr)), GENMASK(31, 0))
|
||||
+#define GET_FWSECTION_HDR_MSSC(fwhdr) \
|
||||
+ le32_get_bits(*((const __le32 *)(fwhdr) + 2), GENMASK(31, 0))
|
||||
|
||||
#define GET_FW_HDR_MAJOR_VERSION(fwhdr) \
|
||||
le32_get_bits(*((const __le32 *)(fwhdr) + 1), GENMASK(7, 0))
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,46 @@
|
||||
From 33eaf6157fecb32ffff8b0ac1f75f19248825a45 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 080/142] wifi: rtw89: 8852c: rfk: correct DACK setting
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b2bab7b14098dcf5d405fa8c76b2c3f6ce9184f9
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Dec 9 10:09:38 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: rfk: correct DACK setting
|
||||
|
||||
After filling calibration parameters, set BIT(0) to enable the hardware
|
||||
circuit, but original set incorrect bit that affects a little TX
|
||||
performance.
|
||||
|
||||
Fixes: 76599a8d0b7d ("rtw89: 8852c: rfk: add DACK")
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221209020940.9573-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index 60cd676fe22c9..f5b0b57f33207 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -337,7 +337,7 @@ static void _dack_reload_by_path(struct rtw89_dev *rtwdev,
|
||||
(dack->dadck_d[path][index] << 14);
|
||||
addr = 0xc210 + offset;
|
||||
rtw89_phy_write32(rtwdev, addr, val32);
|
||||
- rtw89_phy_write32_set(rtwdev, addr, BIT(1));
|
||||
+ rtw89_phy_write32_set(rtwdev, addr, BIT(0));
|
||||
}
|
||||
|
||||
static void _dack_reload(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,67 @@
|
||||
From b78b8b0d588655977715ddcdb4c9fc4711b802ef Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 081/142] wifi: rtw89: 8852c: rfk: correct DPK settings
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 21b5f159a2ee47d30f418559f6ece0088c80199f
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Dec 9 10:09:39 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: rfk: correct DPK settings
|
||||
|
||||
Some DPK settings are wrong, and causes bad TX performance occasionally.
|
||||
So, fix them by internal suggestions.
|
||||
|
||||
Fixes: da4cea16cb13 ("rtw89: 8852c: rfk: add DPK")
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221209020940.9573-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 2 ++
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 9 ++++-----
|
||||
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index 5324e645728bb..ca6f6c3e63095 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -3671,6 +3671,8 @@
|
||||
#define RR_TXRSV_GAPK BIT(19)
|
||||
#define RR_BIAS 0x5e
|
||||
#define RR_BIAS_GAPK BIT(19)
|
||||
+#define RR_TXAC 0x5f
|
||||
+#define RR_TXAC_IQG GENMASK(3, 0)
|
||||
#define RR_BIASA 0x60
|
||||
#define RR_BIASA_TXG GENMASK(15, 12)
|
||||
#define RR_BIASA_TXA GENMASK(19, 16)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index f5b0b57f33207..f3a07b0e672f7 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -1872,12 +1872,11 @@ static void _dpk_rf_setting(struct rtw89_dev *rtwdev, u8 gain,
|
||||
0x50101 | BIT(rtwdev->dbcc_en));
|
||||
rtw89_write_rf(rtwdev, path, RR_MOD_V1, RR_MOD_MASK, RF_DPK);
|
||||
|
||||
- if (dpk->bp[path][kidx].band == RTW89_BAND_6G && dpk->bp[path][kidx].ch >= 161) {
|
||||
+ if (dpk->bp[path][kidx].band == RTW89_BAND_6G && dpk->bp[path][kidx].ch >= 161)
|
||||
rtw89_write_rf(rtwdev, path, RR_IQGEN, RR_IQGEN_BIAS, 0x8);
|
||||
- rtw89_write_rf(rtwdev, path, RR_LOGEN, RR_LOGEN_RPT, 0xd);
|
||||
- } else {
|
||||
- rtw89_write_rf(rtwdev, path, RR_LOGEN, RR_LOGEN_RPT, 0xd);
|
||||
- }
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LOGEN, RR_LOGEN_RPT, 0xd);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_TXAC, RR_TXAC_IQG, 0x8);
|
||||
|
||||
rtw89_write_rf(rtwdev, path, RR_RXA2, RR_RXA2_ATT, 0x0);
|
||||
rtw89_write_rf(rtwdev, path, RR_TXIQK, RR_TXIQK_ATT2, 0x3);
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,414 @@
|
||||
From d2ebebae70833bfb5314d046677361f5d622ce19 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:32 +0200
|
||||
Subject: [PATCH 082/142] wifi: rtw89: 8852c: rfk: recover RX DCK failure
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 9c22d603e255ece73e61e3b3f93dae8ab82c17ff
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Fri Dec 9 10:09:40 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: rfk: recover RX DCK failure
|
||||
|
||||
RX DCK stands for RX DC calibration that affects CCA, so abnormal
|
||||
calibration values resulted from calibration failure can cause TX get
|
||||
stuck.
|
||||
|
||||
To solve this, redo calibration if result is bad (over thresholds). When
|
||||
retry count is over, do recovery that sets high gain fields of RX DCK
|
||||
results from low gain fields.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221209020940.9573-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 10 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 253 +++++++++++++++++++++-
|
||||
2 files changed, 256 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index ca6f6c3e63095..ec5b8d5750364 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -3559,6 +3559,7 @@
|
||||
#define RR_MOD_IQK GENMASK(19, 4)
|
||||
#define RR_MOD_DPK GENMASK(19, 5)
|
||||
#define RR_MOD_MASK GENMASK(19, 16)
|
||||
+#define RR_MOD_DCK GENMASK(14, 10)
|
||||
#define RR_MOD_RGM GENMASK(13, 4)
|
||||
#define RR_MOD_V_DOWN 0x0
|
||||
#define RR_MOD_V_STANDBY 0x1
|
||||
@@ -3572,6 +3573,7 @@
|
||||
#define RR_MOD_NBW GENMASK(15, 14)
|
||||
#define RR_MOD_M_RXG GENMASK(13, 4)
|
||||
#define RR_MOD_M_RXBB GENMASK(9, 5)
|
||||
+#define RR_MOD_LO_SEL BIT(1)
|
||||
#define RR_MODOPT 0x01
|
||||
#define RR_MODOPT_M_TXPWR GENMASK(5, 0)
|
||||
#define RR_WLSEL 0x02
|
||||
@@ -3638,6 +3640,7 @@
|
||||
#define RR_LUTWA_M2 GENMASK(4, 0)
|
||||
#define RR_LUTWD1 0x3e
|
||||
#define RR_LUTWD0 0x3f
|
||||
+#define RR_LUTWD0_MB GENMASK(11, 6)
|
||||
#define RR_LUTWD0_LB GENMASK(5, 0)
|
||||
#define RR_TM 0x42
|
||||
#define RR_TM_TRI BIT(19)
|
||||
@@ -3731,10 +3734,14 @@
|
||||
#define RR_XALNA2_SW2 GENMASK(9, 8)
|
||||
#define RR_XALNA2_SW GENMASK(1, 0)
|
||||
#define RR_DCK 0x92
|
||||
+#define RR_DCK_S1 GENMASK(19, 16)
|
||||
+#define RR_DCK_TIA GENMASK(15, 9)
|
||||
#define RR_DCK_DONE GENMASK(7, 5)
|
||||
#define RR_DCK_FINE BIT(1)
|
||||
#define RR_DCK_LV BIT(0)
|
||||
#define RR_DCK1 0x93
|
||||
+#define RR_DCK1_S1 GENMASK(19, 16)
|
||||
+#define RR_DCK1_TIA GENMASK(15, 9)
|
||||
#define RR_DCK1_DONE BIT(5)
|
||||
#define RR_DCK1_CLR GENMASK(3, 0)
|
||||
#define RR_DCK1_SEL BIT(3)
|
||||
@@ -3783,11 +3790,14 @@
|
||||
#define RR_LUTDBG 0xdf
|
||||
#define RR_LUTDBG_TIA BIT(12)
|
||||
#define RR_LUTDBG_LOK BIT(2)
|
||||
+#define RR_LUTPLL 0xec
|
||||
+#define RR_CAL_RW BIT(19)
|
||||
#define RR_LUTWE2 0xee
|
||||
#define RR_LUTWE2_RTXBW BIT(2)
|
||||
#define RR_LUTWE 0xef
|
||||
#define RR_LUTWE_LOK BIT(2)
|
||||
#define RR_RFC 0xf0
|
||||
+#define RR_WCAL BIT(16)
|
||||
#define RR_RFC_CKEN BIT(1)
|
||||
|
||||
#define R_UPD_P0 0x0000
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index f3a07b0e672f7..b0ea23d9f81fb 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -59,6 +59,9 @@ static const u32 dpk_par_regs[RTW89_DPK_RF_PATH][4] = {
|
||||
{0x81a8, 0x81c4, 0x81c8, 0x81e8},
|
||||
};
|
||||
|
||||
+static const u8 _dck_addr_bs[RF_PATH_NUM_8852C] = {0x0, 0x10};
|
||||
+static const u8 _dck_addr[RF_PATH_NUM_8852C] = {0xc, 0x1c};
|
||||
+
|
||||
static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RFK]dbcc_en: %x, PHY%d\n",
|
||||
@@ -1536,6 +1539,155 @@ static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
+static void _rx_dck_value_rewrite(struct rtw89_dev *rtwdev, u8 path, u8 addr,
|
||||
+ u8 val_i, u8 val_q)
|
||||
+{
|
||||
+ u32 ofst_val;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] rewrite val_i = 0x%x, val_q = 0x%x\n", val_i, val_q);
|
||||
+
|
||||
+ /* val_i and val_q are 7 bits, and target is 6 bits. */
|
||||
+ ofst_val = u32_encode_bits(val_q >> 1, RR_LUTWD0_MB) |
|
||||
+ u32_encode_bits(val_i >> 1, RR_LUTWD0_LB);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTPLL, RR_CAL_RW, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RFC, RR_WCAL, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, 0x1);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWA, MASKBYTE0, addr);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWD0, RFREG_MASK, ofst_val);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTWD0, RFREG_MASK, ofst_val);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_RFC, RR_WCAL, 0x0);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_LUTPLL, RR_CAL_RW, 0x0);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RX_DCK] Final val_i = 0x%x, val_q = 0x%x\n",
|
||||
+ u32_get_bits(ofst_val, RR_LUTWD0_LB) << 1,
|
||||
+ u32_get_bits(ofst_val, RR_LUTWD0_MB) << 1);
|
||||
+}
|
||||
+
|
||||
+static bool _rx_dck_rek_check(struct rtw89_dev *rtwdev, u8 path)
|
||||
+{
|
||||
+ u8 i_even_bs, q_even_bs;
|
||||
+ u8 i_odd_bs, q_odd_bs;
|
||||
+ u8 i_even, q_even;
|
||||
+ u8 i_odd, q_odd;
|
||||
+ const u8 th = 10;
|
||||
+ u8 i;
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852C; i++) {
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr_bs[i]);
|
||||
+ i_even_bs = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_even_bs = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_even_bs/ q_even_bs = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr_bs[i], i_even_bs, q_even_bs);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr[i]);
|
||||
+ i_even = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_even = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_even/ q_even = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr[i], i_even, q_even);
|
||||
+
|
||||
+ if (abs(i_even_bs - i_even) > th || abs(q_even_bs - q_even) > th)
|
||||
+ return true;
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr_bs[i] + 1);
|
||||
+ i_odd_bs = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_odd_bs = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_odd_bs/ q_odd_bs = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr_bs[i] + 1, i_odd_bs, q_odd_bs);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr[i] + 1);
|
||||
+ i_odd = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_odd = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_odd/ q_odd = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr[i] + 1, i_odd, q_odd);
|
||||
+
|
||||
+ if (abs(i_odd_bs - i_odd) > th || abs(q_odd_bs - q_odd) > th)
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static void _rx_dck_fix_if_need(struct rtw89_dev *rtwdev, u8 path, u8 addr,
|
||||
+ u8 val_i_bs, u8 val_q_bs, u8 val_i, u8 val_q)
|
||||
+{
|
||||
+ const u8 th = 10;
|
||||
+
|
||||
+ if ((abs(val_i_bs - val_i) < th) && (abs(val_q_bs - val_q) <= th)) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RX_DCK] offset check PASS!!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (abs(val_i_bs - val_i) > th) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] val_i over TH (0x%x / 0x%x)\n", val_i_bs, val_i);
|
||||
+ val_i = val_i_bs;
|
||||
+ }
|
||||
+
|
||||
+ if (abs(val_q_bs - val_q) > th) {
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] val_q over TH (0x%x / 0x%x)\n", val_q_bs, val_q);
|
||||
+ val_q = val_q_bs;
|
||||
+ }
|
||||
+
|
||||
+ _rx_dck_value_rewrite(rtwdev, path, addr, val_i, val_q);
|
||||
+}
|
||||
+
|
||||
+static void _rx_dck_recover(struct rtw89_dev *rtwdev, u8 path)
|
||||
+{
|
||||
+ u8 i_even_bs, q_even_bs;
|
||||
+ u8 i_odd_bs, q_odd_bs;
|
||||
+ u8 i_even, q_even;
|
||||
+ u8 i_odd, q_odd;
|
||||
+ u8 i;
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RX_DCK] ===> recovery\n");
|
||||
+
|
||||
+ for (i = 0; i < RF_PATH_NUM_8852C; i++) {
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr_bs[i]);
|
||||
+ i_even_bs = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_even_bs = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr_bs[i] + 1);
|
||||
+ i_odd_bs = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_odd_bs = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_even_bs/ q_even_bs = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr_bs[i], i_even_bs, q_even_bs);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr[i]);
|
||||
+ i_even = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_even = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_even/ q_even = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr[i], i_even, q_even);
|
||||
+ _rx_dck_fix_if_need(rtwdev, path, _dck_addr[i],
|
||||
+ i_even_bs, q_even_bs, i_even, q_even);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_odd_bs/ q_odd_bs = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr_bs[i] + 1, i_odd_bs, q_odd_bs);
|
||||
+
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_DCK, _dck_addr[i] + 1);
|
||||
+ i_odd = rtw89_read_rf(rtwdev, path, RR_DCK, RR_DCK_TIA);
|
||||
+ q_odd = rtw89_read_rf(rtwdev, path, RR_DCK1, RR_DCK1_TIA);
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] Gain[0x%x] i_odd/ q_odd = 0x%x/ 0x%x\n",
|
||||
+ _dck_addr[i] + 1, i_odd, q_odd);
|
||||
+ _rx_dck_fix_if_need(rtwdev, path, _dck_addr[i] + 1,
|
||||
+ i_odd_bs, q_odd_bs, i_odd, q_odd);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void _rx_dck_toggle(struct rtw89_dev *rtwdev, u8 path)
|
||||
{
|
||||
int ret;
|
||||
@@ -1573,6 +1725,37 @@ static void _set_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, u8 pat
|
||||
}
|
||||
}
|
||||
|
||||
+static
|
||||
+u8 _rx_dck_channel_calc(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan)
|
||||
+{
|
||||
+ u8 target_ch = 0;
|
||||
+
|
||||
+ if (chan->band_type == RTW89_BAND_5G) {
|
||||
+ if (chan->channel >= 36 && chan->channel <= 64) {
|
||||
+ target_ch = 100;
|
||||
+ } else if (chan->channel >= 100 && chan->channel <= 144) {
|
||||
+ target_ch = chan->channel + 32;
|
||||
+ if (target_ch > 144)
|
||||
+ target_ch = chan->channel + 33;
|
||||
+ } else if (chan->channel >= 149 && chan->channel <= 177) {
|
||||
+ target_ch = chan->channel - 33;
|
||||
+ }
|
||||
+ } else if (chan->band_type == RTW89_BAND_6G) {
|
||||
+ if (chan->channel >= 1 && chan->channel <= 125)
|
||||
+ target_ch = chan->channel + 32;
|
||||
+ else
|
||||
+ target_ch = chan->channel - 32;
|
||||
+ } else {
|
||||
+ target_ch = chan->channel;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
+ "[RX_DCK] cur_ch / target_ch = %d / %d\n",
|
||||
+ chan->channel, target_ch);
|
||||
+
|
||||
+ return target_ch;
|
||||
+}
|
||||
+
|
||||
#define RTW8852C_RF_REL_VERSION 34
|
||||
#define RTW8852C_DPK_VER 0x10
|
||||
#define RTW8852C_DPK_TH_AVG_NUM 4
|
||||
@@ -3874,11 +4057,14 @@ void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
|
||||
#define RXDCK_VER_8852C 0xe
|
||||
|
||||
-void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_afe)
|
||||
+static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
+ bool is_afe, u8 retry_limit)
|
||||
{
|
||||
struct rtw89_rx_dck_info *rx_dck = &rtwdev->rx_dck;
|
||||
u8 path, kpath;
|
||||
u32 rf_reg5;
|
||||
+ bool is_fail;
|
||||
+ u8 rek_cnt;
|
||||
|
||||
kpath = _kpath(rtwdev, phy);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
@@ -3895,7 +4081,27 @@ void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_a
|
||||
B_P0_TSSI_TRK_EN, 0x1);
|
||||
rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX);
|
||||
- _set_rx_dck(rtwdev, phy, path, is_afe);
|
||||
+ rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_LO_SEL, rtwdev->dbcc_en);
|
||||
+
|
||||
+ for (rek_cnt = 0; rek_cnt < retry_limit; rek_cnt++) {
|
||||
+ _set_rx_dck(rtwdev, phy, path, is_afe);
|
||||
+
|
||||
+ /* To reduce IO of dck_rek_check(), the last try is seen
|
||||
+ * as failure always, and then do recovery procedure.
|
||||
+ */
|
||||
+ if (rek_cnt == retry_limit - 1) {
|
||||
+ _rx_dck_recover(rtwdev, path);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ is_fail = _rx_dck_rek_check(rtwdev, path);
|
||||
+ if (!is_fail)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RX_DCK] rek_cnt[%d]=%d",
|
||||
+ path, rek_cnt);
|
||||
+
|
||||
rx_dck->thermal[path] = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
|
||||
rtw89_write_rf(rtwdev, path, RR_RSV1, RFREG_MASK, rf_reg5);
|
||||
|
||||
@@ -3905,15 +4111,31 @@ void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_a
|
||||
}
|
||||
}
|
||||
|
||||
-#define RTW8852C_RX_DCK_TH 8
|
||||
+void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_afe)
|
||||
+{
|
||||
+ _rx_dck(rtwdev, phy, is_afe, 1);
|
||||
+}
|
||||
+
|
||||
+#define RTW8852C_RX_DCK_TH 12
|
||||
|
||||
void rtw8852c_rx_dck_track(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
struct rtw89_rx_dck_info *rx_dck = &rtwdev->rx_dck;
|
||||
+ enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
|
||||
+ u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0);
|
||||
+ u8 dck_channel;
|
||||
u8 cur_thermal;
|
||||
+ u32 tx_en;
|
||||
int delta;
|
||||
int path;
|
||||
|
||||
+ if (chan->band_type == RTW89_BAND_2G)
|
||||
+ return;
|
||||
+
|
||||
+ if (rtwdev->scanning)
|
||||
+ return;
|
||||
+
|
||||
for (path = 0; path < RF_PATH_NUM_8852C; path++) {
|
||||
cur_thermal =
|
||||
ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
|
||||
@@ -3923,11 +4145,28 @@ void rtw8852c_rx_dck_track(struct rtw89_dev *rtwdev)
|
||||
"[RX_DCK] path=%d current thermal=0x%x delta=0x%x\n",
|
||||
path, cur_thermal, delta);
|
||||
|
||||
- if (delta >= RTW8852C_RX_DCK_TH) {
|
||||
- rtw8852c_rx_dck(rtwdev, RTW89_PHY_0, false);
|
||||
- return;
|
||||
- }
|
||||
+ if (delta >= RTW8852C_RX_DCK_TH)
|
||||
+ goto trigger_rx_dck;
|
||||
}
|
||||
+
|
||||
+ return;
|
||||
+
|
||||
+trigger_rx_dck:
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
+ rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
+
|
||||
+ for (path = 0; path < RF_PATH_NUM_8852C; path++) {
|
||||
+ dck_channel = _rx_dck_channel_calc(rtwdev, chan);
|
||||
+ _ctrl_ch(rtwdev, RTW89_PHY_0, dck_channel, chan->band_type);
|
||||
+ }
|
||||
+
|
||||
+ _rx_dck(rtwdev, RTW89_PHY_0, false, 20);
|
||||
+
|
||||
+ for (path = 0; path < RF_PATH_NUM_8852C; path++)
|
||||
+ _ctrl_ch(rtwdev, RTW89_PHY_0, chan->channel, chan->band_type);
|
||||
+
|
||||
+ rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
+ rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852c_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,215 @@
|
||||
From 79bec555a8cc77b1d723fa2b22983e9070c21df8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 083/142] wifi: rtw89: coex: add BTC format version derived
|
||||
from firmware version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 6140635a73c00c0b3a8a58d13890dcf27d0af32a
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sat Dec 17 22:17:39 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: add BTC format version derived from firmware version
|
||||
|
||||
Originally, each chip maintains its own format version followed firmware
|
||||
it uses. As new chip is added, firmware changes format of exchange
|
||||
messages to have rich information to handle more conditions.
|
||||
|
||||
When old chip is going to upgrade firmware, it could use new format and
|
||||
driver needs to maintain compatibility with old firmware. So, add this
|
||||
version array to achieve this goal.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 95 +++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/coex.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 26 +++++++++
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 2 +
|
||||
4 files changed, 124 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index f21c73310fdb6..96aadd50f5fd6 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -120,6 +120,70 @@ static const u32 cxtbl[] = {
|
||||
0xfafadafa /* 19 */
|
||||
};
|
||||
|
||||
+static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {
|
||||
+ /* firmware version must be in decreasing order for each chip */
|
||||
+ {RTL8852C, RTW89_FW_VER_CODE(0, 27, 57, 0),
|
||||
+ .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 3, .fcxctrl = 1,
|
||||
+ .info_buf = 1280, .max_role_num = 5,
|
||||
+ },
|
||||
+ {RTL8852C, RTW89_FW_VER_CODE(0, 27, 42, 0),
|
||||
+ .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 2, .fcxctrl = 1,
|
||||
+ .info_buf = 1280, .max_role_num = 5,
|
||||
+ },
|
||||
+ {RTL8852C, RTW89_FW_VER_CODE(0, 27, 0, 0),
|
||||
+ .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 2, .fcxctrl = 1,
|
||||
+ .info_buf = 1280, .max_role_num = 5,
|
||||
+ },
|
||||
+ {RTL8852B, RTW89_FW_VER_CODE(0, 29, 14, 0),
|
||||
+ .fcxbtcrpt = 5, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 4,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 3, .fcxctrl = 1,
|
||||
+ .info_buf = 1800, .max_role_num = 6,
|
||||
+ },
|
||||
+ {RTL8852B, RTW89_FW_VER_CODE(0, 27, 0, 0),
|
||||
+ .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 1, .fcxctrl = 1,
|
||||
+ .info_buf = 1280, .max_role_num = 5,
|
||||
+ },
|
||||
+ {RTL8852A, RTW89_FW_VER_CODE(0, 13, 37, 0),
|
||||
+ .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3,
|
||||
+ .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 1, .frptmap = 3, .fcxctrl = 1,
|
||||
+ .info_buf = 1280, .max_role_num = 5,
|
||||
+ },
|
||||
+ {RTL8852A, RTW89_FW_VER_CODE(0, 13, 0, 0),
|
||||
+ .fcxbtcrpt = 1, .fcxtdma = 1, .fcxslots = 1, .fcxcysta = 2,
|
||||
+ .fcxstep = 2, .fcxnullsta = 1, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 0, .frptmap = 0, .fcxctrl = 0,
|
||||
+ .info_buf = 1024, .max_role_num = 5,
|
||||
+ },
|
||||
+
|
||||
+ /* keep it to be the last as default entry */
|
||||
+ {0, RTW89_FW_VER_CODE(0, 0, 0, 0),
|
||||
+ .fcxbtcrpt = 1, .fcxtdma = 1, .fcxslots = 1, .fcxcysta = 2,
|
||||
+ .fcxstep = 2, .fcxnullsta = 1, .fcxmreg = 1, .fcxgpiodbg = 1,
|
||||
+ .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1,
|
||||
+ .fwlrole = 0, .frptmap = 0, .fcxctrl = 0,
|
||||
+ .info_buf = 1024, .max_role_num = 5,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+#define RTW89_DEFAULT_BTC_VER_IDX (ARRAY_SIZE(rtw89_btc_ver_defs) - 1)
|
||||
+
|
||||
struct rtw89_btc_btf_tlv {
|
||||
u8 type;
|
||||
u8 len;
|
||||
@@ -7008,3 +7072,34 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
else
|
||||
_show_summary_v1(rtwdev, m);
|
||||
}
|
||||
+
|
||||
+void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev)
|
||||
+{
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *btc_ver_def;
|
||||
+ const struct rtw89_fw_suit *fw_suit;
|
||||
+ u32 suit_ver_code;
|
||||
+ int i;
|
||||
+
|
||||
+ fw_suit = rtw89_fw_suit_get(rtwdev, RTW89_FW_NORMAL);
|
||||
+ suit_ver_code = RTW89_FW_SUIT_VER_CODE(fw_suit);
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(rtw89_btc_ver_defs); i++) {
|
||||
+ btc_ver_def = &rtw89_btc_ver_defs[i];
|
||||
+
|
||||
+ if (chip->chip_id != btc_ver_def->chip_id)
|
||||
+ continue;
|
||||
+
|
||||
+ if (suit_ver_code >= btc_ver_def->fw_ver_code) {
|
||||
+ btc->ver = btc_ver_def;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ btc->ver = &rtw89_btc_ver_defs[RTW89_DEFAULT_BTC_VER_IDX];
|
||||
+
|
||||
+out:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC] use version def[%d] = 0x%08x\n",
|
||||
+ (int)(btc->ver - rtw89_btc_ver_defs), btc->ver->fw_ver_code);
|
||||
+}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.h b/drivers/net/wireless/realtek/rtw89/coex.h
|
||||
index ca16afa97ec07..401fb55df82b0 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.h
|
||||
@@ -164,6 +164,7 @@ void rtw89_coex_rfk_chk_work(struct work_struct *work);
|
||||
void rtw89_coex_power_on(struct rtw89_dev *rtwdev);
|
||||
void rtw89_btc_set_policy(struct rtw89_dev *rtwdev, u16 policy_type);
|
||||
void rtw89_btc_set_policy_v1(struct rtw89_dev *rtwdev, u16 policy_type);
|
||||
+void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev);
|
||||
|
||||
static inline u8 rtw89_btc_phymap(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 800ede1d69c75..151343ee7b763 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2019,9 +2019,35 @@ struct rtw89_btc_btf_fwinfo {
|
||||
struct rtw89_btc_rpt_fbtc_btdev rpt_fbtc_btdev;
|
||||
};
|
||||
|
||||
+struct rtw89_btc_ver {
|
||||
+ enum rtw89_core_chip_id chip_id;
|
||||
+ u32 fw_ver_code;
|
||||
+
|
||||
+ u8 fcxbtcrpt;
|
||||
+ u8 fcxtdma;
|
||||
+ u8 fcxslots;
|
||||
+ u8 fcxcysta;
|
||||
+ u8 fcxstep;
|
||||
+ u8 fcxnullsta;
|
||||
+ u8 fcxmreg;
|
||||
+ u8 fcxgpiodbg;
|
||||
+ u8 fcxbtver;
|
||||
+ u8 fcxbtscan;
|
||||
+ u8 fcxbtafh;
|
||||
+ u8 fcxbtdevinfo;
|
||||
+ u8 fwlrole;
|
||||
+ u8 frptmap;
|
||||
+ u8 fcxctrl;
|
||||
+
|
||||
+ u16 info_buf;
|
||||
+ u8 max_role_num;
|
||||
+};
|
||||
+
|
||||
#define RTW89_BTC_POLICY_MAXLEN 512
|
||||
|
||||
struct rtw89_btc {
|
||||
+ const struct rtw89_btc_ver *ver;
|
||||
+
|
||||
struct rtw89_btc_cx cx;
|
||||
struct rtw89_btc_dm dm;
|
||||
struct rtw89_btc_ctrl ctrl;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index fddad1c21e3d3..ecf68912eac2a 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -352,6 +352,8 @@ int rtw89_fw_recognize(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw89_fw_recognize_features(rtwdev);
|
||||
|
||||
+ rtw89_coex_recognize_ver(rtwdev);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,417 @@
|
||||
From 26142ff54ec132d688a63cb645f293a00a30dc71 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 084/142] wifi: rtw89: coex: use new introduction BTC version
|
||||
format
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 1fc4a874ff02ba8c07f8abf97c0bef686406f6df
|
||||
Author: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Date: Sat Dec 17 22:17:40 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: use new introduction BTC version format
|
||||
|
||||
Previous patch has added format version derived from firmware version.
|
||||
Use the format version, and remove constant version number from chip_info.
|
||||
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 32 ++++++++++----------
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 42 +++++++++------------------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 14 ---------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 15 +---------
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 14 ---------
|
||||
5 files changed, 32 insertions(+), 85 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index 96aadd50f5fd6..df3984ebba06e 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -976,6 +976,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
@@ -1022,7 +1023,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfinfo = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo_v1);
|
||||
}
|
||||
- pcinfo->req_fver = chip->fcxbtcrpt_ver;
|
||||
+ pcinfo->req_fver = ver->fcxbtcrpt;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1035,7 +1036,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo_v1;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo_v1);
|
||||
}
|
||||
- pcinfo->req_fver = chip->fcxtdma_ver;
|
||||
+ pcinfo->req_fver = ver->fcxtdma;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1043,7 +1044,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_slots.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_slots.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_slots.finfo);
|
||||
- pcinfo->req_fver = chip->fcxslots_ver;
|
||||
+ pcinfo->req_fver = ver->fcxslots;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1059,7 +1060,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo_v1);
|
||||
}
|
||||
- pcinfo->req_fver = chip->fcxcysta_ver;
|
||||
+ pcinfo->req_fver = ver->fcxcysta;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1076,7 +1077,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
trace_step +
|
||||
offsetof(struct rtw89_btc_fbtc_steps_v1, step);
|
||||
}
|
||||
- pcinfo->req_fver = chip->fcxstep_ver;
|
||||
+ pcinfo->req_fver = ver->fcxstep;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1089,7 +1090,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfinfo = &pfwinfo->rpt_fbtc_nullsta.finfo_v1;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo_v1);
|
||||
}
|
||||
- pcinfo->req_fver = chip->fcxnullsta_ver;
|
||||
+ pcinfo->req_fver = ver->fcxnullsta;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1097,7 +1098,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo);
|
||||
- pcinfo->req_fver = chip->fcxmreg_ver;
|
||||
+ pcinfo->req_fver = ver->fcxmreg;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1105,7 +1106,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_gpio_dbg.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_gpio_dbg.finfo);
|
||||
- pcinfo->req_fver = chip->fcxgpiodbg_ver;
|
||||
+ pcinfo->req_fver = ver->fcxgpiodbg;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1113,7 +1114,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btver.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btver.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo);
|
||||
- pcinfo->req_fver = chip->fcxbtver_ver;
|
||||
+ pcinfo->req_fver = ver->fcxbtver;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1121,7 +1122,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btscan.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo);
|
||||
- pcinfo->req_fver = chip->fcxbtscan_ver;
|
||||
+ pcinfo->req_fver = ver->fcxbtscan;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1129,7 +1130,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btafh.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo);
|
||||
- pcinfo->req_fver = chip->fcxbtafh_ver;
|
||||
+ pcinfo->req_fver = ver->fcxbtafh;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1137,7 +1138,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btdev.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btdev.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btdev.finfo);
|
||||
- pcinfo->req_fver = chip->fcxbtdevinfo_ver;
|
||||
+ pcinfo->req_fver = ver->fcxbtdevinfo;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
break;
|
||||
@@ -1394,7 +1395,7 @@ static void _parse_btc_report(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo,
|
||||
u8 *pbuf, u32 buf_len)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
+ const struct rtw89_btc_ver *ver = rtwdev->btc.ver;
|
||||
struct rtw89_btc_prpt *btc_prpt = NULL;
|
||||
u32 index = 0, rpt_len = 0;
|
||||
|
||||
@@ -1404,7 +1405,7 @@ static void _parse_btc_report(struct rtw89_dev *rtwdev,
|
||||
|
||||
while (pbuf) {
|
||||
btc_prpt = (struct rtw89_btc_prpt *)&pbuf[index];
|
||||
- if (index + 2 >= chip->btc_fwinfo_buf)
|
||||
+ if (index + 2 >= ver->info_buf)
|
||||
break;
|
||||
/* At least 3 bytes: type(1) & len(2) */
|
||||
rpt_len = le16_to_cpu(btc_prpt->len);
|
||||
@@ -1424,6 +1425,7 @@ static void _append_tdma(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_btf_tlv *tlv;
|
||||
struct rtw89_btc_fbtc_tdma *v;
|
||||
@@ -1448,7 +1450,7 @@ static void _append_tdma(struct rtw89_dev *rtwdev)
|
||||
} else {
|
||||
tlv->len = sizeof(*v1);
|
||||
v1 = (struct rtw89_btc_fbtc_tdma_v1 *)&tlv->val[0];
|
||||
- v1->fver = chip->fcxtdma_ver;
|
||||
+ v1->fver = ver->fcxtdma;
|
||||
v1->tdma = dm->tdma;
|
||||
btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v1);
|
||||
}
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 151343ee7b763..358bfcd9ece20 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1438,7 +1438,7 @@ struct rtw89_btc_cx {
|
||||
};
|
||||
|
||||
struct rtw89_btc_fbtc_tdma {
|
||||
- u8 type; /* chip_info::fcxtdma_ver */
|
||||
+ u8 type; /* btc_ver::fcxtdma */
|
||||
u8 rxflctrl;
|
||||
u8 txpause;
|
||||
u8 wtgle_n;
|
||||
@@ -1449,7 +1449,7 @@ struct rtw89_btc_fbtc_tdma {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_tdma_v1 {
|
||||
- u8 fver; /* chip_info::fcxtdma_ver */
|
||||
+ u8 fver; /* btc_ver::fcxtdma */
|
||||
u8 rsvd;
|
||||
__le16 rsvd1;
|
||||
struct rtw89_btc_fbtc_tdma tdma;
|
||||
@@ -1474,7 +1474,7 @@ enum rtw89_btc_bt_sta_counter {
|
||||
};
|
||||
|
||||
struct rtw89_btc_fbtc_rpt_ctrl {
|
||||
- u16 fver; /* chip_info::fcxbtcrpt_ver */
|
||||
+ u16 fver; /* btc_ver::fcxbtcrpt */
|
||||
u16 rpt_cnt; /* tmr counters */
|
||||
u32 wl_fw_coex_ver; /* match which driver's coex version */
|
||||
u32 wl_fw_cx_offload;
|
||||
@@ -1607,7 +1607,7 @@ enum { /* STEP TYPE */
|
||||
|
||||
#define BTC_DBG_MAX1 32
|
||||
struct rtw89_btc_fbtc_gpio_dbg {
|
||||
- u8 fver; /* chip_info::fcxgpiodbg_ver */
|
||||
+ u8 fver; /* btc_ver::fcxgpiodbg */
|
||||
u8 rsvd;
|
||||
u16 rsvd2;
|
||||
u32 en_map; /* which debug signal (see btc_wl_gpio_debug) is enable */
|
||||
@@ -1616,7 +1616,7 @@ struct rtw89_btc_fbtc_gpio_dbg {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_mreg_val {
|
||||
- u8 fver; /* chip_info::fcxmreg_ver */
|
||||
+ u8 fver; /* btc_ver::fcxmreg */
|
||||
u8 reg_num;
|
||||
__le16 rsvd;
|
||||
__le32 mreg_val[CXMREG_MAX];
|
||||
@@ -1639,7 +1639,7 @@ struct rtw89_btc_fbtc_slot {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_slots {
|
||||
- u8 fver; /* chip_info::fcxslots_ver */
|
||||
+ u8 fver; /* btc_ver::fcxslots */
|
||||
u8 tbl_num;
|
||||
__le16 rsvd;
|
||||
__le32 update_map;
|
||||
@@ -1653,7 +1653,7 @@ struct rtw89_btc_fbtc_step {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_steps {
|
||||
- u8 fver; /* chip_info::fcxstep_ver */
|
||||
+ u8 fver; /* btc_ver::fcxstep */
|
||||
u8 rsvd;
|
||||
__le16 cnt;
|
||||
__le16 pos_old;
|
||||
@@ -1670,7 +1670,7 @@ struct rtw89_btc_fbtc_steps_v1 {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_cysta { /* statistics for cycles */
|
||||
- u8 fver; /* chip_info::fcxcysta_ver */
|
||||
+ u8 fver; /* btc_ver::fcxcysta */
|
||||
u8 rsvd;
|
||||
__le16 cycles; /* total cycle number */
|
||||
__le16 cycles_a2dp[CXT_FLCTRL_MAX];
|
||||
@@ -1750,7 +1750,7 @@ struct rtw89_btc_fbtc_cysta_v1 { /* statistics for cycles */
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_cynullsta { /* cycle null statistics */
|
||||
- u8 fver; /* chip_info::fcxnullsta_ver */
|
||||
+ u8 fver; /* btc_ver::fcxnullsta */
|
||||
u8 rsvd;
|
||||
__le16 rsvd2;
|
||||
__le32 max_t[2]; /* max_t for 0:null0/1:null1 */
|
||||
@@ -1759,7 +1759,7 @@ struct rtw89_btc_fbtc_cynullsta { /* cycle null statistics */
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_cynullsta_v1 { /* cycle null statistics */
|
||||
- u8 fver; /* chip_info::fcxnullsta_ver */
|
||||
+ u8 fver; /* btc_ver::fcxnullsta */
|
||||
u8 rsvd;
|
||||
__le16 rsvd2;
|
||||
__le32 max_t[2]; /* max_t for 0:null0/1:null1 */
|
||||
@@ -1768,7 +1768,7 @@ struct rtw89_btc_fbtc_cynullsta_v1 { /* cycle null statistics */
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_btver {
|
||||
- u8 fver; /* chip_info::fcxbtver_ver */
|
||||
+ u8 fver; /* btc_ver::fcxbtver */
|
||||
u8 rsvd;
|
||||
__le16 rsvd2;
|
||||
__le32 coex_ver; /*bit[15:8]->shared, bit[7:0]->non-shared */
|
||||
@@ -1777,14 +1777,14 @@ struct rtw89_btc_fbtc_btver {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_btscan {
|
||||
- u8 fver; /* chip_info::fcxbtscan_ver */
|
||||
+ u8 fver; /* btc_ver::fcxbtscan */
|
||||
u8 rsvd;
|
||||
__le16 rsvd2;
|
||||
u8 scan[6];
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_btafh {
|
||||
- u8 fver; /* chip_info::fcxbtafh_ver */
|
||||
+ u8 fver; /* btc_ver::fcxbtafh */
|
||||
u8 rsvd;
|
||||
__le16 rsvd2;
|
||||
u8 afh_l[4]; /*bit0:2402, bit1: 2403.... bit31:2433 */
|
||||
@@ -1793,7 +1793,7 @@ struct rtw89_btc_fbtc_btafh {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_btdevinfo {
|
||||
- u8 fver; /* chip_info::fcxbtdevinfo_ver */
|
||||
+ u8 fver; /* btc_ver::fcxbtdevinfo */
|
||||
u8 rsvd;
|
||||
__le16 vendor_id;
|
||||
__le32 dev_name; /* only 24 bits valid */
|
||||
@@ -2756,20 +2756,6 @@ struct rtw89_chip_info {
|
||||
u8 btcx_desired;
|
||||
u8 scbd;
|
||||
u8 mailbox;
|
||||
- u16 btc_fwinfo_buf;
|
||||
-
|
||||
- u8 fcxbtcrpt_ver;
|
||||
- u8 fcxtdma_ver;
|
||||
- u8 fcxslots_ver;
|
||||
- u8 fcxcysta_ver;
|
||||
- u8 fcxstep_ver;
|
||||
- u8 fcxnullsta_ver;
|
||||
- u8 fcxmreg_ver;
|
||||
- u8 fcxgpiodbg_ver;
|
||||
- u8 fcxbtver_ver;
|
||||
- u8 fcxbtscan_ver;
|
||||
- u8 fcxbtafh_ver;
|
||||
- u8 fcxbtdevinfo_ver;
|
||||
|
||||
u8 afh_guard_ch;
|
||||
const u8 *wl_rssi_thres;
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index eff6519cf0191..9a6f2f9f35a84 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -2106,20 +2106,6 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.btcx_desired = 0x7,
|
||||
.scbd = 0x1,
|
||||
.mailbox = 0x1,
|
||||
- .btc_fwinfo_buf = 1024,
|
||||
-
|
||||
- .fcxbtcrpt_ver = 1,
|
||||
- .fcxtdma_ver = 1,
|
||||
- .fcxslots_ver = 1,
|
||||
- .fcxcysta_ver = 2,
|
||||
- .fcxstep_ver = 2,
|
||||
- .fcxnullsta_ver = 1,
|
||||
- .fcxmreg_ver = 1,
|
||||
- .fcxgpiodbg_ver = 1,
|
||||
- .fcxbtver_ver = 1,
|
||||
- .fcxbtscan_ver = 1,
|
||||
- .fcxbtafh_ver = 1,
|
||||
- .fcxbtdevinfo_ver = 1,
|
||||
|
||||
.afh_guard_ch = 6,
|
||||
.wl_rssi_thres = rtw89_btc_8852a_wl_rssi_thres,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index b635ac1d1ca2f..498ae8616cd59 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -2483,20 +2483,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.btcx_desired = 0x5,
|
||||
.scbd = 0x1,
|
||||
.mailbox = 0x1,
|
||||
- .btc_fwinfo_buf = 1024,
|
||||
-
|
||||
- .fcxbtcrpt_ver = 1,
|
||||
- .fcxtdma_ver = 1,
|
||||
- .fcxslots_ver = 1,
|
||||
- .fcxcysta_ver = 2,
|
||||
- .fcxstep_ver = 2,
|
||||
- .fcxnullsta_ver = 1,
|
||||
- .fcxmreg_ver = 1,
|
||||
- .fcxgpiodbg_ver = 1,
|
||||
- .fcxbtver_ver = 1,
|
||||
- .fcxbtscan_ver = 1,
|
||||
- .fcxbtafh_ver = 1,
|
||||
- .fcxbtdevinfo_ver = 1,
|
||||
+
|
||||
.afh_guard_ch = 6,
|
||||
.wl_rssi_thres = rtw89_btc_8852b_wl_rssi_thres,
|
||||
.bt_rssi_thres = rtw89_btc_8852b_bt_rssi_thres,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index a87482cc25f58..bacdc91d63e9f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2915,20 +2915,6 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
.btcx_desired = 0x7,
|
||||
.scbd = 0x1,
|
||||
.mailbox = 0x1,
|
||||
- .btc_fwinfo_buf = 1280,
|
||||
-
|
||||
- .fcxbtcrpt_ver = 4,
|
||||
- .fcxtdma_ver = 3,
|
||||
- .fcxslots_ver = 1,
|
||||
- .fcxcysta_ver = 3,
|
||||
- .fcxstep_ver = 3,
|
||||
- .fcxnullsta_ver = 2,
|
||||
- .fcxmreg_ver = 1,
|
||||
- .fcxgpiodbg_ver = 1,
|
||||
- .fcxbtver_ver = 1,
|
||||
- .fcxbtscan_ver = 1,
|
||||
- .fcxbtafh_ver = 1,
|
||||
- .fcxbtdevinfo_ver = 1,
|
||||
|
||||
.afh_guard_ch = 6,
|
||||
.wl_rssi_thres = rtw89_btc_8852c_wl_rssi_thres,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 39d7ebf1095575793ff50489d230734b357a30b7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 085/142] wifi: rtw89: coex: Enable Bluetooth report when show
|
||||
debug info
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit bc20f9235f644846520a68340ea0730d09022e0a
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Sat Dec 17 22:17:41 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: Enable Bluetooth report when show debug info
|
||||
|
||||
Ask WiFi firmware to send Bluetooth version report when we want to show
|
||||
Bluetooth debug info. If there is no request for debug log, driver will
|
||||
not enable the report. This modification can save some C2H/H2C resources.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 32 ++++++++++++++++++-------------
|
||||
1 file changed, 19 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index df3984ebba06e..b58c839e10d92 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -5066,11 +5066,6 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
|
||||
|
||||
a2dp->sink = btinfo.hb3.a2dp_sink;
|
||||
|
||||
- if (b->profile_cnt.now || b->status.map.ble_connect)
|
||||
- rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP, 1);
|
||||
- else
|
||||
- rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP, 0);
|
||||
-
|
||||
if (!a2dp->exist_last && a2dp->exist) {
|
||||
a2dp->vendor_id = 0;
|
||||
a2dp->flush_time = 0;
|
||||
@@ -5080,12 +5075,6 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
|
||||
RTW89_COEX_BT_DEVINFO_WORK_PERIOD);
|
||||
}
|
||||
|
||||
- if (a2dp->exist && (a2dp->flush_time == 0 || a2dp->vendor_id == 0 ||
|
||||
- a2dp->play_latency == 1))
|
||||
- rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_DEVICE_INFO, 1);
|
||||
- else
|
||||
- rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_DEVICE_INFO, 0);
|
||||
-
|
||||
_run_coex(rtwdev, BTC_RSN_UPDATE_BT_INFO);
|
||||
}
|
||||
|
||||
@@ -5218,8 +5207,7 @@ void rtw89_btc_ntfy_radio_state(struct rtw89_dev *rtwdev, enum btc_rfctrl rf_sta
|
||||
|
||||
if (rf_state == BTC_RFCTRL_WL_ON) {
|
||||
btc->dm.cnt_dm[BTC_DCNT_BTCNT_FREEZE] = 0;
|
||||
- rtw89_btc_fw_en_rpt(rtwdev,
|
||||
- RPT_EN_MREG | RPT_EN_BT_VER_INFO, true);
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_MREG, true);
|
||||
val = BTC_WSCB_ACTIVE | BTC_WSCB_ON | BTC_WSCB_BTLOG;
|
||||
_write_scbd(rtwdev, val, true);
|
||||
_update_bt_scbd(rtwdev, true);
|
||||
@@ -5866,6 +5854,24 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
"[trx_req_cnt]", cx->cnt_bt[BTC_BCNT_HIPRI_RX],
|
||||
cx->cnt_bt[BTC_BCNT_HIPRI_TX], cx->cnt_bt[BTC_BCNT_LOPRI_RX],
|
||||
cx->cnt_bt[BTC_BCNT_LOPRI_TX], cx->cnt_bt[BTC_BCNT_POLUT]);
|
||||
+
|
||||
+ if (bt->enable.now && bt->ver_info.fw == 0)
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_VER_INFO, true);
|
||||
+ else
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_VER_INFO, false);
|
||||
+
|
||||
+ if (bt_linfo->profile_cnt.now || bt_linfo->status.map.ble_connect)
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP, true);
|
||||
+ else
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP, false);
|
||||
+
|
||||
+ if (bt_linfo->a2dp_desc.exist &&
|
||||
+ (bt_linfo->a2dp_desc.flush_time == 0 ||
|
||||
+ bt_linfo->a2dp_desc.vendor_id == 0 ||
|
||||
+ bt_linfo->a2dp_desc.play_latency == 1))
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_DEVICE_INFO, true);
|
||||
+ else
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_DEVICE_INFO, false);
|
||||
}
|
||||
|
||||
#define CASE_BTC_RSN_STR(e) case BTC_RSN_ ## e: return #e
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,243 @@
|
||||
From ac93364355ca02b02d5410de997a3a7c2f83d56e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 086/142] wifi: rtw89: coex: Update BTC firmware report bitmap
|
||||
definition
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 52c7c983174cd8e2f92e157ef806be3629d5d73b
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Sat Dec 17 22:17:42 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: Update BTC firmware report bitmap definition
|
||||
|
||||
The different version use different bit definition to enable firmware
|
||||
report. WiFi firmware will report information from Bluetooth firmware or
|
||||
some Wi-Fi firmware mechanism/status to driver by these bits. To solve the
|
||||
difference, add a function to map bitmap and versions.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 177 +++++++++++++++++++++++++++---
|
||||
1 file changed, 164 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index b58c839e10d92..6840f0363d96c 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -191,16 +191,20 @@ struct rtw89_btc_btf_tlv {
|
||||
} __packed;
|
||||
|
||||
enum btc_btf_set_report_en {
|
||||
- RPT_EN_TDMA = BIT(0),
|
||||
- RPT_EN_CYCLE = BIT(1),
|
||||
- RPT_EN_MREG = BIT(2),
|
||||
- RPT_EN_BT_VER_INFO = BIT(3),
|
||||
- RPT_EN_BT_SCAN_INFO = BIT(4),
|
||||
- RPT_EN_BT_AFH_MAP = BIT(5),
|
||||
- RPT_EN_BT_DEVICE_INFO = BIT(6),
|
||||
- RPT_EN_WL_ALL = GENMASK(2, 0),
|
||||
- RPT_EN_BT_ALL = GENMASK(6, 3),
|
||||
- RPT_EN_ALL = GENMASK(6, 0),
|
||||
+ RPT_EN_TDMA,
|
||||
+ RPT_EN_CYCLE,
|
||||
+ RPT_EN_MREG,
|
||||
+ RPT_EN_BT_VER_INFO,
|
||||
+ RPT_EN_BT_SCAN_INFO,
|
||||
+ RPT_EN_BT_DEVICE_INFO,
|
||||
+ RPT_EN_BT_AFH_MAP,
|
||||
+ RPT_EN_BT_AFH_MAP_LE,
|
||||
+ RPT_EN_FW_STEP_INFO,
|
||||
+ RPT_EN_TEST,
|
||||
+ RPT_EN_WL_ALL,
|
||||
+ RPT_EN_BT_ALL,
|
||||
+ RPT_EN_ALL,
|
||||
+ RPT_EN_MONITER,
|
||||
};
|
||||
|
||||
#define BTF_SET_REPORT_VER 1
|
||||
@@ -1507,22 +1511,169 @@ static void _append_slot(struct rtw89_dev *rtwdev)
|
||||
__func__, cnt);
|
||||
}
|
||||
|
||||
+static u32 rtw89_btc_fw_rpt_ver(struct rtw89_dev *rtwdev, u32 rpt_map)
|
||||
+{
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
+ u32 bit_map = 0;
|
||||
+
|
||||
+ switch (rpt_map) {
|
||||
+ case RPT_EN_TDMA:
|
||||
+ bit_map = BIT(0);
|
||||
+ break;
|
||||
+ case RPT_EN_CYCLE:
|
||||
+ bit_map = BIT(1);
|
||||
+ break;
|
||||
+ case RPT_EN_MREG:
|
||||
+ bit_map = BIT(2);
|
||||
+ break;
|
||||
+ case RPT_EN_BT_VER_INFO:
|
||||
+ bit_map = BIT(3);
|
||||
+ break;
|
||||
+ case RPT_EN_BT_SCAN_INFO:
|
||||
+ bit_map = BIT(4);
|
||||
+ break;
|
||||
+ case RPT_EN_BT_DEVICE_INFO:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ case 2:
|
||||
+ bit_map = BIT(6);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = BIT(5);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_BT_AFH_MAP:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ case 2:
|
||||
+ bit_map = BIT(5);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = BIT(6);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_BT_AFH_MAP_LE:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 2:
|
||||
+ bit_map = BIT(8);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = BIT(7);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_FW_STEP_INFO:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 1:
|
||||
+ case 2:
|
||||
+ bit_map = BIT(7);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = BIT(8);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_TEST:
|
||||
+ bit_map = BIT(31);
|
||||
+ break;
|
||||
+ case RPT_EN_WL_ALL:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ case 2:
|
||||
+ bit_map = GENMASK(2, 0);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = GENMASK(2, 0) | BIT(8);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_BT_ALL:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ bit_map = GENMASK(6, 3);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ bit_map = GENMASK(6, 3) | BIT(8);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = GENMASK(7, 3);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_ALL:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ bit_map = GENMASK(6, 0);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ bit_map = GENMASK(7, 0);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ case 3:
|
||||
+ bit_map = GENMASK(8, 0);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case RPT_EN_MONITER:
|
||||
+ switch (ver->frptmap) {
|
||||
+ case 0:
|
||||
+ case 1:
|
||||
+ bit_map = GENMASK(6, 2);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ bit_map = GENMASK(6, 2) | BIT(8);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bit_map = GENMASK(8, 2);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return bit_map;
|
||||
+}
|
||||
+
|
||||
static void rtw89_btc_fw_en_rpt(struct rtw89_dev *rtwdev,
|
||||
u32 rpt_map, bool rpt_state)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_btf_fwinfo *fwinfo = &btc->fwinfo;
|
||||
struct rtw89_btc_btf_set_report r = {0};
|
||||
- u32 val = 0;
|
||||
+ u32 val, bit_map;
|
||||
+
|
||||
+ bit_map = rtw89_btc_fw_rpt_ver(rtwdev, rpt_map);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
"[BTC], %s(): rpt_map=%x, rpt_state=%x\n",
|
||||
__func__, rpt_map, rpt_state);
|
||||
|
||||
if (rpt_state)
|
||||
- val = fwinfo->rpt_en_map | rpt_map;
|
||||
+ val = fwinfo->rpt_en_map | bit_map;
|
||||
else
|
||||
- val = fwinfo->rpt_en_map & ~rpt_map;
|
||||
+ val = fwinfo->rpt_en_map & ~bit_map;
|
||||
|
||||
if (val == fwinfo->rpt_en_map)
|
||||
return;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,229 @@
|
||||
From 6923eab289962e6d28cbd997fdb8c24e5d79a880 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 087/142] wifi: rtw89: coex: Add v2 BT AFH report and related
|
||||
variable
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 0cdfcfce85b6f067f1639550a0aacf2c112a3441
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Sat Dec 17 22:17:43 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: Add v2 BT AFH report and related variable
|
||||
|
||||
Wi-Fi firmware update AFH report feature to version 2. If there is BT BLE
|
||||
device connect to DUT, the mechanism will send H2C to request BT BLE
|
||||
channel map, it will help to debug.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 54 +++++++++++++++++++++++++++----
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 26 ++++++++++++++-
|
||||
2 files changed, 72 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index 6840f0363d96c..13764bfdd0bea 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -854,17 +854,18 @@ static void _chk_btc_err(struct rtw89_dev *rtwdev, u8 type, u32 cnt)
|
||||
static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info;
|
||||
struct rtw89_btc_bt_a2dp_desc *a2dp = &bt_linfo->a2dp_desc;
|
||||
struct rtw89_btc_fbtc_btver *pver = NULL;
|
||||
struct rtw89_btc_fbtc_btscan *pscan = NULL;
|
||||
- struct rtw89_btc_fbtc_btafh *pafh = NULL;
|
||||
+ struct rtw89_btc_fbtc_btafh *pafh_v1 = NULL;
|
||||
+ struct rtw89_btc_fbtc_btafh_v2 *pafh_v2 = NULL;
|
||||
struct rtw89_btc_fbtc_btdevinfo *pdev = NULL;
|
||||
|
||||
pver = (struct rtw89_btc_fbtc_btver *)pfinfo;
|
||||
pscan = (struct rtw89_btc_fbtc_btscan *)pfinfo;
|
||||
- pafh = (struct rtw89_btc_fbtc_btafh *)pfinfo;
|
||||
pdev = (struct rtw89_btc_fbtc_btdevinfo *)pfinfo;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
@@ -881,9 +882,23 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
|
||||
memcpy(bt->scan_info, pscan->scan, BTC_SCAN_MAX1);
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_AFH:
|
||||
- memcpy(&bt_linfo->afh_map[0], pafh->afh_l, 4);
|
||||
- memcpy(&bt_linfo->afh_map[4], pafh->afh_m, 4);
|
||||
- memcpy(&bt_linfo->afh_map[8], pafh->afh_h, 2);
|
||||
+ if (ver->fcxbtafh == 2) {
|
||||
+ pafh_v2 = (struct rtw89_btc_fbtc_btafh_v2 *)pfinfo;
|
||||
+ if (pafh_v2->map_type & RPT_BT_AFH_SEQ_LEGACY) {
|
||||
+ memcpy(&bt_linfo->afh_map[0], pafh_v2->afh_l, 4);
|
||||
+ memcpy(&bt_linfo->afh_map[4], pafh_v2->afh_m, 4);
|
||||
+ memcpy(&bt_linfo->afh_map[8], pafh_v2->afh_h, 2);
|
||||
+ }
|
||||
+ if (pafh_v2->map_type & RPT_BT_AFH_SEQ_LE) {
|
||||
+ memcpy(&bt_linfo->afh_map_le[0], pafh_v2->afh_le_a, 4);
|
||||
+ memcpy(&bt_linfo->afh_map_le[4], pafh_v2->afh_le_b, 1);
|
||||
+ }
|
||||
+ } else if (ver->fcxbtafh == 1) {
|
||||
+ pafh_v1 = (struct rtw89_btc_fbtc_btafh *)pfinfo;
|
||||
+ memcpy(&bt_linfo->afh_map[0], pafh_v1->afh_l, 4);
|
||||
+ memcpy(&bt_linfo->afh_map[4], pafh_v1->afh_m, 4);
|
||||
+ memcpy(&bt_linfo->afh_map[8], pafh_v1->afh_h, 2);
|
||||
+ }
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_DEVICE:
|
||||
a2dp->device_name = le32_to_cpu(pdev->dev_name);
|
||||
@@ -1132,8 +1147,15 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_AFH:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btafh.cinfo;
|
||||
- pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo);
|
||||
+ if (ver->fcxbtafh == 1) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v1;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v1);
|
||||
+ } else if (ver->fcxbtafh == 2) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v2;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v2);
|
||||
+ } else {
|
||||
+ goto err;
|
||||
+ }
|
||||
pcinfo->req_fver = ver->fcxbtafh;
|
||||
pcinfo->rx_len = rpt_len;
|
||||
pcinfo->rx_cnt++;
|
||||
@@ -1393,6 +1415,11 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
_update_bt_report(rtwdev, rpt_type, pfinfo);
|
||||
|
||||
return (rpt_len + BTC_RPT_HDR_SIZE);
|
||||
+
|
||||
+err:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
+ "[BTC], %s(): Undefined version for type=%d\n", __func__, rpt_type);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void _parse_btc_report(struct rtw89_dev *rtwdev,
|
||||
@@ -5919,12 +5946,14 @@ static void _show_bt_profile_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_cx *cx = &btc->cx;
|
||||
struct rtw89_btc_bt_info *bt = &cx->bt;
|
||||
struct rtw89_btc_wl_info *wl = &cx->wl;
|
||||
struct rtw89_btc_module *module = &btc->mdinfo;
|
||||
struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info;
|
||||
u8 *afh = bt_linfo->afh_map;
|
||||
+ u8 *afh_le = bt_linfo->afh_map_le;
|
||||
|
||||
if (!(btc->dm.coex_info_map & BTC_COEX_INFO_BT))
|
||||
return;
|
||||
@@ -5974,6 +6003,12 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
afh[0], afh[1], afh[2], afh[3], afh[4],
|
||||
afh[5], afh[6], afh[7], afh[8], afh[9]);
|
||||
|
||||
+ if (ver->fcxbtafh == 2 && bt_linfo->status.map.ble_connect)
|
||||
+ seq_printf(m,
|
||||
+ "LE[%02x%02x_%02x_%02x%02x]",
|
||||
+ afh_le[0], afh_le[1], afh_le[2],
|
||||
+ afh_le[3], afh_le[4]);
|
||||
+
|
||||
seq_printf(m, "wl_ch_map[en:%d/ch:%d/bw:%d]\n",
|
||||
wl->afh_info.en, wl->afh_info.ch, wl->afh_info.bw);
|
||||
|
||||
@@ -6016,6 +6051,11 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
else
|
||||
rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP, false);
|
||||
|
||||
+ if (ver->fcxbtafh == 2 && bt_linfo->status.map.ble_connect)
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP_LE, true);
|
||||
+ else
|
||||
+ rtw89_btc_fw_en_rpt(rtwdev, RPT_EN_BT_AFH_MAP_LE, false);
|
||||
+
|
||||
if (bt_linfo->a2dp_desc.exist &&
|
||||
(bt_linfo->a2dp_desc.flush_time == 0 ||
|
||||
bt_linfo->a2dp_desc.vendor_id == 0 ||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 358bfcd9ece20..af42e67897b6e 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1264,6 +1264,7 @@ union rtw89_btc_bt_state_map {
|
||||
|
||||
#define BTC_BT_RSSI_THMAX 4
|
||||
#define BTC_BT_AFH_GROUP 12
|
||||
+#define BTC_BT_AFH_LE_GROUP 5
|
||||
|
||||
struct rtw89_btc_bt_link_info {
|
||||
struct rtw89_btc_u8_sta_chg profile_cnt;
|
||||
@@ -1279,6 +1280,7 @@ struct rtw89_btc_bt_link_info {
|
||||
u8 golden_rx_shift[BTC_PROFILE_MAX];
|
||||
u8 rssi_state[BTC_BT_RSSI_THMAX];
|
||||
u8 afh_map[BTC_BT_AFH_GROUP];
|
||||
+ u8 afh_map_le[BTC_BT_AFH_LE_GROUP];
|
||||
|
||||
u32 role_sw: 1;
|
||||
u32 slave_role: 1;
|
||||
@@ -1605,6 +1607,11 @@ enum { /* STEP TYPE */
|
||||
CXSTEP_MAX,
|
||||
};
|
||||
|
||||
+enum rtw89_btc_afh_map_type { /*AFH MAP TYPE */
|
||||
+ RPT_BT_AFH_SEQ_LEGACY = 0x10,
|
||||
+ RPT_BT_AFH_SEQ_LE = 0x20
|
||||
+};
|
||||
+
|
||||
#define BTC_DBG_MAX1 32
|
||||
struct rtw89_btc_fbtc_gpio_dbg {
|
||||
u8 fver; /* btc_ver::fcxgpiodbg */
|
||||
@@ -1792,6 +1799,18 @@ struct rtw89_btc_fbtc_btafh {
|
||||
u8 afh_h[4]; /*bit0:2466, bit1:2467......bit14:2480 */
|
||||
} __packed;
|
||||
|
||||
+struct rtw89_btc_fbtc_btafh_v2 {
|
||||
+ u8 fver; /* btc_ver::fcxbtafh */
|
||||
+ u8 rsvd;
|
||||
+ u8 rsvd2;
|
||||
+ u8 map_type;
|
||||
+ u8 afh_l[4];
|
||||
+ u8 afh_m[4];
|
||||
+ u8 afh_h[4];
|
||||
+ u8 afh_le_a[4];
|
||||
+ u8 afh_le_b[4];
|
||||
+} __packed;
|
||||
+
|
||||
struct rtw89_btc_fbtc_btdevinfo {
|
||||
u8 fver; /* btc_ver::fcxbtdevinfo */
|
||||
u8 rsvd;
|
||||
@@ -1912,6 +1931,11 @@ struct rtw89_btc_rpt_cmn_info {
|
||||
u8 valid;
|
||||
} __packed;
|
||||
|
||||
+union rtw89_btc_fbtc_btafh_info {
|
||||
+ struct rtw89_btc_fbtc_btafh v1;
|
||||
+ struct rtw89_btc_fbtc_btafh_v2 v2;
|
||||
+};
|
||||
+
|
||||
struct rtw89_btc_report_ctrl_state {
|
||||
struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
|
||||
union {
|
||||
@@ -1979,7 +2003,7 @@ struct rtw89_btc_rpt_fbtc_btscan {
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_btafh {
|
||||
struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
|
||||
- struct rtw89_btc_fbtc_btafh finfo; /* info from fw */
|
||||
+ union rtw89_btc_fbtc_btafh_info finfo;
|
||||
};
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_btdev {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,526 @@
|
||||
From 801d99e983d490176539afe34c6dfa277dbbf947 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 088/142] wifi: rtw89: coex: refactor _chk_btc_report() to
|
||||
extend more features
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 31f12cff9d262468a11dc02af48fd1e538e1223f
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Sat Dec 17 22:17:44 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: refactor _chk_btc_report() to extend more features
|
||||
|
||||
Change the checking logic to switch case. Make the code more readable.
|
||||
There are more feature including to common code, in order to commit the
|
||||
following version of the features, switch case will make the logic more
|
||||
clearly. This patch did not change logic.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-7-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 365 ++++++++++++------------------
|
||||
1 file changed, 143 insertions(+), 222 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index 13764bfdd0bea..db0c694c4f92b 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -1006,7 +1006,6 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_btc_fbtc_cysta_v1 *pcysta_v1 = NULL;
|
||||
struct rtw89_btc_fbtc_cysta_cpu pcysta[1];
|
||||
struct rtw89_btc_prpt *btc_prpt = NULL;
|
||||
- struct rtw89_btc_fbtc_slot *rtp_slot = NULL;
|
||||
void *rpt_content = NULL, *pfinfo = NULL;
|
||||
u8 rpt_type = 0;
|
||||
u16 wl_slot_set = 0, wl_slot_real = 0;
|
||||
@@ -1043,8 +1042,6 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo_v1);
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxbtcrpt;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_TDMA:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo;
|
||||
@@ -1056,16 +1053,12 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo_v1);
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxtdma;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_SLOT:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_slots.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_slots.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_slots.finfo);
|
||||
pcinfo->req_fver = ver->fcxslots;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_CYSTA:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;
|
||||
@@ -1080,8 +1073,6 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo_v1);
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxcysta;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_STEP:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_step.cinfo;
|
||||
@@ -1097,8 +1088,6 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
offsetof(struct rtw89_btc_fbtc_steps_v1, step);
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxstep;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_NULLSTA:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo;
|
||||
@@ -1110,40 +1099,30 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_nullsta.finfo_v1);
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxnullsta;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_MREG:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_mregval.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_mregval.finfo);
|
||||
pcinfo->req_fver = ver->fcxmreg;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_GPIO_DBG:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_gpio_dbg.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_gpio_dbg.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_gpio_dbg.finfo);
|
||||
pcinfo->req_fver = ver->fcxgpiodbg;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_VER:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btver.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btver.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo);
|
||||
pcinfo->req_fver = ver->fcxbtver;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_SCAN:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btscan.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo);
|
||||
pcinfo->req_fver = ver->fcxbtscan;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_AFH:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btafh.cinfo;
|
||||
@@ -1157,22 +1136,21 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
goto err;
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxbtafh;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_DEVICE:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_btdev.cinfo;
|
||||
pfinfo = &pfwinfo->rpt_fbtc_btdev.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btdev.finfo);
|
||||
pcinfo->req_fver = ver->fcxbtdevinfo;
|
||||
- pcinfo->rx_len = rpt_len;
|
||||
- pcinfo->rx_cnt++;
|
||||
break;
|
||||
default:
|
||||
pfwinfo->err[BTFRE_UNDEF_TYPE]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ pcinfo->rx_len = rpt_len;
|
||||
+ pcinfo->rx_cnt++;
|
||||
+
|
||||
if (rpt_len != pcinfo->req_len) {
|
||||
if (rpt_type < BTC_RPT_TYPE_MAX)
|
||||
pfwinfo->len_mismch |= (0x1 << rpt_type);
|
||||
@@ -1193,227 +1171,170 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
memcpy(pfinfo, rpt_content, pcinfo->req_len);
|
||||
pcinfo->valid = 1;
|
||||
|
||||
- if (rpt_type == BTC_RPT_TYPE_TDMA && chip->chip_id == RTL8852A) {
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): check %d %zu\n", __func__,
|
||||
- BTC_DCNT_TDMA_NONSYNC, sizeof(dm->tdma_now));
|
||||
-
|
||||
- if (memcmp(&dm->tdma_now, &pfwinfo->rpt_fbtc_tdma.finfo,
|
||||
- sizeof(dm->tdma_now)) != 0) {
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d tdma_now %x %x %x %x %x %x %x %x\n",
|
||||
- __func__, BTC_DCNT_TDMA_NONSYNC,
|
||||
- dm->tdma_now.type, dm->tdma_now.rxflctrl,
|
||||
- dm->tdma_now.txpause, dm->tdma_now.wtgle_n,
|
||||
- dm->tdma_now.leak_n, dm->tdma_now.ext_ctrl,
|
||||
- dm->tdma_now.rxflctrl_role,
|
||||
- dm->tdma_now.option_ctrl);
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d rpt_fbtc_tdma %x %x %x %x %x %x %x %x\n",
|
||||
- __func__, BTC_DCNT_TDMA_NONSYNC,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.type,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.rxflctrl,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.txpause,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.wtgle_n,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.leak_n,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.ext_ctrl,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.rxflctrl_role,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo.option_ctrl);
|
||||
- }
|
||||
+ switch (rpt_type) {
|
||||
+ case BTC_RPT_TYPE_CTRL:
|
||||
+ if (chip->chip_id == RTL8852A) {
|
||||
+ prpt = &pfwinfo->rpt_ctrl.finfo;
|
||||
+ btc->fwinfo.rpt_en_map = prpt->rpt_enable;
|
||||
+ wl->ver_info.fw_coex = prpt->wl_fw_coex_ver;
|
||||
+ wl->ver_info.fw = prpt->wl_fw_ver;
|
||||
+ dm->wl_fw_cx_offload = !!prpt->wl_fw_cx_offload;
|
||||
+
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
+ pfwinfo->event[BTF_EVNT_RPT]);
|
||||
+
|
||||
+ /* To avoid I/O if WL LPS or power-off */
|
||||
+ if (wl->status.map.lps != BTC_LPS_RF_OFF &&
|
||||
+ !wl->status.map.rf_off) {
|
||||
+ rtwdev->chip->ops->btc_update_bt_cnt(rtwdev);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
+
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
||||
+ rtw89_mac_get_plt_cnt(rtwdev,
|
||||
+ RTW89_MAC_0);
|
||||
+ }
|
||||
+ } else {
|
||||
+ prpt_v1 = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
+ btc->fwinfo.rpt_en_map = le32_to_cpu(prpt_v1->rpt_info.en);
|
||||
+ wl->ver_info.fw_coex = le32_to_cpu(prpt_v1->wl_fw_info.cx_ver);
|
||||
+ wl->ver_info.fw = le32_to_cpu(prpt_v1->wl_fw_info.fw_ver);
|
||||
+ dm->wl_fw_cx_offload = !!le32_to_cpu(prpt_v1->wl_fw_info.cx_offload);
|
||||
+
|
||||
+ for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
||||
+ memcpy(&dm->gnt.band[i], &prpt_v1->gnt_val[i],
|
||||
+ sizeof(dm->gnt.band[i]));
|
||||
+
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] =
|
||||
+ le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_TX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] =
|
||||
+ le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_RX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] =
|
||||
+ le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_TX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] =
|
||||
+ le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_RX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
||||
+ le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_POLLUTED]);
|
||||
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
- memcmp(&dm->tdma_now,
|
||||
- &pfwinfo->rpt_fbtc_tdma.finfo,
|
||||
- sizeof(dm->tdma_now)));
|
||||
- } else if (rpt_type == BTC_RPT_TYPE_TDMA) {
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): check %d %zu\n", __func__,
|
||||
- BTC_DCNT_TDMA_NONSYNC, sizeof(dm->tdma_now));
|
||||
-
|
||||
- if (memcmp(&dm->tdma_now, &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma,
|
||||
- sizeof(dm->tdma_now)) != 0) {
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d tdma_now %x %x %x %x %x %x %x %x\n",
|
||||
- __func__, BTC_DCNT_TDMA_NONSYNC,
|
||||
- dm->tdma_now.type, dm->tdma_now.rxflctrl,
|
||||
- dm->tdma_now.txpause, dm->tdma_now.wtgle_n,
|
||||
- dm->tdma_now.leak_n, dm->tdma_now.ext_ctrl,
|
||||
- dm->tdma_now.rxflctrl_role,
|
||||
- dm->tdma_now.option_ctrl);
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d rpt_fbtc_tdma %x %x %x %x %x %x %x %x\n",
|
||||
- __func__, BTC_DCNT_TDMA_NONSYNC,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.type,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.rxflctrl,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.txpause,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.wtgle_n,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.leak_n,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.ext_ctrl,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.rxflctrl_role,
|
||||
- pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma.option_ctrl);
|
||||
- }
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
+ pfwinfo->event[BTF_EVNT_RPT]);
|
||||
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
- memcmp(&dm->tdma_now,
|
||||
- &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma,
|
||||
- sizeof(dm->tdma_now)));
|
||||
- }
|
||||
+ if (le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0)
|
||||
+ bt->rfk_info.map.timeout = 1;
|
||||
+ else
|
||||
+ bt->rfk_info.map.timeout = 0;
|
||||
|
||||
- if (rpt_type == BTC_RPT_TYPE_SLOT) {
|
||||
+ dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
+ }
|
||||
+ break;
|
||||
+ case BTC_RPT_TYPE_TDMA:
|
||||
+ rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
+ "[BTC], %s(): check %d %zu\n", __func__,
|
||||
+ BTC_DCNT_TDMA_NONSYNC,
|
||||
+ sizeof(dm->tdma_now));
|
||||
+ if (chip->chip_id == RTL8852A)
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
+ memcmp(&dm->tdma_now,
|
||||
+ &pfwinfo->rpt_fbtc_tdma.finfo_v1,
|
||||
+ sizeof(dm->tdma_now)));
|
||||
+ else
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
+ memcmp(&dm->tdma_now,
|
||||
+ &pfwinfo->rpt_fbtc_tdma.finfo,
|
||||
+ sizeof(dm->tdma_now)));
|
||||
+ break;
|
||||
+ case BTC_RPT_TYPE_SLOT:
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
"[BTC], %s(): check %d %zu\n",
|
||||
__func__, BTC_DCNT_SLOT_NONSYNC,
|
||||
sizeof(dm->slot_now));
|
||||
-
|
||||
- if (memcmp(dm->slot_now, pfwinfo->rpt_fbtc_slots.finfo.slot,
|
||||
- sizeof(dm->slot_now)) != 0) {
|
||||
- for (i = 0; i < CXST_MAX; i++) {
|
||||
- rtp_slot =
|
||||
- &pfwinfo->rpt_fbtc_slots.finfo.slot[i];
|
||||
- if (memcmp(&dm->slot_now[i], rtp_slot,
|
||||
- sizeof(dm->slot_now[i])) != 0) {
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d slot_now[%d] dur=0x%04x tbl=%08x type=0x%04x\n",
|
||||
- __func__,
|
||||
- BTC_DCNT_SLOT_NONSYNC, i,
|
||||
- dm->slot_now[i].dur,
|
||||
- dm->slot_now[i].cxtbl,
|
||||
- dm->slot_now[i].cxtype);
|
||||
-
|
||||
- rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
- "[BTC], %s(): %d rpt_fbtc_slots[%d] dur=0x%04x tbl=%08x type=0x%04x\n",
|
||||
- __func__,
|
||||
- BTC_DCNT_SLOT_NONSYNC, i,
|
||||
- rtp_slot->dur,
|
||||
- rtp_slot->cxtbl,
|
||||
- rtp_slot->cxtype);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_SLOT_NONSYNC,
|
||||
memcmp(dm->slot_now,
|
||||
pfwinfo->rpt_fbtc_slots.finfo.slot,
|
||||
sizeof(dm->slot_now)));
|
||||
- }
|
||||
+ break;
|
||||
+ case BTC_RPT_TYPE_CYSTA:
|
||||
+ if (chip->chip_id == RTL8852A) {
|
||||
+ if (pcysta->cycles < BTC_CYSTA_CHK_PERIOD)
|
||||
+ break;
|
||||
+ /* Check Leak-AP */
|
||||
+ if (pcysta->slot_cnt[CXST_LK] != 0 &&
|
||||
+ pcysta->leakrx_cnt != 0 && dm->tdma_now.rxflctrl) {
|
||||
+ if (pcysta->slot_cnt[CXST_LK] <
|
||||
+ BTC_LEAK_AP_TH * pcysta->leakrx_cnt)
|
||||
+ dm->leak_ap = 1;
|
||||
+ }
|
||||
|
||||
- if (rpt_type == BTC_RPT_TYPE_CYSTA && chip->chip_id == RTL8852A &&
|
||||
- pcysta->cycles >= BTC_CYSTA_CHK_PERIOD) {
|
||||
- /* Check Leak-AP */
|
||||
- if (pcysta->slot_cnt[CXST_LK] != 0 &&
|
||||
- pcysta->leakrx_cnt != 0 && dm->tdma_now.rxflctrl) {
|
||||
- if (pcysta->slot_cnt[CXST_LK] <
|
||||
- BTC_LEAK_AP_TH * pcysta->leakrx_cnt)
|
||||
- dm->leak_ap = 1;
|
||||
- }
|
||||
+ /* Check diff time between WL slot and W1/E2G slot */
|
||||
+ if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
+ dm->tdma_now.ext_ctrl == CXECTL_EXT)
|
||||
+ wl_slot_set = le16_to_cpu(dm->slot_now[CXST_E2G].dur);
|
||||
+ else
|
||||
+ wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
|
||||
- /* Check diff time between WL slot and W1/E2G slot */
|
||||
- if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
- dm->tdma_now.ext_ctrl == CXECTL_EXT)
|
||||
- wl_slot_set = le16_to_cpu(dm->slot_now[CXST_E2G].dur);
|
||||
- else
|
||||
- wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
+ if (pcysta->tavg_cycle[CXT_WL] > wl_slot_set) {
|
||||
+ diff_t = pcysta->tavg_cycle[CXT_WL] - wl_slot_set;
|
||||
+ _chk_btc_err(rtwdev,
|
||||
+ BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
+ }
|
||||
|
||||
- if (pcysta->tavg_cycle[CXT_WL] > wl_slot_set) {
|
||||
- diff_t = pcysta->tavg_cycle[CXT_WL] - wl_slot_set;
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
- }
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
+ pcysta->slot_cnt[CXST_W1]);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
+ pcysta->slot_cnt[CXST_B1]);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
+ (u32)pcysta->cycles);
|
||||
+ } else {
|
||||
+ if (le16_to_cpu(pcysta_v1->cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
+ break;
|
||||
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_W1]);
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_B1]);
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE, (u32)pcysta->cycles);
|
||||
- } else if (rpt_type == BTC_RPT_TYPE_CYSTA && pcysta_v1 &&
|
||||
- le16_to_cpu(pcysta_v1->cycles) >= BTC_CYSTA_CHK_PERIOD) {
|
||||
- cnt_leak_slot = le32_to_cpu(pcysta_v1->slot_cnt[CXST_LK]);
|
||||
- cnt_rx_imr = le32_to_cpu(pcysta_v1->leak_slot.cnt_rximr);
|
||||
- /* Check Leak-AP */
|
||||
- if (cnt_leak_slot != 0 && cnt_rx_imr != 0 &&
|
||||
- dm->tdma_now.rxflctrl) {
|
||||
- if (cnt_leak_slot < BTC_LEAK_AP_TH * cnt_rx_imr)
|
||||
- dm->leak_ap = 1;
|
||||
- }
|
||||
+ cnt_leak_slot = le32_to_cpu(pcysta_v1->slot_cnt[CXST_LK]);
|
||||
+ cnt_rx_imr = le32_to_cpu(pcysta_v1->leak_slot.cnt_rximr);
|
||||
|
||||
- /* Check diff time between real WL slot and W1 slot */
|
||||
- if (dm->tdma_now.type == CXTDMA_OFF) {
|
||||
- wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
- wl_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_WL]);
|
||||
- if (wl_slot_real > wl_slot_set) {
|
||||
- diff_t = wl_slot_real - wl_slot_set;
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
+ /* Check Leak-AP */
|
||||
+ if (cnt_leak_slot != 0 && cnt_rx_imr != 0 &&
|
||||
+ dm->tdma_now.rxflctrl) {
|
||||
+ if (cnt_leak_slot < BTC_LEAK_AP_TH * cnt_rx_imr)
|
||||
+ dm->leak_ap = 1;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- /* Check diff time between real BT slot and EBT/E5G slot */
|
||||
- if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
- dm->tdma_now.ext_ctrl == CXECTL_EXT &&
|
||||
- btc->bt_req_len != 0) {
|
||||
- bt_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_BT]);
|
||||
|
||||
- if (btc->bt_req_len > bt_slot_real) {
|
||||
- diff_t = btc->bt_req_len - bt_slot_real;
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_BT_SLOT_DRIFT, diff_t);
|
||||
+ /* Check diff time between real WL slot and W1 slot */
|
||||
+ if (dm->tdma_now.type == CXTDMA_OFF) {
|
||||
+ wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
+ wl_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_WL]);
|
||||
+ if (wl_slot_real > wl_slot_set) {
|
||||
+ diff_t = wl_slot_real - wl_slot_set;
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- le32_to_cpu(pcysta_v1->slot_cnt[CXST_W1]));
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_B1_FREEZE,
|
||||
- le32_to_cpu(pcysta_v1->slot_cnt[CXST_B1]));
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
- (u32)le16_to_cpu(pcysta_v1->cycles));
|
||||
- }
|
||||
-
|
||||
- if (rpt_type == BTC_RPT_TYPE_CTRL && chip->chip_id == RTL8852A) {
|
||||
- prpt = &pfwinfo->rpt_ctrl.finfo;
|
||||
- btc->fwinfo.rpt_en_map = prpt->rpt_enable;
|
||||
- wl->ver_info.fw_coex = prpt->wl_fw_coex_ver;
|
||||
- wl->ver_info.fw = prpt->wl_fw_ver;
|
||||
- dm->wl_fw_cx_offload = !!prpt->wl_fw_cx_offload;
|
||||
+ /* Check diff time between real BT slot and EBT/E5G slot */
|
||||
+ if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
+ dm->tdma_now.ext_ctrl == CXECTL_EXT &&
|
||||
+ btc->bt_req_len != 0) {
|
||||
+ bt_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_BT]);
|
||||
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
- pfwinfo->event[BTF_EVNT_RPT]);
|
||||
-
|
||||
- /* To avoid I/O if WL LPS or power-off */
|
||||
- if (wl->status.map.lps != BTC_LPS_RF_OFF && !wl->status.map.rf_off) {
|
||||
- rtwdev->chip->ops->btc_update_bt_cnt(rtwdev);
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
+ if (btc->bt_req_len > bt_slot_real) {
|
||||
+ diff_t = btc->bt_req_len - bt_slot_real;
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_BT_SLOT_DRIFT, diff_t);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
||||
- rtw89_mac_get_plt_cnt(rtwdev, RTW89_MAC_0);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
+ le32_to_cpu(pcysta_v1->slot_cnt[CXST_W1]));
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_B1_FREEZE,
|
||||
+ le32_to_cpu(pcysta_v1->slot_cnt[CXST_B1]));
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
+ (u32)le16_to_cpu(pcysta_v1->cycles));
|
||||
}
|
||||
- } else if (rpt_type == BTC_RPT_TYPE_CTRL) {
|
||||
- prpt_v1 = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
- btc->fwinfo.rpt_en_map = le32_to_cpu(prpt_v1->rpt_info.en);
|
||||
- wl->ver_info.fw_coex = le32_to_cpu(prpt_v1->wl_fw_info.cx_ver);
|
||||
- wl->ver_info.fw = le32_to_cpu(prpt_v1->wl_fw_info.fw_ver);
|
||||
- dm->wl_fw_cx_offload = !!le32_to_cpu(prpt_v1->wl_fw_info.cx_offload);
|
||||
-
|
||||
- for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
||||
- memcpy(&dm->gnt.band[i], &prpt_v1->gnt_val[i],
|
||||
- sizeof(dm->gnt.band[i]));
|
||||
-
|
||||
- btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_TX]);
|
||||
- btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_RX]);
|
||||
- btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_TX]);
|
||||
- btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_RX]);
|
||||
- btc->cx.cnt_bt[BTC_BCNT_POLUT] = le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_POLLUTED]);
|
||||
-
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
- _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
- pfwinfo->event[BTF_EVNT_RPT]);
|
||||
-
|
||||
- if (le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0)
|
||||
- bt->rfk_info.map.timeout = 1;
|
||||
- else
|
||||
- bt->rfk_info.map.timeout = 0;
|
||||
-
|
||||
- dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
- }
|
||||
-
|
||||
- if (rpt_type >= BTC_RPT_TYPE_BT_VER &&
|
||||
- rpt_type <= BTC_RPT_TYPE_BT_DEVICE)
|
||||
+ break;
|
||||
+ case BTC_RPT_TYPE_BT_VER:
|
||||
+ case BTC_RPT_TYPE_BT_SCAN:
|
||||
+ case BTC_RPT_TYPE_BT_AFH:
|
||||
+ case BTC_RPT_TYPE_BT_DEVICE:
|
||||
_update_bt_report(rtwdev, rpt_type, pfinfo);
|
||||
-
|
||||
+ break;
|
||||
+ }
|
||||
return (rpt_len + BTC_RPT_HDR_SIZE);
|
||||
|
||||
err:
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,182 @@
|
||||
From cd06f0acb1dddf4daa8c162848ace05353d677b4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 089/142] wifi: rtw89: coex: Change TDMA related logic to
|
||||
version separate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit e0097ac51e84243f0d0c065cbede1138f5e3aa9f
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Sat Dec 17 22:17:45 2022 +0800
|
||||
|
||||
wifi: rtw89: coex: Change TDMA related logic to version separate
|
||||
|
||||
In order to make different version of TDMA and coming update in the future
|
||||
can all work well, use BTC format version to replace chip_id, because
|
||||
format could change for specific chip_id.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221217141745.43291-8-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 47 ++++++++++++++++---------------
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 12 ++++----
|
||||
2 files changed, 32 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index db0c694c4f92b..2cb7ed1636030 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -1045,12 +1045,14 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
case BTC_RPT_TYPE_TDMA:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo;
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo);
|
||||
+ if (ver->fcxtdma == 1) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo.v1;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo.v1);
|
||||
+ } else if (ver->fcxtdma == 3) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo.v3;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo.v3);
|
||||
} else {
|
||||
- pfinfo = &pfwinfo->rpt_fbtc_tdma.finfo_v1;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_tdma.finfo_v1);
|
||||
+ goto err;
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxtdma;
|
||||
break;
|
||||
@@ -1232,16 +1234,18 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
"[BTC], %s(): check %d %zu\n", __func__,
|
||||
BTC_DCNT_TDMA_NONSYNC,
|
||||
sizeof(dm->tdma_now));
|
||||
- if (chip->chip_id == RTL8852A)
|
||||
+ if (ver->fcxtdma == 1)
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
memcmp(&dm->tdma_now,
|
||||
- &pfwinfo->rpt_fbtc_tdma.finfo_v1,
|
||||
+ &pfwinfo->rpt_fbtc_tdma.finfo.v1,
|
||||
sizeof(dm->tdma_now)));
|
||||
- else
|
||||
+ else if (ver->fcxtdma == 3)
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_TDMA_NONSYNC,
|
||||
memcmp(&dm->tdma_now,
|
||||
- &pfwinfo->rpt_fbtc_tdma.finfo,
|
||||
+ &pfwinfo->rpt_fbtc_tdma.finfo.v3.tdma,
|
||||
sizeof(dm->tdma_now)));
|
||||
+ else
|
||||
+ goto err;
|
||||
break;
|
||||
case BTC_RPT_TYPE_SLOT:
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
@@ -1375,13 +1379,12 @@ static void _parse_btc_report(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _append_tdma(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_btf_tlv *tlv;
|
||||
struct rtw89_btc_fbtc_tdma *v;
|
||||
- struct rtw89_btc_fbtc_tdma_v1 *v1;
|
||||
+ struct rtw89_btc_fbtc_tdma_v3 *v3;
|
||||
u16 len = btc->policy_len;
|
||||
|
||||
if (!btc->update_policy_force &&
|
||||
@@ -1394,17 +1397,17 @@ static void _append_tdma(struct rtw89_dev *rtwdev)
|
||||
|
||||
tlv = (struct rtw89_btc_btf_tlv *)&btc->policy[len];
|
||||
tlv->type = CXPOLICY_TDMA;
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
+ if (ver->fcxtdma == 1) {
|
||||
v = (struct rtw89_btc_fbtc_tdma *)&tlv->val[0];
|
||||
tlv->len = sizeof(*v);
|
||||
memcpy(v, &dm->tdma, sizeof(*v));
|
||||
- btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v);
|
||||
+ btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v);
|
||||
} else {
|
||||
- tlv->len = sizeof(*v1);
|
||||
- v1 = (struct rtw89_btc_fbtc_tdma_v1 *)&tlv->val[0];
|
||||
- v1->fver = ver->fcxtdma;
|
||||
- v1->tdma = dm->tdma;
|
||||
- btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v1);
|
||||
+ tlv->len = sizeof(*v3);
|
||||
+ v3 = (struct rtw89_btc_fbtc_tdma_v3 *)&tlv->val[0];
|
||||
+ v3->fver = ver->fcxtdma;
|
||||
+ memcpy(&v3->tdma, &dm->tdma, sizeof(v3->tdma));
|
||||
+ btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v3);
|
||||
}
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC,
|
||||
@@ -6281,8 +6284,8 @@ static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
static void _show_fbtc_tdma(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
struct rtw89_btc_fbtc_tdma *t = NULL;
|
||||
@@ -6294,10 +6297,10 @@ static void _show_fbtc_tdma(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
if (!pcinfo->valid)
|
||||
return;
|
||||
|
||||
- if (chip->chip_id == RTL8852A)
|
||||
- t = &pfwinfo->rpt_fbtc_tdma.finfo;
|
||||
+ if (ver->fcxtdma == 1)
|
||||
+ t = &pfwinfo->rpt_fbtc_tdma.finfo.v1;
|
||||
else
|
||||
- t = &pfwinfo->rpt_fbtc_tdma.finfo_v1.tdma;
|
||||
+ t = &pfwinfo->rpt_fbtc_tdma.finfo.v3.tdma;
|
||||
|
||||
seq_printf(m,
|
||||
" %-15s : ", "[tdma_policy]");
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index af42e67897b6e..2d7b8c7182472 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1450,13 +1450,18 @@ struct rtw89_btc_fbtc_tdma {
|
||||
u8 option_ctrl;
|
||||
} __packed;
|
||||
|
||||
-struct rtw89_btc_fbtc_tdma_v1 {
|
||||
+struct rtw89_btc_fbtc_tdma_v3 {
|
||||
u8 fver; /* btc_ver::fcxtdma */
|
||||
u8 rsvd;
|
||||
__le16 rsvd1;
|
||||
struct rtw89_btc_fbtc_tdma tdma;
|
||||
} __packed;
|
||||
|
||||
+union rtw89_btc_fbtc_tdma_le32 {
|
||||
+ struct rtw89_btc_fbtc_tdma v1;
|
||||
+ struct rtw89_btc_fbtc_tdma_v3 v3;
|
||||
+};
|
||||
+
|
||||
#define CXMREG_MAX 30
|
||||
#define FCXMAX_STEP 255 /*STEP trace record cnt, Max:65535, default:255*/
|
||||
#define BTC_CYCLE_SLOT_MAX 48 /* must be even number, non-zero */
|
||||
@@ -1946,10 +1951,7 @@ struct rtw89_btc_report_ctrl_state {
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_tdma {
|
||||
struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
|
||||
- union {
|
||||
- struct rtw89_btc_fbtc_tdma finfo; /* info from fw */
|
||||
- struct rtw89_btc_fbtc_tdma_v1 finfo_v1; /* info from fw for 52C*/
|
||||
- };
|
||||
+ union rtw89_btc_fbtc_tdma_le32 finfo;
|
||||
};
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_slots {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,126 @@
|
||||
From 90465a7002498c8740747dca519f0ecb3b10ad17 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:33 +0200
|
||||
Subject: [PATCH 090/142] wifi: rtw89: 8852b: update BSS color mapping register
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit a48f4fd05d5ea20c55afb212240972c1bd2c6ad3
|
||||
Author: Eric Huang <echuang@realtek.com>
|
||||
Date: Wed Dec 14 17:18:03 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852b: update BSS color mapping register
|
||||
|
||||
BSS color mapping register is different per IC, therefore, move this
|
||||
register to chip_info and update the setting function. Without this patch,
|
||||
wrong BSS color causes behavior abnormal, especially DL-OFDMA.
|
||||
|
||||
Signed-off-by: Eric Huang <echuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221214091803.41293-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/phy.c | 9 +++++----
|
||||
drivers/net/wireless/realtek/rtw89/reg.h | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 +
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 +
|
||||
6 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 2d7b8c7182472..04450a4938cad 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -2811,6 +2811,7 @@ struct rtw89_chip_info {
|
||||
u8 dcfo_comp_sft;
|
||||
const struct rtw89_imr_info *imr_info;
|
||||
const struct rtw89_rrsr_cfgs *rrsr_cfgs;
|
||||
+ u32 bss_clr_map_reg;
|
||||
u32 dma_ch_mask;
|
||||
const struct wiphy_wowlan_support *wowlan_stub;
|
||||
};
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
index 5dc617a0a47a7..ca2b5c17d6da0 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||||
@@ -4117,6 +4117,7 @@ void rtw89_phy_dm_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif)
|
||||
{
|
||||
+ const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
|
||||
u8 bss_color;
|
||||
|
||||
@@ -4125,11 +4126,11 @@ void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif
|
||||
|
||||
bss_color = vif->bss_conf.he_bss_color.color;
|
||||
|
||||
- rtw89_phy_write32_idx(rtwdev, R_BSS_CLR_MAP, B_BSS_CLR_MAP_VLD0, 0x1,
|
||||
- phy_idx);
|
||||
- rtw89_phy_write32_idx(rtwdev, R_BSS_CLR_MAP, B_BSS_CLR_MAP_TGT, bss_color,
|
||||
+ rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_VLD0, 0x1,
|
||||
phy_idx);
|
||||
- rtw89_phy_write32_idx(rtwdev, R_BSS_CLR_MAP, B_BSS_CLR_MAP_STAID,
|
||||
+ rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_TGT,
|
||||
+ bss_color, phy_idx);
|
||||
+ rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_STAID,
|
||||
vif->cfg.aid, phy_idx);
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
index ec5b8d5750364..578a1969afd61 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
|
||||
@@ -4108,6 +4108,7 @@
|
||||
#define R_SEG0CSI_EN 0x42C4
|
||||
#define B_SEG0CSI_EN BIT(23)
|
||||
#define R_BSS_CLR_MAP 0x43ac
|
||||
+#define R_BSS_CLR_MAP_V1 0x43B0
|
||||
#define B_BSS_CLR_MAP_VLD0 BIT(28)
|
||||
#define B_BSS_CLR_MAP_TGT GENMASK(27, 22)
|
||||
#define B_BSS_CLR_MAP_STAID GENMASK(21, 11)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
index 9a6f2f9f35a84..1875c2537ddbd 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
|
||||
@@ -2135,6 +2135,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.dcfo_comp_sft = 3,
|
||||
.imr_info = &rtw8852a_imr_info,
|
||||
.rrsr_cfgs = &rtw8852a_rrsr_cfgs,
|
||||
+ .bss_clr_map_reg = R_BSS_CLR_MAP,
|
||||
.dma_ch_mask = 0,
|
||||
#ifdef CONFIG_PM
|
||||
.wowlan_stub = &rtw_wowlan_stub_8852a,
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
index 498ae8616cd59..b9e5363e524b3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
|
||||
@@ -2512,6 +2512,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.dcfo_comp_sft = 3,
|
||||
.imr_info = &rtw8852b_imr_info,
|
||||
.rrsr_cfgs = &rtw8852b_rrsr_cfgs,
|
||||
+ .bss_clr_map_reg = R_BSS_CLR_MAP_V1,
|
||||
.dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
|
||||
BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
|
||||
BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
index bacdc91d63e9f..00fbb65355061 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
||||
@@ -2945,6 +2945,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
.dcfo_comp_sft = 5,
|
||||
.imr_info = &rtw8852c_imr_info,
|
||||
.rrsr_cfgs = &rtw8852c_rrsr_cfgs,
|
||||
+ .bss_clr_map_reg = R_BSS_CLR_MAP,
|
||||
.dma_ch_mask = 0,
|
||||
#ifdef CONFIG_PM
|
||||
.wowlan_stub = &rtw_wowlan_stub_8852c,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 22f342a028752f58ff012e1688a12d2c02665092 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 091/142] wifi: rtw89: refine 6 GHz scanning dwell time
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 08c93c0ca74c4223dce8fb68e4bb24f7426e55c8
|
||||
Author: Po-Hao Huang <phhuang@realtek.com>
|
||||
Date: Wed Dec 14 17:19:52 2022 +0800
|
||||
|
||||
wifi: rtw89: refine 6 GHz scanning dwell time
|
||||
|
||||
Reduce dwell time to improve scan duration in 6 GHz. This is required
|
||||
for scan requests that does not include RNR parsing and does full
|
||||
channel scan.
|
||||
|
||||
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221214091952.42792-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/fw.c | 5 +++--
|
||||
drivers/net/wireless/realtek/rtw89/fw.h | 1 +
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
index ecf68912eac2a..466d8273bc2b1 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||||
@@ -2751,7 +2751,7 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
if (ssid_num == 1 && req->ssids[0].ssid_len == 0) {
|
||||
ch_info->tx_pkt = false;
|
||||
if (!req->duration_mandatory)
|
||||
- ch_info->period -= RTW89_DWELL_TIME;
|
||||
+ ch_info->period -= RTW89_DWELL_TIME_6G;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2804,7 +2804,8 @@ static int rtw89_hw_scan_add_chan_list(struct rtw89_dev *rtwdev,
|
||||
if (req->duration_mandatory)
|
||||
ch_info->period = req->duration;
|
||||
else if (channel->band == NL80211_BAND_6GHZ)
|
||||
- ch_info->period = RTW89_CHANNEL_TIME_6G + RTW89_DWELL_TIME;
|
||||
+ ch_info->period = RTW89_CHANNEL_TIME_6G +
|
||||
+ RTW89_DWELL_TIME_6G;
|
||||
else
|
||||
ch_info->period = RTW89_CHANNEL_TIME;
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
index 4326e0ede54b8..3ce59ac48f433 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
||||
@@ -205,6 +205,7 @@ struct rtw89_h2creg_sch_tx_en {
|
||||
#define RTW89_DFS_CHAN_TIME 105
|
||||
#define RTW89_OFF_CHAN_TIME 100
|
||||
#define RTW89_DWELL_TIME 20
|
||||
+#define RTW89_DWELL_TIME_6G 10
|
||||
#define RTW89_SCAN_WIDTH 0
|
||||
#define RTW89_SCANOFLD_MAX_SSID 8
|
||||
#define RTW89_SCANOFLD_MAX_IE_LEN 512
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,135 @@
|
||||
From 40c418f356774701b7ab0cfcab49677baf8bc3fd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 092/142] wifi: rtw89: 8852c: rfk: refine AGC tuning flow of
|
||||
DPK for irregular PA
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit ba1a6905c71898509fd3e8d1eb790b4e1213126f
|
||||
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Date: Fri Dec 16 13:29:39 2022 +0800
|
||||
|
||||
wifi: rtw89: 8852c: rfk: refine AGC tuning flow of DPK for irregular PA
|
||||
|
||||
Some hardware modules don't have good RF characteristic as regular.
|
||||
It could have RF PA characteristic that current code doesn't handle
|
||||
properly, and it runs into wrong DPK flow that doesn't complete DPK
|
||||
resulting in bad EVM.
|
||||
|
||||
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221216052939.9991-1-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 38 ++++++++++++++++++-----
|
||||
1 file changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
index b0ea23d9f81fb..3c5fa3bb2a8f4 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
|
||||
@@ -26,7 +26,7 @@ static const u32 rtw8852c_backup_bb_regs[] = {
|
||||
};
|
||||
|
||||
static const u32 rtw8852c_backup_rf_regs[] = {
|
||||
- 0xdf, 0x8f, 0x97, 0xa3, 0x5, 0x10005
|
||||
+ 0xdf, 0x5f, 0x8f, 0x97, 0xa3, 0x5, 0x10005
|
||||
};
|
||||
|
||||
#define BACKUP_BB_REGS_NR ARRAY_SIZE(rtw8852c_backup_bb_regs)
|
||||
@@ -1757,7 +1757,7 @@ u8 _rx_dck_channel_calc(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan)
|
||||
}
|
||||
|
||||
#define RTW8852C_RF_REL_VERSION 34
|
||||
-#define RTW8852C_DPK_VER 0x10
|
||||
+#define RTW8852C_DPK_VER 0xf
|
||||
#define RTW8852C_DPK_TH_AVG_NUM 4
|
||||
#define RTW8852C_DPK_RF_PATH 2
|
||||
#define RTW8852C_DPK_KIP_REG_NUM 5
|
||||
@@ -1797,6 +1797,12 @@ enum dpk_agc_step {
|
||||
DPK_AGC_STEP_SET_TX_GAIN,
|
||||
};
|
||||
|
||||
+enum dpk_pas_result {
|
||||
+ DPK_PAS_NOR,
|
||||
+ DPK_PAS_GT,
|
||||
+ DPK_PAS_LT,
|
||||
+};
|
||||
+
|
||||
static void _rf_direct_cntrl(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_rf_path path, bool is_bybb)
|
||||
{
|
||||
@@ -2206,9 +2212,10 @@ static u8 _dpk_gainloss(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
return _dpk_gainloss_read(rtwdev);
|
||||
}
|
||||
|
||||
-static bool _dpk_pas_read(struct rtw89_dev *rtwdev, bool is_check)
|
||||
+static enum dpk_pas_result _dpk_pas_read(struct rtw89_dev *rtwdev, bool is_check)
|
||||
{
|
||||
u32 val1_i = 0, val1_q = 0, val2_i = 0, val2_q = 0;
|
||||
+ u32 val1_sqrt_sum, val2_sqrt_sum;
|
||||
u8 i;
|
||||
|
||||
rtw89_phy_write32_mask(rtwdev, R_KIP_RPT1, MASKBYTE2, 0x06);
|
||||
@@ -2239,15 +2246,25 @@ static bool _dpk_pas_read(struct rtw89_dev *rtwdev, bool is_check)
|
||||
}
|
||||
}
|
||||
|
||||
- if (val1_i * val1_i + val1_q * val1_q >= (val2_i * val2_i + val2_q * val2_q) * 8 / 5)
|
||||
- return true;
|
||||
+ val1_sqrt_sum = val1_i * val1_i + val1_q * val1_q;
|
||||
+ val2_sqrt_sum = val2_i * val2_i + val2_q * val2_q;
|
||||
+
|
||||
+ if (val1_sqrt_sum < val2_sqrt_sum)
|
||||
+ return DPK_PAS_LT;
|
||||
+ else if (val1_sqrt_sum >= val2_sqrt_sum * 8 / 5)
|
||||
+ return DPK_PAS_GT;
|
||||
else
|
||||
- return false;
|
||||
+ return DPK_PAS_NOR;
|
||||
}
|
||||
|
||||
static bool _dpk_kip_set_rxagc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx)
|
||||
{
|
||||
+ _dpk_kip_control_rfc(rtwdev, path, false);
|
||||
+ rtw89_phy_write32_mask(rtwdev, R_KIP_MOD, B_KIP_MOD,
|
||||
+ rtw89_read_rf(rtwdev, path, RR_MOD, RFREG_MASK));
|
||||
+ _dpk_kip_control_rfc(rtwdev, path, true);
|
||||
+
|
||||
_dpk_one_shot(rtwdev, phy, path, D_RXAGC);
|
||||
|
||||
return _dpk_sync_check(rtwdev, path, kidx);
|
||||
@@ -2285,6 +2302,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
u8 tmp_dbm = init_xdbm, tmp_gl_idx = 0;
|
||||
u8 tmp_rxbb;
|
||||
u8 goout = 0, agc_cnt = 0;
|
||||
+ enum dpk_pas_result pas;
|
||||
u16 dgain = 0;
|
||||
bool is_fail = false;
|
||||
int limit = 200;
|
||||
@@ -2320,9 +2338,13 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
case DPK_AGC_STEP_GAIN_LOSS_IDX:
|
||||
tmp_gl_idx = _dpk_gainloss(rtwdev, phy, path, kidx);
|
||||
+ pas = _dpk_pas_read(rtwdev, true);
|
||||
|
||||
- if ((tmp_gl_idx == 0 && _dpk_pas_read(rtwdev, true)) ||
|
||||
- tmp_gl_idx >= 7)
|
||||
+ if (pas == DPK_PAS_LT && tmp_gl_idx > 0)
|
||||
+ step = DPK_AGC_STEP_GL_LT_CRITERION;
|
||||
+ else if (pas == DPK_PAS_GT && tmp_gl_idx == 0)
|
||||
+ step = DPK_AGC_STEP_GL_GT_CRITERION;
|
||||
+ else if (tmp_gl_idx >= 7)
|
||||
step = DPK_AGC_STEP_GL_GT_CRITERION;
|
||||
else if (tmp_gl_idx == 0)
|
||||
step = DPK_AGC_STEP_GL_LT_CRITERION;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,44 @@
|
||||
From 5e98cd761aa9768498e7364d74df9287e9917d18 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 093/142] wifi: rtw89: Fix a typo in debug message
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit e20c9f656654f74c9234e6cd3231aed72f53d246
|
||||
Author: Masanari Iida <standby24x7@gmail.com>
|
||||
Date: Fri Dec 23 19:20:58 2022 +0900
|
||||
|
||||
wifi: rtw89: Fix a typo in debug message
|
||||
|
||||
This patch fixes a spelling typo in debug message.
|
||||
|
||||
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
|
||||
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20221223102058.162179-1-standby24x7@gmail.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
|
||||
index 582ff0d3a9ea0..cd6c39b7f8025 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
|
||||
@@ -1643,7 +1643,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
- "[IQK]==========IQK strat!!!!!==========\n");
|
||||
+ "[IQK]==========IQK start!!!!!==========\n");
|
||||
iqk_info->iqk_times++;
|
||||
iqk_info->kcount = 0;
|
||||
iqk_info->version = RTW8852A_IQK_VER;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,345 @@
|
||||
From b362cbf69c09642e8891fd1485bdb0a502b9ddb6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 094/142] wifi: rtw89: coex: Remove le32 to CPU translator at
|
||||
firmware cycle report
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit f643d08642b82eeb9b9654399dd04657050f7c6f
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Tue Jan 3 22:02:32 2023 +0800
|
||||
|
||||
wifi: rtw89: coex: Remove le32 to CPU translator at firmware cycle report
|
||||
|
||||
There are at least 2 version of cycle report format. If the code keep
|
||||
translating the report to local variable, the numbers of variable in
|
||||
check btc report function will out of maximum variable numbers. And
|
||||
most of these variable are using only one time, it is not necessary
|
||||
to store at memory.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230103140238.15601-2-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 190 ++++++++++--------------------
|
||||
1 file changed, 60 insertions(+), 130 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index 2cb7ed1636030..a594f5c729608 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -910,76 +910,6 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
|
||||
}
|
||||
}
|
||||
|
||||
-struct rtw89_btc_fbtc_cysta_cpu {
|
||||
- u8 fver;
|
||||
- u8 rsvd;
|
||||
- u16 cycles;
|
||||
- u16 cycles_a2dp[CXT_FLCTRL_MAX];
|
||||
- u16 a2dpept;
|
||||
- u16 a2dpeptto;
|
||||
- u16 tavg_cycle[CXT_MAX];
|
||||
- u16 tmax_cycle[CXT_MAX];
|
||||
- u16 tmaxdiff_cycle[CXT_MAX];
|
||||
- u16 tavg_a2dp[CXT_FLCTRL_MAX];
|
||||
- u16 tmax_a2dp[CXT_FLCTRL_MAX];
|
||||
- u16 tavg_a2dpept;
|
||||
- u16 tmax_a2dpept;
|
||||
- u16 tavg_lk;
|
||||
- u16 tmax_lk;
|
||||
- u32 slot_cnt[CXST_MAX];
|
||||
- u32 bcn_cnt[CXBCN_MAX];
|
||||
- u32 leakrx_cnt;
|
||||
- u32 collision_cnt;
|
||||
- u32 skip_cnt;
|
||||
- u32 exception;
|
||||
- u32 except_cnt;
|
||||
- u16 tslot_cycle[BTC_CYCLE_SLOT_MAX];
|
||||
-};
|
||||
-
|
||||
-static void rtw89_btc_fbtc_cysta_to_cpu(const struct rtw89_btc_fbtc_cysta *src,
|
||||
- struct rtw89_btc_fbtc_cysta_cpu *dst)
|
||||
-{
|
||||
- static_assert(sizeof(*src) == sizeof(*dst));
|
||||
-
|
||||
-#define __CPY_U8(_x) ({dst->_x = src->_x; })
|
||||
-#define __CPY_LE16(_x) ({dst->_x = le16_to_cpu(src->_x); })
|
||||
-#define __CPY_LE16S(_x) ({int _i; for (_i = 0; _i < ARRAY_SIZE(dst->_x); _i++) \
|
||||
- dst->_x[_i] = le16_to_cpu(src->_x[_i]); })
|
||||
-#define __CPY_LE32(_x) ({dst->_x = le32_to_cpu(src->_x); })
|
||||
-#define __CPY_LE32S(_x) ({int _i; for (_i = 0; _i < ARRAY_SIZE(dst->_x); _i++) \
|
||||
- dst->_x[_i] = le32_to_cpu(src->_x[_i]); })
|
||||
-
|
||||
- __CPY_U8(fver);
|
||||
- __CPY_U8(rsvd);
|
||||
- __CPY_LE16(cycles);
|
||||
- __CPY_LE16S(cycles_a2dp);
|
||||
- __CPY_LE16(a2dpept);
|
||||
- __CPY_LE16(a2dpeptto);
|
||||
- __CPY_LE16S(tavg_cycle);
|
||||
- __CPY_LE16S(tmax_cycle);
|
||||
- __CPY_LE16S(tmaxdiff_cycle);
|
||||
- __CPY_LE16S(tavg_a2dp);
|
||||
- __CPY_LE16S(tmax_a2dp);
|
||||
- __CPY_LE16(tavg_a2dpept);
|
||||
- __CPY_LE16(tmax_a2dpept);
|
||||
- __CPY_LE16(tavg_lk);
|
||||
- __CPY_LE16(tmax_lk);
|
||||
- __CPY_LE32S(slot_cnt);
|
||||
- __CPY_LE32S(bcn_cnt);
|
||||
- __CPY_LE32(leakrx_cnt);
|
||||
- __CPY_LE32(collision_cnt);
|
||||
- __CPY_LE32(skip_cnt);
|
||||
- __CPY_LE32(exception);
|
||||
- __CPY_LE32(except_cnt);
|
||||
- __CPY_LE16S(tslot_cycle);
|
||||
-
|
||||
-#undef __CPY_U8
|
||||
-#undef __CPY_LE16
|
||||
-#undef __CPY_LE16S
|
||||
-#undef __CPY_LE32
|
||||
-#undef __CPY_LE32S
|
||||
-}
|
||||
-
|
||||
#define BTC_LEAK_AP_TH 10
|
||||
#define BTC_CYSTA_CHK_PERIOD 100
|
||||
|
||||
@@ -1002,9 +932,8 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl *prpt;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v1 *prpt_v1;
|
||||
- struct rtw89_btc_fbtc_cysta *pcysta_le32 = NULL;
|
||||
+ struct rtw89_btc_fbtc_cysta *pcysta = NULL;
|
||||
struct rtw89_btc_fbtc_cysta_v1 *pcysta_v1 = NULL;
|
||||
- struct rtw89_btc_fbtc_cysta_cpu pcysta[1];
|
||||
struct rtw89_btc_prpt *btc_prpt = NULL;
|
||||
void *rpt_content = NULL, *pfinfo = NULL;
|
||||
u8 rpt_type = 0;
|
||||
@@ -1066,8 +995,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;
|
||||
if (chip->chip_id == RTL8852A) {
|
||||
pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- rtw89_btc_fbtc_cysta_to_cpu(pcysta_le32, pcysta);
|
||||
+ pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo);
|
||||
} else {
|
||||
pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
@@ -1259,13 +1187,13 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
case BTC_RPT_TYPE_CYSTA:
|
||||
if (chip->chip_id == RTL8852A) {
|
||||
- if (pcysta->cycles < BTC_CYSTA_CHK_PERIOD)
|
||||
+ if (le16_to_cpu(pcysta->cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
break;
|
||||
/* Check Leak-AP */
|
||||
- if (pcysta->slot_cnt[CXST_LK] != 0 &&
|
||||
- pcysta->leakrx_cnt != 0 && dm->tdma_now.rxflctrl) {
|
||||
- if (pcysta->slot_cnt[CXST_LK] <
|
||||
- BTC_LEAK_AP_TH * pcysta->leakrx_cnt)
|
||||
+ if (le32_to_cpu(pcysta->slot_cnt[CXST_LK]) != 0 &&
|
||||
+ le32_to_cpu(pcysta->leakrx_cnt) != 0 && dm->tdma_now.rxflctrl) {
|
||||
+ if (le32_to_cpu(pcysta->slot_cnt[CXST_LK]) <
|
||||
+ BTC_LEAK_AP_TH * le32_to_cpu(pcysta->leakrx_cnt))
|
||||
dm->leak_ap = 1;
|
||||
}
|
||||
|
||||
@@ -1276,18 +1204,18 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
else
|
||||
wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
|
||||
- if (pcysta->tavg_cycle[CXT_WL] > wl_slot_set) {
|
||||
- diff_t = pcysta->tavg_cycle[CXT_WL] - wl_slot_set;
|
||||
+ if (le16_to_cpu(pcysta->tavg_cycle[CXT_WL]) > wl_slot_set) {
|
||||
+ diff_t = le16_to_cpu(pcysta->tavg_cycle[CXT_WL]) - wl_slot_set;
|
||||
_chk_btc_err(rtwdev,
|
||||
BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
}
|
||||
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- pcysta->slot_cnt[CXST_W1]);
|
||||
+ le32_to_cpu(pcysta->slot_cnt[CXST_W1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- pcysta->slot_cnt[CXST_B1]);
|
||||
+ le32_to_cpu(pcysta->slot_cnt[CXST_B1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
- (u32)pcysta->cycles);
|
||||
+ le16_to_cpu(pcysta->cycles));
|
||||
} else {
|
||||
if (le16_to_cpu(pcysta_v1->cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
break;
|
||||
@@ -6385,7 +6313,6 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
struct rtw89_btc_fbtc_cysta *pcysta_le32 = NULL;
|
||||
- struct rtw89_btc_fbtc_cysta_cpu pcysta[1];
|
||||
union rtw89_btc_fbtc_rxflct r;
|
||||
u8 i, cnt = 0, slot_pair;
|
||||
u16 cycle, c_begin, c_end, store_index;
|
||||
@@ -6395,64 +6322,65 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
return;
|
||||
|
||||
pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- rtw89_btc_fbtc_cysta_to_cpu(pcysta_le32, pcysta);
|
||||
seq_printf(m,
|
||||
" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]",
|
||||
- "[cycle_cnt]", pcysta->cycles, pcysta->bcn_cnt[CXBCN_ALL],
|
||||
- pcysta->bcn_cnt[CXBCN_ALL_OK],
|
||||
- pcysta->bcn_cnt[CXBCN_BT_SLOT],
|
||||
- pcysta->bcn_cnt[CXBCN_BT_OK]);
|
||||
+ "[cycle_cnt]",
|
||||
+ le16_to_cpu(pcysta_le32->cycles),
|
||||
+ le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_ALL]),
|
||||
+ le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_ALL_OK]),
|
||||
+ le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_BT_SLOT]),
|
||||
+ le32_to_cpu(pcysta_le32->bcn_cnt[CXBCN_BT_OK]));
|
||||
|
||||
for (i = 0; i < CXST_MAX; i++) {
|
||||
- if (!pcysta->slot_cnt[i])
|
||||
+ if (!le32_to_cpu(pcysta_le32->slot_cnt[i]))
|
||||
continue;
|
||||
- seq_printf(m,
|
||||
- ", %d:%d", (u32)i, pcysta->slot_cnt[i]);
|
||||
+ seq_printf(m, ", %d:%d", (u32)i,
|
||||
+ le32_to_cpu(pcysta_le32->slot_cnt[i]));
|
||||
}
|
||||
|
||||
if (dm->tdma_now.rxflctrl) {
|
||||
- seq_printf(m,
|
||||
- ", leak_rx:%d", pcysta->leakrx_cnt);
|
||||
+ seq_printf(m, ", leak_rx:%d",
|
||||
+ le32_to_cpu(pcysta_le32->leakrx_cnt));
|
||||
}
|
||||
|
||||
- if (pcysta->collision_cnt) {
|
||||
- seq_printf(m,
|
||||
- ", collision:%d", pcysta->collision_cnt);
|
||||
+ if (le32_to_cpu(pcysta_le32->collision_cnt)) {
|
||||
+ seq_printf(m, ", collision:%d",
|
||||
+ le32_to_cpu(pcysta_le32->collision_cnt));
|
||||
}
|
||||
|
||||
- if (pcysta->skip_cnt) {
|
||||
- seq_printf(m,
|
||||
- ", skip:%d", pcysta->skip_cnt);
|
||||
+ if (le32_to_cpu(pcysta_le32->skip_cnt)) {
|
||||
+ seq_printf(m, ", skip:%d",
|
||||
+ le32_to_cpu(pcysta_le32->skip_cnt));
|
||||
}
|
||||
seq_puts(m, "\n");
|
||||
|
||||
seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]",
|
||||
"[cycle_time]",
|
||||
- pcysta->tavg_cycle[CXT_WL],
|
||||
- pcysta->tavg_cycle[CXT_BT],
|
||||
- pcysta->tavg_lk / 1000, pcysta->tavg_lk % 1000);
|
||||
- seq_printf(m,
|
||||
- ", max_t[wl:%d/bt:%d/lk:%d.%03d]",
|
||||
- pcysta->tmax_cycle[CXT_WL],
|
||||
- pcysta->tmax_cycle[CXT_BT],
|
||||
- pcysta->tmax_lk / 1000, pcysta->tmax_lk % 1000);
|
||||
- seq_printf(m,
|
||||
- ", maxdiff_t[wl:%d/bt:%d]\n",
|
||||
- pcysta->tmaxdiff_cycle[CXT_WL],
|
||||
- pcysta->tmaxdiff_cycle[CXT_BT]);
|
||||
-
|
||||
- if (pcysta->cycles == 0)
|
||||
+ le16_to_cpu(pcysta_le32->tavg_cycle[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta_le32->tavg_cycle[CXT_BT]),
|
||||
+ le16_to_cpu(pcysta_le32->tavg_lk) / 1000,
|
||||
+ le16_to_cpu(pcysta_le32->tavg_lk) % 1000);
|
||||
+ seq_printf(m, ", max_t[wl:%d/bt:%d/lk:%d.%03d]",
|
||||
+ le16_to_cpu(pcysta_le32->tmax_cycle[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta_le32->tmax_cycle[CXT_BT]),
|
||||
+ le16_to_cpu(pcysta_le32->tmax_lk) / 1000,
|
||||
+ le16_to_cpu(pcysta_le32->tmax_lk) % 1000);
|
||||
+ seq_printf(m, ", maxdiff_t[wl:%d/bt:%d]\n",
|
||||
+ le16_to_cpu(pcysta_le32->tmaxdiff_cycle[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta_le32->tmaxdiff_cycle[CXT_BT]));
|
||||
+
|
||||
+ if (le16_to_cpu(pcysta_le32->cycles) == 0)
|
||||
return;
|
||||
|
||||
/* 1 cycle record 1 wl-slot and 1 bt-slot */
|
||||
slot_pair = BTC_CYCLE_SLOT_MAX / 2;
|
||||
|
||||
- if (pcysta->cycles <= slot_pair)
|
||||
+ if (le16_to_cpu(pcysta_le32->cycles) <= slot_pair)
|
||||
c_begin = 1;
|
||||
else
|
||||
- c_begin = pcysta->cycles - slot_pair + 1;
|
||||
+ c_begin = le16_to_cpu(pcysta_le32->cycles) - slot_pair + 1;
|
||||
|
||||
- c_end = pcysta->cycles;
|
||||
+ c_end = le16_to_cpu(pcysta_le32->cycles);
|
||||
|
||||
for (cycle = c_begin; cycle <= c_end; cycle++) {
|
||||
cnt++;
|
||||
@@ -6461,13 +6389,13 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
if (cnt % (BTC_CYCLE_SLOT_MAX / 4) == 1)
|
||||
seq_printf(m,
|
||||
" %-15s : ->b%02d->w%02d", "[cycle_step]",
|
||||
- pcysta->tslot_cycle[store_index],
|
||||
- pcysta->tslot_cycle[store_index + 1]);
|
||||
+ le16_to_cpu(pcysta_le32->tslot_cycle[store_index]),
|
||||
+ le16_to_cpu(pcysta_le32->tslot_cycle[store_index + 1]));
|
||||
else
|
||||
seq_printf(m,
|
||||
"->b%02d->w%02d",
|
||||
- pcysta->tslot_cycle[store_index],
|
||||
- pcysta->tslot_cycle[store_index + 1]);
|
||||
+ le16_to_cpu(pcysta_le32->tslot_cycle[store_index]),
|
||||
+ le16_to_cpu(pcysta_le32->tslot_cycle[store_index + 1]));
|
||||
if (cnt % (BTC_CYCLE_SLOT_MAX / 4) == 0 || cnt == c_end)
|
||||
seq_puts(m, "\n");
|
||||
}
|
||||
@@ -6476,28 +6404,30 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
seq_printf(m,
|
||||
" %-15s : a2dp_ept:%d, a2dp_late:%d",
|
||||
"[a2dp_t_sta]",
|
||||
- pcysta->a2dpept, pcysta->a2dpeptto);
|
||||
+ le16_to_cpu(pcysta_le32->a2dpept),
|
||||
+ le16_to_cpu(pcysta_le32->a2dpeptto));
|
||||
|
||||
seq_printf(m,
|
||||
", avg_t:%d, max_t:%d",
|
||||
- pcysta->tavg_a2dpept, pcysta->tmax_a2dpept);
|
||||
+ le16_to_cpu(pcysta_le32->tavg_a2dpept),
|
||||
+ le16_to_cpu(pcysta_le32->tmax_a2dpept));
|
||||
r.val = dm->tdma_now.rxflctrl;
|
||||
|
||||
if (r.type && r.tgln_n) {
|
||||
seq_printf(m,
|
||||
", cycle[PSTDMA:%d/TDMA:%d], ",
|
||||
- pcysta->cycles_a2dp[CXT_FLCTRL_ON],
|
||||
- pcysta->cycles_a2dp[CXT_FLCTRL_OFF]);
|
||||
+ le16_to_cpu(pcysta_le32->cycles_a2dp[CXT_FLCTRL_ON]),
|
||||
+ le16_to_cpu(pcysta_le32->cycles_a2dp[CXT_FLCTRL_OFF]));
|
||||
|
||||
seq_printf(m,
|
||||
"avg_t[PSTDMA:%d/TDMA:%d], ",
|
||||
- pcysta->tavg_a2dp[CXT_FLCTRL_ON],
|
||||
- pcysta->tavg_a2dp[CXT_FLCTRL_OFF]);
|
||||
+ le16_to_cpu(pcysta_le32->tavg_a2dp[CXT_FLCTRL_ON]),
|
||||
+ le16_to_cpu(pcysta_le32->tavg_a2dp[CXT_FLCTRL_OFF]));
|
||||
|
||||
seq_printf(m,
|
||||
"max_t[PSTDMA:%d/TDMA:%d]",
|
||||
- pcysta->tmax_a2dp[CXT_FLCTRL_ON],
|
||||
- pcysta->tmax_a2dp[CXT_FLCTRL_OFF]);
|
||||
+ le16_to_cpu(pcysta_le32->tmax_a2dp[CXT_FLCTRL_ON]),
|
||||
+ le16_to_cpu(pcysta_le32->tmax_a2dp[CXT_FLCTRL_OFF]));
|
||||
}
|
||||
seq_puts(m, "\n");
|
||||
}
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,323 @@
|
||||
From 7f76d7d4b39317867e2e177b5b8d2395122d8aa6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 095/142] wifi: rtw89: coex: Rename BTC firmware cycle report
|
||||
by feature version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit fab895b31982f8093afe807cb0a69805aaa97850
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Tue Jan 3 22:02:33 2023 +0800
|
||||
|
||||
wifi: rtw89: coex: Rename BTC firmware cycle report by feature version
|
||||
|
||||
Because there are new report format in the upcoming patches, to make the
|
||||
logic more readable, rename the related structure by their version number.
|
||||
And to support the several version at the same time, add union definition
|
||||
to include all the versions.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230103140238.15601-3-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 107 ++++++++++++++++--------------
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 14 ++--
|
||||
2 files changed, 64 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index a594f5c729608..be5ab2c4eefb3 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -932,8 +932,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl *prpt;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v1 *prpt_v1;
|
||||
- struct rtw89_btc_fbtc_cysta *pcysta = NULL;
|
||||
- struct rtw89_btc_fbtc_cysta_v1 *pcysta_v1 = NULL;
|
||||
+ union rtw89_btc_fbtc_cysta_info *pcysta = NULL;
|
||||
struct rtw89_btc_prpt *btc_prpt = NULL;
|
||||
void *rpt_content = NULL, *pfinfo = NULL;
|
||||
u8 rpt_type = 0;
|
||||
@@ -993,14 +992,17 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
case BTC_RPT_TYPE_CYSTA:
|
||||
pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo);
|
||||
+ pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
+ if (ver->fcxcysta == 2) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v2;
|
||||
+ pcysta->v2 = pfwinfo->rpt_fbtc_cysta.finfo.v2;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v2);
|
||||
+ } else if (ver->fcxcysta == 3) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
+ pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v3);
|
||||
} else {
|
||||
- pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
- pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo_v1);
|
||||
+ goto err;
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxcysta;
|
||||
break;
|
||||
@@ -1186,14 +1188,14 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
sizeof(dm->slot_now)));
|
||||
break;
|
||||
case BTC_RPT_TYPE_CYSTA:
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- if (le16_to_cpu(pcysta->cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
+ if (ver->fcxcysta == 2) {
|
||||
+ if (le16_to_cpu(pcysta->v2.cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
break;
|
||||
/* Check Leak-AP */
|
||||
- if (le32_to_cpu(pcysta->slot_cnt[CXST_LK]) != 0 &&
|
||||
- le32_to_cpu(pcysta->leakrx_cnt) != 0 && dm->tdma_now.rxflctrl) {
|
||||
- if (le32_to_cpu(pcysta->slot_cnt[CXST_LK]) <
|
||||
- BTC_LEAK_AP_TH * le32_to_cpu(pcysta->leakrx_cnt))
|
||||
+ if (le32_to_cpu(pcysta->v2.slot_cnt[CXST_LK]) != 0 &&
|
||||
+ le32_to_cpu(pcysta->v2.leakrx_cnt) != 0 && dm->tdma_now.rxflctrl) {
|
||||
+ if (le32_to_cpu(pcysta->v2.slot_cnt[CXST_LK]) <
|
||||
+ BTC_LEAK_AP_TH * le32_to_cpu(pcysta->v2.leakrx_cnt))
|
||||
dm->leak_ap = 1;
|
||||
}
|
||||
|
||||
@@ -1204,24 +1206,24 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
else
|
||||
wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
|
||||
- if (le16_to_cpu(pcysta->tavg_cycle[CXT_WL]) > wl_slot_set) {
|
||||
- diff_t = le16_to_cpu(pcysta->tavg_cycle[CXT_WL]) - wl_slot_set;
|
||||
+ if (le16_to_cpu(pcysta->v2.tavg_cycle[CXT_WL]) > wl_slot_set) {
|
||||
+ diff_t = le16_to_cpu(pcysta->v2.tavg_cycle[CXT_WL]) - wl_slot_set;
|
||||
_chk_btc_err(rtwdev,
|
||||
BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
}
|
||||
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- le32_to_cpu(pcysta->slot_cnt[CXST_W1]));
|
||||
+ le32_to_cpu(pcysta->v2.slot_cnt[CXST_W1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- le32_to_cpu(pcysta->slot_cnt[CXST_B1]));
|
||||
+ le32_to_cpu(pcysta->v2.slot_cnt[CXST_B1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
- le16_to_cpu(pcysta->cycles));
|
||||
- } else {
|
||||
- if (le16_to_cpu(pcysta_v1->cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
+ le16_to_cpu(pcysta->v2.cycles));
|
||||
+ } else if (ver->fcxcysta == 3) {
|
||||
+ if (le16_to_cpu(pcysta->v3.cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
break;
|
||||
|
||||
- cnt_leak_slot = le32_to_cpu(pcysta_v1->slot_cnt[CXST_LK]);
|
||||
- cnt_rx_imr = le32_to_cpu(pcysta_v1->leak_slot.cnt_rximr);
|
||||
+ cnt_leak_slot = le32_to_cpu(pcysta->v3.slot_cnt[CXST_LK]);
|
||||
+ cnt_rx_imr = le32_to_cpu(pcysta->v3.leak_slot.cnt_rximr);
|
||||
|
||||
/* Check Leak-AP */
|
||||
if (cnt_leak_slot != 0 && cnt_rx_imr != 0 &&
|
||||
@@ -1233,7 +1235,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
/* Check diff time between real WL slot and W1 slot */
|
||||
if (dm->tdma_now.type == CXTDMA_OFF) {
|
||||
wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
- wl_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_WL]);
|
||||
+ wl_slot_real = le16_to_cpu(pcysta->v3.cycle_time.tavg[CXT_WL]);
|
||||
if (wl_slot_real > wl_slot_set) {
|
||||
diff_t = wl_slot_real - wl_slot_set;
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
@@ -1244,8 +1246,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
dm->tdma_now.ext_ctrl == CXECTL_EXT &&
|
||||
btc->bt_req_len != 0) {
|
||||
- bt_slot_real = le16_to_cpu(pcysta_v1->cycle_time.tavg[CXT_BT]);
|
||||
-
|
||||
+ bt_slot_real = le16_to_cpu(pcysta->v3.cycle_time.tavg[CXT_BT]);
|
||||
if (btc->bt_req_len > bt_slot_real) {
|
||||
diff_t = btc->bt_req_len - bt_slot_real;
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_BT_SLOT_DRIFT, diff_t);
|
||||
@@ -1253,11 +1254,13 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
- le32_to_cpu(pcysta_v1->slot_cnt[CXST_W1]));
|
||||
+ le32_to_cpu(pcysta->v3.slot_cnt[CXST_W1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_B1_FREEZE,
|
||||
- le32_to_cpu(pcysta_v1->slot_cnt[CXST_B1]));
|
||||
+ le32_to_cpu(pcysta->v3.slot_cnt[CXST_B1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
- (u32)le16_to_cpu(pcysta_v1->cycles));
|
||||
+ le16_to_cpu(pcysta->v3.cycles));
|
||||
+ } else {
|
||||
+ goto err;
|
||||
}
|
||||
break;
|
||||
case BTC_RPT_TYPE_BT_VER:
|
||||
@@ -6160,21 +6163,23 @@ static void _show_dm_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
- struct rtw89_btc_fbtc_cysta *pcysta;
|
||||
- struct rtw89_btc_fbtc_cysta_v1 *pcysta_v1;
|
||||
+ union rtw89_btc_fbtc_cysta_info *pcysta;
|
||||
u32 except_cnt, exception_map;
|
||||
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
- except_cnt = le32_to_cpu(pcysta->except_cnt);
|
||||
- exception_map = le32_to_cpu(pcysta->exception);
|
||||
+ pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
+ if (ver->fcxcysta == 2) {
|
||||
+ pcysta->v2 = pfwinfo->rpt_fbtc_cysta.finfo.v2;
|
||||
+ except_cnt = le32_to_cpu(pcysta->v2.except_cnt);
|
||||
+ exception_map = le32_to_cpu(pcysta->v2.exception);
|
||||
+ } else if (ver->fcxcysta == 3) {
|
||||
+ pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
+ except_cnt = le32_to_cpu(pcysta->v3.except_cnt);
|
||||
+ exception_map = le32_to_cpu(pcysta->v3.except_map);
|
||||
} else {
|
||||
- pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
- except_cnt = le32_to_cpu(pcysta_v1->except_cnt);
|
||||
- exception_map = le32_to_cpu(pcysta_v1->except_map);
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW] == 0 && except_cnt == 0 &&
|
||||
@@ -6305,14 +6310,14 @@ static void _show_fbtc_slots(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
}
|
||||
}
|
||||
|
||||
-static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+static void _show_fbtc_cysta_v2(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
- struct rtw89_btc_fbtc_cysta *pcysta_le32 = NULL;
|
||||
+ struct rtw89_btc_fbtc_cysta_v2 *pcysta_le32 = NULL;
|
||||
union rtw89_btc_fbtc_rxflct r;
|
||||
u8 i, cnt = 0, slot_pair;
|
||||
u16 cycle, c_begin, c_end, store_index;
|
||||
@@ -6321,7 +6326,7 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
if (!pcinfo->valid)
|
||||
return;
|
||||
|
||||
- pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo;
|
||||
+ pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo.v2;
|
||||
seq_printf(m,
|
||||
" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]",
|
||||
"[cycle_cnt]",
|
||||
@@ -6433,14 +6438,14 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
}
|
||||
}
|
||||
|
||||
-static void _show_fbtc_cysta_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+static void _show_fbtc_cysta_v3(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_fbtc_a2dp_trx_stat *a2dp_trx;
|
||||
- struct rtw89_btc_fbtc_cysta_v1 *pcysta;
|
||||
+ struct rtw89_btc_fbtc_cysta_v3 *pcysta;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo;
|
||||
u8 i, cnt = 0, slot_pair, divide_cnt;
|
||||
u16 cycle, c_begin, c_end, store_index;
|
||||
@@ -6449,7 +6454,7 @@ static void _show_fbtc_cysta_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
if (!pcinfo->valid)
|
||||
return;
|
||||
|
||||
- pcysta = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
|
||||
+ pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
seq_printf(m,
|
||||
" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]",
|
||||
"[cycle_cnt]",
|
||||
@@ -6708,8 +6713,8 @@ static void _show_fbtc_step(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
static void _show_fw_dm_msg(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
|
||||
if (!(btc->dm.coex_info_map & BTC_COEX_INFO_DM))
|
||||
return;
|
||||
@@ -6718,10 +6723,10 @@ static void _show_fw_dm_msg(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
_show_fbtc_tdma(rtwdev, m);
|
||||
_show_fbtc_slots(rtwdev, m);
|
||||
|
||||
- if (chip->chip_id == RTL8852A)
|
||||
- _show_fbtc_cysta(rtwdev, m);
|
||||
- else
|
||||
- _show_fbtc_cysta_v1(rtwdev, m);
|
||||
+ if (ver->fcxcysta == 2)
|
||||
+ _show_fbtc_cysta_v2(rtwdev, m);
|
||||
+ else if (ver->fcxcysta == 3)
|
||||
+ _show_fbtc_cysta_v3(rtwdev, m);
|
||||
|
||||
_show_fbtc_nullsta(rtwdev, m);
|
||||
_show_fbtc_step(rtwdev, m);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 04450a4938cad..6af70eabb9080 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1681,7 +1681,7 @@ struct rtw89_btc_fbtc_steps_v1 {
|
||||
struct rtw89_btc_fbtc_step step[FCXMAX_STEP];
|
||||
} __packed;
|
||||
|
||||
-struct rtw89_btc_fbtc_cysta { /* statistics for cycles */
|
||||
+struct rtw89_btc_fbtc_cysta_v2 { /* statistics for cycles */
|
||||
u8 fver; /* btc_ver::fcxcysta */
|
||||
u8 rsvd;
|
||||
__le16 cycles; /* total cycle number */
|
||||
@@ -1743,7 +1743,7 @@ struct rtw89_btc_fbtc_cycle_leak_info {
|
||||
__le16 tmax; /* max leak-slot time */
|
||||
} __packed;
|
||||
|
||||
-struct rtw89_btc_fbtc_cysta_v1 { /* statistics for cycles */
|
||||
+struct rtw89_btc_fbtc_cysta_v3 { /* statistics for cycles */
|
||||
u8 fver;
|
||||
u8 rsvd;
|
||||
__le16 cycles; /* total cycle number */
|
||||
@@ -1761,6 +1761,11 @@ struct rtw89_btc_fbtc_cysta_v1 { /* statistics for cycles */
|
||||
__le32 except_map;
|
||||
} __packed;
|
||||
|
||||
+union rtw89_btc_fbtc_cysta_info {
|
||||
+ struct rtw89_btc_fbtc_cysta_v2 v2;
|
||||
+ struct rtw89_btc_fbtc_cysta_v3 v3;
|
||||
+};
|
||||
+
|
||||
struct rtw89_btc_fbtc_cynullsta { /* cycle null statistics */
|
||||
u8 fver; /* btc_ver::fcxnullsta */
|
||||
u8 rsvd;
|
||||
@@ -1961,10 +1966,7 @@ struct rtw89_btc_rpt_fbtc_slots {
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_cysta {
|
||||
struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
|
||||
- union {
|
||||
- struct rtw89_btc_fbtc_cysta finfo; /* info from fw for 52A*/
|
||||
- struct rtw89_btc_fbtc_cysta_v1 finfo_v1; /* info from fw for 52C*/
|
||||
- };
|
||||
+ union rtw89_btc_fbtc_cysta_info finfo;
|
||||
};
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_step {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,356 @@
|
||||
From 0f546e1925b08b58052d8016abae821586d6117b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 096/142] wifi: rtw89: coex: Add v4 version firmware cycle
|
||||
report
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 202c3b5c276f3f7525d9baabea7e8896d300ceff
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Tue Jan 3 22:02:34 2023 +0800
|
||||
|
||||
wifi: rtw89: coex: Add v4 version firmware cycle report
|
||||
|
||||
To support v4 version firmware cycle report, apply the related
|
||||
structure and functions. v4 cycle report add a group of status
|
||||
to show how the free-run/TDMA training goes to. It is a firmware
|
||||
mechanism that can auto adjust coexistence mode between TDMA and
|
||||
free run mechanism at 3 antenna solution.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230103140238.15601-4-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 185 ++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 67 +++++++++++
|
||||
2 files changed, 252 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index be5ab2c4eefb3..b25329d1806a4 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -1001,6 +1001,10 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v3);
|
||||
+ } else if (ver->fcxcysta == 4) {
|
||||
+ pfinfo = &pfwinfo->rpt_fbtc_cysta.finfo.v4;
|
||||
+ pcysta->v4 = pfwinfo->rpt_fbtc_cysta.finfo.v4;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_cysta.finfo.v4);
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
@@ -1259,6 +1263,48 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
le32_to_cpu(pcysta->v3.slot_cnt[CXST_B1]));
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
le16_to_cpu(pcysta->v3.cycles));
|
||||
+ } else if (ver->fcxcysta == 4) {
|
||||
+ if (le16_to_cpu(pcysta->v4.cycles) < BTC_CYSTA_CHK_PERIOD)
|
||||
+ break;
|
||||
+
|
||||
+ cnt_leak_slot = le16_to_cpu(pcysta->v4.slot_cnt[CXST_LK]);
|
||||
+ cnt_rx_imr = le32_to_cpu(pcysta->v4.leak_slot.cnt_rximr);
|
||||
+
|
||||
+ /* Check Leak-AP */
|
||||
+ if (cnt_leak_slot != 0 && cnt_rx_imr != 0 &&
|
||||
+ dm->tdma_now.rxflctrl) {
|
||||
+ if (cnt_leak_slot < BTC_LEAK_AP_TH * cnt_rx_imr)
|
||||
+ dm->leak_ap = 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Check diff time between real WL slot and W1 slot */
|
||||
+ if (dm->tdma_now.type == CXTDMA_OFF) {
|
||||
+ wl_slot_set = le16_to_cpu(dm->slot_now[CXST_W1].dur);
|
||||
+ wl_slot_real = le16_to_cpu(pcysta->v4.cycle_time.tavg[CXT_WL]);
|
||||
+ if (wl_slot_real > wl_slot_set) {
|
||||
+ diff_t = wl_slot_real - wl_slot_set;
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Check diff time between real BT slot and EBT/E5G slot */
|
||||
+ if (dm->tdma_now.type == CXTDMA_OFF &&
|
||||
+ dm->tdma_now.ext_ctrl == CXECTL_EXT &&
|
||||
+ btc->bt_req_len != 0) {
|
||||
+ bt_slot_real = le16_to_cpu(pcysta->v4.cycle_time.tavg[CXT_BT]);
|
||||
+
|
||||
+ if (btc->bt_req_len > bt_slot_real) {
|
||||
+ diff_t = btc->bt_req_len - bt_slot_real;
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_BT_SLOT_DRIFT, diff_t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE,
|
||||
+ le16_to_cpu(pcysta->v4.slot_cnt[CXST_W1]));
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_B1_FREEZE,
|
||||
+ le16_to_cpu(pcysta->v4.slot_cnt[CXST_B1]));
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE,
|
||||
+ le16_to_cpu(pcysta->v4.cycles));
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
@@ -6178,6 +6224,10 @@ static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
pcysta->v3 = pfwinfo->rpt_fbtc_cysta.finfo.v3;
|
||||
except_cnt = le32_to_cpu(pcysta->v3.except_cnt);
|
||||
exception_map = le32_to_cpu(pcysta->v3.except_map);
|
||||
+ } else if (ver->fcxcysta == 4) {
|
||||
+ pcysta->v4 = pfwinfo->rpt_fbtc_cysta.finfo.v4;
|
||||
+ except_cnt = pcysta->v4.except_cnt;
|
||||
+ exception_map = le32_to_cpu(pcysta->v4.except_map);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -6569,6 +6619,139 @@ static void _show_fbtc_cysta_v3(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
}
|
||||
}
|
||||
|
||||
+static void _show_fbtc_cysta_v4(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+{
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
|
||||
+ struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
+ struct rtw89_btc_dm *dm = &btc->dm;
|
||||
+ struct rtw89_btc_fbtc_a2dp_trx_stat_v4 *a2dp_trx;
|
||||
+ struct rtw89_btc_fbtc_cysta_v4 *pcysta;
|
||||
+ struct rtw89_btc_rpt_cmn_info *pcinfo;
|
||||
+ u8 i, cnt = 0, slot_pair, divide_cnt;
|
||||
+ u16 cycle, c_begin, c_end, store_index;
|
||||
+
|
||||
+ pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;
|
||||
+ if (!pcinfo->valid)
|
||||
+ return;
|
||||
+
|
||||
+ pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v4;
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]",
|
||||
+ "[cycle_cnt]",
|
||||
+ le16_to_cpu(pcysta->cycles),
|
||||
+ le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL]),
|
||||
+ le16_to_cpu(pcysta->bcn_cnt[CXBCN_ALL_OK]),
|
||||
+ le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_SLOT]),
|
||||
+ le16_to_cpu(pcysta->bcn_cnt[CXBCN_BT_OK]));
|
||||
+
|
||||
+ for (i = 0; i < CXST_MAX; i++) {
|
||||
+ if (!le16_to_cpu(pcysta->slot_cnt[i]))
|
||||
+ continue;
|
||||
+
|
||||
+ seq_printf(m, ", %s:%d", id_to_slot(i),
|
||||
+ le16_to_cpu(pcysta->slot_cnt[i]));
|
||||
+ }
|
||||
+
|
||||
+ if (dm->tdma_now.rxflctrl)
|
||||
+ seq_printf(m, ", leak_rx:%d",
|
||||
+ le32_to_cpu(pcysta->leak_slot.cnt_rximr));
|
||||
+
|
||||
+ if (pcysta->collision_cnt)
|
||||
+ seq_printf(m, ", collision:%d", pcysta->collision_cnt);
|
||||
+
|
||||
+ if (le16_to_cpu(pcysta->skip_cnt))
|
||||
+ seq_printf(m, ", skip:%d",
|
||||
+ le16_to_cpu(pcysta->skip_cnt));
|
||||
+
|
||||
+ seq_puts(m, "\n");
|
||||
+
|
||||
+ seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]",
|
||||
+ "[cycle_time]",
|
||||
+ le16_to_cpu(pcysta->cycle_time.tavg[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta->cycle_time.tavg[CXT_BT]),
|
||||
+ le16_to_cpu(pcysta->leak_slot.tavg) / 1000,
|
||||
+ le16_to_cpu(pcysta->leak_slot.tavg) % 1000);
|
||||
+ seq_printf(m,
|
||||
+ ", max_t[wl:%d/bt:%d/lk:%d.%03d]",
|
||||
+ le16_to_cpu(pcysta->cycle_time.tmax[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta->cycle_time.tmax[CXT_BT]),
|
||||
+ le16_to_cpu(pcysta->leak_slot.tmax) / 1000,
|
||||
+ le16_to_cpu(pcysta->leak_slot.tmax) % 1000);
|
||||
+ seq_printf(m,
|
||||
+ ", maxdiff_t[wl:%d/bt:%d]\n",
|
||||
+ le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_WL]),
|
||||
+ le16_to_cpu(pcysta->cycle_time.tmaxdiff[CXT_BT]));
|
||||
+
|
||||
+ cycle = le16_to_cpu(pcysta->cycles);
|
||||
+ if (cycle == 0)
|
||||
+ return;
|
||||
+
|
||||
+ /* 1 cycle record 1 wl-slot and 1 bt-slot */
|
||||
+ slot_pair = BTC_CYCLE_SLOT_MAX / 2;
|
||||
+
|
||||
+ if (cycle <= slot_pair)
|
||||
+ c_begin = 1;
|
||||
+ else
|
||||
+ c_begin = cycle - slot_pair + 1;
|
||||
+
|
||||
+ c_end = cycle;
|
||||
+
|
||||
+ if (a2dp->exist)
|
||||
+ divide_cnt = 3;
|
||||
+ else
|
||||
+ divide_cnt = BTC_CYCLE_SLOT_MAX / 4;
|
||||
+
|
||||
+ for (cycle = c_begin; cycle <= c_end; cycle++) {
|
||||
+ cnt++;
|
||||
+ store_index = ((cycle - 1) % slot_pair) * 2;
|
||||
+
|
||||
+ if (cnt % divide_cnt == 1) {
|
||||
+ seq_printf(m, "\n\r %-15s : ", "[cycle_step]");
|
||||
+ } else {
|
||||
+ seq_printf(m, "->b%02d",
|
||||
+ le16_to_cpu(pcysta->slot_step_time[store_index]));
|
||||
+ if (a2dp->exist) {
|
||||
+ a2dp_trx = &pcysta->a2dp_trx[store_index];
|
||||
+ seq_printf(m, "(%d/%d/%dM/%d/%d/%d)",
|
||||
+ a2dp_trx->empty_cnt,
|
||||
+ a2dp_trx->retry_cnt,
|
||||
+ a2dp_trx->tx_rate ? 3 : 2,
|
||||
+ a2dp_trx->tx_cnt,
|
||||
+ a2dp_trx->ack_cnt,
|
||||
+ a2dp_trx->nack_cnt);
|
||||
+ }
|
||||
+ seq_printf(m, "->w%02d",
|
||||
+ le16_to_cpu(pcysta->slot_step_time[store_index + 1]));
|
||||
+ if (a2dp->exist) {
|
||||
+ a2dp_trx = &pcysta->a2dp_trx[store_index + 1];
|
||||
+ seq_printf(m, "(%d/%d/%dM/%d/%d/%d)",
|
||||
+ a2dp_trx->empty_cnt,
|
||||
+ a2dp_trx->retry_cnt,
|
||||
+ a2dp_trx->tx_rate ? 3 : 2,
|
||||
+ a2dp_trx->tx_cnt,
|
||||
+ a2dp_trx->ack_cnt,
|
||||
+ a2dp_trx->nack_cnt);
|
||||
+ }
|
||||
+ }
|
||||
+ if (cnt % (BTC_CYCLE_SLOT_MAX / 4) == 0 || cnt == c_end)
|
||||
+ seq_puts(m, "\n");
|
||||
+ }
|
||||
+
|
||||
+ if (a2dp->exist) {
|
||||
+ seq_printf(m, "%-15s : a2dp_ept:%d, a2dp_late:%d",
|
||||
+ "[a2dp_t_sta]",
|
||||
+ le16_to_cpu(pcysta->a2dp_ept.cnt),
|
||||
+ le16_to_cpu(pcysta->a2dp_ept.cnt_timeout));
|
||||
+
|
||||
+ seq_printf(m, ", avg_t:%d, max_t:%d",
|
||||
+ le16_to_cpu(pcysta->a2dp_ept.tavg),
|
||||
+ le16_to_cpu(pcysta->a2dp_ept.tmax));
|
||||
+
|
||||
+ seq_puts(m, "\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void _show_fbtc_nullsta(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
@@ -6727,6 +6910,8 @@ static void _show_fw_dm_msg(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
_show_fbtc_cysta_v2(rtwdev, m);
|
||||
else if (ver->fcxcysta == 3)
|
||||
_show_fbtc_cysta_v3(rtwdev, m);
|
||||
+ else if (ver->fcxcysta == 4)
|
||||
+ _show_fbtc_cysta_v4(rtwdev, m);
|
||||
|
||||
_show_fbtc_nullsta(rtwdev, m);
|
||||
_show_fbtc_step(rtwdev, m);
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 6af70eabb9080..9f4cb83a8326f 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1730,6 +1730,17 @@ struct rtw89_btc_fbtc_a2dp_trx_stat {
|
||||
u8 rsvd2;
|
||||
} __packed;
|
||||
|
||||
+struct rtw89_btc_fbtc_a2dp_trx_stat_v4 {
|
||||
+ u8 empty_cnt;
|
||||
+ u8 retry_cnt;
|
||||
+ u8 tx_rate;
|
||||
+ u8 tx_cnt;
|
||||
+ u8 ack_cnt;
|
||||
+ u8 nack_cnt;
|
||||
+ u8 no_empty_cnt;
|
||||
+ u8 rsvd;
|
||||
+} __packed;
|
||||
+
|
||||
struct rtw89_btc_fbtc_cycle_a2dp_empty_info {
|
||||
__le16 cnt; /* a2dp empty cnt */
|
||||
__le16 cnt_timeout; /* a2dp empty timeout cnt*/
|
||||
@@ -1743,6 +1754,34 @@ struct rtw89_btc_fbtc_cycle_leak_info {
|
||||
__le16 tmax; /* max leak-slot time */
|
||||
} __packed;
|
||||
|
||||
+#define RTW89_BTC_FDDT_PHASE_CYCLE GENMASK(9, 0)
|
||||
+#define RTW89_BTC_FDDT_TRAIN_STEP GENMASK(15, 10)
|
||||
+
|
||||
+struct rtw89_btc_fbtc_cycle_fddt_info {
|
||||
+ __le16 train_cycle;
|
||||
+ __le16 tp;
|
||||
+
|
||||
+ s8 tx_power; /* absolute Tx power (dBm), 0xff-> no BTC control */
|
||||
+ s8 bt_tx_power; /* decrease Tx power (dB) */
|
||||
+ s8 bt_rx_gain; /* LNA constrain level */
|
||||
+ u8 no_empty_cnt;
|
||||
+
|
||||
+ u8 rssi; /* [7:4] -> bt_rssi_level, [3:0]-> wl_rssi_level */
|
||||
+ u8 cn; /* condition_num */
|
||||
+ u8 train_status; /* [7:4]-> train-state, [3:0]-> train-phase */
|
||||
+ u8 train_result; /* refer to enum btc_fddt_check_map */
|
||||
+} __packed;
|
||||
+
|
||||
+#define RTW89_BTC_FDDT_CELL_TRAIN_STATE GENMASK(3, 0)
|
||||
+#define RTW89_BTC_FDDT_CELL_TRAIN_PHASE GENMASK(7, 4)
|
||||
+
|
||||
+struct rtw89_btc_fbtc_fddt_cell_status {
|
||||
+ s8 wl_tx_pwr;
|
||||
+ s8 bt_tx_pwr;
|
||||
+ s8 bt_rx_gain;
|
||||
+ u8 state_phase; /* [0:3] train state, [4:7] train phase */
|
||||
+} __packed;
|
||||
+
|
||||
struct rtw89_btc_fbtc_cysta_v3 { /* statistics for cycles */
|
||||
u8 fver;
|
||||
u8 rsvd;
|
||||
@@ -1761,9 +1800,37 @@ struct rtw89_btc_fbtc_cysta_v3 { /* statistics for cycles */
|
||||
__le32 except_map;
|
||||
} __packed;
|
||||
|
||||
+#define FDD_TRAIN_WL_DIRECTION 2
|
||||
+#define FDD_TRAIN_WL_RSSI_LEVEL 5
|
||||
+#define FDD_TRAIN_BT_RSSI_LEVEL 5
|
||||
+
|
||||
+struct rtw89_btc_fbtc_cysta_v4 { /* statistics for cycles */
|
||||
+ u8 fver;
|
||||
+ u8 rsvd;
|
||||
+ u8 collision_cnt; /* counter for event/timer occur at the same time */
|
||||
+ u8 except_cnt;
|
||||
+
|
||||
+ __le16 skip_cnt;
|
||||
+ __le16 cycles; /* total cycle number */
|
||||
+
|
||||
+ __le16 slot_step_time[BTC_CYCLE_SLOT_MAX]; /* record the wl/bt slot time */
|
||||
+ __le16 slot_cnt[CXST_MAX]; /* slot count */
|
||||
+ __le16 bcn_cnt[CXBCN_MAX];
|
||||
+ struct rtw89_btc_fbtc_cycle_time_info cycle_time;
|
||||
+ struct rtw89_btc_fbtc_cycle_leak_info leak_slot;
|
||||
+ struct rtw89_btc_fbtc_cycle_a2dp_empty_info a2dp_ept;
|
||||
+ struct rtw89_btc_fbtc_a2dp_trx_stat_v4 a2dp_trx[BTC_CYCLE_SLOT_MAX];
|
||||
+ struct rtw89_btc_fbtc_cycle_fddt_info fddt_trx[BTC_CYCLE_SLOT_MAX];
|
||||
+ struct rtw89_btc_fbtc_fddt_cell_status fddt_cells[FDD_TRAIN_WL_DIRECTION]
|
||||
+ [FDD_TRAIN_WL_RSSI_LEVEL]
|
||||
+ [FDD_TRAIN_BT_RSSI_LEVEL];
|
||||
+ __le32 except_map;
|
||||
+} __packed;
|
||||
+
|
||||
union rtw89_btc_fbtc_cysta_info {
|
||||
struct rtw89_btc_fbtc_cysta_v2 v2;
|
||||
struct rtw89_btc_fbtc_cysta_v3 v3;
|
||||
+ struct rtw89_btc_fbtc_cysta_v4 v4;
|
||||
};
|
||||
|
||||
struct rtw89_btc_fbtc_cynullsta { /* cycle null statistics */
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,263 @@
|
||||
From cccdf6b4a31c2f1adc4fe88280118da42c6bfdb6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:34 +0200
|
||||
Subject: [PATCH 097/142] wifi: rtw89: coex: Change firmware control report to
|
||||
version separate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit b02e3f5c344d62da86afbc6444638a9beb375f2e
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Tue Jan 3 22:02:35 2023 +0800
|
||||
|
||||
wifi: rtw89: coex: Change firmware control report to version separate
|
||||
|
||||
The rtw89 driver may support more than 1 version of Wi-Fi firmware for
|
||||
certain chips. In order to support all the firmware, change to select logic
|
||||
by firmware feature version code. Type control version 4 will monitor
|
||||
Bluetooth PTA hardware counters at firmware and C2H to driver, but
|
||||
version 1 will not do this.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230103140238.15601-5-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 76 ++++++++++++++++---------------
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 14 +++---
|
||||
2 files changed, 48 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index b25329d1806a4..e5aa0d663cdd6 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -930,8 +930,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl *prpt;
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl_v1 *prpt_v1;
|
||||
+ union rtw89_btc_fbtc_rpt_ctrl_ver_info *prpt = NULL;
|
||||
union rtw89_btc_fbtc_cysta_info *pcysta = NULL;
|
||||
struct rtw89_btc_prpt *btc_prpt = NULL;
|
||||
void *rpt_content = NULL, *pfinfo = NULL;
|
||||
@@ -962,12 +961,15 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
switch (rpt_type) {
|
||||
case BTC_RPT_TYPE_CTRL:
|
||||
pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- pfinfo = &pfwinfo->rpt_ctrl.finfo;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo);
|
||||
+ prpt = &pfwinfo->rpt_ctrl.finfo;
|
||||
+ if (ver->fcxbtcrpt == 1) {
|
||||
+ pfinfo = &pfwinfo->rpt_ctrl.finfo.v1;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v1);
|
||||
+ } else if (ver->fcxbtcrpt == 4) {
|
||||
+ pfinfo = &pfwinfo->rpt_ctrl.finfo.v4;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v4);
|
||||
} else {
|
||||
- pfinfo = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
- pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo_v1);
|
||||
+ goto err;
|
||||
}
|
||||
pcinfo->req_fver = ver->fcxbtcrpt;
|
||||
break;
|
||||
@@ -1109,12 +1111,12 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
|
||||
switch (rpt_type) {
|
||||
case BTC_RPT_TYPE_CTRL:
|
||||
- if (chip->chip_id == RTL8852A) {
|
||||
- prpt = &pfwinfo->rpt_ctrl.finfo;
|
||||
- btc->fwinfo.rpt_en_map = prpt->rpt_enable;
|
||||
- wl->ver_info.fw_coex = prpt->wl_fw_coex_ver;
|
||||
- wl->ver_info.fw = prpt->wl_fw_ver;
|
||||
- dm->wl_fw_cx_offload = !!prpt->wl_fw_cx_offload;
|
||||
+ if (ver->fcxbtcrpt == 1) {
|
||||
+ prpt->v1 = pfwinfo->rpt_ctrl.finfo.v1;
|
||||
+ btc->fwinfo.rpt_en_map = prpt->v1.rpt_enable;
|
||||
+ wl->ver_info.fw_coex = prpt->v1.wl_fw_coex_ver;
|
||||
+ wl->ver_info.fw = prpt->v1.wl_fw_ver;
|
||||
+ dm->wl_fw_cx_offload = !!prpt->v1.wl_fw_cx_offload;
|
||||
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
pfwinfo->event[BTF_EVNT_RPT]);
|
||||
@@ -1129,38 +1131,40 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
rtw89_mac_get_plt_cnt(rtwdev,
|
||||
RTW89_MAC_0);
|
||||
}
|
||||
- } else {
|
||||
- prpt_v1 = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
- btc->fwinfo.rpt_en_map = le32_to_cpu(prpt_v1->rpt_info.en);
|
||||
- wl->ver_info.fw_coex = le32_to_cpu(prpt_v1->wl_fw_info.cx_ver);
|
||||
- wl->ver_info.fw = le32_to_cpu(prpt_v1->wl_fw_info.fw_ver);
|
||||
- dm->wl_fw_cx_offload = !!le32_to_cpu(prpt_v1->wl_fw_info.cx_offload);
|
||||
+ } else if (ver->fcxbtcrpt == 4) {
|
||||
+ prpt->v4 = pfwinfo->rpt_ctrl.finfo.v4;
|
||||
+ btc->fwinfo.rpt_en_map = le32_to_cpu(prpt->v4.rpt_info.en);
|
||||
+ wl->ver_info.fw_coex = le32_to_cpu(prpt->v4.wl_fw_info.cx_ver);
|
||||
+ wl->ver_info.fw = le32_to_cpu(prpt->v4.wl_fw_info.fw_ver);
|
||||
+ dm->wl_fw_cx_offload = !!le32_to_cpu(prpt->v4.wl_fw_info.cx_offload);
|
||||
|
||||
for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
||||
- memcpy(&dm->gnt.band[i], &prpt_v1->gnt_val[i],
|
||||
+ memcpy(&dm->gnt.band[i], &prpt->v4.gnt_val[i],
|
||||
sizeof(dm->gnt.band[i]));
|
||||
|
||||
btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] =
|
||||
- le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_TX]);
|
||||
+ le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_HI_TX]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] =
|
||||
- le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_HI_RX]);
|
||||
+ le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_HI_RX]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] =
|
||||
- le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_TX]);
|
||||
+ le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_LO_TX]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] =
|
||||
- le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_LO_RX]);
|
||||
+ le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_LO_RX]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
||||
- le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_POLLUTED]);
|
||||
+ le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_POLLUTED]);
|
||||
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
pfwinfo->event[BTF_EVNT_RPT]);
|
||||
|
||||
- if (le32_to_cpu(prpt_v1->bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0)
|
||||
+ if (le32_to_cpu(prpt->v4.bt_cnt[BTC_BCNT_RFK_TIMEOUT]) > 0)
|
||||
bt->rfk_info.map.timeout = 1;
|
||||
else
|
||||
bt->rfk_info.map.timeout = 0;
|
||||
|
||||
dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
+ } else {
|
||||
+ goto err;
|
||||
}
|
||||
break;
|
||||
case BTC_RPT_TYPE_TDMA:
|
||||
@@ -7061,12 +7065,12 @@ static void _show_mreg(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
seq_puts(m, "\n");
|
||||
}
|
||||
|
||||
-static void _show_summary(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl *prptctrl = NULL;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v1 *prptctrl = NULL;
|
||||
struct rtw89_btc_cx *cx = &btc->cx;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_wl_info *wl = &cx->wl;
|
||||
@@ -7081,7 +7085,7 @@ static void _show_summary(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
||||
if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) {
|
||||
- prptctrl = &pfwinfo->rpt_ctrl.finfo;
|
||||
+ prptctrl = &pfwinfo->rpt_ctrl.finfo.v1;
|
||||
|
||||
seq_printf(m,
|
||||
" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ",
|
||||
@@ -7165,11 +7169,11 @@ static void _show_summary(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
cnt[BTC_NCNT_CUSTOMERIZE]);
|
||||
}
|
||||
|
||||
-static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+static void _show_summary_v4(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl_v1 *prptctrl;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v4 *prptctrl;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo;
|
||||
struct rtw89_btc_cx *cx = &btc->cx;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
@@ -7185,7 +7189,7 @@ static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
||||
if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) {
|
||||
- prptctrl = &pfwinfo->rpt_ctrl.finfo_v1;
|
||||
+ prptctrl = &pfwinfo->rpt_ctrl.finfo.v4;
|
||||
|
||||
seq_printf(m,
|
||||
" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), ",
|
||||
@@ -7279,9 +7283,9 @@ static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
|
||||
void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_fw_suit *fw_suit = &rtwdev->fw.normal;
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_cx *cx = &btc->cx;
|
||||
struct rtw89_btc_bt_info *bt = &cx->bt;
|
||||
|
||||
@@ -7310,10 +7314,10 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
_show_dm_info(rtwdev, m);
|
||||
_show_fw_dm_msg(rtwdev, m);
|
||||
_show_mreg(rtwdev, m);
|
||||
- if (chip->chip_id == RTL8852A)
|
||||
- _show_summary(rtwdev, m);
|
||||
- else
|
||||
+ if (ver->fcxbtcrpt == 1)
|
||||
_show_summary_v1(rtwdev, m);
|
||||
+ else if (ver->fcxbtcrpt == 4)
|
||||
+ _show_summary_v4(rtwdev, m);
|
||||
}
|
||||
|
||||
void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 9f4cb83a8326f..384eb9cb92240 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1480,7 +1480,7 @@ enum rtw89_btc_bt_sta_counter {
|
||||
BTC_BCNT_STA_MAX
|
||||
};
|
||||
|
||||
-struct rtw89_btc_fbtc_rpt_ctrl {
|
||||
+struct rtw89_btc_fbtc_rpt_ctrl_v1 {
|
||||
u16 fver; /* btc_ver::fcxbtcrpt */
|
||||
u16 rpt_cnt; /* tmr counters */
|
||||
u32 wl_fw_coex_ver; /* match which driver's coex version */
|
||||
@@ -1533,7 +1533,7 @@ struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox {
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_a2dp_empty a2dp;
|
||||
} __packed;
|
||||
|
||||
-struct rtw89_btc_fbtc_rpt_ctrl_v1 {
|
||||
+struct rtw89_btc_fbtc_rpt_ctrl_v4 {
|
||||
u8 fver;
|
||||
u8 rsvd;
|
||||
__le16 rsvd1;
|
||||
@@ -1544,6 +1544,11 @@ struct rtw89_btc_fbtc_rpt_ctrl_v1 {
|
||||
struct rtw89_mac_ax_gnt gnt_val[RTW89_PHY_MAX];
|
||||
} __packed;
|
||||
|
||||
+union rtw89_btc_fbtc_rpt_ctrl_ver_info {
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v1 v1;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v4 v4;
|
||||
+};
|
||||
+
|
||||
enum rtw89_fbtc_ext_ctrl_type {
|
||||
CXECTL_OFF = 0x0, /* tdma off */
|
||||
CXECTL_B2 = 0x1, /* allow B2 (beacon-early) */
|
||||
@@ -2015,10 +2020,7 @@ union rtw89_btc_fbtc_btafh_info {
|
||||
|
||||
struct rtw89_btc_report_ctrl_state {
|
||||
struct rtw89_btc_rpt_cmn_info cinfo; /* common info, by driver */
|
||||
- union {
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl finfo; /* info from fw for 52A*/
|
||||
- struct rtw89_btc_fbtc_rpt_ctrl_v1 finfo_v1; /* info from fw for 52C*/
|
||||
- };
|
||||
+ union rtw89_btc_fbtc_rpt_ctrl_ver_info finfo;
|
||||
};
|
||||
|
||||
struct rtw89_btc_rpt_fbtc_tdma {
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,262 @@
|
||||
From ca948c733764cc5e27c0b067e1186aa4a53af585 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Wed, 24 May 2023 15:00:35 +0200
|
||||
Subject: [PATCH 098/142] wifi: rtw89: coex: Add v5 firmware control report
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/2207499
|
||||
|
||||
commit 0c06fd47335ab9bbcbca250267eb22227e98ffa4
|
||||
Author: Ching-Te Ku <ku920601@realtek.com>
|
||||
Date: Tue Jan 3 22:02:36 2023 +0800
|
||||
|
||||
wifi: rtw89: coex: Add v5 firmware control report
|
||||
|
||||
Comparing v5 control report to v4 version, v5 reduce some of variable's
|
||||
size to reduce firmware code size. And change the grant signal report
|
||||
format.
|
||||
|
||||
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||||
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||||
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230103140238.15601-6-pkshih@realtek.com
|
||||
|
||||
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw89/coex.c | 148 ++++++++++++++++++++++++++++++
|
||||
drivers/net/wireless/realtek/rtw89/core.h | 27 ++++++
|
||||
2 files changed, 175 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
index e5aa0d663cdd6..21d1011d50c9d 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||||
@@ -968,6 +968,9 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
} else if (ver->fcxbtcrpt == 4) {
|
||||
pfinfo = &pfwinfo->rpt_ctrl.finfo.v4;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v4);
|
||||
+ } else if (ver->fcxbtcrpt == 5) {
|
||||
+ pfinfo = &pfwinfo->rpt_ctrl.finfo.v5;
|
||||
+ pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v5);
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
@@ -1163,6 +1166,33 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
bt->rfk_info.map.timeout = 0;
|
||||
|
||||
dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
+ } else if (ver->fcxbtcrpt == 5) {
|
||||
+ prpt->v5 = pfwinfo->rpt_ctrl.finfo.v5;
|
||||
+ pfwinfo->rpt_en_map = le32_to_cpu(prpt->v5.rpt_info.en);
|
||||
+ wl->ver_info.fw_coex = le32_to_cpu(prpt->v5.rpt_info.cx_ver);
|
||||
+ wl->ver_info.fw = le32_to_cpu(prpt->v5.rpt_info.fw_ver);
|
||||
+ dm->wl_fw_cx_offload = 0;
|
||||
+
|
||||
+ for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
||||
+ memcpy(&dm->gnt.band[i], &prpt->v5.gnt_val[i][0],
|
||||
+ sizeof(dm->gnt.band[i]));
|
||||
+
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] =
|
||||
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_TX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] =
|
||||
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_RX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] =
|
||||
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_TX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] =
|
||||
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_RX]);
|
||||
+ btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
||||
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_POLLUTED]);
|
||||
+
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
||||
+ _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
||||
+ pfwinfo->event[BTF_EVNT_RPT]);
|
||||
+
|
||||
+ dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
@@ -7281,6 +7311,122 @@ static void _show_summary_v4(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
cnt[BTC_NCNT_CUSTOMERIZE]);
|
||||
}
|
||||
|
||||
+static void _show_summary_v5(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
+{
|
||||
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||||
+ struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v5 *prptctrl;
|
||||
+ struct rtw89_btc_rpt_cmn_info *pcinfo;
|
||||
+ struct rtw89_btc_cx *cx = &btc->cx;
|
||||
+ struct rtw89_btc_dm *dm = &btc->dm;
|
||||
+ struct rtw89_btc_wl_info *wl = &cx->wl;
|
||||
+ u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify;
|
||||
+ u8 i;
|
||||
+
|
||||
+ if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY))
|
||||
+ return;
|
||||
+
|
||||
+ seq_puts(m, "========== [Statistics] ==========\n");
|
||||
+
|
||||
+ pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
||||
+ if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) {
|
||||
+ prptctrl = &pfwinfo->rpt_ctrl.finfo.v5;
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d, len:%d), ",
|
||||
+ "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail,
|
||||
+ le16_to_cpu(prptctrl->rpt_info.cnt_h2c),
|
||||
+ pfwinfo->cnt_c2h,
|
||||
+ le16_to_cpu(prptctrl->rpt_info.cnt_c2h),
|
||||
+ le16_to_cpu(prptctrl->rpt_info.len_c2h));
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ "rpt_cnt=%d(fw_send:%d), rpt_map=0x%x",
|
||||
+ pfwinfo->event[BTF_EVNT_RPT],
|
||||
+ le16_to_cpu(prptctrl->rpt_info.cnt),
|
||||
+ le32_to_cpu(prptctrl->rpt_info.en));
|
||||
+
|
||||
+ if (dm->error.map.wl_fw_hang)
|
||||
+ seq_puts(m, " (WL FW Hang!!)");
|
||||
+ seq_puts(m, "\n");
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : send_ok:%d, send_fail:%d, recv:%d, ",
|
||||
+ "[mailbox]",
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv));
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ "A2DP_empty:%d(stop:%d, tx:%d, ack:%d, nack:%d)\n",
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack),
|
||||
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack));
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d]",
|
||||
+ "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ],
|
||||
+ cx->cnt_wl[BTC_WCNT_RFK_GO],
|
||||
+ cx->cnt_wl[BTC_WCNT_RFK_REJECT],
|
||||
+ cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]);
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ ", bt_rfk[req:%d]",
|
||||
+ le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ]));
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ ", AOAC[RF_on:%d/RF_off:%d]",
|
||||
+ le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on),
|
||||
+ le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off));
|
||||
+ } else {
|
||||
+ seq_puts(m, "\n");
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d",
|
||||
+ "[summary]", pfwinfo->cnt_h2c,
|
||||
+ pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h);
|
||||
+ }
|
||||
+
|
||||
+ if (!pcinfo->valid || pfwinfo->len_mismch || pfwinfo->fver_mismch ||
|
||||
+ pfwinfo->err[BTFRE_EXCEPTION]) {
|
||||
+ seq_puts(m, "\n");
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : WL FW rpt error!![rpt_ctrl_valid:%d/len:"
|
||||
+ "0x%x/ver:0x%x/ex:%d/lps=%d/rf_off=%d]",
|
||||
+ "[ERROR]", pcinfo->valid, pfwinfo->len_mismch,
|
||||
+ pfwinfo->fver_mismch, pfwinfo->err[BTFRE_EXCEPTION],
|
||||
+ wl->status.map.lps, wl->status.map.rf_off);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < BTC_NCNT_NUM; i++)
|
||||
+ cnt_sum += dm->cnt_notify[i];
|
||||
+
|
||||
+ seq_puts(m, "\n");
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ",
|
||||
+ "[notify_cnt]",
|
||||
+ cnt_sum, cnt[BTC_NCNT_SHOW_COEX_INFO],
|
||||
+ cnt[BTC_NCNT_POWER_ON], cnt[BTC_NCNT_INIT_COEX]);
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ "power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d",
|
||||
+ cnt[BTC_NCNT_POWER_OFF], cnt[BTC_NCNT_RADIO_STATE],
|
||||
+ cnt[BTC_NCNT_ROLE_INFO], cnt[BTC_NCNT_WL_RFK],
|
||||
+ cnt[BTC_NCNT_WL_STA]);
|
||||
+
|
||||
+ seq_puts(m, "\n");
|
||||
+ seq_printf(m,
|
||||
+ " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ",
|
||||
+ "[notify_cnt]",
|
||||
+ cnt[BTC_NCNT_SCAN_START], cnt[BTC_NCNT_SCAN_FINISH],
|
||||
+ cnt[BTC_NCNT_SWITCH_BAND], cnt[BTC_NCNT_SPECIAL_PACKET]);
|
||||
+
|
||||
+ seq_printf(m,
|
||||
+ "timer=%d, control=%d, customerize=%d",
|
||||
+ cnt[BTC_NCNT_TIMER], cnt[BTC_NCNT_CONTROL],
|
||||
+ cnt[BTC_NCNT_CUSTOMERIZE]);
|
||||
+}
|
||||
+
|
||||
void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_fw_suit *fw_suit = &rtwdev->fw.normal;
|
||||
@@ -7318,6 +7464,8 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
_show_summary_v1(rtwdev, m);
|
||||
else if (ver->fcxbtcrpt == 4)
|
||||
_show_summary_v4(rtwdev, m);
|
||||
+ else if (ver->fcxbtcrpt == 5)
|
||||
+ _show_summary_v5(rtwdev, m);
|
||||
}
|
||||
|
||||
void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev)
|
||||
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
index 384eb9cb92240..d0b4c00324572 100644
|
||||
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
||||
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
||||
@@ -1512,6 +1512,20 @@ struct rtw89_btc_fbtc_rpt_ctrl_info {
|
||||
__le32 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
|
||||
} __packed;
|
||||
|
||||
+struct rtw89_btc_fbtc_rpt_ctrl_info_v5 {
|
||||
+ __le32 cx_ver; /* match which driver's coex version */
|
||||
+ __le32 fw_ver;
|
||||
+ __le32 en; /* report map */
|
||||
+
|
||||
+ __le16 cnt; /* fw report counter */
|
||||
+ __le16 cnt_c2h; /* fw send c2h counter */
|
||||
+ __le16 cnt_h2c; /* fw recv h2c counter */
|
||||
+ __le16 len_c2h; /* The total length of the last C2H */
|
||||
+
|
||||
+ __le16 cnt_aoac_rf_on; /* rf-on counter for aoac switch notify */
|
||||
+ __le16 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
|
||||
+} __packed;
|
||||
+
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_wl_fw_info {
|
||||
__le32 cx_ver; /* match which driver's coex version */
|
||||
__le32 cx_offload;
|
||||
@@ -1544,9 +1558,22 @@ struct rtw89_btc_fbtc_rpt_ctrl_v4 {
|
||||
struct rtw89_mac_ax_gnt gnt_val[RTW89_PHY_MAX];
|
||||
} __packed;
|
||||
|
||||
+struct rtw89_btc_fbtc_rpt_ctrl_v5 {
|
||||
+ u8 fver;
|
||||
+ u8 rsvd;
|
||||
+ __le16 rsvd1;
|
||||
+
|
||||
+ u8 gnt_val[RTW89_PHY_MAX][4];
|
||||
+ __le16 bt_cnt[BTC_BCNT_STA_MAX];
|
||||
+
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_info_v5 rpt_info;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
|
||||
+} __packed;
|
||||
+
|
||||
union rtw89_btc_fbtc_rpt_ctrl_ver_info {
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v1 v1;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v4 v4;
|
||||
+ struct rtw89_btc_fbtc_rpt_ctrl_v5 v5;
|
||||
};
|
||||
|
||||
enum rtw89_fbtc_ext_ctrl_type {
|
||||
--
|
||||
2.13.6
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue