18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __MT76X02_REGS_H
78c2ecf20Sopenharmony_ci#define __MT76X02_REGS_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define MT_ASIC_VERSION			0x0000
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define MT76XX_REV_E3			0x22
128c2ecf20Sopenharmony_ci#define MT76XX_REV_E4			0x33
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define MT_CMB_CTRL			0x0020
158c2ecf20Sopenharmony_ci#define MT_CMB_CTRL_XTAL_RDY		BIT(22)
168c2ecf20Sopenharmony_ci#define MT_CMB_CTRL_PLL_LD		BIT(23)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL			0x0024
198c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_AOUT		GENMASK(5, 0)
208c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_MODE		GENMASK(7, 6)
218c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_OFF_TIME	GENMASK(13, 8)
228c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_ON_TIME	GENMASK(15, 14)
238c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_AIN		GENMASK(25, 16)
248c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_KICK		BIT(30)
258c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_SEL		BIT(31)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define MT_EFUSE_DATA_BASE		0x0028
288c2ecf20Sopenharmony_ci#define MT_EFUSE_DATA(_n)		(MT_EFUSE_DATA_BASE + ((_n) << 2))
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define MT_COEXCFG0			0x0040
318c2ecf20Sopenharmony_ci#define MT_COEXCFG0_COEX_EN		BIT(0)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL		0x0080
348c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_WLAN_EN	BIT(0)
358c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_WLAN_CLK_EN	BIT(1)
368c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_WLAN_RESET_RF	BIT(2)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define MT_COEXCFG3			0x004c
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define	MT_LDO_CTRL_0			0x006c
418c2ecf20Sopenharmony_ci#define	MT_LDO_CTRL_1			0x0070
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_WLAN_RESET	BIT(3) /* MT76x0 */
448c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_CSR_F20M_CKEN	BIT(3) /* MT76x2 */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_PCIE_CLK_REQ	BIT(4)
478c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_FRC_WL_ANT_SEL	BIT(5)
488c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_INV_ANT_SEL	BIT(6)
498c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_WAKE_HOST	BIT(7)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_THERM_RST	BIT(8) /* MT76x2 */
528c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_THERM_CKEN	BIT(9) /* MT76x2 */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_GPIO_IN	GENMASK(15, 8) /* MT76x0 */
558c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_GPIO_OUT	GENMASK(23, 16) /* MT76x0 */
568c2ecf20Sopenharmony_ci#define MT_WLAN_FUN_CTRL_GPIO_OUT_EN	GENMASK(31, 24) /* MT76x0 */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* MT76x0 */
598c2ecf20Sopenharmony_ci#define MT_CSR_EE_CFG1			0x0104
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define MT_XO_CTRL0			0x0100
628c2ecf20Sopenharmony_ci#define MT_XO_CTRL1			0x0104
638c2ecf20Sopenharmony_ci#define MT_XO_CTRL2			0x0108
648c2ecf20Sopenharmony_ci#define MT_XO_CTRL3			0x010c
658c2ecf20Sopenharmony_ci#define MT_XO_CTRL4			0x0110
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define MT_XO_CTRL5			0x0114
688c2ecf20Sopenharmony_ci#define MT_XO_CTRL5_C2_VAL		GENMASK(14, 8)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define MT_XO_CTRL6			0x0118
718c2ecf20Sopenharmony_ci#define MT_XO_CTRL6_C2_CTRL		GENMASK(14, 8)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define MT_XO_CTRL7			0x011c
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define MT_IOCFG_6			0x0124
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define MT_USB_U3DMA_CFG		0x9018
788c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_BULK_AGG_TOUT	GENMASK(7, 0)
798c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_BULK_AGG_LMT	GENMASK(15, 8)
808c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_UDMA_TX_WL_DROP	BIT(16)
818c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_WAKE_UP_EN	BIT(17)
828c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_DROP_OR_PAD	BIT(18)
838c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_TX_CLR		BIT(19)
848c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_TXOP_HALT	BIT(20)
858c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_BULK_AGG_EN	BIT(21)
868c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_BULK_EN	BIT(22)
878c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_TX_BULK_EN	BIT(23)
888c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_EP_OUT_VALID	GENMASK(29, 24)
898c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_RX_BUSY		BIT(30)
908c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG_TX_BUSY		BIT(31)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL		0x10148
938c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_MTCMOS_PWR_UP	BIT(0)
948c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_PWR_ACK	BIT(12)
958c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_PWR_ACK_S	BIT(13)
968c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_BBP_MEM_PD	GENMASK(19, 16)
978c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_PBF_MEM_PD	BIT(20)
988c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_FCE_MEM_PD	BIT(21)
998c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_TSO_MEM_PD	BIT(22)
1008c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_BBP_MEM_RB	BIT(24)
1018c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_PBF_MEM_RB	BIT(25)
1028c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_FCE_MEM_RB	BIT(26)
1038c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_TSO_MEM_RB	BIT(27)
1048c2ecf20Sopenharmony_ci#define MT_WLAN_MTC_CTRL_STATE_UP	BIT(28)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define MT_INT_SOURCE_CSR		0x0200
1078c2ecf20Sopenharmony_ci#define MT_INT_MASK_CSR			0x0204
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE(_n)		BIT(_n)
1108c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_ALL		GENMASK(1, 0)
1118c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_ALL		GENMASK(13, 4)
1128c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE(_n)		BIT((_n) + 4)
1138c2ecf20Sopenharmony_ci#define MT_INT_RX_COHERENT		BIT(16)
1148c2ecf20Sopenharmony_ci#define MT_INT_TX_COHERENT		BIT(17)
1158c2ecf20Sopenharmony_ci#define MT_INT_ANY_COHERENT		BIT(18)
1168c2ecf20Sopenharmony_ci#define MT_INT_MCU_CMD			BIT(19)
1178c2ecf20Sopenharmony_ci#define MT_INT_TBTT			BIT(20)
1188c2ecf20Sopenharmony_ci#define MT_INT_PRE_TBTT			BIT(21)
1198c2ecf20Sopenharmony_ci#define MT_INT_TX_STAT			BIT(22)
1208c2ecf20Sopenharmony_ci#define MT_INT_AUTO_WAKEUP		BIT(23)
1218c2ecf20Sopenharmony_ci#define MT_INT_GPTIMER			BIT(24)
1228c2ecf20Sopenharmony_ci#define MT_INT_RXDELAYINT		BIT(26)
1238c2ecf20Sopenharmony_ci#define MT_INT_TXDELAYINT		BIT(27)
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG		0x0208
1268c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_EN	BIT(0)
1278c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_BUSY	BIT(1)
1288c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_EN	BIT(2)
1298c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_BUSY	BIT(3)
1308c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE	GENMASK(5, 4)
1318c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE	BIT(6)
1328c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_BIG_ENDIAN	BIT(7)
1338c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_HDR_SEG_LEN	GENMASK(15, 8)
1348c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_CLK_GATE_DIS	BIT(30)
1358c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_2B_OFFSET	BIT(31)
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define MT_WPDMA_RST_IDX		0x020c
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci#define MT_WPDMA_DELAY_INT_CFG		0x0210
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define MT_WMM_AIFSN			0x0214
1428c2ecf20Sopenharmony_ci#define MT_WMM_AIFSN_MASK		GENMASK(3, 0)
1438c2ecf20Sopenharmony_ci#define MT_WMM_AIFSN_SHIFT(_n)		((_n) * 4)
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define MT_WMM_CWMIN			0x0218
1468c2ecf20Sopenharmony_ci#define MT_WMM_CWMIN_MASK		GENMASK(3, 0)
1478c2ecf20Sopenharmony_ci#define MT_WMM_CWMIN_SHIFT(_n)		((_n) * 4)
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci#define MT_WMM_CWMAX			0x021c
1508c2ecf20Sopenharmony_ci#define MT_WMM_CWMAX_MASK		GENMASK(3, 0)
1518c2ecf20Sopenharmony_ci#define MT_WMM_CWMAX_SHIFT(_n)		((_n) * 4)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define MT_WMM_TXOP_BASE		0x0220
1548c2ecf20Sopenharmony_ci#define MT_WMM_TXOP(_n)			(MT_WMM_TXOP_BASE + (((_n) / 2) << 2))
1558c2ecf20Sopenharmony_ci#define MT_WMM_TXOP_SHIFT(_n)		(((_n) & 1) * 16)
1568c2ecf20Sopenharmony_ci#define MT_WMM_TXOP_MASK		GENMASK(15, 0)
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define MT_WMM_CTRL			0x0230 /* MT76x0 */
1598c2ecf20Sopenharmony_ci#define MT_FCE_DMA_ADDR			0x0230
1608c2ecf20Sopenharmony_ci#define MT_FCE_DMA_LEN			0x0234
1618c2ecf20Sopenharmony_ci#define MT_USB_DMA_CFG			0x0238
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define MT_TSO_CTRL			0x0250
1648c2ecf20Sopenharmony_ci#define MT_HEADER_TRANS_CTRL_REG	0x0260
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci#define MT_US_CYC_CFG			0x02a4
1678c2ecf20Sopenharmony_ci#define MT_US_CYC_CNT			GENMASK(7, 0)
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define MT_TX_RING_BASE			0x0300
1708c2ecf20Sopenharmony_ci#define MT_RX_RING_BASE			0x03c0
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define MT_TX_HW_QUEUE_MCU		8
1738c2ecf20Sopenharmony_ci#define MT_TX_HW_QUEUE_MGMT		9
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL			0x0400
1768c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL_MCU_RESET	BIT(0)
1778c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL_DMA_RESET	BIT(1)
1788c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL_MAC_RESET	BIT(2)
1798c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL_PBF_RESET	BIT(3)
1808c2ecf20Sopenharmony_ci#define MT_PBF_SYS_CTRL_ASY_RESET	BIT(4)
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define MT_PBF_CFG			0x0404
1838c2ecf20Sopenharmony_ci#define MT_PBF_CFG_TX0Q_EN		BIT(0)
1848c2ecf20Sopenharmony_ci#define MT_PBF_CFG_TX1Q_EN		BIT(1)
1858c2ecf20Sopenharmony_ci#define MT_PBF_CFG_TX2Q_EN		BIT(2)
1868c2ecf20Sopenharmony_ci#define MT_PBF_CFG_TX3Q_EN		BIT(3)
1878c2ecf20Sopenharmony_ci#define MT_PBF_CFG_RX0Q_EN		BIT(4)
1888c2ecf20Sopenharmony_ci#define MT_PBF_CFG_RX_DROP_EN		BIT(8)
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci#define MT_PBF_TX_MAX_PCNT		0x0408
1918c2ecf20Sopenharmony_ci#define MT_PBF_RX_MAX_PCNT		0x040c
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci#define MT_BCN_OFFSET_BASE		0x041c
1948c2ecf20Sopenharmony_ci#define MT_BCN_OFFSET(_n)		(MT_BCN_OFFSET_BASE + ((_n) << 2))
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define MT_RXQ_STA			0x0430
1978c2ecf20Sopenharmony_ci#define MT_TXQ_STA			0x0434
1988c2ecf20Sopenharmony_ci#define	MT_RF_CSR_CFG			0x0500
1998c2ecf20Sopenharmony_ci#define MT_RF_CSR_CFG_DATA		GENMASK(7, 0)
2008c2ecf20Sopenharmony_ci#define MT_RF_CSR_CFG_REG_ID		GENMASK(14, 8)
2018c2ecf20Sopenharmony_ci#define MT_RF_CSR_CFG_REG_BANK		GENMASK(17, 15)
2028c2ecf20Sopenharmony_ci#define MT_RF_CSR_CFG_WR		BIT(30)
2038c2ecf20Sopenharmony_ci#define MT_RF_CSR_CFG_KICK		BIT(31)
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci#define MT_RF_BYPASS_0			0x0504
2068c2ecf20Sopenharmony_ci#define MT_RF_BYPASS_1			0x0508
2078c2ecf20Sopenharmony_ci#define MT_RF_SETTING_0			0x050c
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define MT_RF_MISC			0x0518
2108c2ecf20Sopenharmony_ci#define MT_RF_DATA_WRITE		0x0524
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci#define MT_RF_CTRL			0x0528
2138c2ecf20Sopenharmony_ci#define MT_RF_CTRL_ADDR			GENMASK(11, 0)
2148c2ecf20Sopenharmony_ci#define MT_RF_CTRL_WRITE		BIT(12)
2158c2ecf20Sopenharmony_ci#define MT_RF_CTRL_BUSY			BIT(13)
2168c2ecf20Sopenharmony_ci#define MT_RF_CTRL_IDX			BIT(16)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci#define MT_RF_DATA_READ			0x052c
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#define MT_COM_REG0			0x0730
2218c2ecf20Sopenharmony_ci#define MT_COM_REG1			0x0734
2228c2ecf20Sopenharmony_ci#define MT_COM_REG2			0x0738
2238c2ecf20Sopenharmony_ci#define MT_COM_REG3			0x073C
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci#define MT_LED_CTRL			0x0770
2268c2ecf20Sopenharmony_ci#define MT_LED_CTRL_REPLAY(_n)		BIT(0 + (8 * (_n)))
2278c2ecf20Sopenharmony_ci#define MT_LED_CTRL_POLARITY(_n)	BIT(1 + (8 * (_n)))
2288c2ecf20Sopenharmony_ci#define MT_LED_CTRL_TX_BLINK_MODE(_n)	BIT(2 + (8 * (_n)))
2298c2ecf20Sopenharmony_ci#define MT_LED_CTRL_KICK(_n)		BIT(7 + (8 * (_n)))
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define MT_LED_TX_BLINK_0		0x0774
2328c2ecf20Sopenharmony_ci#define MT_LED_TX_BLINK_1		0x0778
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#define MT_LED_S0_BASE			0x077C
2358c2ecf20Sopenharmony_ci#define MT_LED_S0(_n)			(MT_LED_S0_BASE + 8 * (_n))
2368c2ecf20Sopenharmony_ci#define MT_LED_S1_BASE			0x0780
2378c2ecf20Sopenharmony_ci#define MT_LED_S1(_n)			(MT_LED_S1_BASE + 8 * (_n))
2388c2ecf20Sopenharmony_ci#define MT_LED_STATUS_OFF		GENMASK(31, 24)
2398c2ecf20Sopenharmony_ci#define MT_LED_STATUS_ON		GENMASK(23, 16)
2408c2ecf20Sopenharmony_ci#define MT_LED_STATUS_DURATION		GENMASK(15, 8)
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci#define MT_FCE_PSE_CTRL			0x0800
2438c2ecf20Sopenharmony_ci#define MT_FCE_PARAMETERS		0x0804
2448c2ecf20Sopenharmony_ci#define MT_FCE_CSO			0x0808
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF			0x080c
2478c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_HT_L2_EN	BIT(0)
2488c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_QOS_L2_EN	BIT(1)
2498c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_RX_STUFF_EN	BIT(2)
2508c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_TX_STUFF_EN	BIT(3)
2518c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_WR_MPDU_LEN_EN	BIT(4)
2528c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_MVINV_BSWAP	BIT(5)
2538c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_TS_CMD_QSEL_EN	GENMASK(15, 8)
2548c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_TS_LEN_EN	GENMASK(23, 16)
2558c2ecf20Sopenharmony_ci#define MT_FCE_L2_STUFF_OTHER_PORT	GENMASK(25, 24)
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci#define MT_FCE_WLAN_FLOW_CONTROL1	0x0824
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci#define MT_TX_CPU_FROM_FCE_BASE_PTR	0x09a0
2608c2ecf20Sopenharmony_ci#define MT_TX_CPU_FROM_FCE_MAX_COUNT	0x09a4
2618c2ecf20Sopenharmony_ci#define MT_TX_CPU_FROM_FCE_CPU_DESC_IDX	0x09a8
2628c2ecf20Sopenharmony_ci#define MT_FCE_PDMA_GLOBAL_CONF		0x09c4
2638c2ecf20Sopenharmony_ci#define MT_FCE_SKIP_FS			0x0a6c
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci#define MT_PAUSE_ENABLE_CONTROL1	0x0a38
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci#define MT_MAC_CSR0			0x1000
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#define MT_MAC_SYS_CTRL			0x1004
2708c2ecf20Sopenharmony_ci#define MT_MAC_SYS_CTRL_RESET_CSR	BIT(0)
2718c2ecf20Sopenharmony_ci#define MT_MAC_SYS_CTRL_RESET_BBP	BIT(1)
2728c2ecf20Sopenharmony_ci#define MT_MAC_SYS_CTRL_ENABLE_TX	BIT(2)
2738c2ecf20Sopenharmony_ci#define MT_MAC_SYS_CTRL_ENABLE_RX	BIT(3)
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci#define MT_MAC_ADDR_DW0			0x1008
2768c2ecf20Sopenharmony_ci#define MT_MAC_ADDR_DW1			0x100c
2778c2ecf20Sopenharmony_ci#define MT_MAC_ADDR_DW1_U2ME_MASK	GENMASK(23, 16)
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW0		0x1010
2808c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1		0x1014
2818c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_ADDR		GENMASK(15, 0)
2828c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBSS_MODE	GENMASK(17, 16)
2838c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBEACON_N	GENMASK(20, 18)
2848c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT	BIT(21)
2858c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBSS_MODE_B2	BIT(22)
2868c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBEACON_N_B3	BIT(23)
2878c2ecf20Sopenharmony_ci#define MT_MAC_BSSID_DW1_MBSS_IDX_BYTE	GENMASK(26, 24)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci#define MT_MAX_LEN_CFG			0x1018
2908c2ecf20Sopenharmony_ci#define MT_MAX_LEN_CFG_AMPDU		GENMASK(13, 12)
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#define MT_LED_CFG			0x102c
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#define MT_AMPDU_MAX_LEN_20M1S		0x1030
2958c2ecf20Sopenharmony_ci#define MT_AMPDU_MAX_LEN_20M2S		0x1034
2968c2ecf20Sopenharmony_ci#define MT_AMPDU_MAX_LEN_40M1S		0x1038
2978c2ecf20Sopenharmony_ci#define MT_AMPDU_MAX_LEN_40M2S		0x103c
2988c2ecf20Sopenharmony_ci#define MT_AMPDU_MAX_LEN		0x1040
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define MT_WCID_DROP_BASE		0x106c
3018c2ecf20Sopenharmony_ci#define MT_WCID_DROP(_n)		(MT_WCID_DROP_BASE + ((_n) >> 5) * 4)
3028c2ecf20Sopenharmony_ci#define MT_WCID_DROP_MASK(_n)		BIT((_n) % 32)
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci#define MT_BCN_BYPASS_MASK		0x108c
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci#define MT_MAC_APC_BSSID_BASE		0x1090
3078c2ecf20Sopenharmony_ci#define MT_MAC_APC_BSSID_L(_n)		(MT_MAC_APC_BSSID_BASE + ((_n) * 8))
3088c2ecf20Sopenharmony_ci#define MT_MAC_APC_BSSID_H(_n)		(MT_MAC_APC_BSSID_BASE + ((_n) * 8 + 4))
3098c2ecf20Sopenharmony_ci#define MT_MAC_APC_BSSID_H_ADDR		GENMASK(15, 0)
3108c2ecf20Sopenharmony_ci#define MT_MAC_APC_BSSID0_H_EN		BIT(16)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG		0x1100
3138c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG_CCK_SIFS	GENMASK(7, 0)
3148c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG_OFDM_SIFS	GENMASK(15, 8)
3158c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG_OFDM_XIFS	GENMASK(19, 16)
3168c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG_EIFS		GENMASK(28, 20)
3178c2ecf20Sopenharmony_ci#define MT_XIFS_TIME_CFG_BB_RXEND_EN	BIT(29)
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define MT_BKOFF_SLOT_CFG		0x1104
3208c2ecf20Sopenharmony_ci#define MT_BKOFF_SLOT_CFG_SLOTTIME	GENMASK(7, 0)
3218c2ecf20Sopenharmony_ci#define MT_BKOFF_SLOT_CFG_CC_DELAY	GENMASK(11, 8)
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG			0x110c
3248c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_TIMER_EN		BIT(0)
3258c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_TX_AS_BUSY	BIT(1)
3268c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_RX_AS_BUSY	BIT(2)
3278c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_NAV_AS_BUSY	BIT(3)
3288c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_EIFS_AS_BUSY	BIT(4)
3298c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_MDRDY_CNT_EN	BIT(5)
3308c2ecf20Sopenharmony_ci#define MT_CH_CCA_RC_EN			BIT(6)
3318c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_CH_TIMER_CLR	GENMASK(9, 8)
3328c2ecf20Sopenharmony_ci#define MT_CH_TIME_CFG_MDRDY_CLR	GENMASK(11, 10)
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci#define MT_PBF_LIFE_TIMER		0x1110
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG		0x1114
3378c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_INTVAL	GENMASK(15, 0)
3388c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_TIMER_EN	BIT(16)
3398c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_SYNC_MODE	GENMASK(18, 17)
3408c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_TBTT_EN	BIT(19)
3418c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_BEACON_TX	BIT(20)
3428c2ecf20Sopenharmony_ci#define MT_BEACON_TIME_CFG_TSF_COMP	GENMASK(31, 24)
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci#define MT_TBTT_SYNC_CFG		0x1118
3458c2ecf20Sopenharmony_ci#define MT_TSF_TIMER_DW0		0x111c
3468c2ecf20Sopenharmony_ci#define MT_TSF_TIMER_DW1		0x1120
3478c2ecf20Sopenharmony_ci#define MT_TBTT_TIMER			0x1124
3488c2ecf20Sopenharmony_ci#define MT_TBTT_TIMER_VAL		GENMASK(16, 0)
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci#define MT_INT_TIMER_CFG		0x1128
3518c2ecf20Sopenharmony_ci#define MT_INT_TIMER_CFG_PRE_TBTT	GENMASK(15, 0)
3528c2ecf20Sopenharmony_ci#define MT_INT_TIMER_CFG_GP_TIMER	GENMASK(31, 16)
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci#define MT_INT_TIMER_EN			0x112c
3558c2ecf20Sopenharmony_ci#define MT_INT_TIMER_EN_PRE_TBTT_EN	BIT(0)
3568c2ecf20Sopenharmony_ci#define MT_INT_TIMER_EN_GP_TIMER_EN	BIT(1)
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci#define MT_CH_IDLE			0x1130
3598c2ecf20Sopenharmony_ci#define MT_CH_BUSY			0x1134
3608c2ecf20Sopenharmony_ci#define MT_EXT_CH_BUSY			0x1138
3618c2ecf20Sopenharmony_ci#define MT_ED_CCA_TIMER			0x1140
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci#define MT_MAC_STATUS			0x1200
3648c2ecf20Sopenharmony_ci#define MT_MAC_STATUS_TX		BIT(0)
3658c2ecf20Sopenharmony_ci#define MT_MAC_STATUS_RX		BIT(1)
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci#define MT_PWR_PIN_CFG			0x1204
3688c2ecf20Sopenharmony_ci#define MT_AUX_CLK_CFG			0x120c
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci#define MT_BB_PA_MODE_CFG0		0x1214
3718c2ecf20Sopenharmony_ci#define MT_BB_PA_MODE_CFG1		0x1218
3728c2ecf20Sopenharmony_ci#define MT_RF_PA_MODE_CFG0		0x121c
3738c2ecf20Sopenharmony_ci#define MT_RF_PA_MODE_CFG1		0x1220
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci#define MT_RF_PA_MODE_ADJ0		0x1228
3768c2ecf20Sopenharmony_ci#define MT_RF_PA_MODE_ADJ1		0x122c
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci#define MT_DACCLK_EN_DLY_CFG		0x1264
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_BASE		0x1300
3818c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_AC(_n)		(MT_EDCA_CFG_BASE + ((_n) << 2))
3828c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_TXOP		GENMASK(7, 0)
3838c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_AIFSN		GENMASK(11, 8)
3848c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_CWMIN		GENMASK(15, 12)
3858c2ecf20Sopenharmony_ci#define MT_EDCA_CFG_CWMAX		GENMASK(19, 16)
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_0			0x1314
3888c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_1			0x1318
3898c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_2			0x131c
3908c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_3			0x1320
3918c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_4			0x1324
3928c2ecf20Sopenharmony_ci#define MT_TX_PIN_CFG			0x1328
3938c2ecf20Sopenharmony_ci#define MT_TX_PIN_CFG_TXANT		GENMASK(3, 0)
3948c2ecf20Sopenharmony_ci#define MT_TX_PIN_CFG_RXANT		GENMASK(11, 8)
3958c2ecf20Sopenharmony_ci#define MT_TX_PIN_RFTR_EN		BIT(16)
3968c2ecf20Sopenharmony_ci#define MT_TX_PIN_TRSW_EN		BIT(18)
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci#define MT_TX_BAND_CFG			0x132c
3998c2ecf20Sopenharmony_ci#define MT_TX_BAND_CFG_UPPER_40M	BIT(0)
4008c2ecf20Sopenharmony_ci#define MT_TX_BAND_CFG_5G		BIT(1)
4018c2ecf20Sopenharmony_ci#define MT_TX_BAND_CFG_2G		BIT(2)
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci#define MT_HT_FBK_TO_LEGACY		0x1384
4048c2ecf20Sopenharmony_ci#define MT_TX_MPDU_ADJ_INT		0x1388
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_7			0x13d4
4078c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_8			0x13d8
4088c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_9			0x13dc
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci#define MT_TX_SW_CFG0			0x1330
4118c2ecf20Sopenharmony_ci#define MT_TX_SW_CFG1			0x1334
4128c2ecf20Sopenharmony_ci#define MT_TX_SW_CFG2			0x1338
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci#define MT_TXOP_CTRL_CFG		0x1340
4158c2ecf20Sopenharmony_ci#define MT_TXOP_TRUN_EN			GENMASK(5, 0)
4168c2ecf20Sopenharmony_ci#define MT_TXOP_EXT_CCA_DLY		GENMASK(15, 8)
4178c2ecf20Sopenharmony_ci#define MT_TXOP_ED_CCA_EN		BIT(20)
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci#define MT_TX_RTS_CFG			0x1344
4208c2ecf20Sopenharmony_ci#define MT_TX_RTS_CFG_RETRY_LIMIT	GENMASK(7, 0)
4218c2ecf20Sopenharmony_ci#define MT_TX_RTS_CFG_THRESH		GENMASK(23, 8)
4228c2ecf20Sopenharmony_ci#define MT_TX_RTS_FALLBACK		BIT(24)
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci#define MT_TX_TIMEOUT_CFG		0x1348
4258c2ecf20Sopenharmony_ci#define MT_TX_TIMEOUT_CFG_ACKTO		GENMASK(15, 8)
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#define MT_TX_RETRY_CFG			0x134c
4288c2ecf20Sopenharmony_ci#define MT_TX_LINK_CFG			0x1350
4298c2ecf20Sopenharmony_ci#define MT_TX_CFACK_EN			BIT(12)
4308c2ecf20Sopenharmony_ci#define MT_VHT_HT_FBK_CFG0		0x1354
4318c2ecf20Sopenharmony_ci#define MT_VHT_HT_FBK_CFG1		0x1358
4328c2ecf20Sopenharmony_ci#define MT_LG_FBK_CFG0			0x135c
4338c2ecf20Sopenharmony_ci#define MT_LG_FBK_CFG1			0x1360
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define MT_PROT_CFG_RATE		GENMASK(15, 0)
4368c2ecf20Sopenharmony_ci#define MT_PROT_CFG_CTRL		GENMASK(17, 16)
4378c2ecf20Sopenharmony_ci#define MT_PROT_CFG_NAV			GENMASK(19, 18)
4388c2ecf20Sopenharmony_ci#define MT_PROT_CFG_TXOP_ALLOW		GENMASK(25, 20)
4398c2ecf20Sopenharmony_ci#define MT_PROT_CFG_RTS_THRESH		BIT(26)
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#define MT_CCK_PROT_CFG			0x1364
4428c2ecf20Sopenharmony_ci#define MT_OFDM_PROT_CFG		0x1368
4438c2ecf20Sopenharmony_ci#define MT_MM20_PROT_CFG		0x136c
4448c2ecf20Sopenharmony_ci#define MT_MM40_PROT_CFG		0x1370
4458c2ecf20Sopenharmony_ci#define MT_GF20_PROT_CFG		0x1374
4468c2ecf20Sopenharmony_ci#define MT_GF40_PROT_CFG		0x1378
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci#define MT_PROT_RATE			GENMASK(15, 0)
4498c2ecf20Sopenharmony_ci#define MT_PROT_CTRL_RTS_CTS		BIT(16)
4508c2ecf20Sopenharmony_ci#define MT_PROT_CTRL_CTS2SELF		BIT(17)
4518c2ecf20Sopenharmony_ci#define MT_PROT_NAV_SHORT		BIT(18)
4528c2ecf20Sopenharmony_ci#define MT_PROT_NAV_LONG		BIT(19)
4538c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_CCK		BIT(20)
4548c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_OFDM		BIT(21)
4558c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_MM20		BIT(22)
4568c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_MM40		BIT(23)
4578c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_GF20		BIT(24)
4588c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_GF40		BIT(25)
4598c2ecf20Sopenharmony_ci#define MT_PROT_RTS_THR_EN		BIT(26)
4608c2ecf20Sopenharmony_ci#define MT_PROT_RATE_CCK_11		0x0003
4618c2ecf20Sopenharmony_ci#define MT_PROT_RATE_OFDM_6		0x2000
4628c2ecf20Sopenharmony_ci#define MT_PROT_RATE_OFDM_24		0x2004
4638c2ecf20Sopenharmony_ci#define MT_PROT_RATE_DUP_OFDM_24	0x2084
4648c2ecf20Sopenharmony_ci#define MT_PROT_RATE_SGI_OFDM_24	0x2104
4658c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_ALL		GENMASK(25, 20)
4668c2ecf20Sopenharmony_ci#define MT_PROT_TXOP_ALLOW_BW20		(MT_PROT_TXOP_ALLOW_ALL &	\
4678c2ecf20Sopenharmony_ci					 ~MT_PROT_TXOP_ALLOW_MM40 &	\
4688c2ecf20Sopenharmony_ci					 ~MT_PROT_TXOP_ALLOW_GF40)
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci#define MT_EXP_ACK_TIME			0x1380
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_0_EXT		0x1390
4738c2ecf20Sopenharmony_ci#define MT_TX_PWR_CFG_1_EXT		0x1394
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT			0x1398
4768c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT_MPDU_FBK	GENMASK(7, 0)
4778c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT_AMPDU_FBK	GENMASK(15, 8)
4788c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT_MPDU_UP_CLEAR	BIT(16)
4798c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT_AMPDU_UP_CLEAR	BIT(17)
4808c2ecf20Sopenharmony_ci#define MT_TX_FBK_LIMIT_RATE_LUT	BIT(18)
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci#define MT_TX0_RF_GAIN_CORR		0x13a0
4838c2ecf20Sopenharmony_ci#define MT_TX1_RF_GAIN_CORR		0x13a4
4848c2ecf20Sopenharmony_ci#define MT_TX0_RF_GAIN_ATTEN		0x13a8
4858c2ecf20Sopenharmony_ci#define MT_TX0_RF_GAIN_ATTEN		0x13a8 /* MT76x0 */
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_0			0x13b0
4888c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_0_CH_INIT_0	GENMASK(5, 0)
4898c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_0_CH_INIT_1	GENMASK(13, 8)
4908c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_0_LIMIT_0		GENMASK(21, 16)
4918c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_0_LIMIT_1		GENMASK(29, 24)
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_1			0x13b4
4948c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_1_TEMP_COMP	GENMASK(5, 0)
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_2			0x13a8
4978c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_2_TEMP_COMP	GENMASK(5, 0)
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_3			0x13ac
5008c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_4			0x13c0
5018c2ecf20Sopenharmony_ci#define MT_TX_ALC_CFG_4_LOWGAIN_CH_EN	BIT(31)
5028c2ecf20Sopenharmony_ci#define MT_TX0_BB_GAIN_ATTEN		0x13c0 /* MT76x0 */
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci#define MT_TX_ALC_VGA3			0x13c8
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci#define MT_TX_PROT_CFG6			0x13e0
5078c2ecf20Sopenharmony_ci#define MT_TX_PROT_CFG7			0x13e4
5088c2ecf20Sopenharmony_ci#define MT_TX_PROT_CFG8			0x13e8
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci#define MT_PIFS_TX_CFG			0x13ec
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG			0x1400
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_CRC_ERR		BIT(0)
5158c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_PHY_ERR		BIT(1)
5168c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_PROMISC		BIT(2)
5178c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_OTHER_BSS	BIT(3)
5188c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_VER_ERR		BIT(4)
5198c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_MCAST		BIT(5)
5208c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_BCAST		BIT(6)
5218c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_DUP		BIT(7)
5228c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_CFACK		BIT(8)
5238c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_CFEND		BIT(9)
5248c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_ACK		BIT(10)
5258c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_CTS		BIT(11)
5268c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_RTS		BIT(12)
5278c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_PSPOLL		BIT(13)
5288c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_BA		BIT(14)
5298c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_BAR		BIT(15)
5308c2ecf20Sopenharmony_ci#define MT_RX_FILTR_CFG_CTRL_RSV	BIT(16)
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci#define MT_AUTO_RSP_CFG			0x1404
5338c2ecf20Sopenharmony_ci#define MT_AUTO_RSP_EN			BIT(0)
5348c2ecf20Sopenharmony_ci#define MT_AUTO_RSP_PREAMB_SHORT	BIT(4)
5358c2ecf20Sopenharmony_ci#define MT_LEGACY_BASIC_RATE		0x1408
5368c2ecf20Sopenharmony_ci#define MT_HT_BASIC_RATE		0x140c
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci#define MT_HT_CTRL_CFG			0x1410
5398c2ecf20Sopenharmony_ci#define MT_RX_PARSER_CFG		0x1418
5408c2ecf20Sopenharmony_ci#define MT_RX_PARSER_RX_SET_NAV_ALL	BIT(0)
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG			0x141c
5438c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_CCA0		GENMASK(1, 0)
5448c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_CCA1		GENMASK(3, 2)
5458c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_CCA2		GENMASK(5, 4)
5468c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_CCA3		GENMASK(7, 6)
5478c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_CCA_MASK		GENMASK(11, 8)
5488c2ecf20Sopenharmony_ci#define MT_EXT_CCA_CFG_ED_CCA_MASK	GENMASK(15, 12)
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci#define MT_TX_SW_CFG3			0x1478
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci#define MT_PN_PAD_MODE			0x150c
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci#define MT_TXOP_HLDR_ET			0x1608
5558c2ecf20Sopenharmony_ci#define MT_TXOP_HLDR_TX40M_BLK_EN	BIT(1)
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci#define MT_PROT_AUTO_TX_CFG		0x1648
5588c2ecf20Sopenharmony_ci#define MT_PROT_AUTO_TX_CFG_PROT_PADJ	GENMASK(11, 8)
5598c2ecf20Sopenharmony_ci#define MT_PROT_AUTO_TX_CFG_AUTO_PADJ	GENMASK(27, 24)
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci#define MT_RX_STAT_0			0x1700
5628c2ecf20Sopenharmony_ci#define MT_RX_STAT_0_CRC_ERRORS		GENMASK(15, 0)
5638c2ecf20Sopenharmony_ci#define MT_RX_STAT_0_PHY_ERRORS		GENMASK(31, 16)
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci#define MT_RX_STAT_1			0x1704
5668c2ecf20Sopenharmony_ci#define MT_RX_STAT_1_CCA_ERRORS		GENMASK(15, 0)
5678c2ecf20Sopenharmony_ci#define MT_RX_STAT_1_PLCP_ERRORS	GENMASK(31, 16)
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci#define MT_RX_STAT_2			0x1708
5708c2ecf20Sopenharmony_ci#define MT_RX_STAT_2_DUP_ERRORS		GENMASK(15, 0)
5718c2ecf20Sopenharmony_ci#define MT_RX_STAT_2_OVERFLOW_ERRORS	GENMASK(31, 16)
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci#define MT_TX_STA_0			0x170c
5748c2ecf20Sopenharmony_ci#define MT_TX_STA_1			0x1710
5758c2ecf20Sopenharmony_ci#define MT_TX_STA_2			0x1714
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO			0x1718
5788c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_VALID		BIT(0)
5798c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_SUCCESS		BIT(5)
5808c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_AGGR		BIT(6)
5818c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_ACKREQ		BIT(7)
5828c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_WCID		GENMASK(15, 8)
5838c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_RATE		GENMASK(31, 16)
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci#define MT_TX_AGG_STAT			0x171c
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT_BASE0		0x1720
5888c2ecf20Sopenharmony_ci#define MT_MPDU_DENSITY_CNT		0x1740
5898c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT_BASE1		0x174c
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT(_id)		((_id) < 8 ?			\
5928c2ecf20Sopenharmony_ci					 MT_TX_AGG_CNT_BASE0 + ((_id) << 2) : \
5938c2ecf20Sopenharmony_ci					 MT_TX_AGG_CNT_BASE1 + (((_id) - 8) << 2))
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_EXT		0x1798
5968c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_EXT_RETRY	GENMASK(7, 0)
5978c2ecf20Sopenharmony_ci#define MT_TX_STAT_FIFO_EXT_PKTID	GENMASK(15, 8)
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci#define MT_WCID_TX_RATE_BASE		0x1c00
6008c2ecf20Sopenharmony_ci#define MT_WCID_TX_RATE(_i)		(MT_WCID_TX_RATE_BASE + ((_i) << 3))
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci#define MT_BBP_CORE_BASE		0x2000
6038c2ecf20Sopenharmony_ci#define MT_BBP_IBI_BASE			0x2100
6048c2ecf20Sopenharmony_ci#define MT_BBP_AGC_BASE			0x2300
6058c2ecf20Sopenharmony_ci#define MT_BBP_TXC_BASE			0x2400
6068c2ecf20Sopenharmony_ci#define MT_BBP_RXC_BASE			0x2500
6078c2ecf20Sopenharmony_ci#define MT_BBP_TXO_BASE			0x2600
6088c2ecf20Sopenharmony_ci#define MT_BBP_TXBE_BASE		0x2700
6098c2ecf20Sopenharmony_ci#define MT_BBP_RXFE_BASE		0x2800
6108c2ecf20Sopenharmony_ci#define MT_BBP_RXO_BASE			0x2900
6118c2ecf20Sopenharmony_ci#define MT_BBP_DFS_BASE			0x2a00
6128c2ecf20Sopenharmony_ci#define MT_BBP_TR_BASE			0x2b00
6138c2ecf20Sopenharmony_ci#define MT_BBP_CAL_BASE			0x2c00
6148c2ecf20Sopenharmony_ci#define MT_BBP_DSC_BASE			0x2e00
6158c2ecf20Sopenharmony_ci#define MT_BBP_PFMU_BASE		0x2f00
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci#define MT_BBP(_type, _n)		(MT_BBP_##_type##_BASE + ((_n) << 2))
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci#define MT_BBP_CORE_R1_BW		GENMASK(4, 3)
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci#define MT_BBP_AGC_R0_CTRL_CHAN		GENMASK(9, 8)
6228c2ecf20Sopenharmony_ci#define MT_BBP_AGC_R0_BW		GENMASK(14, 12)
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_ci/* AGC, R4/R5 */
6258c2ecf20Sopenharmony_ci#define MT_BBP_AGC_LNA_HIGH_GAIN	GENMASK(21, 16)
6268c2ecf20Sopenharmony_ci#define MT_BBP_AGC_LNA_MID_GAIN		GENMASK(13, 8)
6278c2ecf20Sopenharmony_ci#define MT_BBP_AGC_LNA_LOW_GAIN		GENMASK(5, 0)
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/* AGC, R6/R7 */
6308c2ecf20Sopenharmony_ci#define MT_BBP_AGC_LNA_ULOW_GAIN	GENMASK(5, 0)
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_ci/* AGC, R8/R9 */
6338c2ecf20Sopenharmony_ci#define MT_BBP_AGC_LNA_GAIN_MODE	GENMASK(7, 6)
6348c2ecf20Sopenharmony_ci#define MT_BBP_AGC_GAIN			GENMASK(14, 8)
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci#define MT_BBP_AGC20_RSSI0		GENMASK(7, 0)
6378c2ecf20Sopenharmony_ci#define MT_BBP_AGC20_RSSI1		GENMASK(15, 8)
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci#define MT_BBP_TXBE_R0_CTRL_CHAN	GENMASK(1, 0)
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci#define MT_WCID_ADDR_BASE		0x1800
6428c2ecf20Sopenharmony_ci#define MT_WCID_ADDR(_n)		(MT_WCID_ADDR_BASE + (_n) * 8)
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci#define MT_SRAM_BASE			0x4000
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ci#define MT_WCID_KEY_BASE		0x8000
6478c2ecf20Sopenharmony_ci#define MT_WCID_KEY(_n)			(MT_WCID_KEY_BASE + (_n) * 32)
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci#define MT_WCID_IV_BASE			0xa000
6508c2ecf20Sopenharmony_ci#define MT_WCID_IV(_n)			(MT_WCID_IV_BASE + (_n) * 8)
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_BASE		0xa800
6538c2ecf20Sopenharmony_ci#define MT_WCID_ATTR(_n)		(MT_WCID_ATTR_BASE + (_n) * 4)
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_PAIRWISE		BIT(0)
6568c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_PKEY_MODE		GENMASK(3, 1)
6578c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_BSS_IDX		GENMASK(6, 4)
6588c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_RXWI_UDF		GENMASK(9, 7)
6598c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_PKEY_MODE_EXT	BIT(10)
6608c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_BSS_IDX_EXT	BIT(11)
6618c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_WAPI_MCBC		BIT(15)
6628c2ecf20Sopenharmony_ci#define MT_WCID_ATTR_WAPI_KEYID		GENMASK(31, 24)
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci#define MT_SKEY_BASE_0			0xac00
6658c2ecf20Sopenharmony_ci#define MT_SKEY_BASE_1			0xb400
6668c2ecf20Sopenharmony_ci#define MT_SKEY_0(_bss, _idx)		(MT_SKEY_BASE_0 + (4 * (_bss) + (_idx)) * 32)
6678c2ecf20Sopenharmony_ci#define MT_SKEY_1(_bss, _idx)		(MT_SKEY_BASE_1 + (4 * ((_bss) & 7) + (_idx)) * 32)
6688c2ecf20Sopenharmony_ci#define MT_SKEY(_bss, _idx)		(((_bss) & 8) ? MT_SKEY_1(_bss, _idx) : MT_SKEY_0(_bss, _idx))
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_BASE_0		0xb000
6718c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_BASE_1		0xb3f0
6728c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_0(_bss)		(MT_SKEY_MODE_BASE_0 + (((_bss) / 2) << 2))
6738c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_1(_bss)		(MT_SKEY_MODE_BASE_1 + ((((_bss) & 7) / 2) << 2))
6748c2ecf20Sopenharmony_ci#define MT_SKEY_MODE(_bss)		(((_bss) & 8) ? MT_SKEY_MODE_1(_bss) : MT_SKEY_MODE_0(_bss))
6758c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_MASK		GENMASK(3, 0)
6768c2ecf20Sopenharmony_ci#define MT_SKEY_MODE_SHIFT(_bss, _idx)	(4 * ((_idx) + 4 * ((_bss) & 1)))
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci#define MT_BEACON_BASE			0xc000
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_ci#define MT_TEMP_SENSOR			0x1d000
6818c2ecf20Sopenharmony_ci#define MT_TEMP_SENSOR_VAL		GENMASK(6, 0)
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_cistruct mt76_wcid_addr {
6848c2ecf20Sopenharmony_ci	u8 macaddr[6];
6858c2ecf20Sopenharmony_ci	__le16 ba_mask;
6868c2ecf20Sopenharmony_ci} __packed __aligned(4);
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_cistruct mt76_wcid_key {
6898c2ecf20Sopenharmony_ci	u8 key[16];
6908c2ecf20Sopenharmony_ci	u8 tx_mic[8];
6918c2ecf20Sopenharmony_ci	u8 rx_mic[8];
6928c2ecf20Sopenharmony_ci} __packed __aligned(4);
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_cienum mt76x02_cipher_type {
6958c2ecf20Sopenharmony_ci	MT_CIPHER_NONE,
6968c2ecf20Sopenharmony_ci	MT_CIPHER_WEP40,
6978c2ecf20Sopenharmony_ci	MT_CIPHER_WEP104,
6988c2ecf20Sopenharmony_ci	MT_CIPHER_TKIP,
6998c2ecf20Sopenharmony_ci	MT_CIPHER_AES_CCMP,
7008c2ecf20Sopenharmony_ci	MT_CIPHER_CKIP40,
7018c2ecf20Sopenharmony_ci	MT_CIPHER_CKIP104,
7028c2ecf20Sopenharmony_ci	MT_CIPHER_CKIP128,
7038c2ecf20Sopenharmony_ci	MT_CIPHER_WAPI,
7048c2ecf20Sopenharmony_ci};
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci#endif
707