Commit Graph

127 Commits

Author SHA1 Message Date
Zong-Zhe Yang
a3edb20146 wifi: rtw89: 8852b: fill the missing configuration about queue empty checking
The configurations, wde_qempty_acq_num and wde_qempty_mgq_sel, are used
when MAC checks if TX queues are empty. Fill the corresponding setting
for 8852B.

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/20230113090632.60957-5-pkshih@realtek.com
2023-01-16 15:38:12 +02:00
Ching-Te Ku
447a3267cb wifi: rtw89: coex: Change RTL8852B use v1 TDMA policy
RTL8852B support the new features like TDMA instant (Change TDMA mechanism
immediately), Co-RX feature (Wi-Fi/Bluetooth can RX in the same time) and
so on. The v1 TDMA policy will enable those newer mechanism. It will have
a better coexistence performance.

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/20230106120844.17441-7-pkshih@realtek.com
2023-01-16 15:36:58 +02:00
Eric Huang
a48f4fd05d 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
2022-12-21 20:50:16 +02:00
Ping-Ke Shih
1fc4a874ff 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
2022-12-21 20:49:24 +02:00
Ping-Ke Shih
a215b2b705 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
2022-12-01 13:02:31 +02:00
Eric Huang
29136c95fd 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
2022-11-22 12:15:30 +02:00
Eric Huang
10cd4092f6 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
2022-11-22 12:15:30 +02:00
Ping-Ke Shih
79ca91a3c1 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
2022-11-22 12:15:01 +02:00
Ping-Ke Shih
ef8acbcac6 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
2022-10-19 08:57:51 +03:00
Ping-Ke Shih
b8fe87b816 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
2022-10-12 07:34:57 +03:00
Ping-Ke Shih
572fd2ab37 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
2022-10-12 07:34:57 +03:00
Ping-Ke Shih
8915a25653 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
2022-10-12 07:34:57 +03:00
Ping-Ke Shih
bf958f76cf 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
2022-10-12 07:34:56 +03:00
Ping-Ke Shih
98bf0ddf20 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
2022-10-12 07:34:56 +03:00
Ping-Ke Shih
8f88474ce3 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
2022-10-12 07:34:56 +03:00
Ping-Ke Shih
a804479839 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
2022-10-12 07:34:56 +03:00
Ping-Ke Shih
b23b36efbd 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
2022-10-12 07:34:55 +03:00
Ping-Ke Shih
d0a95ef3ed 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
2022-10-12 07:34:55 +03:00
Ping-Ke Shih
6b0698984e wifi: rtw89: 8852b: add chip_ops::set_channel
set_channel is main function to configure channel and bandwidth for all
layers, namely MAC, BB and RF. Additionally, MAC layer enables CCK rate
checking to avoid wrong rate from driver. BB layer configures SCO
(Sample Clock Offset) for CCK, TX gain error/offset, and reset baseband
hardware circuit after all configurations done.

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-7-pkshih@realtek.com
2022-10-11 19:45:20 +03:00
Ping-Ke Shih
3e870b4817 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
2022-10-11 19:45:19 +03:00
Ping-Ke Shih
134cf7c015 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
2022-10-04 10:17:38 +03:00
Ping-Ke Shih
132dc4fe5b 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
2022-10-04 10:17:38 +03:00
Ping-Ke Shih
08484e1f6e 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
2022-10-04 10:17:37 +03:00
Ping-Ke Shih
a1cb097168 wifi: rtw89: 8852b: configure DLE mem
Configure DLE (data link engine) memory size for operating modes.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-10-pkshih@realtek.com
2022-09-28 09:45:59 +03:00
Ping-Ke Shih
5f8c35b932 wifi: rtw89: check DLE FIFO size with reserved size
For SCC mode, some FIFO are reserved, so compare the quantity after minus
the reserved size.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-9-pkshih@realtek.com
2022-09-28 09:45:59 +03:00
Ping-Ke Shih
14b6e9f4b0 wifi: rtw89: 8852b: implement chip_ops::{enable,disable}_bb_rf
Implement to power on/off BB and RF via MAC registers.

Add return type of chip_ops::disable_bb_rf, because it could fail to
disable. Also, correct naming of register 0x0200 used by the ops as well.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-5-pkshih@realtek.com
2022-09-28 09:45:58 +03:00
Ping-Ke Shih
a1b7163aab wifi: rtw89: mac: define DMA channel mask to avoid unsupported channels
Six channels are unsupported by 8852b, so mask them out to prevent to
access undefined registers in this chip.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-3-pkshih@realtek.com
2022-09-28 09:45:57 +03:00