162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/* Copyright(c) 2018-2019  Realtek Corporation
362306a36Sopenharmony_ci */
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __RTW8822C_H__
662306a36Sopenharmony_ci#define __RTW8822C_H__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <asm/byteorder.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct rtw8822cu_efuse {
1162306a36Sopenharmony_ci	u8 res0[0x30];			/* 0x120 */
1262306a36Sopenharmony_ci	u8 vid[2];			/* 0x150 */
1362306a36Sopenharmony_ci	u8 pid[2];
1462306a36Sopenharmony_ci	u8 res1[3];
1562306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0x157 */
1662306a36Sopenharmony_ci	u8 res2[0x3d];
1762306a36Sopenharmony_ci};
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cistruct rtw8822cs_efuse {
2062306a36Sopenharmony_ci	u8 res0[0x4a];			/* 0x120 */
2162306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0x16a */
2262306a36Sopenharmony_ci} __packed;
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct rtw8822ce_efuse {
2562306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0x120 */
2662306a36Sopenharmony_ci	u8 vender_id[2];
2762306a36Sopenharmony_ci	u8 device_id[2];
2862306a36Sopenharmony_ci	u8 sub_vender_id[2];
2962306a36Sopenharmony_ci	u8 sub_device_id[2];
3062306a36Sopenharmony_ci	u8 pmc[2];
3162306a36Sopenharmony_ci	u8 exp_device_cap[2];
3262306a36Sopenharmony_ci	u8 msi_cap;
3362306a36Sopenharmony_ci	u8 ltr_cap;			/* 0x133 */
3462306a36Sopenharmony_ci	u8 exp_link_control[2];
3562306a36Sopenharmony_ci	u8 link_cap[4];
3662306a36Sopenharmony_ci	u8 link_control[2];
3762306a36Sopenharmony_ci	u8 serial_number[8];
3862306a36Sopenharmony_ci	u8 res0:2;			/* 0x144 */
3962306a36Sopenharmony_ci	u8 ltr_en:1;
4062306a36Sopenharmony_ci	u8 res1:2;
4162306a36Sopenharmony_ci	u8 obff:2;
4262306a36Sopenharmony_ci	u8 res2:3;
4362306a36Sopenharmony_ci	u8 obff_cap:2;
4462306a36Sopenharmony_ci	u8 res3:4;
4562306a36Sopenharmony_ci	u8 class_code[3];
4662306a36Sopenharmony_ci	u8 res4;
4762306a36Sopenharmony_ci	u8 pci_pm_L1_2_supp:1;
4862306a36Sopenharmony_ci	u8 pci_pm_L1_1_supp:1;
4962306a36Sopenharmony_ci	u8 aspm_pm_L1_2_supp:1;
5062306a36Sopenharmony_ci	u8 aspm_pm_L1_1_supp:1;
5162306a36Sopenharmony_ci	u8 L1_pm_substates_supp:1;
5262306a36Sopenharmony_ci	u8 res5:3;
5362306a36Sopenharmony_ci	u8 port_common_mode_restore_time;
5462306a36Sopenharmony_ci	u8 port_t_power_on_scale:2;
5562306a36Sopenharmony_ci	u8 res6:1;
5662306a36Sopenharmony_ci	u8 port_t_power_on_value:5;
5762306a36Sopenharmony_ci	u8 res7;
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cistruct rtw8822c_efuse {
6162306a36Sopenharmony_ci	__le16 rtl_id;
6262306a36Sopenharmony_ci	u8 res0[0x0e];
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	/* power index for four RF paths */
6562306a36Sopenharmony_ci	struct rtw_txpwr_idx txpwr_idx_table[4];
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	u8 channel_plan;		/* 0xb8 */
6862306a36Sopenharmony_ci	u8 xtal_k;
6962306a36Sopenharmony_ci	u8 res1;
7062306a36Sopenharmony_ci	u8 iqk_lck;
7162306a36Sopenharmony_ci	u8 res2[5];			/* 0xbc */
7262306a36Sopenharmony_ci	u8 rf_board_option;
7362306a36Sopenharmony_ci	u8 rf_feature_option;
7462306a36Sopenharmony_ci	u8 rf_bt_setting;
7562306a36Sopenharmony_ci	u8 eeprom_version;
7662306a36Sopenharmony_ci	u8 eeprom_customer_id;
7762306a36Sopenharmony_ci	u8 tx_bb_swing_setting_2g;
7862306a36Sopenharmony_ci	u8 tx_bb_swing_setting_5g;
7962306a36Sopenharmony_ci	u8 tx_pwr_calibrate_rate;
8062306a36Sopenharmony_ci	u8 rf_antenna_option;		/* 0xc9 */
8162306a36Sopenharmony_ci	u8 rfe_option;
8262306a36Sopenharmony_ci	u8 country_code[2];
8362306a36Sopenharmony_ci	u8 res3[3];
8462306a36Sopenharmony_ci	u8 path_a_thermal;		/* 0xd0 */
8562306a36Sopenharmony_ci	u8 path_b_thermal;
8662306a36Sopenharmony_ci	u8 res4[2];
8762306a36Sopenharmony_ci	u8 rx_gain_gap_2g_ofdm;
8862306a36Sopenharmony_ci	u8 res5;
8962306a36Sopenharmony_ci	u8 rx_gain_gap_2g_cck;
9062306a36Sopenharmony_ci	u8 res6;
9162306a36Sopenharmony_ci	u8 rx_gain_gap_5gl;
9262306a36Sopenharmony_ci	u8 res7;
9362306a36Sopenharmony_ci	u8 rx_gain_gap_5gm;
9462306a36Sopenharmony_ci	u8 res8;
9562306a36Sopenharmony_ci	u8 rx_gain_gap_5gh;
9662306a36Sopenharmony_ci	u8 res9;
9762306a36Sopenharmony_ci	u8 res10[0x42];
9862306a36Sopenharmony_ci	union {
9962306a36Sopenharmony_ci		struct rtw8822ce_efuse e;
10062306a36Sopenharmony_ci		struct rtw8822cu_efuse u;
10162306a36Sopenharmony_ci		struct rtw8822cs_efuse s;
10262306a36Sopenharmony_ci	};
10362306a36Sopenharmony_ci};
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_cienum rtw8822c_dpk_agc_phase {
10662306a36Sopenharmony_ci	RTW_DPK_GAIN_CHECK,
10762306a36Sopenharmony_ci	RTW_DPK_GAIN_LARGE,
10862306a36Sopenharmony_ci	RTW_DPK_GAIN_LESS,
10962306a36Sopenharmony_ci	RTW_DPK_GL_LARGE,
11062306a36Sopenharmony_ci	RTW_DPK_GL_LESS,
11162306a36Sopenharmony_ci	RTW_DPK_LOSS_CHECK,
11262306a36Sopenharmony_ci	RTW_DPK_AGC_OUT,
11362306a36Sopenharmony_ci};
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_cienum rtw8822c_dpk_one_shot_action {
11662306a36Sopenharmony_ci	RTW_DPK_CAL_PWR,
11762306a36Sopenharmony_ci	RTW_DPK_GAIN_LOSS,
11862306a36Sopenharmony_ci	RTW_DPK_DO_DPK,
11962306a36Sopenharmony_ci	RTW_DPK_DPK_ON,
12062306a36Sopenharmony_ci	RTW_DPK_DAGC,
12162306a36Sopenharmony_ci	RTW_DPK_ACTION_MAX
12262306a36Sopenharmony_ci};
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_civoid rtw8822c_parse_tbl_dpk(struct rtw_dev *rtwdev,
12562306a36Sopenharmony_ci			    const struct rtw_table *tbl);
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ciextern const struct rtw_chip_info rtw8822c_hw_spec;
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define RTW_DECL_TABLE_DPK(name)			\
13062306a36Sopenharmony_ciconst struct rtw_table name ## _tbl = {			\
13162306a36Sopenharmony_ci	.data = name,					\
13262306a36Sopenharmony_ci	.size = ARRAY_SIZE(name),			\
13362306a36Sopenharmony_ci	.parse = rtw8822c_parse_tbl_dpk,		\
13462306a36Sopenharmony_ci}
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define DACK_PATH_8822C		2
13762306a36Sopenharmony_ci#define DACK_REG_8822C		16
13862306a36Sopenharmony_ci#define DACK_RF_8822C		1
13962306a36Sopenharmony_ci#define DACK_SN_8822C		100
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci/* phy status page0 */
14262306a36Sopenharmony_ci#define GET_PHY_STAT_P0_PWDB_A(phy_stat)                                       \
14362306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x00), GENMASK(15, 8))
14462306a36Sopenharmony_ci#define GET_PHY_STAT_P0_PWDB_B(phy_stat)                                       \
14562306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0))
14662306a36Sopenharmony_ci#define GET_PHY_STAT_P0_GAIN_A(phy_stat)                                       \
14762306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x00), GENMASK(21, 16))
14862306a36Sopenharmony_ci#define GET_PHY_STAT_P0_CHANNEL(phy_stat)				       \
14962306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(23, 16))
15062306a36Sopenharmony_ci#define GET_PHY_STAT_P0_GAIN_B(phy_stat)                                       \
15162306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(29, 24))
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci/* phy status page1 */
15462306a36Sopenharmony_ci#define GET_PHY_STAT_P1_PWDB_A(phy_stat)                                       \
15562306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x00), GENMASK(15, 8))
15662306a36Sopenharmony_ci#define GET_PHY_STAT_P1_PWDB_B(phy_stat)                                       \
15762306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x00), GENMASK(23, 16))
15862306a36Sopenharmony_ci#define GET_PHY_STAT_P1_L_RXSC(phy_stat)                                       \
15962306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(11, 8))
16062306a36Sopenharmony_ci#define GET_PHY_STAT_P1_HT_RXSC(phy_stat)                                      \
16162306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(15, 12))
16262306a36Sopenharmony_ci#define GET_PHY_STAT_P1_CHANNEL(phy_stat)				       \
16362306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(23, 16))
16462306a36Sopenharmony_ci#define GET_PHY_STAT_P1_RXEVM_A(phy_stat)                                      \
16562306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0))
16662306a36Sopenharmony_ci#define GET_PHY_STAT_P1_RXEVM_B(phy_stat)                                      \
16762306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(15, 8))
16862306a36Sopenharmony_ci#define GET_PHY_STAT_P1_CFO_TAIL_A(phy_stat)                                 \
16962306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(7, 0))
17062306a36Sopenharmony_ci#define GET_PHY_STAT_P1_CFO_TAIL_B(phy_stat)                                 \
17162306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(15, 8))
17262306a36Sopenharmony_ci#define GET_PHY_STAT_P1_RXSNR_A(phy_stat)                                      \
17362306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(7, 0))
17462306a36Sopenharmony_ci#define GET_PHY_STAT_P1_RXSNR_B(phy_stat)                                      \
17562306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(15, 8))
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci#define RTW8822C_EDCCA_MAX	0x7f
17862306a36Sopenharmony_ci#define REG_ANAPARLDO_POW_MAC	0x0029
17962306a36Sopenharmony_ci#define BIT_LDOE25_PON		BIT(0)
18062306a36Sopenharmony_ci#define XCAP_MASK		GENMASK(6, 0)
18162306a36Sopenharmony_ci#define CFO_TRK_ENABLE_TH	20
18262306a36Sopenharmony_ci#define CFO_TRK_STOP_TH		10
18362306a36Sopenharmony_ci#define CFO_TRK_ADJ_TH		10
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci#define REG_TXDFIR0		0x808
18662306a36Sopenharmony_ci#define REG_DFIRBW		0x810
18762306a36Sopenharmony_ci#define REG_ANTMAP0		0x820
18862306a36Sopenharmony_ci#define BIT_ANT_PATH		GENMASK(1, 0)
18962306a36Sopenharmony_ci#define REG_ANTMAP		0x824
19062306a36Sopenharmony_ci#define REG_EDCCA_DECISION	0x844
19162306a36Sopenharmony_ci#define BIT_EDCCA_OPTION	GENMASK(30, 29)
19262306a36Sopenharmony_ci#define REG_DYMPRITH		0x86c
19362306a36Sopenharmony_ci#define REG_DYMENTH0		0x870
19462306a36Sopenharmony_ci#define REG_DYMENTH		0x874
19562306a36Sopenharmony_ci#define REG_SBD			0x88c
19662306a36Sopenharmony_ci#define BITS_SUBTUNE		GENMASK(15, 12)
19762306a36Sopenharmony_ci#define REG_DYMTHMIN		0x8a4
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci#define REG_TXBWCTL		0x9b0
20062306a36Sopenharmony_ci#define REG_TXCLK		0x9b4
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci#define REG_SCOTRK		0xc30
20362306a36Sopenharmony_ci#define REG_MRCM		0xc38
20462306a36Sopenharmony_ci#define REG_AGCSWSH		0xc44
20562306a36Sopenharmony_ci#define REG_ANTWTPD		0xc54
20662306a36Sopenharmony_ci#define REG_PT_CHSMO		0xcbc
20762306a36Sopenharmony_ci#define BIT_PT_OPT		BIT(21)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci#define REG_ORITXCODE		0x1800
21062306a36Sopenharmony_ci#define BIT_PATH_EN		BIT(31)
21162306a36Sopenharmony_ci#define REG_3WIRE		0x180c
21262306a36Sopenharmony_ci#define BIT_DIS_SHARERX_TXGAT	BIT(27)
21362306a36Sopenharmony_ci#define BIT_3WIRE_TX_EN		BIT(0)
21462306a36Sopenharmony_ci#define BIT_3WIRE_RX_EN		BIT(1)
21562306a36Sopenharmony_ci#define BIT_3WIRE_EN		GENMASK(1, 0)
21662306a36Sopenharmony_ci#define BIT_3WIRE_PI_ON		BIT(28)
21762306a36Sopenharmony_ci#define REG_ANAPAR_A		0x1830
21862306a36Sopenharmony_ci#define BIT_ANAPAR_UPDATE	BIT(29)
21962306a36Sopenharmony_ci#define REG_RFTXEN_GCK_A	0x1864
22062306a36Sopenharmony_ci#define BIT_RFTXEN_GCK_FORCE_ON	BIT(31)
22162306a36Sopenharmony_ci#define REG_DIS_SHARE_RX_A	0x186c
22262306a36Sopenharmony_ci#define BIT_TX_SCALE_0DB	BIT(7)
22362306a36Sopenharmony_ci#define REG_RXAGCCTL0		0x18ac
22462306a36Sopenharmony_ci#define BITS_RXAGC_CCK		GENMASK(15, 12)
22562306a36Sopenharmony_ci#define BITS_RXAGC_OFDM		GENMASK(8, 4)
22662306a36Sopenharmony_ci#define REG_DCKA_I_0		0x18bc
22762306a36Sopenharmony_ci#define REG_DCKA_I_1		0x18c0
22862306a36Sopenharmony_ci#define REG_DCKA_Q_0		0x18d8
22962306a36Sopenharmony_ci#define REG_DCKA_Q_1		0x18dc
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci#define REG_CCKSB		0x1a00
23262306a36Sopenharmony_ci#define BIT_BBMODE		GENMASK(2, 1)
23362306a36Sopenharmony_ci#define REG_RXCCKSEL		0x1a04
23462306a36Sopenharmony_ci#define REG_BGCTRL		0x1a14
23562306a36Sopenharmony_ci#define BITS_RX_IQ_WEIGHT	(BIT(8) | BIT(9))
23662306a36Sopenharmony_ci#define REG_TXF0		0x1a20
23762306a36Sopenharmony_ci#define REG_TXF1		0x1a24
23862306a36Sopenharmony_ci#define REG_TXF2		0x1a28
23962306a36Sopenharmony_ci#define REG_CCANRX		0x1a2c
24062306a36Sopenharmony_ci#define BIT_CCK_FA_RST		(BIT(14) | BIT(15))
24162306a36Sopenharmony_ci#define BIT_OFDM_FA_RST		(BIT(12) | BIT(13))
24262306a36Sopenharmony_ci#define REG_CCK_FACNT		0x1a5c
24362306a36Sopenharmony_ci#define REG_CCKTXONLY		0x1a80
24462306a36Sopenharmony_ci#define BIT_BB_CCK_CHECK_EN	BIT(18)
24562306a36Sopenharmony_ci#define REG_TXF3		0x1a98
24662306a36Sopenharmony_ci#define REG_TXF4		0x1a9c
24762306a36Sopenharmony_ci#define REG_TXF5		0x1aa0
24862306a36Sopenharmony_ci#define REG_TXF6		0x1aac
24962306a36Sopenharmony_ci#define REG_TXF7		0x1ab0
25062306a36Sopenharmony_ci#define REG_CCK_SOURCE		0x1abc
25162306a36Sopenharmony_ci#define BIT_NBI_EN		BIT(30)
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci#define REG_NCTL0		0x1b00
25462306a36Sopenharmony_ci#define BIT_SEL_PATH		GENMASK(2, 1)
25562306a36Sopenharmony_ci#define BIT_SUBPAGE		GENMASK(3, 0)
25662306a36Sopenharmony_ci#define REG_DPD_CTL0_S0		0x1b04
25762306a36Sopenharmony_ci#define BIT_GS_PWSF		GENMASK(27, 0)
25862306a36Sopenharmony_ci#define REG_DPD_CTL1_S0		0x1b08
25962306a36Sopenharmony_ci#define BIT_DPD_EN		BIT(31)
26062306a36Sopenharmony_ci#define BIT_PS_EN		BIT(7)
26162306a36Sopenharmony_ci#define REG_IQKSTAT		0x1b10
26262306a36Sopenharmony_ci#define REG_IQK_CTL1		0x1b20
26362306a36Sopenharmony_ci#define BIT_TX_CFIR		GENMASK(31, 30)
26462306a36Sopenharmony_ci#define BIT_CFIR_EN		GENMASK(26, 24)
26562306a36Sopenharmony_ci#define BIT_BYPASS_DPD		BIT(25)
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define REG_TX_TONE_IDX		0x1b2c
26862306a36Sopenharmony_ci#define REG_DPD_LUT0		0x1b44
26962306a36Sopenharmony_ci#define BIT_GLOSS_DB		GENMASK(14, 12)
27062306a36Sopenharmony_ci#define REG_DPD_CTL0_S1		0x1b5c
27162306a36Sopenharmony_ci#define REG_DPD_CTL1_S1		0x1b60
27262306a36Sopenharmony_ci#define REG_DPD_AGC		0x1b67
27362306a36Sopenharmony_ci#define REG_TABLE_SEL		0x1b98
27462306a36Sopenharmony_ci#define BIT_I_GAIN		GENMASK(19, 16)
27562306a36Sopenharmony_ci#define BIT_GAIN_RST		BIT(15)
27662306a36Sopenharmony_ci#define BIT_Q_GAIN_SEL		GENMASK(14, 12)
27762306a36Sopenharmony_ci#define BIT_Q_GAIN		GENMASK(11, 0)
27862306a36Sopenharmony_ci#define REG_TX_GAIN_SET		0x1b9c
27962306a36Sopenharmony_ci#define BIT_GAPK_RPT_IDX	GENMASK(11, 8)
28062306a36Sopenharmony_ci#define REG_DPD_CTL0		0x1bb4
28162306a36Sopenharmony_ci#define REG_SINGLE_TONE_SW	0x1bb8
28262306a36Sopenharmony_ci#define BIT_IRQ_TEST_MODE	BIT(20)
28362306a36Sopenharmony_ci#define REG_R_CONFIG		0x1bcc
28462306a36Sopenharmony_ci#define BIT_INNER_LB		BIT(21)
28562306a36Sopenharmony_ci#define BIT_IQ_SWITCH		GENMASK(5, 0)
28662306a36Sopenharmony_ci#define BIT_2G_SWING		0x2d
28762306a36Sopenharmony_ci#define BIT_5G_SWING		0x36
28862306a36Sopenharmony_ci#define REG_RXSRAM_CTL		0x1bd4
28962306a36Sopenharmony_ci#define BIT_RPT_EN		BIT(21)
29062306a36Sopenharmony_ci#define BIT_RPT_SEL		GENMASK(20, 16)
29162306a36Sopenharmony_ci#define BIT_DPD_CLK		GENMASK(7, 4)
29262306a36Sopenharmony_ci#define REG_DPD_CTL11		0x1be4
29362306a36Sopenharmony_ci#define REG_DPD_CTL12		0x1be8
29462306a36Sopenharmony_ci#define REG_DPD_CTL15		0x1bf4
29562306a36Sopenharmony_ci#define REG_DPD_CTL16		0x1bf8
29662306a36Sopenharmony_ci#define REG_STAT_RPT		0x1bfc
29762306a36Sopenharmony_ci#define BIT_RPT_DGAIN		GENMASK(27, 16)
29862306a36Sopenharmony_ci#define BIT_GAPK_RPT0		GENMASK(3, 0)
29962306a36Sopenharmony_ci#define BIT_GAPK_RPT1		GENMASK(7, 4)
30062306a36Sopenharmony_ci#define BIT_GAPK_RPT2		GENMASK(11, 8)
30162306a36Sopenharmony_ci#define BIT_GAPK_RPT3		GENMASK(15, 12)
30262306a36Sopenharmony_ci#define BIT_GAPK_RPT4		GENMASK(19, 16)
30362306a36Sopenharmony_ci#define BIT_GAPK_RPT5		GENMASK(23, 20)
30462306a36Sopenharmony_ci#define BIT_GAPK_RPT6		GENMASK(27, 24)
30562306a36Sopenharmony_ci#define BIT_GAPK_RPT7		GENMASK(31, 28)
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci#define REG_TXANT		0x1c28
30862306a36Sopenharmony_ci#define REG_IQK_CTRL		0x1c38
30962306a36Sopenharmony_ci#define REG_ENCCK		0x1c3c
31062306a36Sopenharmony_ci#define BIT_CCK_BLK_EN		BIT(1)
31162306a36Sopenharmony_ci#define BIT_CCK_OFDM_BLK_EN	(BIT(0) | BIT(1))
31262306a36Sopenharmony_ci#define REG_CCAMSK		0x1c80
31362306a36Sopenharmony_ci#define REG_RSTB		0x1c90
31462306a36Sopenharmony_ci#define BIT_RSTB_3WIRE		BIT(8)
31562306a36Sopenharmony_ci#define REG_CH_DELAY_EXTR2	0x1cd0
31662306a36Sopenharmony_ci#define BIT_TST_IQK2SET_SRC	BIT(31)
31762306a36Sopenharmony_ci#define BIT_EN_IOQ_IQK_DPK	BIT(30)
31862306a36Sopenharmony_ci#define BIT_IQK_DPK_RESET_SRC	BIT(29)
31962306a36Sopenharmony_ci#define BIT_IQK_DPK_CLOCK_SRC	BIT(28)
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci#define REG_RX_BREAK		0x1d2c
32262306a36Sopenharmony_ci#define BIT_COM_RX_GCK_EN	BIT(31)
32362306a36Sopenharmony_ci#define REG_RXFNCTL		0x1d30
32462306a36Sopenharmony_ci#define REG_CCA_OFF		0x1d58
32562306a36Sopenharmony_ci#define BIT_CCA_ON_BY_PW	GENMASK(11, 3)
32662306a36Sopenharmony_ci#define REG_RXIGI		0x1d70
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#define REG_ENFN		0x1e24
32962306a36Sopenharmony_ci#define BIT_IQK_DPK_EN		BIT(17)
33062306a36Sopenharmony_ci#define REG_TXANTSEG		0x1e28
33162306a36Sopenharmony_ci#define BIT_ANTSEG		GENMASK(3, 0)
33262306a36Sopenharmony_ci#define REG_TXLGMAP		0x1e2c
33362306a36Sopenharmony_ci#define REG_CCKPATH		0x1e5c
33462306a36Sopenharmony_ci#define REG_TX_FIFO		0x1e70
33562306a36Sopenharmony_ci#define BIT_STOP_TX		GENMASK(3, 0)
33662306a36Sopenharmony_ci#define REG_CNT_CTRL		0x1eb4
33762306a36Sopenharmony_ci#define BIT_ALL_CNT_RST		BIT(25)
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci#define REG_OFDM_FACNT		0x2d00
34062306a36Sopenharmony_ci#define REG_OFDM_FACNT1		0x2d04
34162306a36Sopenharmony_ci#define REG_OFDM_FACNT2		0x2d08
34262306a36Sopenharmony_ci#define REG_OFDM_FACNT3		0x2d0c
34362306a36Sopenharmony_ci#define REG_OFDM_FACNT4		0x2d10
34462306a36Sopenharmony_ci#define REG_OFDM_FACNT5		0x2d20
34562306a36Sopenharmony_ci#define REG_RPT_CIP		0x2d9c
34662306a36Sopenharmony_ci#define BIT_RPT_CIP_STATUS	GENMASK(7, 0)
34762306a36Sopenharmony_ci#define REG_OFDM_TXCNT		0x2de0
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci#define REG_ORITXCODE2		0x4100
35062306a36Sopenharmony_ci#define REG_3WIRE2		0x410c
35162306a36Sopenharmony_ci#define REG_ANAPAR_B		0x4130
35262306a36Sopenharmony_ci#define REG_RFTXEN_GCK_B	0x4164
35362306a36Sopenharmony_ci#define REG_DIS_SHARE_RX_B	0x416c
35462306a36Sopenharmony_ci#define BIT_EXT_TIA_BW		BIT(1)
35562306a36Sopenharmony_ci#define REG_RXAGCCTL		0x41ac
35662306a36Sopenharmony_ci#define REG_DCKB_I_0		0x41bc
35762306a36Sopenharmony_ci#define REG_DCKB_I_1		0x41c0
35862306a36Sopenharmony_ci#define REG_DCKB_Q_0		0x41d8
35962306a36Sopenharmony_ci#define REG_DCKB_Q_1		0x41dc
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci#define RF_MODE_TRXAGC		0x00
36262306a36Sopenharmony_ci#define BIT_RF_MODE		GENMASK(19, 16)
36362306a36Sopenharmony_ci#define BIT_RXAGC		GENMASK(9, 5)
36462306a36Sopenharmony_ci#define BIT_TXAGC		GENMASK(4, 0)
36562306a36Sopenharmony_ci#define RF_RXAGC_OFFSET		0x19
36662306a36Sopenharmony_ci#define RF_BW_TRXBB		0x1a
36762306a36Sopenharmony_ci#define BIT_TX_CCK_IND		BIT(16)
36862306a36Sopenharmony_ci#define BIT_BW_TXBB		GENMASK(14, 12)
36962306a36Sopenharmony_ci#define BIT_BW_RXBB		GENMASK(11, 10)
37062306a36Sopenharmony_ci#define BIT_DBG_CCK_CCA		BIT(1)
37162306a36Sopenharmony_ci#define RF_TX_GAIN_OFFSET	0x55
37262306a36Sopenharmony_ci#define BIT_BB_GAIN		GENMASK(18, 14)
37362306a36Sopenharmony_ci#define BIT_RF_GAIN		GENMASK(4, 2)
37462306a36Sopenharmony_ci#define RF_TX_GAIN		0x56
37562306a36Sopenharmony_ci#define BIT_GAIN_TXBB		GENMASK(4, 0)
37662306a36Sopenharmony_ci#define RF_IDAC			0x58
37762306a36Sopenharmony_ci#define BIT_TX_MODE		GENMASK(19, 8)
37862306a36Sopenharmony_ci#define RF_TX_RESULT		0x5f
37962306a36Sopenharmony_ci#define BIT_GAIN_TX_PAD_H	GENMASK(11, 8)
38062306a36Sopenharmony_ci#define BIT_GAIN_TX_PAD_L	GENMASK(7, 4)
38162306a36Sopenharmony_ci#define RF_PA			0x60
38262306a36Sopenharmony_ci#define RF_PABIAS_2G_MASK	GENMASK(15, 12)
38362306a36Sopenharmony_ci#define RF_PABIAS_5G_MASK	GENMASK(19, 16)
38462306a36Sopenharmony_ci#define RF_TXA_LB_SW		0x63
38562306a36Sopenharmony_ci#define BIT_TXA_LB_ATT		GENMASK(15, 14)
38662306a36Sopenharmony_ci#define BIT_LB_SW		GENMASK(13, 12)
38762306a36Sopenharmony_ci#define BIT_LB_ATT		GENMASK(4, 2)
38862306a36Sopenharmony_ci#define RF_RXG_GAIN		0x87
38962306a36Sopenharmony_ci#define BIT_RXG_GAIN		BIT(18)
39062306a36Sopenharmony_ci#define RF_RXA_MIX_GAIN		0x8a
39162306a36Sopenharmony_ci#define BIT_RXA_MIX_GAIN	GENMASK(4, 3)
39262306a36Sopenharmony_ci#define RF_EXT_TIA_BW		0x8f
39362306a36Sopenharmony_ci#define BIT_PW_EXT_TIA		BIT(1)
39462306a36Sopenharmony_ci#define RF_DIS_BYPASS_TXBB	0x9e
39562306a36Sopenharmony_ci#define BIT_TXBB		BIT(10)
39662306a36Sopenharmony_ci#define BIT_TIA_BYPASS		BIT(5)
39762306a36Sopenharmony_ci#define RF_DEBUG		0xde
39862306a36Sopenharmony_ci#define BIT_DE_PWR_TRIM		BIT(19)
39962306a36Sopenharmony_ci#define BIT_DE_TX_GAIN		BIT(16)
40062306a36Sopenharmony_ci#define BIT_DE_TRXBW		BIT(2)
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci#define PPG_THERMAL_B		0x1b0
40362306a36Sopenharmony_ci#define RF_THEMAL_MASK		GENMASK(19, 16)
40462306a36Sopenharmony_ci#define PPG_2GH_TXAB		0x1d2
40562306a36Sopenharmony_ci#define PPG_2G_A_MASK		GENMASK(3, 0)
40662306a36Sopenharmony_ci#define PPG_2G_B_MASK		GENMASK(7, 4)
40762306a36Sopenharmony_ci#define PPG_2GL_TXAB		0x1d4
40862306a36Sopenharmony_ci#define PPG_PABIAS_2GB		0x1d5
40962306a36Sopenharmony_ci#define PPG_PABIAS_2GA		0x1d6
41062306a36Sopenharmony_ci#define PPG_PABIAS_MASK		GENMASK(3, 0)
41162306a36Sopenharmony_ci#define PPG_PABIAS_5GB		0x1d7
41262306a36Sopenharmony_ci#define PPG_PABIAS_5GA		0x1d8
41362306a36Sopenharmony_ci#define PPG_5G_MASK		GENMASK(4, 0)
41462306a36Sopenharmony_ci#define PPG_5GH1_TXB		0x1db
41562306a36Sopenharmony_ci#define PPG_5GH1_TXA		0x1dc
41662306a36Sopenharmony_ci#define PPG_5GM2_TXB		0x1df
41762306a36Sopenharmony_ci#define PPG_5GM2_TXA		0x1e0
41862306a36Sopenharmony_ci#define PPG_5GM1_TXB		0x1e3
41962306a36Sopenharmony_ci#define PPG_5GM1_TXA		0x1e4
42062306a36Sopenharmony_ci#define PPG_5GL2_TXB		0x1e7
42162306a36Sopenharmony_ci#define PPG_5GL2_TXA		0x1e8
42262306a36Sopenharmony_ci#define PPG_5GL1_TXB		0x1eb
42362306a36Sopenharmony_ci#define PPG_5GL1_TXA		0x1ec
42462306a36Sopenharmony_ci#define PPG_2GM_TXAB		0x1ee
42562306a36Sopenharmony_ci#define PPG_THERMAL_A		0x1ef
42662306a36Sopenharmony_ci#endif
427