wifi: rtw89: set needed firmware elements for early chips transition

The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852C have
driver built-in tables, which are not preferred. New firmware is prepared
with corresponding tables in firmware elements, so we can start to
transition. After this patch, old firmware is still usable, but add a
prompt text for users to update firmware.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260707091056.42771-16-pkshih@realtek.com
This commit is contained in:
Ping-Ke Shih
2026-07-07 17:10:56 +08:00
parent 5c925d7722
commit 56d32cdc60
6 changed files with 41 additions and 8 deletions

View File

@@ -1562,6 +1562,7 @@ int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev)
u32 unrecognized_elements = chip->needed_fw_elms;
const struct rtw89_fw_element_handler *handler;
const struct rtw89_fw_element_hdr *hdr;
bool transition;
u32 elm_size;
u32 elem_id;
u32 offset;
@@ -1569,6 +1570,9 @@ int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev)
BUILD_BUG_ON(sizeof(chip->needed_fw_elms) * 8 < RTW89_FW_ELEMENT_ID_NUM);
transition = !!((chip->needed_fw_elms & BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION)));
unrecognized_elements &= ~BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION);
offset = rtw89_mfw_get_size(rtwdev);
offset = ALIGN(offset, RTW89_FW_ELEMENT_ALIGN);
if (offset == 0)
@@ -1608,6 +1612,12 @@ int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev)
}
if (unrecognized_elements) {
if (transition) {
rtw89_info(rtwdev, "NOTE: This firmware is going to be obsolete!\n"
"Please download the latest firmware from https://gitlab.com/kernel-firmware/linux-firmware.git\n");
return 0;
}
rtw89_err(rtwdev, "Firmware elements 0x%08x are unrecognized\n",
unrecognized_elements);
return -ENOENT;

View File

@@ -4354,31 +4354,50 @@ enum rtw89_fw_element_id {
RTW89_FW_ELEMENT_ID_DIAG_MAC = 28,
RTW89_FW_ELEMENT_ID_TX_COMP = 29,
__RTW89_FW_ELEMENT_ID_INTL_TRANSITION,
RTW89_FW_ELEMENT_ID_NUM,
};
#define BITS_OF_RTW89_TXPWR_FW_ELEMENTS_TX_SHAPE \
(BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT) | \
BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU))
#define BITS_OF_RTW89_TXPWR_FW_ELEMENTS_NO_6GHZ \
(BIT(RTW89_FW_ELEMENT_ID_TXPWR_BYRATE) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_2GHZ) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_5GHZ) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_2GHZ) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_5GHZ) | \
BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT) | \
BIT(RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU))
BITS_OF_RTW89_TXPWR_FW_ELEMENTS_TX_SHAPE)
#define BITS_OF_RTW89_TXPWR_FW_ELEMENTS \
(BITS_OF_RTW89_TXPWR_FW_ELEMENTS_NO_6GHZ | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_6GHZ) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_6GHZ))
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ \
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_BASE \
(BIT(RTW89_FW_ELEMENT_ID_BB_REG) | \
BIT(RTW89_FW_ELEMENT_ID_RADIO_A) | \
BIT(RTW89_FW_ELEMENT_ID_RADIO_B) | \
BIT(RTW89_FW_ELEMENT_ID_RF_NCTL) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_TRK) | \
BIT(RTW89_FW_ELEMENT_ID_TXPWR_TRK))
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ \
(RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_BASE | \
BITS_OF_RTW89_TXPWR_FW_ELEMENTS_NO_6GHZ)
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS \
(RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_BASE | \
BITS_OF_RTW89_TXPWR_FW_ELEMENTS)
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_RTL8852A \
(RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ & \
~BITS_OF_RTW89_TXPWR_FW_ELEMENTS_TX_SHAPE)
#define RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_RTL8851B \
(RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ & \
~BIT(RTW89_FW_ELEMENT_ID_RADIO_B))
#define RTW89_BE_GEN_DEF_NEEDED_FW_ELEMENTS_BASE \
(BIT(RTW89_FW_ELEMENT_ID_BB_REG) | \
BIT(RTW89_FW_ELEMENT_ID_RADIO_A) | \

View File

@@ -2635,7 +2635,8 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
},
.try_ce_fw = true,
.bbmcu_nr = 0,
.needed_fw_elms = 0,
.needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_RTL8851B |
BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION),
.fw_blacklist = NULL,
.fifo_size = 196608,
.small_fifo_size = true,

View File

@@ -2373,7 +2373,8 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
},
.try_ce_fw = false,
.bbmcu_nr = 0,
.needed_fw_elms = 0,
.needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_RTL8852A |
BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION),
.fw_blacklist = NULL,
.fifo_size = 458752,
.small_fifo_size = false,

View File

@@ -968,7 +968,8 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
},
.try_ce_fw = true,
.bbmcu_nr = 0,
.needed_fw_elms = 0,
.needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ |
BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION),
.fw_blacklist = &rtw89_fw_blacklist_default,
.fifo_size = 196608,
.small_fifo_size = true,

View File

@@ -3172,7 +3172,8 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
},
.try_ce_fw = false,
.bbmcu_nr = 0,
.needed_fw_elms = 0,
.needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS |
BIT(__RTW89_FW_ELEMENT_ID_INTL_TRANSITION),
.fw_blacklist = &rtw89_fw_blacklist_default,
.fifo_size = 458752,
.small_fifo_size = false,