* [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS @ 2025-04-28 21:26 Bitterblue Smith 2025-04-28 21:27 ` [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse Bitterblue Smith 2025-04-29 1:03 ` [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Ping-Ke Shih 0 siblings, 2 replies; 5+ messages in thread From: Bitterblue Smith @ 2025-04-28 21:26 UTC (permalink / raw) To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih 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 <rtl8821cerfe2@gmail.com> --- drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c index c57f683d9af8..6f63fd5db665 100644 --- a/drivers/net/wireless/realtek/rtw88/sdio.c +++ b/drivers/net/wireless/realtek/rtw88/sdio.c @@ -677,12 +677,20 @@ 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: 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse 2025-04-28 21:26 [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Bitterblue Smith @ 2025-04-28 21:27 ` Bitterblue Smith 2025-04-29 1:09 ` Ping-Ke Shih 2025-04-29 1:03 ` [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Ping-Ke Shih 1 sibling, 1 reply; 5+ messages in thread From: Bitterblue Smith @ 2025-04-28 21:27 UTC (permalink / raw) To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih 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(). Link: https://github.com/lwfinger/rtw88/issues/157 Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> --- drivers/net/wireless/realtek/rtw88/rtw8703b.c | 60 ------------------- drivers/net/wireless/realtek/rtw88/rtw8723x.c | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8703b.c b/drivers/net/wireless/realtek/rtw88/rtw8703b.c index 5e59cfe4dfdf..9e6700c43a63 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c @@ -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; } diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723x.c b/drivers/net/wireless/realtek/rtw88/rtw8723x.c index 69f73cb5b4cd..4c77963fdd37 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8723x.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8723x.c @@ -69,6 +69,9 @@ static void __rtw8723x_lck(struct rtw_dev *rtwdev) #define DBG_EFUSE_2BYTE(rtwdev, map, name) \ rtw_dbg(rtwdev, RTW_DBG_EFUSE, # name "=0x%02x%02x\n", \ (map)->name[0], (map)->name[1]) +#define DBG_EFUSE_FIX(rtwdev, name) \ + rtw_dbg(rtwdev, RTW_DBG_EFUSE, "Fixed invalid EFUSE value: " \ + # name "=0x%x\n", rtwdev->efuse.name) static void rtw8723xe_efuse_debug(struct rtw_dev *rtwdev, struct rtw8723x_efuse *map) @@ -238,10 +241,21 @@ static void rtw8723xs_efuse_parsing(struct rtw_efuse *efuse, ether_addr_copy(efuse->addr, map->s.mac_addr); } +/* Default power index table for RTL8703B/RTL8723D, used if EFUSE does + * not contain valid data. Replaces EFUSE data from offset 0x10 (start + * of txpwr_idx_table). + */ +static const u8 rtw8723x_txpwr_idx_table[] = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x02 +}; + static int __rtw8723x_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) { struct rtw_efuse *efuse = &rtwdev->efuse; + u8 *pwr = (u8 *)efuse->txpwr_idx_table; struct rtw8723x_efuse *map; + bool valid = false; int i; map = (struct rtw8723x_efuse *)log_map; @@ -279,6 +293,51 @@ static int __rtw8723x_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) return -EOPNOTSUPP; } + /* If TX power index table in EFUSE is invalid, fall back to + * built-in table. + */ + for (i = 0; i < ARRAY_SIZE(rtw8723x_txpwr_idx_table); i++) + if (pwr[i] != 0xff) { + valid = true; + break; + } + if (!valid) { + for (i = 0; i < ARRAY_SIZE(rtw8723x_txpwr_idx_table); i++) + pwr[i] = rtw8723x_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; } -- 2.49.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse 2025-04-28 21:27 ` [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse Bitterblue Smith @ 2025-04-29 1:09 ` Ping-Ke Shih 0 siblings, 0 replies; 5+ messages in thread From: Ping-Ke Shih @ 2025-04-29 1:09 UTC (permalink / raw) To: Bitterblue Smith, linux-wireless@vger.kernel.org Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: > 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(). > > Link: https://github.com/lwfinger/rtw88/issues/157 > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS 2025-04-28 21:26 [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Bitterblue Smith 2025-04-28 21:27 ` [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse Bitterblue Smith @ 2025-04-29 1:03 ` Ping-Ke Shih 2025-04-29 11:38 ` Bitterblue Smith 1 sibling, 1 reply; 5+ messages in thread From: Ping-Ke Shih @ 2025-04-29 1:03 UTC (permalink / raw) To: Bitterblue Smith, linux-wireless@vger.kernel.org Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: > 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 <rtl8821cerfe2@gmail.com> > --- > drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c > index c57f683d9af8..6f63fd5db665 100644 > --- a/drivers/net/wireless/realtek/rtw88/sdio.c > +++ b/drivers/net/wireless/realtek/rtw88/sdio.c > @@ -677,12 +677,20 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) > { > u8 size, timeout; > > - if (rtw_chip_wcpu_11n(rtwdev)) { Originally this only affects 11n chips, but now it affects all chips by default case. Is that in your expectation? And have you tested chips other than RTL8723DS you mentioned in commit message. If so, please add them to commit message. > + switch (rtwdev->chip->id) { > + case RTW_CHIP_TYPE_8703B: > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS 2025-04-29 1:03 ` [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Ping-Ke Shih @ 2025-04-29 11:38 ` Bitterblue Smith 0 siblings, 0 replies; 5+ messages in thread From: Bitterblue Smith @ 2025-04-29 11:38 UTC (permalink / raw) To: Ping-Ke Shih, linux-wireless@vger.kernel.org On 29/04/2025 04:03, Ping-Ke Shih wrote: > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: >> 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 <rtl8821cerfe2@gmail.com> >> --- >> drivers/net/wireless/realtek/rtw88/sdio.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c >> index c57f683d9af8..6f63fd5db665 100644 >> --- a/drivers/net/wireless/realtek/rtw88/sdio.c >> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c >> @@ -677,12 +677,20 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev) >> { >> u8 size, timeout; >> >> - if (rtw_chip_wcpu_11n(rtwdev)) { > > Originally this only affects 11n chips, but now it affects all chips by > default case. Is that in your expectation? > I think it only changes the behaviour for RTL8723D, RTL8821A, and RTL8812A. These last two don't have SDIO drivers in rtw88, but I can add them to the switch so they get the same size and timeout as before. > And have you tested chips other than RTL8723DS you mentioned in commit > message. If so, please add them to commit message. > I only tested RTL8723DS. I don't have others. >> + switch (rtwdev->chip->id) { >> + case RTW_CHIP_TYPE_8703B: >> 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 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-29 11:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-28 21:26 [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Bitterblue Smith 2025-04-28 21:27 ` [PATCH rtw-next 2/2] wifi: rtw88: Handle RTL8723D(S) with blank efuse Bitterblue Smith 2025-04-29 1:09 ` Ping-Ke Shih 2025-04-29 1:03 ` [PATCH rtw-next 1/2] wifi: rtw88: Fix RX aggregation settings for RTL8723DS Ping-Ke Shih 2025-04-29 11:38 ` Bitterblue Smith
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox