Skip to content

Commit f20b2b7

Browse files
Ping-Ke ShihKalle Valo
authored andcommitted
wifi: rtw89: 8922a: add power on/off functions
The power on/off functions are to turn on hardware function blocks and to turn off them if we are going to stay in idle state. Signed-off-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://msgid.link/[email protected]
1 parent efde4f6 commit f20b2b7

File tree

3 files changed

+406
-0
lines changed

3 files changed

+406
-0
lines changed

drivers/net/wireless/realtek/rtw89/mac.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ enum rtw89_mac_xtal_si_offset {
12611261
#define XTAL_SC_XI_MASK GENMASK(7, 0)
12621262
XTAL_SI_XTAL_SC_XO = 0x05,
12631263
#define XTAL_SC_XO_MASK GENMASK(7, 0)
1264+
XTAL_SI_XREF_MODE = 0x0B,
12641265
XTAL_SI_PWR_CUT = 0x10,
12651266
#define XTAL_SI_SMALL_PWR_CUT BIT(0)
12661267
#define XTAL_SI_BIG_PWR_CUT BIT(1)
@@ -1270,6 +1271,8 @@ enum rtw89_mac_xtal_si_offset {
12701271
#define XTAL_SI_LDO_LPS GENMASK(6, 4)
12711272
XTAL_SI_XTAL_XMD_4 = 0x26,
12721273
#define XTAL_SI_LPS_CAP GENMASK(3, 0)
1274+
XTAL_SI_XREF_RF1 = 0x2D,
1275+
XTAL_SI_XREF_RF2 = 0x2E,
12731276
XTAL_SI_CV = 0x41,
12741277
#define XTAL_SI_ACV_MASK GENMASK(3, 0)
12751278
XTAL_SI_LOW_ADDR = 0x62,
@@ -1297,6 +1300,8 @@ enum rtw89_mac_xtal_si_offset {
12971300
XTAL_SI_SRAM_CTRL = 0xA1,
12981301
#define XTAL_SI_SRAM_DIS BIT(1)
12991302
#define FULL_BIT_MASK GENMASK(7, 0)
1303+
XTAL_SI_PLL = 0xE0,
1304+
XTAL_SI_PLL_1 = 0xE1,
13001305
};
13011306

13021307
static inline

drivers/net/wireless/realtek/rtw89/reg.h

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3742,6 +3742,44 @@
37423742
#define B_BE_DIS_CLK_REG1_GATE BIT(1)
37433743
#define B_BE_DIS_CLK_REG0_GATE BIT(0)
37443744

3745+
#define R_BE_ANAPAR_POW_MAC 0x0016
3746+
#define B_BE_POW_PC_LDO_PORT1 BIT(3)
3747+
#define B_BE_POW_PC_LDO_PORT0 BIT(2)
3748+
#define B_BE_POW_PLL_V1 BIT(1)
3749+
#define B_BE_POW_POWER_CUT_POW_LDO BIT(0)
3750+
3751+
#define R_BE_SYS_ADIE_PAD_PWR_CTRL 0x0018
3752+
#define B_BE_SYM_PADPDN_WL_RFC1_1P3 BIT(6)
3753+
#define B_BE_SYM_PADPDN_WL_RFC0_1P3 BIT(5)
3754+
3755+
#define R_BE_AFE_LDO_CTRL 0x0020
3756+
#define B_BE_FORCE_MACBBBT_PWR_ON BIT(31)
3757+
#define B_BE_R_SYM_WLPOFF_P4_PC_EN BIT(28)
3758+
#define B_BE_R_SYM_WLPOFF_P3_PC_EN BIT(27)
3759+
#define B_BE_R_SYM_WLPOFF_P2_PC_EN BIT(26)
3760+
#define B_BE_R_SYM_WLPOFF_P1_PC_EN BIT(25)
3761+
#define B_BE_R_SYM_WLPOFF_PC_EN BIT(24)
3762+
#define B_BE_AON_OFF_PC_EN BIT(23)
3763+
#define B_BE_R_SYM_WLPON_P3_PC_EN BIT(21)
3764+
#define B_BE_R_SYM_WLPON_P2_PC_EN BIT(20)
3765+
#define B_BE_R_SYM_WLPON_P1_PC_EN BIT(19)
3766+
#define B_BE_R_SYM_WLPON_PC_EN BIT(18)
3767+
#define B_BE_R_SYM_WLBBPON1_P1_PC_EN BIT(15)
3768+
#define B_BE_R_SYM_WLBBPON1_PC_EN BIT(14)
3769+
#define B_BE_R_SYM_WLBBPON_P1_PC_EN BIT(13)
3770+
#define B_BE_R_SYM_WLBBPON_PC_EN BIT(12)
3771+
#define B_BE_R_SYM_DIS_WPHYBBOFF_PC BIT(10)
3772+
#define B_BE_R_SYM_WLBBOFF1_P4_PC_EN BIT(9)
3773+
#define B_BE_R_SYM_WLBBOFF1_P3_PC_EN BIT(8)
3774+
#define B_BE_R_SYM_WLBBOFF1_P2_PC_EN BIT(7)
3775+
#define B_BE_R_SYM_WLBBOFF1_P1_PC_EN BIT(6)
3776+
#define B_BE_R_SYM_WLBBOFF1_PC_EN BIT(5)
3777+
#define B_BE_R_SYM_WLBBOFF_P4_PC_EN BIT(4)
3778+
#define B_BE_R_SYM_WLBBOFF_P3_PC_EN BIT(3)
3779+
#define B_BE_R_SYM_WLBBOFF_P2_PC_EN BIT(2)
3780+
#define B_BE_R_SYM_WLBBOFF_P1_PC_EN BIT(1)
3781+
#define B_BE_R_SYM_WLBBOFF_PC_EN BIT(0)
3782+
37453783
#define R_BE_AFE_CTRL1 0x0024
37463784
#define B_BE_R_SYM_WLCMAC0_P4_PC_EN BIT(28)
37473785
#define B_BE_R_SYM_WLCMAC0_P3_PC_EN BIT(27)
@@ -3886,6 +3924,28 @@
38863924
#define B_BE_R_SYM_ISO_BTSDIO2PP BIT(1)
38873925
#define B_BE_R_SYM_ISO_SPDIO2PP BIT(0)
38883926

3927+
#define R_BE_FEN_RST_ENABLE 0x0084
3928+
#define B_BE_R_SYM_FEN_WLMACOFF BIT(31)
3929+
#define B_BE_R_SYM_ISO_WA12PP BIT(28)
3930+
#define B_BE_R_SYM_ISO_CMAC12PP BIT(25)
3931+
#define B_BE_R_SYM_ISO_CMAC02PP BIT(24)
3932+
#define B_BE_R_SYM_ISO_ADDA_P32PP BIT(23)
3933+
#define B_BE_R_SYM_ISO_ADDA_P22PP BIT(22)
3934+
#define B_BE_R_SYM_ISO_ADDA_P12PP BIT(21)
3935+
#define B_BE_R_SYM_ISO_ADDA_P02PP BIT(20)
3936+
#define B_BE_CMAC1_FEN BIT(17)
3937+
#define B_BE_CMAC0_FEN BIT(16)
3938+
#define B_BE_SYM_ISO_BBPON12PP BIT(13)
3939+
#define B_BE_SYM_ISO_BB12PP BIT(12)
3940+
#define B_BE_BOOT_RDY1 BIT(10)
3941+
#define B_BE_FEN_BB1_IP_RSTN BIT(9)
3942+
#define B_BE_FEN_BB1PLAT_RSTB BIT(8)
3943+
#define B_BE_SYM_ISO_BBPON02PP BIT(5)
3944+
#define B_BE_SYM_ISO_BB02PP BIT(4)
3945+
#define B_BE_BOOT_RDY0 BIT(2)
3946+
#define B_BE_FEN_BB_IP_RSTN BIT(1)
3947+
#define B_BE_FEN_BBPLAT_RSTB BIT(0)
3948+
38893949
#define R_BE_PLATFORM_ENABLE 0x0088
38903950
#define B_BE_HOLD_AFTER_RESET BIT(11)
38913951
#define B_BE_SYM_WLPLT_MEM_MUX_EN BIT(10)
@@ -3899,6 +3959,51 @@
38993959
#define B_BE_WCPU_EN BIT(1)
39003960
#define B_BE_PLATFORM_EN BIT(0)
39013961

3962+
#define R_BE_WLLPS_CTRL 0x0090
3963+
#define B_BE_LPSOP_BBMEMDS BIT(30)
3964+
#define B_BE_LPSOP_BBOFF BIT(29)
3965+
#define B_BE_LPSOP_MACOFF BIT(28)
3966+
#define B_BE_LPSOP_OFF_CAPC_EN BIT(27)
3967+
#define B_BE_LPSOP_MEM_DS BIT(26)
3968+
#define B_BE_LPSOP_XTALM_LPS BIT(23)
3969+
#define B_BE_LPSOP_XTAL BIT(22)
3970+
#define B_BE_LPSOP_ACLK_DIV_2 BIT(21)
3971+
#define B_BE_LPSOP_ACLK_SEL BIT(20)
3972+
#define B_BE_LPSOP_ASWRM BIT(17)
3973+
#define B_BE_LPSOP_ASWR BIT(16)
3974+
#define B_BE_LPSOP_DSWR_ADJ_MASK GENMASK(15, 12)
3975+
#define B_BE_LPSOP_DSWRSD BIT(10)
3976+
#define B_BE_LPSOP_DSWRM BIT(9)
3977+
#define B_BE_LPSOP_DSWR BIT(8)
3978+
#define B_BE_LPSOP_OLD_ADJ_MASK GENMASK(7, 4)
3979+
#define B_BE_FORCE_LEAVE_LPS BIT(3)
3980+
#define B_BE_LPSOP_OLDSD BIT(2)
3981+
#define B_BE_DIS_WLBT_LPSEN_LOPC BIT(1)
3982+
#define B_BE_WL_LPS_EN BIT(0)
3983+
3984+
#define R_BE_WLRESUME_CTRL 0x0094
3985+
#define B_BE_LPSROP_DMEM5_RSU_EN BIT(31)
3986+
#define B_BE_LPSROP_DMEM4_RSU_EN BIT(30)
3987+
#define B_BE_LPSROP_DMEM3_RSU_EN BIT(29)
3988+
#define B_BE_LPSROP_DMEM2_RSU_EN BIT(28)
3989+
#define B_BE_LPSROP_DMEM1_RSU_EN BIT(27)
3990+
#define B_BE_LPSROP_DMEM0_RSU_EN BIT(26)
3991+
#define B_BE_LPSROP_IMEM5_RSU_EN BIT(25)
3992+
#define B_BE_LPSROP_IMEM4_RSU_EN BIT(24)
3993+
#define B_BE_LPSROP_IMEM3_RSU_EN BIT(23)
3994+
#define B_BE_LPSROP_IMEM2_RSU_EN BIT(22)
3995+
#define B_BE_LPSROP_IMEM1_RSU_EN BIT(21)
3996+
#define B_BE_LPSROP_IMEM0_RSU_EN BIT(20)
3997+
#define B_BE_LPSROP_BB1_W_BB0 BIT(14)
3998+
#define B_BE_LPSROP_CMAC1 BIT(13)
3999+
#define B_BE_LPSROP_CMAC0 BIT(12)
4000+
#define B_BE_LPSROP_XTALM BIT(11)
4001+
#define B_BE_LPSROP_PLLM BIT(10)
4002+
#define B_BE_LPSROP_HIOE BIT(9)
4003+
#define B_BE_LPSROP_CPU BIT(8)
4004+
#define B_BE_LPSROP_LOWPWRPLL BIT(7)
4005+
#define B_BE_LPSROP_DSWRSD_SEL_MASK GENMASK(5, 4)
4006+
39024007
#define R_BE_EFUSE_CTRL_2_V1 0x00A4
39034008
#define B_BE_EF_ENT BIT(31)
39044009
#define B_BE_EF_TCOLUMN_EN BIT(29)
@@ -4085,6 +4190,59 @@
40854190
#define R_BE_UDM2 0x01F8
40864191
#define B_BE_UDM2_EPC_RA_MASK GENMASK(31, 0)
40874192

4193+
#define R_BE_AFE_ON_CTRL0 0x0240
4194+
#define B_BE_REG_LPF_R3_3_0_MASK GENMASK(31, 29)
4195+
#define B_BE_REG_LPF_R2_MASK GENMASK(28, 24)
4196+
#define B_BE_REG_LPF_C3_MASK GENMASK(23, 21)
4197+
#define B_BE_REG_LPF_C2_MASK GENMASK(20, 18)
4198+
#define B_BE_REG_LPF_C1_MASK GENMASK(17, 15)
4199+
#define B_BE_REG_CP_ICPX2 BIT(14)
4200+
#define B_BE_REG_CP_ICP_SEL_FAST_MASK GENMASK(13, 10)
4201+
#define B_BE_REG_CP_ICP_SEL_MASK GENMASK(9, 6)
4202+
#define B_BE_REG_IB_PI_MASK GENMASK(5, 4)
4203+
#define B_BE_REG_CK_DEBUG_BT BIT(3)
4204+
#define B_BE_EN_PC_LDO BIT(2)
4205+
#define B_BE_LDO_VSEL_MASK GENMASK(1, 0)
4206+
4207+
#define R_BE_AFE_ON_CTRL1 0x0244
4208+
#define B_BE_REG_CK_MON_SEL_MASK GENMASK(31, 29)
4209+
#define B_BE_REG_CK_MON_CK960M_EN BIT(28)
4210+
#define B_BE_REG_XTAL_FREQ_SEL BIT(27)
4211+
#define B_BE_REG_XTAL_EDGE_SEL BIT(26)
4212+
#define B_BE_REG_VCO_KVCO BIT(25)
4213+
#define B_BE_REG_SDM_EDGE_SEL BIT(24)
4214+
#define B_BE_REG_SDM_CK_SEL BIT(23)
4215+
#define B_BE_REG_SDM_CK_GATED BIT(22)
4216+
#define B_BE_REG_PFD_RESET_GATED BIT(21)
4217+
#define B_BE_REG_LPF_R3_FAST_MASK GENMASK(20, 16)
4218+
#define B_BE_REG_LPF_R2_FAST_MASK GENMASK(15, 11)
4219+
#define B_BE_REG_LPF_C3_FAST_MASK GENMASK(10, 8)
4220+
#define B_BE_REG_LPF_C2_FAST_MASK GENMASK(7, 5)
4221+
#define B_BE_REG_LPF_C1_FAST_MASK GENMASK(4, 2)
4222+
#define B_BE_REG_LPF_R3_4_MASK GENMASK(1, 0)
4223+
4224+
#define R_BE_AFE_ON_CTRL3 0x024C
4225+
#define B_BE_LDO_VSEL_DA_1_MASK GENMASK(31, 30)
4226+
#define B_BE_LDO_VSEL_DA_0_MASK GENMASK(29, 28)
4227+
#define B_BE_LDO_VSEL_D2S_1_MASK GENMASK(27, 26)
4228+
#define B_BE_LDO_VSEL_D2S_0_MASK GENMASK(25, 24)
4229+
#define B_BE_LDO_VSEL_BUF_MASK GENMASK(23, 22)
4230+
#define B_BE_REG_R2_L_MASK GENMASK(21, 19)
4231+
#define B_BE_REG_R1_L_MASK GENMASK(18, 16)
4232+
#define B_BE_REG_CK_DEBUG_BT_MON BIT(15)
4233+
#define B_BE_REG_BT_CLK_BUF_POWER BIT(14)
4234+
#define B_BE_REG_BG_OUT_BTADC_V1 BIT(13)
4235+
#define B_BE_REG_SEL_V18 BIT(11)
4236+
#define B_BE_REG_FRAC_EN BIT(10)
4237+
#define B_BE_REG_CK1920M_EN BIT(9)
4238+
#define B_BE_REG_CK1280M_EN BIT(8)
4239+
#define B_BE_REG_12LDO_SEL_MASK GENMASK(7, 6)
4240+
#define B_BE_REG_09LDO_SEL_MASK GENMASK(5, 4)
4241+
#define B_BE_REG_VC_TH BIT(3)
4242+
#define B_BE_REG_VC_TL BIT(2)
4243+
#define B_BE_REG_CK40M_EN BIT(1)
4244+
#define B_BE_REG_CK640M_EN BIT(0)
4245+
40884246
#define R_BE_WLAN_XTAL_SI_CTRL 0x0270
40894247
#define B_BE_WL_XTAL_SI_CMD_POLL BIT(31)
40904248
#define B_BE_WL_XTAL_SI_CHIPID_MASK GENMASK(30, 28)
@@ -5537,6 +5695,16 @@
55375695
#define R_BE_WP_PAGE_INFO1 0xB7AC
55385696
#define B_BE_WP_AVAL_PG_MASK GENMASK(28, 16)
55395697

5698+
#define R_BE_CMAC_SHARE_FUNC_EN 0x0E000
5699+
#define B_BE_CMAC_SHARE_CRPRT BIT(31)
5700+
#define B_BE_CMAC_SHARE_EN BIT(30)
5701+
#define B_BE_FORCE_BTCOEX_REG_GCKEN BIT(24)
5702+
#define B_BE_FORCE_CMAC_SHARE_COMMON_REG_GCKEN BIT(16)
5703+
#define B_BE_FORCE_CMAC_SHARE_REG_GCKEN BIT(15)
5704+
#define B_BE_RESPBA_EN BIT(2)
5705+
#define B_BE_ADDRSRCH_EN BIT(1)
5706+
#define B_BE_BTCOEX_EN BIT(0)
5707+
55405708
#define R_BE_CMAC_FUNC_EN 0x10000
55415709
#define R_BE_CMAC_FUNC_EN_C1 0x14000
55425710
#define B_BE_CMAC_CRPRT BIT(31)

0 commit comments

Comments
 (0)