wifi: rtw88: Fix RX aggregation settings for RTL8723DS
PATCH v2 1/2 wifi: rtw88: Fix RX aggregation settings for RTL8723DS
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.
---
v2:
- Restore the original behaviour for RTL8821A and RTL8812A.
--- drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/sdio.c +12 -2
@@ -677,12 +677,22 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) {u8 size, timeout; -if (rtw_chip_wcpu_11n (rtwdev)) { +switch (rtwdev->chip->id) { +case RTW_CHIP_TYPE_8703B : +case RTW_CHIP_TYPE_8821A : +case RTW_CHIP_TYPE_8812A : size =0x6 ; timeout =0x6 ; - }else { +break ; +case RTW_CHIP_TYPE_8723D : + size =0xa ; + timeout =0x3 ; +rtw_write8_set (rtwdev,REG_RXDMA_AGG_PG_TH +3 ,BIT (7 )); +break ; +default : size =0xff ; timeout =0x1 ; +break ; }/* Make the firmware honor the size limit configured below */
Signature · 1 line
2.49.0
PATCH v2 2/2 wifi: rtw88: Handle RTL8723D(S) with blank efuse
Some users have RTL8723DS chips with nearly blank efuse. Currently these chips cannot connect when using rtw88, but they do work using the old out-of-tree driver.
Use reasonable default values for TX power, antenna configuration, and crystal cap if the chip's efuse is missing these things.
RTL8723D can use the same default values as RTL8703B, so simply move the code from rtl8703b_read_efuse() to the shared function __rtl8723x_read_efuse().
---
v2:
- Add Acked-by.
--- drivers/net/wireless/realtek/rtw88/rtw8703b.c | 60 ------------------- drivers/net/wireless/realtek/rtw88/rtw8723x.c | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+), 60 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8703b.c +0 -60
@@ -519,15 +519,6 @@ static const struct rtw_rqpn rqpn_table_8703b[] = { RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, }; -/* Default power index table for RTL8703B, used if EFUSE does not -* contain valid data. Replaces EFUSE data from offset 0x10 (start of -* txpwr_idx_table). -*/ -static const u8 rtw8703b_txpwr_idx_table[] = { -0x2D ,0x2D ,0x2D ,0x2D ,0x2D ,0x2D , -0x2D ,0x2D ,0x2D ,0x2D ,0x2D ,0x02 -}; -static void try_mac_from_devicetree (struct rtw_dev *rtwdev) {struct device_node *node = rtwdev->dev->of_node;
@@ -544,15 +535,9 @@ static void try_mac_from_devicetree(struct rtw_dev *rtwdev) } } -#define DBG_EFUSE_FIX (rtwdev, name) \ - rtw_dbg(rtwdev, RTW_DBG_EFUSE, "Fixed invalid EFUSE value: " \ - # name "=0x%x\n", rtwdev->efuse.name) -static int rtw8703b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) {struct rtw_efuse *efuse = &rtwdev->efuse; -u8 *pwr = (u8 *)efuse->txpwr_idx_table; -bool valid = false;int ret; ret =rtw8723x_read_efuse (rtwdev, log_map);
@@ -562,51 +547,6 @@ static int rtw8703b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)if (!is_valid_ether_addr (efuse->addr))try_mac_from_devicetree (rtwdev); -/* If TX power index table in EFUSE is invalid, fall back to -* built-in table. -*/ -for (int i =0 ; i <ARRAY_SIZE (rtw8703b_txpwr_idx_table); i++) -if (pwr[i] !=0xff ) { - valid = true; -break ; - } -if (!valid) { -for (int i =0 ; i <ARRAY_SIZE (rtw8703b_txpwr_idx_table); i++) - pwr[i] = rtw8703b_txpwr_idx_table[i]; -rtw_dbg (rtwdev,RTW_DBG_EFUSE , -"Replaced invalid EFUSE TX power index table." ); -rtw8723x_debug_txpwr_limit (rtwdev, - efuse->txpwr_idx_table,2 ); - } - -/* Override invalid antenna settings. */ -if (efuse->bt_setting ==0xff ) { -/* shared antenna */ - efuse->bt_setting |=BIT (0 ); -/* RF path A */ - efuse->bt_setting &= ~BIT (6 ); -DBG_EFUSE_FIX (rtwdev, bt_setting); - } - -/* Override invalid board options: The coex code incorrectly -* assumes that if bits 6 & 7 are set the board doesn't -* support coex. Regd is also derived from rf_board_option and -* should be 0 if there's no valid data. -*/ -if (efuse->rf_board_option ==0xff ) { - efuse->regd =0 ; - efuse->rf_board_option &=GENMASK (5 ,0 ); -DBG_EFUSE_FIX (rtwdev, rf_board_option); - } - -/* Override invalid crystal cap setting, default comes from -* vendor driver. Chip specific. -*/ -if (efuse->crystal_cap ==0xff ) { - efuse->crystal_cap =0x20 ; -DBG_EFUSE_FIX (rtwdev, crystal_cap); - } -return 0 ; }
drivers/net/wireless/realtek/rtw88/rtw8723x.c +59 -0
81 lines not on this page · raw message
Signature · 1 line
2.49.0
Quoted 8 lines · Bitterblue Smith
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of
REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Restore the original behaviour for RTL8821A and RTL8812A.
This patch actually restores the behavior of RTL8821A and RTL8812A. But they are 802.11ac chips [1] [2], somehow defined as RTW_WCPU_11N.
I can accept this patch ahead. Please help to think how we can correct this mistake.
[1] https://www.realtek.com/Product/Index?id=577&cate_id=194
[2] https://www.realtek.com/Product/Index?id=590&cate_id=194
Quoted 35 lines
--- drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/net/wireless/realtek/rtw88/sdio.c +12
-3@@ -677,12 +677,22 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) {u8 size, timeout; -if (rtw_chip_wcpu_11n (rtwdev)) { +switch (rtwdev->chip->id) { +case RTW_CHIP_TYPE_8703B : +case RTW_CHIP_TYPE_8821A : +case RTW_CHIP_TYPE_8812A : size =0x6 ; timeout =0x6 ; - }else { +break ; +case RTW_CHIP_TYPE_8723D : + size =0xa ; + timeout =0x3 ; +rtw_write8_set (rtwdev,REG_RXDMA_AGG_PG_TH +3 ,BIT (7 )); +break ; +default : size =0xff ; timeout =0x1 ; +break ; }/* Make the firmware honor the size limit configured below */ --2.49.0
Quoted 10 lines · Ping-Ke Shih
Quoted 8 lines · Bitterblue Smith
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of
REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Restore the original behaviour for RTL8821A and RTL8812A.
Quoted 6 lines
This patch actually restores the behavior of RTL8821A and RTL8812A. But they are 802.11ac chips [1] [2], somehow defined as
RTW_WCPU_11N.I can accept this patch ahead. Please help to think how we can correct this mistake.
Yes, the enums RTW_WCPU_11AC and RTW_WCPU_11N have wrong names. RTL8821A and RTL8812A are 11ac chips but their MCU is the RTW_WCPU_11N type. RTL8733BU (not supported in rtw88) is 11n but its MCU is the RTW_WCPU_11AC type.
I was thinking to rename them:
RTW_WCPU_11N -> RTW_WCPU_8051RTW_WCPU_11AC -> RTW_WCPU_3081
8051 and 3081 are the names used in the vendor drivers:
#define PHYDM_IC_8051_SERIES (ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\ ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\ ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\ ODM_RTL8710C) #define PHYDM_IC_3081_SERIES (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\ ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\ ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\ ODM_RTL8197G)
Quoted 41 lines
Acked-by Ping-Ke Shih <[email protected]>[1] https://www.realtek.com/Product/Index?id=577&cate_id=194
[2] https://www.realtek.com/Product/Index?id=590&cate_id=194Quoted 35 lines
--- drivers/net/wireless/realtek/rtw88/sdio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/net/wireless/realtek/rtw88/sdio.c +12
-3@@ -677,12 +677,22 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) {u8 size, timeout; -if (rtw_chip_wcpu_11n (rtwdev)) { +switch (rtwdev->chip->id) { +case RTW_CHIP_TYPE_8703B : +case RTW_CHIP_TYPE_8821A : +case RTW_CHIP_TYPE_8812A : size =0x6 ; timeout =0x6 ; - }else { +break ; +case RTW_CHIP_TYPE_8723D : + size =0xa ; + timeout =0x3 ; +rtw_write8_set (rtwdev,REG_RXDMA_AGG_PG_TH +3 ,BIT (7 )); +break ; +default : size =0xff ; timeout =0x1 ; +break ; }/* Make the firmware honor the size limit configured below */ --2.49.0
Ping-Ke Shih
maintainerQuoted 30 lines · Bitterblue Smith
Quoted 10 lines · Ping-Ke Shih
Quoted 8 lines · Bitterblue Smith
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of
REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Restore the original behaviour for RTL8821A and RTL8812A.Quoted 6 lines
This patch actually restores the behavior of RTL8821A and RTL8812A. But they are 802.11ac chips [1] [2], somehow defined as
RTW_WCPU_11N.I can accept this patch ahead. Please help to think how we can correct this mistake.
Yes, the enums
RTW_WCPU_11ACandRTW_WCPU_11Nhave wrong names. RTL8821A and RTL8812A are 11ac chips but their MCU is theRTW_WCPU_11Ntype. RTL8733BU (not supported in rtw88) is 11n but its MCU is theRTW_WCPU_11ACtype.I was thinking to rename them:
RTW_WCPU_11N->RTW_WCPU_8051RTW_WCPU_11AC->RTW_WCPU_30818051 and 3081 are the names used in the vendor drivers:
Quoted 8 lines
#define PHYDM_IC_8051_SERIES (ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\
ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\
ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\
ODM_RTL8710C)
#define PHYDM_IC_3081_SERIES (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\
ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\
ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\
ODM_RTL8197G)Thanks. Please help making a patch.
Quoted 40 lines · Ping-Ke Shih
Quoted 30 lines · Bitterblue Smith
Quoted 10 lines · Ping-Ke Shih
Quoted 8 lines · Bitterblue Smith
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of
REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Restore the original behaviour for RTL8821A and RTL8812A.Quoted 6 lines
This patch actually restores the behavior of RTL8821A and RTL8812A. But they are 802.11ac chips [1] [2], somehow defined as
RTW_WCPU_11N.I can accept this patch ahead. Please help to think how we can correct this mistake.
Yes, the enums
RTW_WCPU_11ACandRTW_WCPU_11Nhave wrong names. RTL8821A and RTL8812A are 11ac chips but their MCU is theRTW_WCPU_11Ntype. RTL8733BU (not supported in rtw88) is 11n but its MCU is theRTW_WCPU_11ACtype.I was thinking to rename them:
RTW_WCPU_11N->RTW_WCPU_8051RTW_WCPU_11AC->RTW_WCPU_30818051 and 3081 are the names used in the vendor drivers:
Quoted 8 lines
#define PHYDM_IC_8051_SERIES (ODM_RTL8881A | ODM_RTL8812 | ODM_RTL8821 |\ ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8703B |\ ODM_RTL8188F | ODM_RTL8192F | ODM_RTL8721D |\ ODM_RTL8710C) #define PHYDM_IC_3081_SERIES (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F |\ ODM_RTL8821C | ODM_RTL8195B | ODM_RTL8198F |\ ODM_RTL8822C | ODM_RTL8812F | ODM_RTL8814B |\ ODM_RTL8197G)
Quoted 3 lines
Thanks. Please help making a patch.
I will do it soon.
Ping-Ke Shih
maintainerQuoted 6 lines · Bitterblue Smith
Use the same RX aggregation size and timeout used by the out-of-tree RTL8723DS driver. Also set mystery bit 31 of
REG_RXDMA_AGG_PG_TH. This improves the RX speed from ~44 Mbps to ~67 Mbps.Signed-off-by Bitterblue Smith <[email protected]>Acked-by Ping-Ke Shih <[email protected]>
2 patch(es) applied to rtw-next branch of rtw.git, thanks.
0ffa1ba81b35 wifi: rtw88: Fix RX aggregation settings for RTL8723DS 2c17afde9ff6 wifi: rtw88: Handle RTL8723D(S) with blank efuse