162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2022 MediaTek Inc.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __MT7996_REGS_H
762306a36Sopenharmony_ci#define __MT7996_REGS_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct __map {
1062306a36Sopenharmony_ci	u32 phys;
1162306a36Sopenharmony_ci	u32 mapped;
1262306a36Sopenharmony_ci	u32 size;
1362306a36Sopenharmony_ci};
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct __base {
1662306a36Sopenharmony_ci	u32 band_base[__MT_MAX_BAND];
1762306a36Sopenharmony_ci};
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* used to differentiate between generations */
2062306a36Sopenharmony_cistruct mt7996_reg_desc {
2162306a36Sopenharmony_ci	const struct __base *base;
2262306a36Sopenharmony_ci	const struct __map *map;
2362306a36Sopenharmony_ci	u32 map_size;
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cienum base_rev {
2762306a36Sopenharmony_ci	WF_AGG_BASE,
2862306a36Sopenharmony_ci	WF_ARB_BASE,
2962306a36Sopenharmony_ci	WF_TMAC_BASE,
3062306a36Sopenharmony_ci	WF_RMAC_BASE,
3162306a36Sopenharmony_ci	WF_DMA_BASE,
3262306a36Sopenharmony_ci	WF_WTBLOFF_BASE,
3362306a36Sopenharmony_ci	WF_ETBF_BASE,
3462306a36Sopenharmony_ci	WF_LPON_BASE,
3562306a36Sopenharmony_ci	WF_MIB_BASE,
3662306a36Sopenharmony_ci	WF_RATE_BASE,
3762306a36Sopenharmony_ci	__MT_REG_BASE_MAX,
3862306a36Sopenharmony_ci};
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define __BASE(_id, _band)			(dev->reg.base[(_id)].band_base[(_band)])
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define MT_MCU_INT_EVENT			0x2108
4362306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_STOPPED		BIT(0)
4462306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_INIT		BIT(1)
4562306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_RESET_DONE		BIT(3)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* PLE */
4862306a36Sopenharmony_ci#define MT_PLE_BASE				0x820c0000
4962306a36Sopenharmony_ci#define MT_PLE(ofs)				(MT_PLE_BASE + (ofs))
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define MT_FL_Q_EMPTY				MT_PLE(0x360)
5262306a36Sopenharmony_ci#define MT_FL_Q0_CTRL				MT_PLE(0x3e0)
5362306a36Sopenharmony_ci#define MT_FL_Q2_CTRL				MT_PLE(0x3e8)
5462306a36Sopenharmony_ci#define MT_FL_Q3_CTRL				MT_PLE(0x3ec)
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define MT_PLE_FREEPG_CNT			MT_PLE(0x380)
5762306a36Sopenharmony_ci#define MT_PLE_FREEPG_HEAD_TAIL			MT_PLE(0x384)
5862306a36Sopenharmony_ci#define MT_PLE_PG_HIF_GROUP			MT_PLE(0x00c)
5962306a36Sopenharmony_ci#define MT_PLE_HIF_PG_INFO			MT_PLE(0x388)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define MT_PLE_AC_QEMPTY(ac, n)			MT_PLE(0x600 +	0x80 * (ac) + ((n) << 2))
6262306a36Sopenharmony_ci#define MT_PLE_AMSDU_PACK_MSDU_CNT(n)		MT_PLE(0x10e0 + ((n) << 2))
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/* WF MDP TOP */
6562306a36Sopenharmony_ci#define MT_MDP_BASE				0x820cc000
6662306a36Sopenharmony_ci#define MT_MDP(ofs)				(MT_MDP_BASE + (ofs))
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define MT_MDP_DCR2				MT_MDP(0x8e8)
6962306a36Sopenharmony_ci#define MT_MDP_DCR2_RX_TRANS_SHORT		BIT(2)
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* TMAC: band 0(0x820e4000), band 1(0x820f4000), band 2(0x830e4000) */
7262306a36Sopenharmony_ci#define MT_WF_TMAC_BASE(_band)			__BASE(WF_TMAC_BASE, (_band))
7362306a36Sopenharmony_ci#define MT_WF_TMAC(_band, ofs)			(MT_WF_TMAC_BASE(_band) + (ofs))
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define MT_TMAC_TCR0(_band)			MT_WF_TMAC(_band, 0)
7662306a36Sopenharmony_ci#define MT_TMAC_TCR0_TX_BLINK			GENMASK(7, 6)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define MT_TMAC_CDTR(_band)			MT_WF_TMAC(_band, 0x0c8)
7962306a36Sopenharmony_ci#define MT_TMAC_ODTR(_band)			MT_WF_TMAC(_band, 0x0cc)
8062306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_PLCP			GENMASK(15, 0)
8162306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_CCA			GENMASK(31, 16)
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci#define MT_TMAC_ICR0(_band)			MT_WF_TMAC(_band, 0x014)
8462306a36Sopenharmony_ci#define MT_IFS_EIFS_OFDM			GENMASK(8, 0)
8562306a36Sopenharmony_ci#define MT_IFS_RIFS				GENMASK(14, 10)
8662306a36Sopenharmony_ci#define MT_IFS_SIFS				GENMASK(22, 16)
8762306a36Sopenharmony_ci#define MT_IFS_SLOT				GENMASK(30, 24)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define MT_TMAC_ICR1(_band)			MT_WF_TMAC(_band, 0x018)
9062306a36Sopenharmony_ci#define MT_IFS_EIFS_CCK				GENMASK(8, 0)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci/* WF DMA TOP: band 0(0x820e7000), band 1(0x820f7000), band 2(0x830e7000) */
9362306a36Sopenharmony_ci#define MT_WF_DMA_BASE(_band)			__BASE(WF_DMA_BASE, (_band))
9462306a36Sopenharmony_ci#define MT_WF_DMA(_band, ofs)			(MT_WF_DMA_BASE(_band) + (ofs))
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define MT_DMA_DCR0(_band)			MT_WF_DMA(_band, 0x000)
9762306a36Sopenharmony_ci#define MT_DMA_DCR0_RXD_G5_EN			BIT(23)
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci#define MT_DMA_TCRF1(_band)			MT_WF_DMA(_band, 0x054)
10062306a36Sopenharmony_ci#define MT_DMA_TCRF1_QIDX			GENMASK(15, 13)
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci/* WTBLOFF TOP: band 0(0x820e9000), band 1(0x820f9000), band 2(0x830e9000) */
10362306a36Sopenharmony_ci#define MT_WTBLOFF_BASE(_band)			__BASE(WF_WTBLOFF_BASE, (_band))
10462306a36Sopenharmony_ci#define MT_WTBLOFF(_band, ofs)			(MT_WTBLOFF_BASE(_band) + (ofs))
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define MT_WTBLOFF_RSCR(_band)			MT_WTBLOFF(_band, 0x008)
10762306a36Sopenharmony_ci#define MT_WTBLOFF_RSCR_RCPI_MODE		GENMASK(31, 30)
10862306a36Sopenharmony_ci#define MT_WTBLOFF_RSCR_RCPI_PARAM		GENMASK(25, 24)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/* ETBF: band 0(0x820ea000), band 1(0x820fa000), band 2(0x830ea000) */
11162306a36Sopenharmony_ci#define MT_WF_ETBF_BASE(_band)			__BASE(WF_ETBF_BASE, (_band))
11262306a36Sopenharmony_ci#define MT_WF_ETBF(_band, ofs)			(MT_WF_ETBF_BASE(_band) + (ofs))
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#define MT_ETBF_RX_FB_CONT(_band)		MT_WF_ETBF(_band, 0x100)
11562306a36Sopenharmony_ci#define MT_ETBF_RX_FB_BW			GENMASK(10, 8)
11662306a36Sopenharmony_ci#define MT_ETBF_RX_FB_NC			GENMASK(7, 4)
11762306a36Sopenharmony_ci#define MT_ETBF_RX_FB_NR			GENMASK(3, 0)
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci/* LPON: band 0(0x820eb000), band 1(0x820fb000), band 2(0x830eb000) */
12062306a36Sopenharmony_ci#define MT_WF_LPON_BASE(_band)			__BASE(WF_LPON_BASE, (_band))
12162306a36Sopenharmony_ci#define MT_WF_LPON(_band, ofs)			(MT_WF_LPON_BASE(_band) + (ofs))
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define MT_LPON_UTTR0(_band)			MT_WF_LPON(_band, 0x360)
12462306a36Sopenharmony_ci#define MT_LPON_UTTR1(_band)			MT_WF_LPON(_band, 0x364)
12562306a36Sopenharmony_ci#define MT_LPON_FRCR(_band)			MT_WF_LPON(_band, 0x37c)
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci#define MT_LPON_TCR(_band, n)			MT_WF_LPON(_band, 0x0a8 + (((n) * 4) << 4))
12862306a36Sopenharmony_ci#define MT_LPON_TCR_SW_MODE			GENMASK(1, 0)
12962306a36Sopenharmony_ci#define MT_LPON_TCR_SW_WRITE			BIT(0)
13062306a36Sopenharmony_ci#define MT_LPON_TCR_SW_ADJUST			BIT(1)
13162306a36Sopenharmony_ci#define MT_LPON_TCR_SW_READ			GENMASK(1, 0)
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/* MIB: band 0(0x820ed000), band 1(0x820fd000), band 2(0x830ed000)*/
13462306a36Sopenharmony_ci/* These counters are (mostly?) clear-on-read.  So, some should not
13562306a36Sopenharmony_ci * be read at all in case firmware is already reading them.  These
13662306a36Sopenharmony_ci * are commented with 'DNR' below. The DNR stats will be read by querying
13762306a36Sopenharmony_ci * the firmware API for the appropriate message.  For counters the driver
13862306a36Sopenharmony_ci * does read, the driver should accumulate the counters.
13962306a36Sopenharmony_ci */
14062306a36Sopenharmony_ci#define MT_WF_MIB_BASE(_band)			__BASE(WF_MIB_BASE, (_band))
14162306a36Sopenharmony_ci#define MT_WF_MIB(_band, ofs)			(MT_WF_MIB_BASE(_band) + (ofs))
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci#define MT_MIB_BSCR0(_band)			MT_WF_MIB(_band, 0x9cc)
14462306a36Sopenharmony_ci#define MT_MIB_BSCR1(_band)			MT_WF_MIB(_band, 0x9d0)
14562306a36Sopenharmony_ci#define MT_MIB_BSCR2(_band)			MT_WF_MIB(_band, 0x9d4)
14662306a36Sopenharmony_ci#define MT_MIB_BSCR3(_band)			MT_WF_MIB(_band, 0x9d8)
14762306a36Sopenharmony_ci#define MT_MIB_BSCR4(_band)			MT_WF_MIB(_band, 0x9dc)
14862306a36Sopenharmony_ci#define MT_MIB_BSCR5(_band)			MT_WF_MIB(_band, 0x9e0)
14962306a36Sopenharmony_ci#define MT_MIB_BSCR6(_band)			MT_WF_MIB(_band, 0x9e4)
15062306a36Sopenharmony_ci#define MT_MIB_BSCR7(_band)			MT_WF_MIB(_band, 0x9e8)
15162306a36Sopenharmony_ci#define MT_MIB_BSCR17(_band)			MT_WF_MIB(_band, 0xa10)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define MT_MIB_TSCR5(_band)			MT_WF_MIB(_band, 0x6c4)
15462306a36Sopenharmony_ci#define MT_MIB_TSCR6(_band)			MT_WF_MIB(_band, 0x6c8)
15562306a36Sopenharmony_ci#define MT_MIB_TSCR7(_band)			MT_WF_MIB(_band, 0x6d0)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define MT_MIB_RSCR1(_band)			MT_WF_MIB(_band, 0x7ac)
15862306a36Sopenharmony_ci/* rx mpdu counter, full 32 bits */
15962306a36Sopenharmony_ci#define MT_MIB_RSCR31(_band)			MT_WF_MIB(_band, 0x964)
16062306a36Sopenharmony_ci#define MT_MIB_RSCR33(_band)			MT_WF_MIB(_band, 0x96c)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define MT_MIB_SDR6(_band)			MT_WF_MIB(_band, 0x020)
16362306a36Sopenharmony_ci#define MT_MIB_SDR6_CHANNEL_IDL_CNT_MASK	GENMASK(15, 0)
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci#define MT_MIB_RVSR0(_band)			MT_WF_MIB(_band, 0x720)
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define MT_MIB_RSCR35(_band)			MT_WF_MIB(_band, 0x974)
16862306a36Sopenharmony_ci#define MT_MIB_RSCR36(_band)			MT_WF_MIB(_band, 0x978)
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/* tx ampdu cnt, full 32 bits */
17162306a36Sopenharmony_ci#define MT_MIB_TSCR0(_band)			MT_WF_MIB(_band, 0x6b0)
17262306a36Sopenharmony_ci#define MT_MIB_TSCR2(_band)			MT_WF_MIB(_band, 0x6b8)
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci/* counts all mpdus in ampdu, regardless of success */
17562306a36Sopenharmony_ci#define MT_MIB_TSCR3(_band)			MT_WF_MIB(_band, 0x6bc)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/* counts all successfully tx'd mpdus in ampdu */
17862306a36Sopenharmony_ci#define MT_MIB_TSCR4(_band)			MT_WF_MIB(_band, 0x6c0)
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* rx ampdu count, 32-bit */
18162306a36Sopenharmony_ci#define MT_MIB_RSCR27(_band)			MT_WF_MIB(_band, 0x954)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci/* rx ampdu bytes count, 32-bit */
18462306a36Sopenharmony_ci#define MT_MIB_RSCR28(_band)			MT_WF_MIB(_band, 0x958)
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci/* rx ampdu valid subframe count */
18762306a36Sopenharmony_ci#define MT_MIB_RSCR29(_band)			MT_WF_MIB(_band, 0x95c)
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci/* rx ampdu valid subframe bytes count, 32bits */
19062306a36Sopenharmony_ci#define MT_MIB_RSCR30(_band)			MT_WF_MIB(_band, 0x960)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* remaining windows protected stats */
19362306a36Sopenharmony_ci#define MT_MIB_SDR27(_band)			MT_WF_MIB(_band, 0x080)
19462306a36Sopenharmony_ci#define MT_MIB_SDR27_TX_RWP_FAIL_CNT		GENMASK(15, 0)
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci#define MT_MIB_SDR28(_band)			MT_WF_MIB(_band, 0x084)
19762306a36Sopenharmony_ci#define MT_MIB_SDR28_TX_RWP_NEED_CNT		GENMASK(15, 0)
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci#define MT_MIB_RVSR1(_band)			MT_WF_MIB(_band, 0x724)
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci/* rx blockack count, 32 bits */
20262306a36Sopenharmony_ci#define MT_MIB_TSCR1(_band)			MT_WF_MIB(_band, 0x6b4)
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci#define MT_MIB_BTSCR0(_band)			MT_WF_MIB(_band, 0x5e0)
20562306a36Sopenharmony_ci#define MT_MIB_BTSCR5(_band)			MT_WF_MIB(_band, 0x788)
20662306a36Sopenharmony_ci#define MT_MIB_BTSCR6(_band)			MT_WF_MIB(_band, 0x798)
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci#define MT_MIB_BFTFCR(_band)			MT_WF_MIB(_band, 0x5d0)
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci#define MT_TX_AGG_CNT(_band, n)			MT_WF_MIB(_band, 0xa28 + ((n) << 2))
21162306a36Sopenharmony_ci#define MT_MIB_ARNG(_band, n)			MT_WF_MIB(_band, 0x0b0 + ((n) << 2))
21262306a36Sopenharmony_ci#define MT_MIB_ARNCR_RANGE(val, n)		(((val) >> ((n) << 4)) & GENMASK(9, 0))
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* UMIB */
21562306a36Sopenharmony_ci#define MT_WF_UMIB_BASE				0x820cd000
21662306a36Sopenharmony_ci#define MT_WF_UMIB(ofs)				(MT_WF_UMIB_BASE + (ofs))
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci#define MT_UMIB_RPDCR(_band)			(MT_WF_UMIB(0x594) + (_band) * 0x164)
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/* WTBLON TOP */
22162306a36Sopenharmony_ci#define MT_WTBLON_TOP_BASE			0x820d4000
22262306a36Sopenharmony_ci#define MT_WTBLON_TOP(ofs)			(MT_WTBLON_TOP_BASE + (ofs))
22362306a36Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR			MT_WTBLON_TOP(0x370)
22462306a36Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR_GROUP		GENMASK(4, 0)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci#define MT_WTBL_UPDATE				MT_WTBLON_TOP(0x380)
22762306a36Sopenharmony_ci#define MT_WTBL_UPDATE_WLAN_IDX			GENMASK(11, 0)
22862306a36Sopenharmony_ci#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR		BIT(14)
22962306a36Sopenharmony_ci#define MT_WTBL_UPDATE_BUSY			BIT(31)
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci#define MT_WTBL_ITCR				MT_WTBLON_TOP(0x3b0)
23262306a36Sopenharmony_ci#define MT_WTBL_ITCR_WR				BIT(16)
23362306a36Sopenharmony_ci#define MT_WTBL_ITCR_EXEC			BIT(31)
23462306a36Sopenharmony_ci#define MT_WTBL_ITDR0				MT_WTBLON_TOP(0x3b8)
23562306a36Sopenharmony_ci#define MT_WTBL_ITDR1				MT_WTBLON_TOP(0x3bc)
23662306a36Sopenharmony_ci#define MT_WTBL_SPE_IDX_SEL			BIT(6)
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci/* WTBL */
23962306a36Sopenharmony_ci#define MT_WTBL_BASE				0x820d8000
24062306a36Sopenharmony_ci#define MT_WTBL_LMAC_ID				GENMASK(14, 8)
24162306a36Sopenharmony_ci#define MT_WTBL_LMAC_DW				GENMASK(7, 2)
24262306a36Sopenharmony_ci#define MT_WTBL_LMAC_OFFS(_id, _dw)		(MT_WTBL_BASE | \
24362306a36Sopenharmony_ci						 FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
24462306a36Sopenharmony_ci						 FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/* ARB: band 0(0x820e3000), band 1(0x820f3000), band 2(0x830e3000) */
24762306a36Sopenharmony_ci#define MT_WF_ARB_BASE(_band)			__BASE(WF_ARB_BASE, (_band))
24862306a36Sopenharmony_ci#define MT_WF_ARB(_band, ofs)			(MT_WF_ARB_BASE(_band) + (ofs))
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci#define MT_ARB_SCR(_band)			MT_WF_ARB(_band, 0x000)
25162306a36Sopenharmony_ci#define MT_ARB_SCR_TX_DISABLE			BIT(8)
25262306a36Sopenharmony_ci#define MT_ARB_SCR_RX_DISABLE			BIT(9)
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/* RMAC: band 0(0x820e5000), band 1(0x820f5000), band 2(0x830e5000), */
25562306a36Sopenharmony_ci#define MT_WF_RMAC_BASE(_band)			__BASE(WF_RMAC_BASE, (_band))
25662306a36Sopenharmony_ci#define MT_WF_RMAC(_band, ofs)			(MT_WF_RMAC_BASE(_band) + (ofs))
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#define MT_WF_RFCR(_band)			MT_WF_RMAC(_band, 0x000)
25962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_STBC_MULTI		BIT(0)
26062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FCSFAIL			BIT(1)
26162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_PROBEREQ		BIT(4)
26262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST			BIT(5)
26362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_BCAST			BIT(6)
26462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST_FILTERED		BIT(7)
26562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_MAC			BIT(8)
26662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_BSSID		BIT(9)
26762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A2_BSSID		BIT(10)
26862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BEACON		BIT(11)
26962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FRAME_REPORT		BIT(12)
27062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTL_RSV			BIT(13)
27162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTS			BIT(14)
27262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_RTS			BIT(15)
27362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_DUPLICATE		BIT(16)
27462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BSS		BIT(17)
27562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_UC		BIT(18)
27662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_TIM		BIT(19)
27762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_NDPA			BIT(20)
27862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_UNWANTED_CTL		BIT(21)
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define MT_WF_RFCR1(_band)			MT_WF_RMAC(_band, 0x004)
28162306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_ACK			BIT(4)
28262306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BF_POLL		BIT(5)
28362306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BA			BIT(6)
28462306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFEND			BIT(7)
28562306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFACK			BIT(8)
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME0(_band)		MT_WF_RMAC(_band, 0x0380)
28862306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_CLR		BIT(31)
28962306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_ED_OFFSET		GENMASK(20, 16)
29062306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_OBSS_BACKOFF		GENMASK(15, 0)
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME1(_band)		MT_WF_RMAC(_band, 0x0384)
29362306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_NONQOSD_BACKOFF		GENMASK(31, 16)
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME3(_band)		MT_WF_RMAC(_band, 0x038c)
29662306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_QOS01_BACKOFF		GENMASK(31, 0)
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME4(_band)		MT_WF_RMAC(_band, 0x0390)
29962306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_QOS23_BACKOFF		GENMASK(31, 0)
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#define MT_WF_RMAC_RSVD0(_band)			MT_WF_RMAC(_band, 0x03e0)
30262306a36Sopenharmony_ci#define MT_WF_RMAC_RSVD0_EIFS_CLR		BIT(21)
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci/* RATE: band 0(0x820ee000), band 1(0x820fe000), band 2(0x830ee000) */
30562306a36Sopenharmony_ci#define MT_WF_RATE_BASE(_band)			__BASE(WF_RATE_BASE, (_band))
30662306a36Sopenharmony_ci#define MT_WF_RATE(_band, ofs)			(MT_WF_RATE_BASE(_band) + (ofs))
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci#define MT_RATE_HRCR0(_band)			MT_WF_RATE(_band, 0x050)
30962306a36Sopenharmony_ci#define MT_RATE_HRCR0_CFEND_RATE		GENMASK(14, 0)
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci/* WFDMA0 */
31262306a36Sopenharmony_ci#define MT_WFDMA0_BASE				0xd4000
31362306a36Sopenharmony_ci#define MT_WFDMA0(ofs)				(MT_WFDMA0_BASE + (ofs))
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci#define MT_WFDMA0_RST				MT_WFDMA0(0x100)
31662306a36Sopenharmony_ci#define MT_WFDMA0_RST_LOGIC_RST			BIT(4)
31762306a36Sopenharmony_ci#define MT_WFDMA0_RST_DMASHDL_ALL_RST		BIT(5)
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA			MT_WFDMA0(0x13c)
32062306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO0		BIT(0)
32162306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO1		BIT(1)
32262306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_RX_FIFO		BIT(2)
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci#define MT_WFDMA0_RX_INT_PCIE_SEL		MT_WFDMA0(0x154)
32562306a36Sopenharmony_ci#define MT_WFDMA0_RX_INT_SEL_RING3		BIT(3)
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci#define MT_WFDMA0_MCU_HOST_INT_ENA		MT_WFDMA0(0x1f4)
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG			MT_WFDMA0(0x208)
33062306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_TX_DMA_EN		BIT(0)
33162306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_RX_DMA_EN		BIT(2)
33262306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_TX_INFO		BIT(28)
33362306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO		BIT(27)
33462306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2	BIT(21)
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT0			MT_WFDMA0(0x2b0)
33762306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT0_RX_WB_RXD	BIT(18)
33862306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT0_WED_MERGE_MODE	BIT(14)
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT1			MT_WFDMA0(0x2b4)
34162306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT1_CALC_MODE	BIT(31)
34262306a36Sopenharmony_ci#define WF_WFDMA0_GLO_CFG_EXT1_TX_FCTRL_MODE	BIT(28)
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci#define MT_WFDMA0_RST_DTX_PTR			MT_WFDMA0(0x20c)
34562306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG0		MT_WFDMA0(0x2f0)
34662306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG1		MT_WFDMA0(0x2f4)
34762306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG2		MT_WFDMA0(0x2f8)
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/* WFDMA1 */
35062306a36Sopenharmony_ci#define MT_WFDMA1_BASE				0xd5000
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci/* WFDMA CSR */
35362306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_BASE			0xd7000
35462306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR(ofs)			(MT_WFDMA_EXT_CSR_BASE + (ofs))
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci#define MT_WFDMA_HOST_CONFIG			MT_WFDMA_EXT_CSR(0x30)
35762306a36Sopenharmony_ci#define MT_WFDMA_HOST_CONFIG_PDMA_BAND		BIT(0)
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC		MT_WFDMA_EXT_CSR(0x44)
36062306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY		BIT(0)
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID			0xd7090
36362306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID_MASK			GENMASK(30, 0)
36462306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID_SEM			BIT(31)
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ci/* WFDMA0 PCIE1 */
36762306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BASE			0xd8000
36862306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1(ofs)			(MT_WFDMA0_PCIE1_BASE + (ofs))
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA		MT_WFDMA0_PCIE1(0x13c)
37162306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO0	BIT(0)
37262306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO1	BIT(1)
37362306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_RX_FIFO	BIT(2)
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci/* WFDMA COMMON */
37662306a36Sopenharmony_ci#define __RXQ(q)				((q) + __MT_MCUQ_MAX)
37762306a36Sopenharmony_ci#define __TXQ(q)				(__RXQ(q) + __MT_RXQ_MAX)
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci#define MT_Q_ID(q)				(dev->q_id[(q)])
38062306a36Sopenharmony_ci#define MT_Q_BASE(q)				((dev->q_wfdma_mask >> (q)) & 0x1 ?	\
38162306a36Sopenharmony_ci						 MT_WFDMA1_BASE : MT_WFDMA0_BASE)
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci#define MT_MCUQ_ID(q)				MT_Q_ID(q)
38462306a36Sopenharmony_ci#define MT_TXQ_ID(q)				MT_Q_ID(__TXQ(q))
38562306a36Sopenharmony_ci#define MT_RXQ_ID(q)				MT_Q_ID(__RXQ(q))
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci#define MT_MCUQ_RING_BASE(q)			(MT_Q_BASE(q) + 0x300)
38862306a36Sopenharmony_ci#define MT_TXQ_RING_BASE(q)			(MT_Q_BASE(__TXQ(q)) + 0x300)
38962306a36Sopenharmony_ci#define MT_RXQ_RING_BASE(q)			(MT_Q_BASE(__RXQ(q)) + 0x500)
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci#define MT_MCUQ_EXT_CTRL(q)			(MT_Q_BASE(q) +	0x600 +	\
39262306a36Sopenharmony_ci						 MT_MCUQ_ID(q) * 0x4)
39362306a36Sopenharmony_ci#define MT_RXQ_BAND1_CTRL(q)			(MT_Q_BASE(__RXQ(q)) + 0x680 +	\
39462306a36Sopenharmony_ci						 MT_RXQ_ID(q) * 0x4)
39562306a36Sopenharmony_ci#define MT_TXQ_EXT_CTRL(q)			(MT_Q_BASE(__TXQ(q)) + 0x600 +	\
39662306a36Sopenharmony_ci						 MT_TXQ_ID(q) * 0x4)
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci#define MT_INT_SOURCE_CSR			MT_WFDMA0(0x200)
39962306a36Sopenharmony_ci#define MT_INT_MASK_CSR				MT_WFDMA0(0x204)
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ci#define MT_INT1_SOURCE_CSR			MT_WFDMA0_PCIE1(0x200)
40262306a36Sopenharmony_ci#define MT_INT1_MASK_CSR			MT_WFDMA0_PCIE1(0x204)
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND0			BIT(12)
40562306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND1			BIT(12)
40662306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND2			BIT(13)
40762306a36Sopenharmony_ci#define MT_INT_RX_DONE_WM			BIT(0)
40862306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA			BIT(1)
40962306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_MAIN			BIT(2)
41062306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_EXT			BIT(2)
41162306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_TRI			BIT(3)
41262306a36Sopenharmony_ci#define MT_INT_RX_TXFREE_MAIN			BIT(17)
41362306a36Sopenharmony_ci#define MT_INT_RX_TXFREE_TRI			BIT(15)
41462306a36Sopenharmony_ci#define MT_INT_MCU_CMD				BIT(29)
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_ci#define MT_INT_RX(q)				(dev->q_int_mask[__RXQ(q)])
41762306a36Sopenharmony_ci#define MT_INT_TX_MCU(q)			(dev->q_int_mask[(q)])
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci#define MT_INT_RX_DONE_MCU			(MT_INT_RX(MT_RXQ_MCU) |	\
42062306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_MCU_WA))
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ci#define MT_INT_BAND0_RX_DONE			(MT_INT_RX(MT_RXQ_MAIN) |	\
42362306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_MAIN_WA))
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci#define MT_INT_BAND1_RX_DONE			(MT_INT_RX(MT_RXQ_BAND1) |	\
42662306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_BAND1_WA) |	\
42762306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_MAIN_WA))
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci#define MT_INT_BAND2_RX_DONE			(MT_INT_RX(MT_RXQ_BAND2) |	\
43062306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_BAND2_WA) |	\
43162306a36Sopenharmony_ci						 MT_INT_RX(MT_RXQ_MAIN_WA))
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_ci#define MT_INT_RX_DONE_ALL			(MT_INT_RX_DONE_MCU |		\
43462306a36Sopenharmony_ci						 MT_INT_BAND0_RX_DONE |		\
43562306a36Sopenharmony_ci						 MT_INT_BAND1_RX_DONE |		\
43662306a36Sopenharmony_ci						 MT_INT_BAND2_RX_DONE)
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define MT_INT_TX_DONE_FWDL			BIT(26)
43962306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WM			BIT(27)
44062306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WA			BIT(22)
44162306a36Sopenharmony_ci#define MT_INT_TX_DONE_BAND0			BIT(30)
44262306a36Sopenharmony_ci#define MT_INT_TX_DONE_BAND1			BIT(31)
44362306a36Sopenharmony_ci#define MT_INT_TX_DONE_BAND2			BIT(15)
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU			(MT_INT_TX_MCU(MT_MCUQ_WA) |	\
44662306a36Sopenharmony_ci						 MT_INT_TX_MCU(MT_MCUQ_WM) |	\
44762306a36Sopenharmony_ci						 MT_INT_TX_MCU(MT_MCUQ_FWDL))
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci#define MT_MCU_CMD				MT_WFDMA0(0x1f0)
45062306a36Sopenharmony_ci#define MT_MCU_CMD_STOP_DMA			BIT(2)
45162306a36Sopenharmony_ci#define MT_MCU_CMD_RESET_DONE			BIT(3)
45262306a36Sopenharmony_ci#define MT_MCU_CMD_RECOVERY_DONE		BIT(4)
45362306a36Sopenharmony_ci#define MT_MCU_CMD_NORMAL_STATE			BIT(5)
45462306a36Sopenharmony_ci#define MT_MCU_CMD_ERROR_MASK			GENMASK(5, 1)
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_ci#define MT_MCU_CMD_WA_WDT			BIT(31)
45762306a36Sopenharmony_ci#define MT_MCU_CMD_WM_WDT			BIT(30)
45862306a36Sopenharmony_ci#define MT_MCU_CMD_WDT_MASK			GENMASK(31, 30)
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci/* l1/l2 remap */
46162306a36Sopenharmony_ci#define MT_HIF_REMAP_L1				0x155024
46262306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_MASK			GENMASK(31, 16)
46362306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_OFFSET			GENMASK(15, 0)
46462306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_BASE			GENMASK(31, 16)
46562306a36Sopenharmony_ci#define MT_HIF_REMAP_BASE_L1			0x130000
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci#define MT_HIF_REMAP_L2				0x1b4
46862306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_MASK			GENMASK(19, 0)
46962306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_OFFSET			GENMASK(11, 0)
47062306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_BASE			GENMASK(31, 12)
47162306a36Sopenharmony_ci#define MT_HIF_REMAP_BASE_L2			0x1000
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci#define MT_INFRA_BASE				0x18000000
47462306a36Sopenharmony_ci#define MT_WFSYS0_PHY_START			0x18400000
47562306a36Sopenharmony_ci#define MT_WFSYS1_PHY_START			0x18800000
47662306a36Sopenharmony_ci#define MT_WFSYS1_PHY_END			0x18bfffff
47762306a36Sopenharmony_ci#define MT_CBTOP1_PHY_START			0x70000000
47862306a36Sopenharmony_ci#define MT_CBTOP1_PHY_END			0x77ffffff
47962306a36Sopenharmony_ci#define MT_CBTOP2_PHY_START			0xf0000000
48062306a36Sopenharmony_ci#define MT_INFRA_MCU_START			0x7c000000
48162306a36Sopenharmony_ci#define MT_INFRA_MCU_END			0x7c3fffff
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/* FW MODE SYNC */
48462306a36Sopenharmony_ci#define MT_FW_ASSERT_CNT			0x02208274
48562306a36Sopenharmony_ci#define MT_FW_DUMP_STATE			0x02209e90
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci#define MT_SWDEF_BASE				0x00401400
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci#define MT_SWDEF(ofs)				(MT_SWDEF_BASE + (ofs))
49062306a36Sopenharmony_ci#define MT_SWDEF_MODE				MT_SWDEF(0x3c)
49162306a36Sopenharmony_ci#define MT_SWDEF_NORMAL_MODE			0
49262306a36Sopenharmony_ci
49362306a36Sopenharmony_ci#define MT_SWDEF_SER_STATS			MT_SWDEF(0x040)
49462306a36Sopenharmony_ci#define MT_SWDEF_PLE_STATS			MT_SWDEF(0x044)
49562306a36Sopenharmony_ci#define MT_SWDEF_PLE1_STATS			MT_SWDEF(0x048)
49662306a36Sopenharmony_ci#define MT_SWDEF_PLE_AMSDU_STATS		MT_SWDEF(0x04c)
49762306a36Sopenharmony_ci#define MT_SWDEF_PSE_STATS			MT_SWDEF(0x050)
49862306a36Sopenharmony_ci#define MT_SWDEF_PSE1_STATS			MT_SWDEF(0x054)
49962306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR6_BN0_STATS		MT_SWDEF(0x058)
50062306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR6_BN1_STATS		MT_SWDEF(0x05c)
50162306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR6_BN2_STATS		MT_SWDEF(0x060)
50262306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR7_BN0_STATS		MT_SWDEF(0x064)
50362306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR7_BN1_STATS		MT_SWDEF(0x068)
50462306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR7_BN2_STATS		MT_SWDEF(0x06c)
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci/* LED */
50762306a36Sopenharmony_ci#define MT_LED_TOP_BASE				0x18013000
50862306a36Sopenharmony_ci#define MT_LED_PHYS(_n)				(MT_LED_TOP_BASE + (_n))
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci#define MT_LED_CTRL(_n)				MT_LED_PHYS(0x00 + ((_n) * 4))
51162306a36Sopenharmony_ci#define MT_LED_CTRL_KICK			BIT(7)
51262306a36Sopenharmony_ci#define MT_LED_CTRL_BLINK_MODE			BIT(2)
51362306a36Sopenharmony_ci#define MT_LED_CTRL_POLARITY			BIT(1)
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci#define MT_LED_TX_BLINK(_n)			MT_LED_PHYS(0x10 + ((_n) * 4))
51662306a36Sopenharmony_ci#define MT_LED_TX_BLINK_ON_MASK			GENMASK(7, 0)
51762306a36Sopenharmony_ci#define MT_LED_TX_BLINK_OFF_MASK		GENMASK(15, 8)
51862306a36Sopenharmony_ci
51962306a36Sopenharmony_ci#define MT_LED_EN(_n)				MT_LED_PHYS(0x40 + ((_n) * 4))
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci/* CONN DBG */
52262306a36Sopenharmony_ci#define MT_CONN_DBG_CTL_BASE			0x18023000
52362306a36Sopenharmony_ci#define MT_CONN_DBG_CTL(ofs)			(MT_CONN_DBG_CTL_BASE + (ofs))
52462306a36Sopenharmony_ci#define MT_CONN_DBG_CTL_OUT_SEL			MT_CONN_DBG_CTL(0x604)
52562306a36Sopenharmony_ci#define MT_CONN_DBG_CTL_PC_LOG_SEL		MT_CONN_DBG_CTL(0x60c)
52662306a36Sopenharmony_ci#define MT_CONN_DBG_CTL_PC_LOG			MT_CONN_DBG_CTL(0x610)
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ci#define MT_LED_GPIO_MUX2			0x70005058 /* GPIO 18 */
52962306a36Sopenharmony_ci#define MT_LED_GPIO_MUX3			0x7000505C /* GPIO 26 */
53062306a36Sopenharmony_ci#define MT_LED_GPIO_SEL_MASK			GENMASK(11, 8)
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci/* MT TOP */
53362306a36Sopenharmony_ci#define MT_TOP_BASE				0xe0000
53462306a36Sopenharmony_ci#define MT_TOP(ofs)				(MT_TOP_BASE + (ofs))
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND(_band)		MT_TOP(0x10 + ((_band) * 0x10))
53762306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_FW_OWN			BIT(0)
53862306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_DRV_OWN		BIT(1)
53962306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_FW_OWN_STAT		BIT(2)
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND_IRQ_STAT(_band)	MT_TOP(0x14 + ((_band) * 0x10))
54262306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND_STAT		BIT(0)
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_ci#define MT_TOP_MISC				MT_TOP(0xf0)
54562306a36Sopenharmony_ci#define MT_TOP_MISC_FW_STATE			GENMASK(2, 0)
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci#define MT_HW_REV				0x70010204
54862306a36Sopenharmony_ci#define MT_WF_SUBSYS_RST			0x70028600
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci/* PCIE MAC */
55162306a36Sopenharmony_ci#define MT_PCIE_MAC_BASE			0x74030000
55262306a36Sopenharmony_ci#define MT_PCIE_MAC(ofs)			(MT_PCIE_MAC_BASE + (ofs))
55362306a36Sopenharmony_ci#define MT_PCIE_MAC_INT_ENABLE			MT_PCIE_MAC(0x188)
55462306a36Sopenharmony_ci
55562306a36Sopenharmony_ci#define MT_PCIE1_MAC_BASE			0x74090000
55662306a36Sopenharmony_ci#define MT_PCIE1_MAC(ofs)			(MT_PCIE1_MAC_BASE + (ofs))
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci#define MT_PCIE1_MAC_INT_ENABLE			MT_PCIE1_MAC(0x188)
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ci/* PHYRX CSD */
56162306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD_BASE			0x83000000
56262306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD(_band, _wf, ofs)	(MT_WF_PHYRX_CSD_BASE + \
56362306a36Sopenharmony_ci						 ((_band) << 20) + \
56462306a36Sopenharmony_ci						 ((_wf) << 16) + (ofs))
56562306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD_IRPI(_band, _wf)	MT_WF_PHYRX_CSD(_band, _wf, 0x1000)
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_ci/* PHYRX CTRL */
56862306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_BASE			0x83080000
56962306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND(_band, ofs)		(MT_WF_PHYRX_BAND_BASE + \
57062306a36Sopenharmony_ci						 ((_band) << 20) + (ofs))
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_VLD0(_band)	MT_WF_PHYRX_BAND(_band, 0x1054)
57362306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_VLD1(_band)	MT_WF_PHYRX_BAND(_band, 0x1058)
57462306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_POS0(_band)	MT_WF_PHYRX_BAND(_band, 0x105c)
57562306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_POS1(_band)	MT_WF_PHYRX_BAND(_band, 0x1060)
57662306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_POS2(_band)	MT_WF_PHYRX_BAND(_band, 0x1064)
57762306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_GID_TAB_POS3(_band)	MT_WF_PHYRX_BAND(_band, 0x1068)
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_RX_CTRL1(_band)	MT_WF_PHYRX_BAND(_band, 0x2004)
58062306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_RX_CTRL1_IPI_EN	GENMASK(2, 0)
58162306a36Sopenharmony_ci#define MT_WF_PHYRX_BAND_RX_CTRL1_STSCNT_EN	GENMASK(11, 9)
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci/* PHYRX CSD BAND */
58462306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD_BAND_RXTD12(_band)		MT_WF_PHYRX_BAND(_band, 0x8230)
58562306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD_BAND_RXTD12_IRPI_SW_CLR_ONLY	BIT(18)
58662306a36Sopenharmony_ci#define MT_WF_PHYRX_CSD_BAND_RXTD12_IRPI_SW_CLR		BIT(29)
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci/* CONN MCU EXCP CON */
58962306a36Sopenharmony_ci#define MT_MCU_WM_EXCP_BASE			0x89050000
59062306a36Sopenharmony_ci#define MT_MCU_WM_EXCP(ofs)			(MT_MCU_WM_EXCP_BASE + (ofs))
59162306a36Sopenharmony_ci#define MT_MCU_WM_EXCP_PC_CTRL			MT_MCU_WM_EXCP(0x100)
59262306a36Sopenharmony_ci#define MT_MCU_WM_EXCP_PC_LOG			MT_MCU_WM_EXCP(0x104)
59362306a36Sopenharmony_ci#define MT_MCU_WM_EXCP_LR_CTRL			MT_MCU_WM_EXCP(0x200)
59462306a36Sopenharmony_ci#define MT_MCU_WM_EXCP_LR_LOG			MT_MCU_WM_EXCP(0x204)
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci#endif
597