mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
wifi: rtw89: read chip ID for RTL8922D variants
The coming RTL8922D has many kinds of hardware variants. Read chips ID ahead, so we can configure proper hardware settings accordingly. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20251229030926.27004-8-pkshih@realtek.com
This commit is contained in:
parent
9e389ad5d1
commit
d57ec29478
|
|
@ -6081,7 +6081,9 @@ void rtw89_core_scan_complete(struct rtw89_dev *rtwdev,
|
|||
static void rtw89_read_chip_ver(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
int ret;
|
||||
u8 val2;
|
||||
u8 val;
|
||||
u8 cv;
|
||||
|
||||
|
|
@ -6093,14 +6095,28 @@ static void rtw89_read_chip_ver(struct rtw89_dev *rtwdev)
|
|||
cv = CHIP_CBV;
|
||||
}
|
||||
|
||||
rtwdev->hal.cv = cv;
|
||||
hal->cv = cv;
|
||||
|
||||
if (rtw89_is_rtl885xb(rtwdev)) {
|
||||
if (rtw89_is_rtl885xb(rtwdev) || chip->chip_gen >= RTW89_CHIP_BE) {
|
||||
ret = rtw89_mac_read_xtal_si(rtwdev, XTAL_SI_CV, &val);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
rtwdev->hal.acv = u8_get_bits(val, XTAL_SI_ACV_MASK);
|
||||
hal->acv = u8_get_bits(val, XTAL_SI_ACV_MASK);
|
||||
}
|
||||
|
||||
if (chip->chip_gen >= RTW89_CHIP_BE) {
|
||||
hal->cid =
|
||||
rtw89_read32_mask(rtwdev, R_BE_SYS_CHIPINFO, B_BE_HW_ID_MASK);
|
||||
|
||||
ret = rtw89_mac_read_xtal_si(rtwdev, XTAL_SI_CHIP_ID_L, &val);
|
||||
if (ret)
|
||||
return;
|
||||
ret = rtw89_mac_read_xtal_si(rtwdev, XTAL_SI_CHIP_ID_H, &val2);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
hal->aid = val | val2 << 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6310,6 +6326,8 @@ void rtw89_core_rfkill_poll(struct rtw89_dev *rtwdev, bool force)
|
|||
|
||||
int rtw89_chip_info_setup(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_efuse *efuse = &rtwdev->efuse;
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
int ret;
|
||||
|
||||
rtw89_read_chip_ver(rtwdev);
|
||||
|
|
@ -6349,6 +6367,9 @@ int rtw89_chip_info_setup(struct rtw89_dev *rtwdev)
|
|||
rtw89_core_setup_rfe_parms(rtwdev);
|
||||
rtwdev->ps_mode = rtw89_update_ps_mode(rtwdev);
|
||||
|
||||
rtw89_info(rtwdev, "chip info CID: %x, CV: %x, AID: %x, ACV: %x, RFE: %d\n",
|
||||
hal->cid, hal->cv, hal->aid, hal->acv, efuse->rfe_type);
|
||||
|
||||
out:
|
||||
rtw89_mac_pwr_off(rtwdev);
|
||||
|
||||
|
|
|
|||
|
|
@ -159,6 +159,17 @@ enum rtw89_core_chip_id {
|
|||
RTL8922D,
|
||||
};
|
||||
|
||||
enum rtw89_core_chip_cid {
|
||||
RTL8922D_CID7025 = 0x74,
|
||||
RTL8922D_CID7090 = 0x79,
|
||||
};
|
||||
|
||||
enum rtw89_core_chip_aid {
|
||||
RTL8922D_AID1348 = 0x1348,
|
||||
RTL8922D_AID7060 = 0x7060,
|
||||
RTL8922D_AID7102 = 0x7102,
|
||||
};
|
||||
|
||||
enum rtw89_chip_gen {
|
||||
RTW89_CHIP_AX,
|
||||
RTW89_CHIP_BE,
|
||||
|
|
@ -5034,7 +5045,9 @@ enum rtw89_dm_type {
|
|||
struct rtw89_hal {
|
||||
u32 rx_fltr;
|
||||
u8 cv;
|
||||
u8 cid; /* enum rtw89_core_chip_cid */
|
||||
u8 acv;
|
||||
u16 aid; /* enum rtw89_core_chip_aid */
|
||||
u32 antenna_tx;
|
||||
u32 antenna_rx;
|
||||
u8 tx_nss;
|
||||
|
|
|
|||
|
|
@ -1573,6 +1573,8 @@ enum rtw89_mac_xtal_si_offset {
|
|||
XTAL_SI_APBT = 0xD1,
|
||||
XTAL_SI_PLL = 0xE0,
|
||||
XTAL_SI_PLL_1 = 0xE1,
|
||||
XTAL_SI_CHIP_ID_L = 0xFD,
|
||||
XTAL_SI_CHIP_ID_H = 0xFE,
|
||||
};
|
||||
|
||||
static inline
|
||||
|
|
|
|||
|
|
@ -4267,6 +4267,13 @@
|
|||
#define R_BE_PCIE_MIO_INTD 0x00E8
|
||||
#define B_BE_PCIE_MIO_DATA_MASK GENMASK(31, 0)
|
||||
|
||||
#define R_BE_SYS_CHIPINFO 0x00FC
|
||||
#define B_BE_USB2_SEL BIT(31)
|
||||
#define B_BE_U3PHY_RST_V1 BIT(30)
|
||||
#define B_BE_U3_TERM_DETECT BIT(29)
|
||||
#define B_BE_VERIFY_ENV_MASK GENMASK(9, 8)
|
||||
#define B_BE_HW_ID_MASK GENMASK(7, 0)
|
||||
|
||||
#define R_BE_HALT_H2C_CTRL 0x0160
|
||||
#define B_BE_HALT_H2C_TRIGGER BIT(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -633,8 +633,6 @@ static int rtw8851b_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
|
|||
efuse->rfe_type = map->rfe_type;
|
||||
efuse->xtal_cap = map->xtal_k;
|
||||
|
||||
rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,8 +678,6 @@ static int rtw8852a_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
|
|||
efuse->rfe_type = map->rfe_type;
|
||||
efuse->xtal_cap = map->xtal_k;
|
||||
|
||||
rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,8 +265,6 @@ static int __rtw8852bx_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
|
|||
efuse->rfe_type = map->rfe_type;
|
||||
efuse->xtal_cap = map->xtal_k;
|
||||
|
||||
rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -600,8 +600,6 @@ static int rtw8852c_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
|
|||
efuse->rfe_type = map->rfe_type;
|
||||
efuse->xtal_cap = map->xtal_k;
|
||||
|
||||
rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -628,8 +628,6 @@ static int rtw8922a_read_efuse_rf(struct rtw89_dev *rtwdev, u8 *log_map)
|
|||
rtw8922a_efuse_parsing_tssi(rtwdev, map);
|
||||
rtw8922a_efuse_parsing_gain_offset(rtwdev, map);
|
||||
|
||||
rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user