Commit 7c8a55dd authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: add mac_gen pointer to access mac port registers

Using mac_gen pointer to reuse the code with WiFi 7 chips, and define
MAC ports registers for WiFi 7 chips.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230911082049.33541-7-pkshih@realtek.com
parent 65129813
This diff is collapsed.
......@@ -858,6 +858,7 @@ struct rtw89_mac_gen_def {
u32 indir_access_addr;
const u32 *mem_base_addrs;
u32 rx_fltr;
const struct rtw89_port_reg *port_base;
void (*disable_cpu)(struct rtw89_dev *rtwdev);
int (*fwdl_enable_wcpu)(struct rtw89_dev *rtwdev, u8 boot_reason,
......
......@@ -30,6 +30,32 @@ static const u32 rtw89_mac_mem_base_addrs_be[RTW89_MAC_MEM_NUM] = {
[RTW89_MAC_MEM_WD_PAGE] = WD_PAGE_BASE_ADDR_BE,
};
static const struct rtw89_port_reg rtw89_port_base_be = {
.port_cfg = R_BE_PORT_CFG_P0,
.tbtt_prohib = R_BE_TBTT_PROHIB_P0,
.bcn_area = R_BE_BCN_AREA_P0,
.bcn_early = R_BE_BCNERLYINT_CFG_P0,
.tbtt_early = R_BE_TBTTERLYINT_CFG_P0,
.tbtt_agg = R_BE_TBTT_AGG_P0,
.bcn_space = R_BE_BCN_SPACE_CFG_P0,
.bcn_forcetx = R_BE_BCN_FORCETX_P0,
.bcn_err_cnt = R_BE_BCN_ERR_CNT_P0,
.bcn_err_flag = R_BE_BCN_ERR_FLAG_P0,
.dtim_ctrl = R_BE_DTIM_CTRL_P0,
.tbtt_shift = R_BE_TBTT_SHIFT_P0,
.bcn_cnt_tmr = R_BE_BCN_CNT_TMR_P0,
.tsftr_l = R_BE_TSFTR_LOW_P0,
.tsftr_h = R_BE_TSFTR_HIGH_P0,
.md_tsft = R_BE_WMTX_MOREDATA_TSFT_STMP_CTL,
.bss_color = R_BE_PTCL_BSS_COLOR_0,
.mbssid = R_BE_MBSSID_CTRL,
.mbssid_drop = R_BE_MBSSID_DROP_0,
.tsf_sync = R_BE_PORT_0_TSF_SYNC,
.hiq_win = {R_BE_P0MB_HGQ_WINDOW_CFG_0, R_BE_PORT_HGQ_WINDOW_CFG,
R_BE_PORT_HGQ_WINDOW_CFG + 1, R_BE_PORT_HGQ_WINDOW_CFG + 2,
R_BE_PORT_HGQ_WINDOW_CFG + 3},
};
static void rtw89_mac_disable_cpu_be(struct rtw89_dev *rtwdev)
{
u32 val32;
......@@ -185,6 +211,7 @@ const struct rtw89_mac_gen_def rtw89_mac_gen_be = {
.indir_access_addr = R_BE_INDIR_ACCESS_ENTRY,
.mem_base_addrs = rtw89_mac_mem_base_addrs_be,
.rx_fltr = R_BE_RX_FLTR_OPT,
.port_base = &rtw89_port_base_be,
.disable_cpu = rtw89_mac_disable_cpu_be,
.fwdl_enable_wcpu = rtw89_mac_fwdl_enable_wcpu_be,
......
......@@ -3736,6 +3736,153 @@
#define R_BE_PLE_DBG_FUN_INTF_DATA 0x9114
#define B_BE_PLE_DFI_DATA_MASK GENMASK(31, 0)
#define R_BE_PORT_0_TSF_SYNC 0x102A0
#define R_BE_PORT_0_TSF_SYNC_C1 0x142A0
#define B_BE_P0_SYNC_NOW_P BIT(30)
#define B_BE_P0_SYNC_ONCE_P BIT(29)
#define B_BE_P0_AUTO_SYNC BIT(28)
#define B_BE_P0_SYNC_PORT_SRC_SEL_MASK GENMASK(26, 24)
#define B_BE_P0_TSFTR_SYNC_OFFSET_MASK GENMASK(18, 0)
#define R_BE_PORT_CFG_P0 0x10400
#define R_BE_PORT_CFG_P0_C1 0x14400
#define B_BE_BCN_ERLY_SORT_EN_P0 BIT(18)
#define B_BE_PROHIB_END_CAL_EN_P0 BIT(17)
#define B_BE_BRK_SETUP_P0 BIT(16)
#define B_BE_TBTT_UPD_SHIFT_SEL_P0 BIT(15)
#define B_BE_BCN_DROP_ALLOW_P0 BIT(14)
#define B_BE_TBTT_PROHIB_EN_P0 BIT(13)
#define B_BE_BCNTX_EN_P0 BIT(12)
#define B_BE_NET_TYPE_P0_MASK GENMASK(11, 10)
#define B_BE_BCN_FORCETX_EN_P0 BIT(9)
#define B_BE_TXBCN_BTCCA_EN_P0 BIT(8)
#define B_BE_BCNERR_CNT_EN_P0 BIT(7)
#define B_BE_BCN_AGRES_P0 BIT(6)
#define B_BE_TSFTR_RST_P0 BIT(5)
#define B_BE_RX_BSSID_FIT_EN_P0 BIT(4)
#define B_BE_TSF_UDT_EN_P0 BIT(3)
#define B_BE_PORT_FUNC_EN_P0 BIT(2)
#define B_BE_TXBCN_RPT_EN_P0 BIT(1)
#define B_BE_RXBCN_RPT_EN_P0 BIT(0)
#define R_BE_TBTT_PROHIB_P0 0x10404
#define R_BE_TBTT_PROHIB_P0_C1 0x14404
#define B_BE_TBTT_HOLD_P0_MASK GENMASK(27, 16)
#define B_BE_TBTT_SETUP_P0_MASK GENMASK(7, 0)
#define R_BE_BCN_AREA_P0 0x10408
#define R_BE_BCN_AREA_P0_C1 0x14408
#define B_BE_BCN_MSK_AREA_P0_MSK 0xfff
#define B_BE_BCN_CTN_AREA_P0_MASK GENMASK(11, 0)
#define R_BE_BCNERLYINT_CFG_P0 0x1040C
#define R_BE_BCNERLYINT_CFG_P0_C1 0x1440C
#define B_BE_BCNERLY_P0_MASK GENMASK(11, 0)
#define R_BE_TBTTERLYINT_CFG_P0 0x1040E
#define R_BE_TBTTERLYINT_CFG_P0_C1 0x1440E
#define B_BE_TBTTERLY_P0_MASK GENMASK(11, 0)
#define R_BE_TBTT_AGG_P0 0x10412
#define R_BE_TBTT_AGG_P0_C1 0x14412
#define B_BE_TBTT_AGG_NUM_P0_MASK GENMASK(15, 8)
#define R_BE_BCN_SPACE_CFG_P0 0x10414
#define R_BE_BCN_SPACE_CFG_P0_C1 0x14414
#define B_BE_SUB_BCN_SPACE_P0_MASK GENMASK(23, 16)
#define B_BE_BCN_SPACE_P0_MASK GENMASK(15, 0)
#define R_BE_BCN_FORCETX_P0 0x10418
#define R_BE_BCN_FORCETX_P0_C1 0x14418
#define B_BE_FORCE_BCN_NUM_P0_MASK GENMASK(15, 8)
#define B_BE_BCN_MAX_ERR_P0_MASK GENMASK(7, 0)
#define R_BE_BCN_ERR_CNT_P0 0x10420
#define R_BE_BCN_ERR_CNT_P0_C1 0x14420
#define B_BE_BCN_ERR_CNT_SUM_P0_MASK GENMASK(31, 24)
#define B_BE_BCN_ERR_CNT_NAV_P0_MASK GENMASK(23, 16)
#define B_BE_BCN_ERR_CNT_EDCCA_P0_MASK GENMASK(15, 8)
#define B_BE_BCN_ERR_CNT_CCA_P0_MASK GENMASK(7, 0)
#define R_BE_BCN_ERR_FLAG_P0 0x10424
#define R_BE_BCN_ERR_FLAG_P0_C1 0x14424
#define B_BE_BCN_ERR_FLAG_SRCHEND_P0 BIT(3)
#define B_BE_BCN_ERR_FLAG_INVALID_P0 BIT(2)
#define B_BE_BCN_ERR_FLAG_CMP_P0 BIT(1)
#define B_BE_BCN_ERR_FLAG_LOCK_P0 BIT(0)
#define R_BE_DTIM_CTRL_P0 0x10426
#define R_BE_DTIM_CTRL_P0_C1 0x14426
#define B_BE_DTIM_NUM_P0_MASK GENMASK(15, 8)
#define B_BE_DTIM_CURRCNT_P0_MASK GENMASK(7, 0)
#define R_BE_TBTT_SHIFT_P0 0x10428
#define R_BE_TBTT_SHIFT_P0_C1 0x14428
#define B_BE_TBTT_SHIFT_OFST_P0_SH 0
#define B_BE_TBTT_SHIFT_OFST_P0_MSK 0xfff
#define R_BE_BCN_CNT_TMR_P0 0x10434
#define R_BE_BCN_CNT_TMR_P0_C1 0x14434
#define B_BE_BCN_CNT_TMR_P0_MASK GENMASK(31, 0)
#define R_BE_TSFTR_LOW_P0 0x10438
#define R_BE_TSFTR_LOW_P0_C1 0x14438
#define B_BE_TSFTR_LOW_P0_MASK GENMASK(31, 0)
#define R_BE_TSFTR_HIGH_P0 0x1043C
#define R_BE_TSFTR_HIGH_P0_C1 0x1443C
#define B_BE_TSFTR_HIGH_P0_MASK GENMASK(31, 0)
#define R_BE_MBSSID_CTRL 0x10568
#define R_BE_MBSSID_CTRL_C1 0x14568
#define B_BE_MBSSID_MODE_SEL BIT(20)
#define B_BE_P0MB_NUM_MASK GENMASK(19, 16)
#define B_BE_P0MB15_EN BIT(15)
#define B_BE_P0MB14_EN BIT(14)
#define B_BE_P0MB13_EN BIT(13)
#define B_BE_P0MB12_EN BIT(12)
#define B_BE_P0MB11_EN BIT(11)
#define B_BE_P0MB10_EN BIT(10)
#define B_BE_P0MB9_EN BIT(9)
#define B_BE_P0MB8_EN BIT(8)
#define B_BE_P0MB7_EN BIT(7)
#define B_BE_P0MB6_EN BIT(6)
#define B_BE_P0MB5_EN BIT(5)
#define B_BE_P0MB4_EN BIT(4)
#define B_BE_P0MB3_EN BIT(3)
#define B_BE_P0MB2_EN BIT(2)
#define B_BE_P0MB1_EN BIT(1)
#define R_BE_P0MB_HGQ_WINDOW_CFG_0 0x10590
#define R_BE_P0MB_HGQ_WINDOW_CFG_0_C1 0x14590
#define R_BE_PORT_HGQ_WINDOW_CFG 0x105A0
#define R_BE_PORT_HGQ_WINDOW_CFG_C1 0x145A0
#define R_BE_MBSSID_DROP_0 0x1083C
#define R_BE_MBSSID_DROP_0_C1 0x1483C
#define B_BE_GI_LTF_FB_SEL BIT(30)
#define B_BE_RATE_SEL_MASK GENMASK(29, 24)
#define B_BE_PORT_DROP_4_0_MASK GENMASK(20, 16)
#define B_BE_MBSSID_DROP_15_0_MASK GENMASK(15, 0)
#define R_BE_PTCL_BSS_COLOR_0 0x108A0
#define R_BE_PTCL_BSS_COLOR_0_C1 0x148A0
#define B_BE_BSS_COLOB_BE_PORT_3_MASK GENMASK(29, 24)
#define B_BE_BSS_COLOB_BE_PORT_2_MASK GENMASK(21, 16)
#define B_BE_BSS_COLOB_BE_PORT_1_MASK GENMASK(13, 8)
#define B_BE_BSS_COLOB_BE_PORT_0_MASK GENMASK(5, 0)
#define R_BE_PTCL_BSS_COLOR_1 0x108A4
#define R_BE_PTCL_BSS_COLOR_1_C1 0x148A4
#define B_BE_BSS_COLOB_BE_PORT_4_MASK GENMASK(5, 0)
#define R_BE_WMTX_MOREDATA_TSFT_STMP_CTL 0x10E08
#define R_BE_WMTX_MOREDATA_TSFT_STMP_CTL_C1 0x14E08
#define B_BE_TSFT_OFS_MASK GENMASK(31, 16)
#define B_BE_STMP_THSD_MASK GENMASK(15, 8)
#define B_BE_UPD_HGQMD BIT(1)
#define B_BE_UPD_TIMIE BIT(0)
#define R_BE_RX_FLTR_OPT 0x11420
#define R_BE_RX_FLTR_OPT_C1 0x15420
#define B_BE_UID_FILTER_MASK GENMASK(31, 24)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment