162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 262306a36Sopenharmony_ci/* Copyright (C) 2020 MediaTek Inc. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __MT7915_REGS_H 562306a36Sopenharmony_ci#define __MT7915_REGS_H 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* used to differentiate between generations */ 862306a36Sopenharmony_cistruct mt7915_reg_desc { 962306a36Sopenharmony_ci const u32 *reg_rev; 1062306a36Sopenharmony_ci const u32 *offs_rev; 1162306a36Sopenharmony_ci const struct mt76_connac_reg_map *map; 1262306a36Sopenharmony_ci u32 map_size; 1362306a36Sopenharmony_ci}; 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cienum reg_rev { 1662306a36Sopenharmony_ci INT_SOURCE_CSR, 1762306a36Sopenharmony_ci INT_MASK_CSR, 1862306a36Sopenharmony_ci INT1_SOURCE_CSR, 1962306a36Sopenharmony_ci INT1_MASK_CSR, 2062306a36Sopenharmony_ci INT_MCU_CMD_SOURCE, 2162306a36Sopenharmony_ci INT_MCU_CMD_EVENT, 2262306a36Sopenharmony_ci WFDMA0_ADDR, 2362306a36Sopenharmony_ci WFDMA0_PCIE1_ADDR, 2462306a36Sopenharmony_ci WFDMA_EXT_CSR_ADDR, 2562306a36Sopenharmony_ci CBTOP1_PHY_END, 2662306a36Sopenharmony_ci INFRA_MCU_ADDR_END, 2762306a36Sopenharmony_ci FW_ASSERT_STAT_ADDR, 2862306a36Sopenharmony_ci FW_EXCEPT_TYPE_ADDR, 2962306a36Sopenharmony_ci FW_EXCEPT_COUNT_ADDR, 3062306a36Sopenharmony_ci FW_CIRQ_COUNT_ADDR, 3162306a36Sopenharmony_ci FW_CIRQ_IDX_ADDR, 3262306a36Sopenharmony_ci FW_CIRQ_LISR_ADDR, 3362306a36Sopenharmony_ci FW_TASK_ID_ADDR, 3462306a36Sopenharmony_ci FW_TASK_IDX_ADDR, 3562306a36Sopenharmony_ci FW_TASK_QID1_ADDR, 3662306a36Sopenharmony_ci FW_TASK_QID2_ADDR, 3762306a36Sopenharmony_ci FW_TASK_START_ADDR, 3862306a36Sopenharmony_ci FW_TASK_END_ADDR, 3962306a36Sopenharmony_ci FW_TASK_SIZE_ADDR, 4062306a36Sopenharmony_ci FW_LAST_MSG_ID_ADDR, 4162306a36Sopenharmony_ci FW_EINT_INFO_ADDR, 4262306a36Sopenharmony_ci FW_SCHED_INFO_ADDR, 4362306a36Sopenharmony_ci SWDEF_BASE_ADDR, 4462306a36Sopenharmony_ci TXQ_WED_RING_BASE, 4562306a36Sopenharmony_ci RXQ_WED_RING_BASE, 4662306a36Sopenharmony_ci RXQ_WED_DATA_RING_BASE, 4762306a36Sopenharmony_ci __MT_REG_MAX, 4862306a36Sopenharmony_ci}; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_cienum offs_rev { 5162306a36Sopenharmony_ci TMAC_CDTR, 5262306a36Sopenharmony_ci TMAC_ODTR, 5362306a36Sopenharmony_ci TMAC_ATCR, 5462306a36Sopenharmony_ci TMAC_TRCR0, 5562306a36Sopenharmony_ci TMAC_ICR0, 5662306a36Sopenharmony_ci TMAC_ICR1, 5762306a36Sopenharmony_ci TMAC_CTCR0, 5862306a36Sopenharmony_ci TMAC_TFCR0, 5962306a36Sopenharmony_ci MDP_BNRCFR0, 6062306a36Sopenharmony_ci MDP_BNRCFR1, 6162306a36Sopenharmony_ci ARB_DRNGR0, 6262306a36Sopenharmony_ci ARB_SCR, 6362306a36Sopenharmony_ci RMAC_MIB_AIRTIME14, 6462306a36Sopenharmony_ci AGG_AWSCR0, 6562306a36Sopenharmony_ci AGG_PCR0, 6662306a36Sopenharmony_ci AGG_ACR0, 6762306a36Sopenharmony_ci AGG_ACR4, 6862306a36Sopenharmony_ci AGG_MRCR, 6962306a36Sopenharmony_ci AGG_ATCR1, 7062306a36Sopenharmony_ci AGG_ATCR3, 7162306a36Sopenharmony_ci LPON_UTTR0, 7262306a36Sopenharmony_ci LPON_UTTR1, 7362306a36Sopenharmony_ci LPON_FRCR, 7462306a36Sopenharmony_ci MIB_SDR3, 7562306a36Sopenharmony_ci MIB_SDR4, 7662306a36Sopenharmony_ci MIB_SDR5, 7762306a36Sopenharmony_ci MIB_SDR7, 7862306a36Sopenharmony_ci MIB_SDR8, 7962306a36Sopenharmony_ci MIB_SDR9, 8062306a36Sopenharmony_ci MIB_SDR10, 8162306a36Sopenharmony_ci MIB_SDR11, 8262306a36Sopenharmony_ci MIB_SDR12, 8362306a36Sopenharmony_ci MIB_SDR13, 8462306a36Sopenharmony_ci MIB_SDR14, 8562306a36Sopenharmony_ci MIB_SDR15, 8662306a36Sopenharmony_ci MIB_SDR16, 8762306a36Sopenharmony_ci MIB_SDR17, 8862306a36Sopenharmony_ci MIB_SDR18, 8962306a36Sopenharmony_ci MIB_SDR19, 9062306a36Sopenharmony_ci MIB_SDR20, 9162306a36Sopenharmony_ci MIB_SDR21, 9262306a36Sopenharmony_ci MIB_SDR22, 9362306a36Sopenharmony_ci MIB_SDR23, 9462306a36Sopenharmony_ci MIB_SDR24, 9562306a36Sopenharmony_ci MIB_SDR25, 9662306a36Sopenharmony_ci MIB_SDR27, 9762306a36Sopenharmony_ci MIB_SDR28, 9862306a36Sopenharmony_ci MIB_SDR29, 9962306a36Sopenharmony_ci MIB_SDRVEC, 10062306a36Sopenharmony_ci MIB_SDR31, 10162306a36Sopenharmony_ci MIB_SDR32, 10262306a36Sopenharmony_ci MIB_SDRMUBF, 10362306a36Sopenharmony_ci MIB_DR8, 10462306a36Sopenharmony_ci MIB_DR9, 10562306a36Sopenharmony_ci MIB_DR11, 10662306a36Sopenharmony_ci MIB_MB_SDR0, 10762306a36Sopenharmony_ci MIB_MB_SDR1, 10862306a36Sopenharmony_ci TX_AGG_CNT, 10962306a36Sopenharmony_ci TX_AGG_CNT2, 11062306a36Sopenharmony_ci MIB_ARNG, 11162306a36Sopenharmony_ci WTBLON_TOP_WDUCR, 11262306a36Sopenharmony_ci WTBL_UPDATE, 11362306a36Sopenharmony_ci PLE_FL_Q_EMPTY, 11462306a36Sopenharmony_ci PLE_FL_Q_CTRL, 11562306a36Sopenharmony_ci PLE_AC_QEMPTY, 11662306a36Sopenharmony_ci PLE_FREEPG_CNT, 11762306a36Sopenharmony_ci PLE_FREEPG_HEAD_TAIL, 11862306a36Sopenharmony_ci PLE_PG_HIF_GROUP, 11962306a36Sopenharmony_ci PLE_HIF_PG_INFO, 12062306a36Sopenharmony_ci AC_OFFSET, 12162306a36Sopenharmony_ci ETBF_PAR_RPT0, 12262306a36Sopenharmony_ci __MT_OFFS_MAX, 12362306a36Sopenharmony_ci}; 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define __REG(id) (dev->reg.reg_rev[(id)]) 12662306a36Sopenharmony_ci#define __OFFS(id) (dev->reg.offs_rev[(id)]) 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci/* MCU WFDMA0 */ 12962306a36Sopenharmony_ci#define MT_MCU_WFDMA0_BASE 0x2000 13062306a36Sopenharmony_ci#define MT_MCU_WFDMA0(ofs) (MT_MCU_WFDMA0_BASE + (ofs)) 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define MT_MCU_WFDMA0_DUMMY_CR MT_MCU_WFDMA0(0x120) 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci/* MCU WFDMA1 */ 13562306a36Sopenharmony_ci#define MT_MCU_WFDMA1_BASE 0x3000 13662306a36Sopenharmony_ci#define MT_MCU_WFDMA1(ofs) (MT_MCU_WFDMA1_BASE + (ofs)) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define MT_MCU_INT_EVENT __REG(INT_MCU_CMD_EVENT) 13962306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_STOPPED BIT(0) 14062306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_INIT BIT(1) 14162306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2) 14262306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_RESET_DONE BIT(3) 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* PLE */ 14562306a36Sopenharmony_ci#define MT_PLE_BASE 0x820c0000 14662306a36Sopenharmony_ci#define MT_PLE(ofs) (MT_PLE_BASE + (ofs)) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define MT_PLE_HOST_RPT0 MT_PLE(0x030) 14962306a36Sopenharmony_ci#define MT_PLE_HOST_RPT0_TX_LATENCY BIT(3) 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define MT_FL_Q_EMPTY MT_PLE(__OFFS(PLE_FL_Q_EMPTY)) 15262306a36Sopenharmony_ci#define MT_FL_Q0_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL)) 15362306a36Sopenharmony_ci#define MT_FL_Q2_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL) + 0x8) 15462306a36Sopenharmony_ci#define MT_FL_Q3_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL) + 0xc) 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define MT_PLE_FREEPG_CNT MT_PLE(__OFFS(PLE_FREEPG_CNT)) 15762306a36Sopenharmony_ci#define MT_PLE_FREEPG_HEAD_TAIL MT_PLE(__OFFS(PLE_FREEPG_HEAD_TAIL)) 15862306a36Sopenharmony_ci#define MT_PLE_PG_HIF_GROUP MT_PLE(__OFFS(PLE_PG_HIF_GROUP)) 15962306a36Sopenharmony_ci#define MT_PLE_HIF_PG_INFO MT_PLE(__OFFS(PLE_HIF_PG_INFO)) 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(__OFFS(PLE_AC_QEMPTY) + \ 16262306a36Sopenharmony_ci __OFFS(AC_OFFSET) * \ 16362306a36Sopenharmony_ci (ac) + ((n) << 2)) 16462306a36Sopenharmony_ci#define MT_PLE_AMSDU_PACK_MSDU_CNT(n) MT_PLE(0x10e0 + ((n) << 2)) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define MT_PSE_BASE 0x820c8000 16762306a36Sopenharmony_ci#define MT_PSE(ofs) (MT_PSE_BASE + (ofs)) 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* WF MDP TOP */ 17062306a36Sopenharmony_ci#define MT_MDP_BASE 0x820cd000 17162306a36Sopenharmony_ci#define MT_MDP(ofs) (MT_MDP_BASE + (ofs)) 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define MT_MDP_DCR0 MT_MDP(0x000) 17462306a36Sopenharmony_ci#define MT_MDP_DCR0_DAMSDU_EN BIT(15) 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define MT_MDP_DCR1 MT_MDP(0x004) 17762306a36Sopenharmony_ci#define MT_MDP_DCR1_MAX_RX_LEN GENMASK(15, 3) 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci#define MT_MDP_DCR2 MT_MDP(0x0e8) 18062306a36Sopenharmony_ci#define MT_MDP_DCR2_RX_TRANS_SHORT BIT(2) 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci#define MT_MDP_BNRCFR0(_band) MT_MDP(__OFFS(MDP_BNRCFR0) + \ 18362306a36Sopenharmony_ci ((_band) << 8)) 18462306a36Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_MGMT GENMASK(5, 4) 18562306a36Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR GENMASK(7, 6) 18662306a36Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_CTL_BAR GENMASK(9, 8) 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci#define MT_MDP_BNRCFR1(_band) MT_MDP(__OFFS(MDP_BNRCFR1) + \ 18962306a36Sopenharmony_ci ((_band) << 8)) 19062306a36Sopenharmony_ci#define MT_MDP_RCFR1_MCU_RX_BYPASS GENMASK(23, 22) 19162306a36Sopenharmony_ci#define MT_MDP_RCFR1_RX_DROPPED_UCAST GENMASK(28, 27) 19262306a36Sopenharmony_ci#define MT_MDP_RCFR1_RX_DROPPED_MCAST GENMASK(30, 29) 19362306a36Sopenharmony_ci#define MT_MDP_TO_HIF 0 19462306a36Sopenharmony_ci#define MT_MDP_TO_WM 1 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/* TRB: band 0(0x820e1000), band 1(0x820f1000) */ 19762306a36Sopenharmony_ci#define MT_WF_TRB_BASE(_band) ((_band) ? 0x820f1000 : 0x820e1000) 19862306a36Sopenharmony_ci#define MT_WF_TRB(_band, ofs) (MT_WF_TRB_BASE(_band) + (ofs)) 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#define MT_TRB_RXPSR0(_band) MT_WF_TRB(_band, 0x03c) 20162306a36Sopenharmony_ci#define MT_TRB_RXPSR0_RX_WTBL_PTR GENMASK(25, 16) 20262306a36Sopenharmony_ci#define MT_TRB_RXPSR0_RX_RMAC_PTR GENMASK(9, 0) 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* TMAC: band 0(0x820e4000), band 1(0x820f4000) */ 20562306a36Sopenharmony_ci#define MT_WF_TMAC_BASE(_band) ((_band) ? 0x820f4000 : 0x820e4000) 20662306a36Sopenharmony_ci#define MT_WF_TMAC(_band, ofs) (MT_WF_TMAC_BASE(_band) + (ofs)) 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci#define MT_TMAC_TCR0(_band) MT_WF_TMAC(_band, 0) 20962306a36Sopenharmony_ci#define MT_TMAC_TCR0_TX_BLINK GENMASK(7, 6) 21062306a36Sopenharmony_ci#define MT_TMAC_TCR0_TBTT_STOP_CTRL BIT(25) 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci#define MT_TMAC_CDTR(_band) MT_WF_TMAC(_band, __OFFS(TMAC_CDTR)) 21362306a36Sopenharmony_ci #define MT_TMAC_ODTR(_band) MT_WF_TMAC(_band, __OFFS(TMAC_ODTR)) 21462306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0) 21562306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_CCA GENMASK(31, 16) 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ci#define MT_TMAC_ATCR(_band) MT_WF_TMAC(_band, __OFFS(TMAC_ATCR)) 21862306a36Sopenharmony_ci#define MT_TMAC_ATCR_TXV_TOUT GENMASK(7, 0) 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci#define MT_TMAC_TRCR0(_band) MT_WF_TMAC(_band, __OFFS(TMAC_TRCR0)) 22162306a36Sopenharmony_ci#define MT_TMAC_TRCR0_TR2T_CHK GENMASK(8, 0) 22262306a36Sopenharmony_ci#define MT_TMAC_TRCR0_I2T_CHK GENMASK(24, 16) 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#define MT_TMAC_ICR0(_band) MT_WF_TMAC(_band, __OFFS(TMAC_ICR0)) 22562306a36Sopenharmony_ci#define MT_IFS_EIFS_OFDM GENMASK(8, 0) 22662306a36Sopenharmony_ci#define MT_IFS_RIFS GENMASK(14, 10) 22762306a36Sopenharmony_ci#define MT_IFS_SIFS GENMASK(22, 16) 22862306a36Sopenharmony_ci#define MT_IFS_SLOT GENMASK(30, 24) 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci#define MT_TMAC_ICR1(_band) MT_WF_TMAC(_band, __OFFS(TMAC_ICR1)) 23162306a36Sopenharmony_ci#define MT_IFS_EIFS_CCK GENMASK(8, 0) 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci#define MT_TMAC_CTCR0(_band) MT_WF_TMAC(_band, __OFFS(TMAC_CTCR0)) 23462306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0) 23562306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17) 23662306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18) 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define MT_TMAC_TFCR0(_band) MT_WF_TMAC(_band, __OFFS(TMAC_TFCR0)) 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci/* WF DMA TOP: band 0(0x820e7000),band 1(0x820f7000) */ 24162306a36Sopenharmony_ci#define MT_WF_DMA_BASE(_band) ((_band) ? 0x820f7000 : 0x820e7000) 24262306a36Sopenharmony_ci#define MT_WF_DMA(_band, ofs) (MT_WF_DMA_BASE(_band) + (ofs)) 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci#define MT_DMA_DCR0(_band) MT_WF_DMA(_band, 0x000) 24562306a36Sopenharmony_ci#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 3) 24662306a36Sopenharmony_ci#define MT_DMA_DCR0_RXD_G5_EN BIT(23) 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci/* WTBLOFF TOP: band 0(0x820e9000),band 1(0x820f9000) */ 24962306a36Sopenharmony_ci#define MT_WTBLOFF_TOP_BASE(_band) ((_band) ? 0x820f9000 : 0x820e9000) 25062306a36Sopenharmony_ci#define MT_WTBLOFF_TOP(_band, ofs) (MT_WTBLOFF_TOP_BASE(_band) + (ofs)) 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci#define MT_WTBLOFF_TOP_RSCR(_band) MT_WTBLOFF_TOP(_band, 0x008) 25362306a36Sopenharmony_ci#define MT_WTBLOFF_TOP_RSCR_RCPI_MODE GENMASK(31, 30) 25462306a36Sopenharmony_ci#define MT_WTBLOFF_TOP_RSCR_RCPI_PARAM GENMASK(25, 24) 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci/* ETBF: band 0(0x820ea000), band 1(0x820fa000) */ 25762306a36Sopenharmony_ci#define MT_WF_ETBF_BASE(_band) ((_band) ? 0x820fa000 : 0x820ea000) 25862306a36Sopenharmony_ci#define MT_WF_ETBF(_band, ofs) (MT_WF_ETBF_BASE(_band) + (ofs)) 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci#define MT_ETBF_TX_NDP_BFRP(_band) MT_WF_ETBF(_band, 0x040) 26162306a36Sopenharmony_ci#define MT_ETBF_TX_FB_CPL GENMASK(31, 16) 26262306a36Sopenharmony_ci#define MT_ETBF_TX_FB_TRI GENMASK(15, 0) 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci#define MT_ETBF_PAR_RPT0(_band) MT_WF_ETBF(_band, __OFFS(ETBF_PAR_RPT0)) 26562306a36Sopenharmony_ci#define MT_ETBF_PAR_RPT0_FB_BW GENMASK(7, 6) 26662306a36Sopenharmony_ci#define MT_ETBF_PAR_RPT0_FB_NC GENMASK(5, 3) 26762306a36Sopenharmony_ci#define MT_ETBF_PAR_RPT0_FB_NR GENMASK(2, 0) 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci#define MT_ETBF_TX_APP_CNT(_band) MT_WF_ETBF(_band, 0x0f0) 27062306a36Sopenharmony_ci#define MT_ETBF_TX_IBF_CNT GENMASK(31, 16) 27162306a36Sopenharmony_ci#define MT_ETBF_TX_EBF_CNT GENMASK(15, 0) 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci#define MT_ETBF_RX_FB_CNT(_band) MT_WF_ETBF(_band, 0x0f8) 27462306a36Sopenharmony_ci#define MT_ETBF_RX_FB_ALL GENMASK(31, 24) 27562306a36Sopenharmony_ci#define MT_ETBF_RX_FB_HE GENMASK(23, 16) 27662306a36Sopenharmony_ci#define MT_ETBF_RX_FB_VHT GENMASK(15, 8) 27762306a36Sopenharmony_ci#define MT_ETBF_RX_FB_HT GENMASK(7, 0) 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci/* LPON: band 0(0x820eb000), band 1(0x820fb000) */ 28062306a36Sopenharmony_ci#define MT_WF_LPON_BASE(_band) ((_band) ? 0x820fb000 : 0x820eb000) 28162306a36Sopenharmony_ci#define MT_WF_LPON(_band, ofs) (MT_WF_LPON_BASE(_band) + (ofs)) 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci#define MT_LPON_UTTR0(_band) MT_WF_LPON(_band, __OFFS(LPON_UTTR0)) 28462306a36Sopenharmony_ci#define MT_LPON_UTTR1(_band) MT_WF_LPON(_band, __OFFS(LPON_UTTR1)) 28562306a36Sopenharmony_ci#define MT_LPON_FRCR(_band) MT_WF_LPON(_band, __OFFS(LPON_FRCR)) 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci#define MT_LPON_TCR(_band, n) MT_WF_LPON(_band, 0x0a8 + \ 28862306a36Sopenharmony_ci (((n) * 4) << 1)) 28962306a36Sopenharmony_ci#define MT_LPON_TCR_MT7916(_band, n) MT_WF_LPON(_band, 0x0a8 + \ 29062306a36Sopenharmony_ci (((n) * 4) << 4)) 29162306a36Sopenharmony_ci#define MT_LPON_TCR_SW_MODE GENMASK(1, 0) 29262306a36Sopenharmony_ci#define MT_LPON_TCR_SW_WRITE BIT(0) 29362306a36Sopenharmony_ci#define MT_LPON_TCR_SW_ADJUST BIT(1) 29462306a36Sopenharmony_ci#define MT_LPON_TCR_SW_READ GENMASK(1, 0) 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci/* MIB: band 0(0x820ed000), band 1(0x820fd000) */ 29762306a36Sopenharmony_ci/* These counters are (mostly?) clear-on-read. So, some should not 29862306a36Sopenharmony_ci * be read at all in case firmware is already reading them. These 29962306a36Sopenharmony_ci * are commented with 'DNR' below. The DNR stats will be read by querying 30062306a36Sopenharmony_ci * the firmware API for the appropriate message. For counters the driver 30162306a36Sopenharmony_ci * does read, the driver should accumulate the counters. 30262306a36Sopenharmony_ci */ 30362306a36Sopenharmony_ci#define MT_WF_MIB_BASE(_band) ((_band) ? 0x820fd000 : 0x820ed000) 30462306a36Sopenharmony_ci#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE(_band) + (ofs)) 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci#define MT_MIB_SDR0(_band) MT_WF_MIB(_band, 0x010) 30762306a36Sopenharmony_ci#define MT_MIB_SDR0_BERACON_TX_CNT_MASK GENMASK(15, 0) 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci#define MT_MIB_SDR3(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR3)) 31062306a36Sopenharmony_ci#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0) 31162306a36Sopenharmony_ci#define MT_MIB_SDR3_FCS_ERR_MASK_MT7916 GENMASK(31, 16) 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci#define MT_MIB_SDR4(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR4)) 31462306a36Sopenharmony_ci#define MT_MIB_SDR4_RX_FIFO_FULL_MASK GENMASK(15, 0) 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/* rx mpdu counter, full 32 bits */ 31762306a36Sopenharmony_ci#define MT_MIB_SDR5(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR5)) 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci#define MT_MIB_SDR6(_band) MT_WF_MIB(_band, 0x020) 32062306a36Sopenharmony_ci#define MT_MIB_SDR6_CHANNEL_IDL_CNT_MASK GENMASK(15, 0) 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ci#define MT_MIB_SDR7(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR7)) 32362306a36Sopenharmony_ci#define MT_MIB_SDR7_RX_VECTOR_MISMATCH_CNT_MASK GENMASK(15, 0) 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci#define MT_MIB_SDR8(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR8)) 32662306a36Sopenharmony_ci#define MT_MIB_SDR8_RX_DELIMITER_FAIL_CNT_MASK GENMASK(15, 0) 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci/* aka CCA_NAV_TX_TIME */ 32962306a36Sopenharmony_ci#define MT_MIB_SDR9_DNR(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR9)) 33062306a36Sopenharmony_ci#define MT_MIB_SDR9_CCA_BUSY_TIME_MASK GENMASK(23, 0) 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_ci#define MT_MIB_SDR10(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR10)) 33362306a36Sopenharmony_ci#define MT_MIB_SDR10_MRDY_COUNT_MASK GENMASK(25, 0) 33462306a36Sopenharmony_ci#define MT_MIB_SDR10_MRDY_COUNT_MASK_MT7916 GENMASK(31, 0) 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_ci#define MT_MIB_SDR11(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR11)) 33762306a36Sopenharmony_ci#define MT_MIB_SDR11_RX_LEN_MISMATCH_CNT_MASK GENMASK(15, 0) 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci/* tx ampdu cnt, full 32 bits */ 34062306a36Sopenharmony_ci#define MT_MIB_SDR12(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR12)) 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci#define MT_MIB_SDR13(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR13)) 34362306a36Sopenharmony_ci#define MT_MIB_SDR13_TX_STOP_Q_EMPTY_CNT_MASK GENMASK(15, 0) 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci/* counts all mpdus in ampdu, regardless of success */ 34662306a36Sopenharmony_ci#define MT_MIB_SDR14(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR14)) 34762306a36Sopenharmony_ci#define MT_MIB_SDR14_TX_MPDU_ATTEMPTS_CNT_MASK GENMASK(23, 0) 34862306a36Sopenharmony_ci#define MT_MIB_SDR14_TX_MPDU_ATTEMPTS_CNT_MASK_MT7916 GENMASK(31, 0) 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci/* counts all successfully tx'd mpdus in ampdu */ 35162306a36Sopenharmony_ci#define MT_MIB_SDR15(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR15)) 35262306a36Sopenharmony_ci#define MT_MIB_SDR15_TX_MPDU_SUCCESS_CNT_MASK GENMASK(23, 0) 35362306a36Sopenharmony_ci#define MT_MIB_SDR15_TX_MPDU_SUCCESS_CNT_MASK_MT7916 GENMASK(31, 0) 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci/* in units of 'us' */ 35662306a36Sopenharmony_ci#define MT_MIB_SDR16(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR16)) 35762306a36Sopenharmony_ci#define MT_MIB_SDR16_PRIMARY_CCA_BUSY_TIME_MASK GENMASK(23, 0) 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci#define MT_MIB_SDR17(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR17)) 36062306a36Sopenharmony_ci#define MT_MIB_SDR17_SECONDARY_CCA_BUSY_TIME_MASK GENMASK(23, 0) 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci#define MT_MIB_SDR18(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR18)) 36362306a36Sopenharmony_ci#define MT_MIB_SDR18_PRIMARY_ENERGY_DETECT_TIME_MASK GENMASK(23, 0) 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci/* units are us */ 36662306a36Sopenharmony_ci#define MT_MIB_SDR19(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR19)) 36762306a36Sopenharmony_ci#define MT_MIB_SDR19_CCK_MDRDY_TIME_MASK GENMASK(23, 0) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci#define MT_MIB_SDR20(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR20)) 37062306a36Sopenharmony_ci#define MT_MIB_SDR20_OFDM_VHT_MDRDY_TIME_MASK GENMASK(23, 0) 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ci#define MT_MIB_SDR21(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR21)) 37362306a36Sopenharmony_ci#define MT_MIB_SDR21_GREEN_MDRDY_TIME_MASK GENMASK(23, 0) 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci/* rx ampdu count, 32-bit */ 37662306a36Sopenharmony_ci#define MT_MIB_SDR22(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR22)) 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci/* rx ampdu bytes count, 32-bit */ 37962306a36Sopenharmony_ci#define MT_MIB_SDR23(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR23)) 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_ci/* rx ampdu valid subframe count */ 38262306a36Sopenharmony_ci#define MT_MIB_SDR24(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR24)) 38362306a36Sopenharmony_ci#define MT_MIB_SDR24_RX_AMPDU_SF_CNT_MASK GENMASK(23, 0) 38462306a36Sopenharmony_ci#define MT_MIB_SDR24_RX_AMPDU_SF_CNT_MASK_MT7916 GENMASK(31, 0) 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci/* rx ampdu valid subframe bytes count, 32bits */ 38762306a36Sopenharmony_ci#define MT_MIB_SDR25(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR25)) 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci/* remaining windows protected stats */ 39062306a36Sopenharmony_ci#define MT_MIB_SDR27(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR27)) 39162306a36Sopenharmony_ci#define MT_MIB_SDR27_TX_RWP_FAIL_CNT_MASK GENMASK(15, 0) 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci#define MT_MIB_SDR28(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR28)) 39462306a36Sopenharmony_ci#define MT_MIB_SDR28_TX_RWP_NEED_CNT_MASK GENMASK(15, 0) 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_ci#define MT_MIB_SDR29(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR29)) 39762306a36Sopenharmony_ci#define MT_MIB_SDR29_RX_PFDROP_CNT_MASK GENMASK(7, 0) 39862306a36Sopenharmony_ci#define MT_MIB_SDR29_RX_PFDROP_CNT_MASK_MT7916 GENMASK(15, 0) 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci#define MT_MIB_SDRVEC(_band) MT_WF_MIB(_band, __OFFS(MIB_SDRVEC)) 40162306a36Sopenharmony_ci#define MT_MIB_SDR30_RX_VEC_QUEUE_OVERFLOW_DROP_CNT_MASK GENMASK(15, 0) 40262306a36Sopenharmony_ci#define MT_MIB_SDR30_RX_VEC_QUEUE_OVERFLOW_DROP_CNT_MASK_MT7916 GENMASK(31, 16) 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci/* rx blockack count, 32 bits */ 40562306a36Sopenharmony_ci#define MT_MIB_SDR31(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR31)) 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci#define MT_MIB_SDR32(_band) MT_WF_MIB(_band, __OFFS(MIB_SDR32)) 40862306a36Sopenharmony_ci#define MT_MIB_SDR32_TX_PKT_EBF_CNT GENMASK(15, 0) 40962306a36Sopenharmony_ci#define MT_MIB_SDR32_TX_PKT_IBF_CNT GENMASK(31, 16) 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci#define MT_MIB_SDR33(_band) MT_WF_MIB(_band, 0x088) 41262306a36Sopenharmony_ci#define MT_MIB_SDR33_TX_PKT_IBF_CNT GENMASK(15, 0) 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci#define MT_MIB_SDRMUBF(_band) MT_WF_MIB(_band, __OFFS(MIB_SDRMUBF)) 41562306a36Sopenharmony_ci#define MT_MIB_MU_BF_TX_CNT GENMASK(15, 0) 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci/* 36, 37 both DNR */ 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci#define MT_MIB_DR8(_band) MT_WF_MIB(_band, __OFFS(MIB_DR8)) 42062306a36Sopenharmony_ci#define MT_MIB_DR9(_band) MT_WF_MIB(_band, __OFFS(MIB_DR9)) 42162306a36Sopenharmony_ci#define MT_MIB_DR11(_band) MT_WF_MIB(_band, __OFFS(MIB_DR11)) 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci#define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, __OFFS(MIB_MB_SDR0) + (n)) 42462306a36Sopenharmony_ci#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16) 42562306a36Sopenharmony_ci#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci#define MT_MIB_MB_SDR1(_band, n) MT_WF_MIB(_band, __OFFS(MIB_MB_SDR1) + (n)) 42862306a36Sopenharmony_ci#define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0) 42962306a36Sopenharmony_ci#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16) 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci#define MT_MIB_MB_SDR2(_band, n) MT_WF_MIB(_band, 0x518 + (n)) 43262306a36Sopenharmony_ci#define MT_MIB_MB_BFTF(_band, n) MT_WF_MIB(_band, 0x510 + (n)) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci#define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, __OFFS(TX_AGG_CNT) + \ 43562306a36Sopenharmony_ci ((n) << 2)) 43662306a36Sopenharmony_ci#define MT_TX_AGG_CNT2(_band, n) MT_WF_MIB(_band, __OFFS(TX_AGG_CNT2) + \ 43762306a36Sopenharmony_ci ((n) << 2)) 43862306a36Sopenharmony_ci#define MT_MIB_ARNG(_band, n) MT_WF_MIB(_band, __OFFS(MIB_ARNG) + \ 43962306a36Sopenharmony_ci ((n) << 2)) 44062306a36Sopenharmony_ci#define MT_MIB_ARNCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(7, 0)) 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ci#define MT_MIB_BFCR0(_band) MT_WF_MIB(_band, 0x7b0) 44362306a36Sopenharmony_ci#define MT_MIB_BFCR0_RX_FB_HT GENMASK(15, 0) 44462306a36Sopenharmony_ci#define MT_MIB_BFCR0_RX_FB_VHT GENMASK(31, 16) 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci#define MT_MIB_BFCR1(_band) MT_WF_MIB(_band, 0x7b4) 44762306a36Sopenharmony_ci#define MT_MIB_BFCR1_RX_FB_HE GENMASK(15, 0) 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci#define MT_MIB_BFCR2(_band) MT_WF_MIB(_band, 0x7b8) 45062306a36Sopenharmony_ci#define MT_MIB_BFCR2_BFEE_TX_FB_TRIG GENMASK(15, 0) 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci#define MT_MIB_BFCR7(_band) MT_WF_MIB(_band, 0x7cc) 45362306a36Sopenharmony_ci#define MT_MIB_BFCR7_BFEE_TX_FB_CPL GENMASK(15, 0) 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci/* WTBLON TOP */ 45662306a36Sopenharmony_ci#define MT_WTBLON_TOP_BASE 0x820d4000 45762306a36Sopenharmony_ci#define MT_WTBLON_TOP(ofs) (MT_WTBLON_TOP_BASE + (ofs)) 45862306a36Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR MT_WTBLON_TOP(__OFFS(WTBLON_TOP_WDUCR)) 45962306a36Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR_GROUP GENMASK(2, 0) 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_ci#define MT_WTBL_UPDATE MT_WTBLON_TOP(__OFFS(WTBL_UPDATE)) 46262306a36Sopenharmony_ci#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(9, 0) 46362306a36Sopenharmony_ci#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12) 46462306a36Sopenharmony_ci#define MT_WTBL_UPDATE_BUSY BIT(31) 46562306a36Sopenharmony_ci 46662306a36Sopenharmony_ci/* WTBL */ 46762306a36Sopenharmony_ci#define MT_WTBL_BASE 0x820d8000 46862306a36Sopenharmony_ci#define MT_WTBL_LMAC_ID GENMASK(14, 8) 46962306a36Sopenharmony_ci#define MT_WTBL_LMAC_DW GENMASK(7, 2) 47062306a36Sopenharmony_ci#define MT_WTBL_LMAC_OFFS(_id, _dw) (MT_WTBL_BASE | \ 47162306a36Sopenharmony_ci FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \ 47262306a36Sopenharmony_ci FIELD_PREP(MT_WTBL_LMAC_DW, _dw)) 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci/* AGG: band 0(0x820e2000), band 1(0x820f2000) */ 47562306a36Sopenharmony_ci#define MT_WF_AGG_BASE(_band) ((_band) ? 0x820f2000 : 0x820e2000) 47662306a36Sopenharmony_ci#define MT_WF_AGG(_band, ofs) (MT_WF_AGG_BASE(_band) + (ofs)) 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci#define MT_AGG_AWSCR0(_band, _n) MT_WF_AGG(_band, (__OFFS(AGG_AWSCR0) + \ 47962306a36Sopenharmony_ci (_n) * 4)) 48062306a36Sopenharmony_ci#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, (__OFFS(AGG_PCR0) + \ 48162306a36Sopenharmony_ci (_n) * 4)) 48262306a36Sopenharmony_ci#define MT_AGG_PCR0_MM_PROT BIT(0) 48362306a36Sopenharmony_ci#define MT_AGG_PCR0_GF_PROT BIT(1) 48462306a36Sopenharmony_ci#define MT_AGG_PCR0_BW20_PROT BIT(2) 48562306a36Sopenharmony_ci#define MT_AGG_PCR0_BW40_PROT BIT(4) 48662306a36Sopenharmony_ci#define MT_AGG_PCR0_BW80_PROT BIT(6) 48762306a36Sopenharmony_ci#define MT_AGG_PCR0_ERP_PROT GENMASK(12, 8) 48862306a36Sopenharmony_ci#define MT_AGG_PCR0_VHT_PROT BIT(13) 48962306a36Sopenharmony_ci#define MT_AGG_PCR0_PTA_WIN_DIS BIT(15) 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ci#define MT_AGG_PCR1_RTS0_NUM_THRES GENMASK(31, 23) 49262306a36Sopenharmony_ci#define MT_AGG_PCR1_RTS0_LEN_THRES GENMASK(19, 0) 49362306a36Sopenharmony_ci 49462306a36Sopenharmony_ci#define MT_AGG_ACR0(_band) MT_WF_AGG(_band, __OFFS(AGG_ACR0)) 49562306a36Sopenharmony_ci#define MT_AGG_ACR_CFEND_RATE GENMASK(13, 0) 49662306a36Sopenharmony_ci#define MT_AGG_ACR_BAR_RATE GENMASK(29, 16) 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci#define MT_AGG_ACR4(_band) MT_WF_AGG(_band, __OFFS(AGG_ACR4)) 49962306a36Sopenharmony_ci#define MT_AGG_ACR_PPDU_TXS2H BIT(1) 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_ci#define MT_AGG_MRCR(_band) MT_WF_AGG(_band, __OFFS(AGG_MRCR)) 50262306a36Sopenharmony_ci#define MT_AGG_MRCR_BAR_CNT_LIMIT GENMASK(15, 12) 50362306a36Sopenharmony_ci#define MT_AGG_MRCR_LAST_RTS_CTS_RN BIT(6) 50462306a36Sopenharmony_ci#define MT_AGG_MRCR_RTS_FAIL_LIMIT GENMASK(11, 7) 50562306a36Sopenharmony_ci#define MT_AGG_MRCR_TXCMD_RTS_FAIL_LIMIT GENMASK(28, 24) 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci#define MT_AGG_ATCR1(_band) MT_WF_AGG(_band, __OFFS(AGG_ATCR1)) 50862306a36Sopenharmony_ci#define MT_AGG_ATCR3(_band) MT_WF_AGG(_band, __OFFS(AGG_ATCR3)) 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ci/* ARB: band 0(0x820e3000), band 1(0x820f3000) */ 51162306a36Sopenharmony_ci#define MT_WF_ARB_BASE(_band) ((_band) ? 0x820f3000 : 0x820e3000) 51262306a36Sopenharmony_ci#define MT_WF_ARB(_band, ofs) (MT_WF_ARB_BASE(_band) + (ofs)) 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci#define MT_ARB_SCR(_band) MT_WF_ARB(_band, __OFFS(ARB_SCR)) 51562306a36Sopenharmony_ci#define MT_ARB_SCR_TX_DISABLE BIT(8) 51662306a36Sopenharmony_ci#define MT_ARB_SCR_RX_DISABLE BIT(9) 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci#define MT_ARB_DRNGR0(_band, _n) MT_WF_ARB(_band, (__OFFS(ARB_DRNGR0) + \ 51962306a36Sopenharmony_ci (_n) * 4)) 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci/* RMAC: band 0(0x820e5000), band 1(0x820f5000) */ 52262306a36Sopenharmony_ci#define MT_WF_RMAC_BASE(_band) ((_band) ? 0x820f5000 : 0x820e5000) 52362306a36Sopenharmony_ci#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs)) 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci#define MT_WF_RFCR(_band) MT_WF_RMAC(_band, 0x000) 52662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_STBC_MULTI BIT(0) 52762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FCSFAIL BIT(1) 52862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_VERSION BIT(3) 52962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_PROBEREQ BIT(4) 53062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST BIT(5) 53162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_BCAST BIT(6) 53262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7) 53362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_MAC BIT(8) 53462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_BSSID BIT(9) 53562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A2_BSSID BIT(10) 53662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11) 53762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12) 53862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTL_RSV BIT(13) 53962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTS BIT(14) 54062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_RTS BIT(15) 54162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_DUPLICATE BIT(16) 54262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BSS BIT(17) 54362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_UC BIT(18) 54462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_TIM BIT(19) 54562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_NDPA BIT(20) 54662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21) 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ci#define MT_WF_RFCR1(_band) MT_WF_RMAC(_band, 0x004) 54962306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_ACK BIT(4) 55062306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BF_POLL BIT(5) 55162306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BA BIT(6) 55262306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFEND BIT(7) 55362306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFACK BIT(8) 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_ci#define MT_WF_RMAC_RSVD0(_band) MT_WF_RMAC(_band, 0x02e0) 55662306a36Sopenharmony_ci#define MT_WF_RMAC_RSVD0_EIFS_CLR BIT(21) 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME0(_band) MT_WF_RMAC(_band, 0x0380) 55962306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31) 56062306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_OBSS_BACKOFF GENMASK(15, 0) 56162306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_ED_OFFSET GENMASK(20, 16) 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME1(_band) MT_WF_RMAC(_band, 0x0384) 56462306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_NONQOSD_BACKOFF GENMASK(31, 16) 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME3(_band) MT_WF_RMAC(_band, 0x038c) 56762306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_QOS01_BACKOFF GENMASK(31, 0) 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME4(_band) MT_WF_RMAC(_band, 0x0390) 57062306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_QOS23_BACKOFF GENMASK(31, 0) 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci/* WFDMA0 */ 57362306a36Sopenharmony_ci#define MT_WFDMA0_BASE __REG(WFDMA0_ADDR) 57462306a36Sopenharmony_ci#define MT_WFDMA0(ofs) (MT_WFDMA0_BASE + (ofs)) 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci#define MT_WFDMA0_RST MT_WFDMA0(0x100) 57762306a36Sopenharmony_ci#define MT_WFDMA0_RST_LOGIC_RST BIT(4) 57862306a36Sopenharmony_ci#define MT_WFDMA0_RST_DMASHDL_ALL_RST BIT(5) 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA MT_WFDMA0(0x13c) 58162306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO0 BIT(0) 58262306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO1 BIT(1) 58362306a36Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_RX_FIFO BIT(2) 58462306a36Sopenharmony_ci 58562306a36Sopenharmony_ci#define MT_WFDMA0_MCU_HOST_INT_ENA MT_WFDMA0(0x1f4) 58662306a36Sopenharmony_ci 58762306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG MT_WFDMA0(0x208) 58862306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_TX_DMA_EN BIT(0) 58962306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_RX_DMA_EN BIT(2) 59062306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_TX_INFO BIT(28) 59162306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO BIT(27) 59262306a36Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 BIT(21) 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ci#define MT_WFDMA0_RST_DTX_PTR MT_WFDMA0(0x20c) 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci#define MT_WFDMA0_EXT0_CFG MT_WFDMA0(0x2b0) 59762306a36Sopenharmony_ci#define MT_WFDMA0_EXT0_RXWB_KEEP BIT(10) 59862306a36Sopenharmony_ci 59962306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG0 MT_WFDMA0(0x2f0) 60062306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG1 MT_WFDMA0(0x2f4) 60162306a36Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG2 MT_WFDMA0(0x2f8) 60262306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG MT_WFDMA0(0x208) 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* WFDMA1 */ 60562306a36Sopenharmony_ci#define MT_WFDMA1_BASE 0xd5000 60662306a36Sopenharmony_ci#define MT_WFDMA1(ofs) (MT_WFDMA1_BASE + (ofs)) 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci#define MT_WFDMA1_RST MT_WFDMA1(0x100) 60962306a36Sopenharmony_ci#define MT_WFDMA1_RST_LOGIC_RST BIT(4) 61062306a36Sopenharmony_ci#define MT_WFDMA1_RST_DMASHDL_ALL_RST BIT(5) 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA MT_WFDMA1(0x13c) 61362306a36Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_TX_FIFO0 BIT(0) 61462306a36Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_TX_FIFO1 BIT(1) 61562306a36Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_RX_FIFO BIT(2) 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG MT_WFDMA1(0x208) 61862306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_TX_DMA_EN BIT(0) 61962306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_RX_DMA_EN BIT(2) 62062306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_OMIT_TX_INFO BIT(28) 62162306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_OMIT_RX_INFO BIT(27) 62262306a36Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_OMIT_RX_INFO_PFET2 BIT(21) 62362306a36Sopenharmony_ci 62462306a36Sopenharmony_ci#define MT_WFDMA1_RST_DTX_PTR MT_WFDMA1(0x20c) 62562306a36Sopenharmony_ci#define MT_WFDMA1_PRI_DLY_INT_CFG0 MT_WFDMA1(0x2f0) 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci/* WFDMA CSR */ 62862306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_BASE __REG(WFDMA_EXT_CSR_ADDR) 62962306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_PHYS_BASE 0x18027000 63062306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR(ofs) (MT_WFDMA_EXT_CSR_BASE + (ofs)) 63162306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_PHYS(ofs) (MT_WFDMA_EXT_CSR_PHYS_BASE + (ofs)) 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_ci#define MT_WFDMA_HOST_CONFIG MT_WFDMA_EXT_CSR_PHYS(0x30) 63462306a36Sopenharmony_ci#define MT_WFDMA_HOST_CONFIG_PDMA_BAND BIT(0) 63562306a36Sopenharmony_ci#define MT_WFDMA_HOST_CONFIG_WED BIT(1) 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci#define MT_WFDMA_WED_RING_CONTROL MT_WFDMA_EXT_CSR_PHYS(0x34) 63862306a36Sopenharmony_ci#define MT_WFDMA_WED_RING_CONTROL_TX0 GENMASK(4, 0) 63962306a36Sopenharmony_ci#define MT_WFDMA_WED_RING_CONTROL_TX1 GENMASK(12, 8) 64062306a36Sopenharmony_ci#define MT_WFDMA_WED_RING_CONTROL_RX1 GENMASK(20, 16) 64162306a36Sopenharmony_ci 64262306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC MT_WFDMA_EXT_CSR_PHYS(0x44) 64362306a36Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY BIT(0) 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID 0xd7090 64662306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID_MASK GENMASK(30, 0) 64762306a36Sopenharmony_ci#define MT_PCIE_RECOG_ID_SEM BIT(31) 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_ci#define MT_INT_WED_SOURCE_CSR MT_WFDMA_EXT_CSR(0x200) 65062306a36Sopenharmony_ci#define MT_INT_WED_MASK_CSR MT_WFDMA_EXT_CSR(0x204) 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_ci#define MT_WED_TX_RING_BASE MT_WFDMA_EXT_CSR(0x300) 65362306a36Sopenharmony_ci#define MT_WED_RX_RING_BASE MT_WFDMA_EXT_CSR(0x400) 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_ci/* WFDMA0 PCIE1 */ 65662306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BASE __REG(WFDMA0_PCIE1_ADDR) 65762306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1(ofs) (MT_WFDMA0_PCIE1_BASE + (ofs)) 65862306a36Sopenharmony_ci 65962306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA MT_WFDMA0_PCIE1(0x13c) 66062306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO0 BIT(0) 66162306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO1 BIT(1) 66262306a36Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_RX_FIFO BIT(2) 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_ci/* WFDMA1 PCIE1 */ 66562306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1_BASE 0xd9000 66662306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1(ofs) (MT_WFDMA1_PCIE1_BASE + (ofs)) 66762306a36Sopenharmony_ci 66862306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA MT_WFDMA1_PCIE1(0x13c) 66962306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_TX_FIFO0 BIT(0) 67062306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_TX_FIFO1 BIT(1) 67162306a36Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_RX_FIFO BIT(2) 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci/* WFDMA COMMON */ 67462306a36Sopenharmony_ci#define __RXQ(q) ((q) + __MT_MCUQ_MAX) 67562306a36Sopenharmony_ci#define __TXQ(q) (__RXQ(q) + MT_RXQ_BAND2) 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci#define MT_Q_ID(q) (dev->q_id[(q)]) 67862306a36Sopenharmony_ci#define MT_Q_BASE(q) ((dev->wfdma_mask >> (q)) & 0x1 ? \ 67962306a36Sopenharmony_ci MT_WFDMA1_BASE : MT_WFDMA0_BASE) 68062306a36Sopenharmony_ci 68162306a36Sopenharmony_ci#define MT_MCUQ_ID(q) MT_Q_ID(q) 68262306a36Sopenharmony_ci#define MT_TXQ_ID(q) MT_Q_ID(__TXQ(q)) 68362306a36Sopenharmony_ci#define MT_RXQ_ID(q) MT_Q_ID(__RXQ(q)) 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci#define MT_MCUQ_RING_BASE(q) (MT_Q_BASE(q) + 0x300) 68662306a36Sopenharmony_ci#define MT_TXQ_RING_BASE(q) (MT_Q_BASE(__TXQ(q)) + 0x300) 68762306a36Sopenharmony_ci#define MT_RXQ_RING_BASE(q) (MT_Q_BASE(__RXQ(q)) + 0x500) 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci#define MT_MCUQ_EXT_CTRL(q) (MT_Q_BASE(q) + 0x600 + \ 69062306a36Sopenharmony_ci MT_MCUQ_ID(q)* 0x4) 69162306a36Sopenharmony_ci#define MT_RXQ_BAND1_CTRL(q) (MT_Q_BASE(__RXQ(q)) + 0x680 + \ 69262306a36Sopenharmony_ci MT_RXQ_ID(q)* 0x4) 69362306a36Sopenharmony_ci#define MT_TXQ_EXT_CTRL(q) (MT_Q_BASE(__TXQ(q)) + 0x600 + \ 69462306a36Sopenharmony_ci MT_TXQ_ID(q)* 0x4) 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ci#define MT_TXQ_WED_RING_BASE __REG(TXQ_WED_RING_BASE) 69762306a36Sopenharmony_ci#define MT_RXQ_WED_RING_BASE __REG(RXQ_WED_RING_BASE) 69862306a36Sopenharmony_ci#define MT_RXQ_WED_DATA_RING_BASE __REG(RXQ_WED_DATA_RING_BASE) 69962306a36Sopenharmony_ci 70062306a36Sopenharmony_ci#define MT_INT_SOURCE_CSR __REG(INT_SOURCE_CSR) 70162306a36Sopenharmony_ci#define MT_INT_MASK_CSR __REG(INT_MASK_CSR) 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci#define MT_INT1_SOURCE_CSR __REG(INT1_SOURCE_CSR) 70462306a36Sopenharmony_ci#define MT_INT1_MASK_CSR __REG(INT1_MASK_CSR) 70562306a36Sopenharmony_ci 70662306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND0 BIT(16) 70762306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND1 BIT(17) 70862306a36Sopenharmony_ci#define MT_INT_RX_DONE_WM BIT(0) 70962306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA BIT(1) 71062306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_MAIN BIT(1) 71162306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_EXT BIT(2) 71262306a36Sopenharmony_ci#define MT_INT_MCU_CMD BIT(29) 71362306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND0_MT7916 BIT(22) 71462306a36Sopenharmony_ci#define MT_INT_RX_DONE_BAND1_MT7916 BIT(23) 71562306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_MAIN_MT7916 BIT(2) 71662306a36Sopenharmony_ci#define MT_INT_RX_DONE_WA_EXT_MT7916 BIT(3) 71762306a36Sopenharmony_ci 71862306a36Sopenharmony_ci#define MT_INT_WED_RX_DONE_BAND0_MT7916 BIT(18) 71962306a36Sopenharmony_ci#define MT_INT_WED_RX_DONE_BAND1_MT7916 BIT(19) 72062306a36Sopenharmony_ci#define MT_INT_WED_RX_DONE_WA_MAIN_MT7916 BIT(1) 72162306a36Sopenharmony_ci#define MT_INT_WED_RX_DONE_WA_MT7916 BIT(17) 72262306a36Sopenharmony_ci 72362306a36Sopenharmony_ci#define MT_INT_RX(q) (dev->q_int_mask[__RXQ(q)]) 72462306a36Sopenharmony_ci#define MT_INT_TX_MCU(q) (dev->q_int_mask[(q)]) 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_ci#define MT_INT_RX_DONE_MCU (MT_INT_RX(MT_RXQ_MCU) | \ 72762306a36Sopenharmony_ci MT_INT_RX(MT_RXQ_MCU_WA)) 72862306a36Sopenharmony_ci 72962306a36Sopenharmony_ci#define MT_INT_BAND0_RX_DONE (MT_INT_RX(MT_RXQ_MAIN) | \ 73062306a36Sopenharmony_ci MT_INT_RX(MT_RXQ_MAIN_WA)) 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ci#define MT_INT_BAND1_RX_DONE (MT_INT_RX(MT_RXQ_BAND1) | \ 73362306a36Sopenharmony_ci MT_INT_RX(MT_RXQ_BAND1_WA) | \ 73462306a36Sopenharmony_ci MT_INT_RX(MT_RXQ_MAIN_WA)) 73562306a36Sopenharmony_ci 73662306a36Sopenharmony_ci#define MT_INT_RX_DONE_ALL (MT_INT_RX_DONE_MCU | \ 73762306a36Sopenharmony_ci MT_INT_BAND0_RX_DONE | \ 73862306a36Sopenharmony_ci MT_INT_BAND1_RX_DONE) 73962306a36Sopenharmony_ci 74062306a36Sopenharmony_ci#define MT_INT_TX_DONE_FWDL BIT(26) 74162306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WM BIT(27) 74262306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WA BIT(15) 74362306a36Sopenharmony_ci#define MT_INT_TX_DONE_BAND0 BIT(30) 74462306a36Sopenharmony_ci#define MT_INT_TX_DONE_BAND1 BIT(31) 74562306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WA_MT7916 BIT(25) 74662306a36Sopenharmony_ci#define MT_INT_WED_TX_DONE_BAND0 BIT(4) 74762306a36Sopenharmony_ci#define MT_INT_WED_TX_DONE_BAND1 BIT(5) 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci#define MT_INT_TX_DONE_MCU (MT_INT_TX_MCU(MT_MCUQ_WA) | \ 75062306a36Sopenharmony_ci MT_INT_TX_MCU(MT_MCUQ_WM) | \ 75162306a36Sopenharmony_ci MT_INT_TX_MCU(MT_MCUQ_FWDL)) 75262306a36Sopenharmony_ci 75362306a36Sopenharmony_ci#define MT_MCU_CMD __REG(INT_MCU_CMD_SOURCE) 75462306a36Sopenharmony_ci#define MT_MCU_CMD_STOP_DMA_FW_RELOAD BIT(1) 75562306a36Sopenharmony_ci#define MT_MCU_CMD_STOP_DMA BIT(2) 75662306a36Sopenharmony_ci#define MT_MCU_CMD_RESET_DONE BIT(3) 75762306a36Sopenharmony_ci#define MT_MCU_CMD_RECOVERY_DONE BIT(4) 75862306a36Sopenharmony_ci#define MT_MCU_CMD_NORMAL_STATE BIT(5) 75962306a36Sopenharmony_ci#define MT_MCU_CMD_ERROR_MASK GENMASK(5, 1) 76062306a36Sopenharmony_ci 76162306a36Sopenharmony_ci#define MT_MCU_CMD_WA_WDT BIT(31) 76262306a36Sopenharmony_ci#define MT_MCU_CMD_WM_WDT BIT(30) 76362306a36Sopenharmony_ci#define MT_MCU_CMD_WDT_MASK GENMASK(31, 30) 76462306a36Sopenharmony_ci 76562306a36Sopenharmony_ci/* TOP RGU */ 76662306a36Sopenharmony_ci#define MT_TOP_RGU_BASE 0x18000000 76762306a36Sopenharmony_ci#define MT_TOP_PWR_CTRL (MT_TOP_RGU_BASE + (0x0)) 76862306a36Sopenharmony_ci#define MT_TOP_PWR_KEY (0x5746 << 16) 76962306a36Sopenharmony_ci#define MT_TOP_PWR_SW_RST BIT(0) 77062306a36Sopenharmony_ci#define MT_TOP_PWR_SW_PWR_ON GENMASK(3, 2) 77162306a36Sopenharmony_ci#define MT_TOP_PWR_HW_CTRL BIT(4) 77262306a36Sopenharmony_ci#define MT_TOP_PWR_PWR_ON BIT(7) 77362306a36Sopenharmony_ci 77462306a36Sopenharmony_ci#define MT_TOP_RGU_SYSRAM_PDN (MT_TOP_RGU_BASE + 0x050) 77562306a36Sopenharmony_ci#define MT_TOP_RGU_SYSRAM_SLP (MT_TOP_RGU_BASE + 0x054) 77662306a36Sopenharmony_ci#define MT_TOP_WFSYS_PWR (MT_TOP_RGU_BASE + 0x010) 77762306a36Sopenharmony_ci#define MT_TOP_PWR_EN_MASK BIT(7) 77862306a36Sopenharmony_ci#define MT_TOP_PWR_ACK_MASK BIT(6) 77962306a36Sopenharmony_ci#define MT_TOP_PWR_KEY_MASK GENMASK(31, 16) 78062306a36Sopenharmony_ci 78162306a36Sopenharmony_ci#define MT7986_TOP_WM_RESET (MT_TOP_RGU_BASE + 0x120) 78262306a36Sopenharmony_ci#define MT7986_TOP_WM_RESET_MASK BIT(0) 78362306a36Sopenharmony_ci 78462306a36Sopenharmony_ci/* l1/l2 remap */ 78562306a36Sopenharmony_ci#define MT_HIF_REMAP_L1 0xf11ac 78662306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_MT7916 0xfe260 78762306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_MASK GENMASK(15, 0) 78862306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_OFFSET GENMASK(15, 0) 78962306a36Sopenharmony_ci#define MT_HIF_REMAP_L1_BASE GENMASK(31, 16) 79062306a36Sopenharmony_ci#define MT_HIF_REMAP_BASE_L1 0xe0000 79162306a36Sopenharmony_ci 79262306a36Sopenharmony_ci#define MT_HIF_REMAP_L2 0xf11b0 79362306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_MASK GENMASK(19, 0) 79462306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_OFFSET GENMASK(11, 0) 79562306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_BASE GENMASK(31, 12) 79662306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_MT7916 0x1b8 79762306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_MASK_MT7916 GENMASK(31, 16) 79862306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_OFFSET_MT7916 GENMASK(15, 0) 79962306a36Sopenharmony_ci#define MT_HIF_REMAP_L2_BASE_MT7916 GENMASK(31, 16) 80062306a36Sopenharmony_ci#define MT_HIF_REMAP_BASE_L2_MT7916 0x40000 80162306a36Sopenharmony_ci 80262306a36Sopenharmony_ci#define MT_INFRA_BASE 0x18000000 80362306a36Sopenharmony_ci#define MT_WFSYS0_PHY_START 0x18400000 80462306a36Sopenharmony_ci#define MT_WFSYS1_PHY_START 0x18800000 80562306a36Sopenharmony_ci#define MT_WFSYS1_PHY_END 0x18bfffff 80662306a36Sopenharmony_ci#define MT_CBTOP1_PHY_START 0x70000000 80762306a36Sopenharmony_ci#define MT_CBTOP1_PHY_END __REG(CBTOP1_PHY_END) 80862306a36Sopenharmony_ci#define MT_CBTOP2_PHY_START 0xf0000000 80962306a36Sopenharmony_ci#define MT_INFRA_MCU_START 0x7c000000 81062306a36Sopenharmony_ci#define MT_INFRA_MCU_END __REG(INFRA_MCU_ADDR_END) 81162306a36Sopenharmony_ci#define MT_CONN_INFRA_OFFSET(p) ((p) - MT_INFRA_BASE) 81262306a36Sopenharmony_ci 81362306a36Sopenharmony_ci/* CONN INFRA CFG */ 81462306a36Sopenharmony_ci#define MT_CONN_INFRA_BASE 0x18001000 81562306a36Sopenharmony_ci#define MT_CONN_INFRA(ofs) (MT_CONN_INFRA_BASE + (ofs)) 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_ci#define MT_CONN_INFRA_EFUSE MT_CONN_INFRA(0x020) 81862306a36Sopenharmony_ci 81962306a36Sopenharmony_ci#define MT_CONN_INFRA_ADIE_RESET MT_CONN_INFRA(0x030) 82062306a36Sopenharmony_ci#define MT_CONN_INFRA_ADIE1_RESET_MASK BIT(0) 82162306a36Sopenharmony_ci#define MT_CONN_INFRA_ADIE2_RESET_MASK BIT(2) 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci#define MT_CONN_INFRA_OSC_RC_EN MT_CONN_INFRA(0x380) 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci#define MT_CONN_INFRA_OSC_CTRL MT_CONN_INFRA(0x300) 82662306a36Sopenharmony_ci#define MT_CONN_INFRA_OSC_RC_EN_MASK BIT(7) 82762306a36Sopenharmony_ci#define MT_CONN_INFRA_OSC_STB_TIME_MASK GENMASK(23, 0) 82862306a36Sopenharmony_ci 82962306a36Sopenharmony_ci#define MT_CONN_INFRA_HW_CTRL MT_CONN_INFRA(0x200) 83062306a36Sopenharmony_ci#define MT_CONN_INFRA_HW_CTRL_MASK BIT(0) 83162306a36Sopenharmony_ci 83262306a36Sopenharmony_ci#define MT_CONN_INFRA_WF_SLP_PROT MT_CONN_INFRA(0x540) 83362306a36Sopenharmony_ci#define MT_CONN_INFRA_WF_SLP_PROT_MASK BIT(0) 83462306a36Sopenharmony_ci 83562306a36Sopenharmony_ci#define MT_CONN_INFRA_WF_SLP_PROT_RDY MT_CONN_INFRA(0x544) 83662306a36Sopenharmony_ci#define MT_CONN_INFRA_CONN_WF_MASK (BIT(29) | BIT(31)) 83762306a36Sopenharmony_ci#define MT_CONN_INFRA_CONN (BIT(25) | BIT(29) | BIT(31)) 83862306a36Sopenharmony_ci 83962306a36Sopenharmony_ci#define MT_CONN_INFRA_EMI_REQ MT_CONN_INFRA(0x414) 84062306a36Sopenharmony_ci#define MT_CONN_INFRA_EMI_REQ_MASK BIT(0) 84162306a36Sopenharmony_ci#define MT_CONN_INFRA_INFRA_REQ_MASK BIT(5) 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_ci/* AFE */ 84462306a36Sopenharmony_ci#define MT_AFE_CTRL_BASE(_band) (0x18003000 + ((_band) << 19)) 84562306a36Sopenharmony_ci#define MT_AFE_CTRL(_band, ofs) (MT_AFE_CTRL_BASE(_band) + (ofs)) 84662306a36Sopenharmony_ci 84762306a36Sopenharmony_ci#define MT_AFE_DIG_EN_01(_band) MT_AFE_CTRL(_band, 0x00) 84862306a36Sopenharmony_ci#define MT_AFE_DIG_EN_02(_band) MT_AFE_CTRL(_band, 0x04) 84962306a36Sopenharmony_ci#define MT_AFE_DIG_EN_03(_band) MT_AFE_CTRL(_band, 0x08) 85062306a36Sopenharmony_ci#define MT_AFE_DIG_TOP_01(_band) MT_AFE_CTRL(_band, 0x0c) 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci#define MT_AFE_PLL_STB_TIME(_band) MT_AFE_CTRL(_band, 0xf4) 85362306a36Sopenharmony_ci#define MT_AFE_PLL_STB_TIME_MASK (GENMASK(30, 16) | GENMASK(14, 0)) 85462306a36Sopenharmony_ci#define MT_AFE_PLL_STB_TIME_VAL (FIELD_PREP(GENMASK(30, 16), 0x4bc) | \ 85562306a36Sopenharmony_ci FIELD_PREP(GENMASK(14, 0), 0x7e4)) 85662306a36Sopenharmony_ci#define MT_AFE_BPLL_CFG_MASK GENMASK(7, 6) 85762306a36Sopenharmony_ci#define MT_AFE_WPLL_CFG_MASK GENMASK(1, 0) 85862306a36Sopenharmony_ci#define MT_AFE_MCU_WPLL_CFG_MASK GENMASK(3, 2) 85962306a36Sopenharmony_ci#define MT_AFE_MCU_BPLL_CFG_MASK GENMASK(17, 16) 86062306a36Sopenharmony_ci#define MT_AFE_PLL_CFG_MASK (MT_AFE_BPLL_CFG_MASK | \ 86162306a36Sopenharmony_ci MT_AFE_WPLL_CFG_MASK | \ 86262306a36Sopenharmony_ci MT_AFE_MCU_WPLL_CFG_MASK | \ 86362306a36Sopenharmony_ci MT_AFE_MCU_BPLL_CFG_MASK) 86462306a36Sopenharmony_ci#define MT_AFE_PLL_CFG_VAL (FIELD_PREP(MT_AFE_BPLL_CFG_MASK, 0x1) | \ 86562306a36Sopenharmony_ci FIELD_PREP(MT_AFE_WPLL_CFG_MASK, 0x2) | \ 86662306a36Sopenharmony_ci FIELD_PREP(MT_AFE_MCU_WPLL_CFG_MASK, 0x1) | \ 86762306a36Sopenharmony_ci FIELD_PREP(MT_AFE_MCU_BPLL_CFG_MASK, 0x2)) 86862306a36Sopenharmony_ci 86962306a36Sopenharmony_ci#define MT_AFE_DIG_TOP_01_MASK GENMASK(18, 15) 87062306a36Sopenharmony_ci#define MT_AFE_DIG_TOP_01_VAL FIELD_PREP(MT_AFE_DIG_TOP_01_MASK, 0x9) 87162306a36Sopenharmony_ci 87262306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_RCK_MASK BIT(0) 87362306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_BPLL_UP_MASK BIT(21) 87462306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_WPLL_UP_MASK BIT(20) 87562306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_PLL_UP_MASK (MT_AFE_RG_WBG_EN_BPLL_UP_MASK | \ 87662306a36Sopenharmony_ci MT_AFE_RG_WBG_EN_WPLL_UP_MASK) 87762306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_WF4 BIT(29) 87862306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_BT BIT(21) 87962306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_WF3 BIT(20) 88062306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_WF2 BIT(19) 88162306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_WF1 BIT(18) 88262306a36Sopenharmony_ci#define MT_AFE_RG_WBG_EN_TXCAL_WF0 BIT(17) 88362306a36Sopenharmony_ci 88462306a36Sopenharmony_ci#define MT_ADIE_SLP_CTRL_BASE(_band) (0x18005000 + ((_band) << 19)) 88562306a36Sopenharmony_ci#define MT_ADIE_SLP_CTRL(_band, ofs) (MT_ADIE_SLP_CTRL_BASE(_band) + (ofs)) 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_ci#define MT_ADIE_SLP_CTRL_CK0(_band) MT_ADIE_SLP_CTRL(_band, 0x120) 88862306a36Sopenharmony_ci 88962306a36Sopenharmony_ci/* ADIE */ 89062306a36Sopenharmony_ci#define MT_ADIE_CHIP_ID 0x02c 89162306a36Sopenharmony_ci#define MT_ADIE_VERSION_MASK GENMASK(15, 0) 89262306a36Sopenharmony_ci#define MT_ADIE_CHIP_ID_MASK GENMASK(31, 16) 89362306a36Sopenharmony_ci#define MT_ADIE_IDX0 GENMASK(15, 0) 89462306a36Sopenharmony_ci#define MT_ADIE_IDX1 GENMASK(31, 16) 89562306a36Sopenharmony_ci 89662306a36Sopenharmony_ci#define MT_ADIE_RG_TOP_THADC_BG 0x034 89762306a36Sopenharmony_ci#define MT_ADIE_VRPI_SEL_CR_MASK GENMASK(15, 12) 89862306a36Sopenharmony_ci#define MT_ADIE_VRPI_SEL_EFUSE_MASK GENMASK(6, 3) 89962306a36Sopenharmony_ci 90062306a36Sopenharmony_ci#define MT_ADIE_RG_TOP_THADC 0x038 90162306a36Sopenharmony_ci#define MT_ADIE_PGA_GAIN_MASK GENMASK(25, 23) 90262306a36Sopenharmony_ci#define MT_ADIE_PGA_GAIN_EFUSE_MASK GENMASK(2, 0) 90362306a36Sopenharmony_ci#define MT_ADIE_LDO_CTRL_MASK GENMASK(27, 26) 90462306a36Sopenharmony_ci#define MT_ADIE_LDO_CTRL_EFUSE_MASK GENMASK(6, 5) 90562306a36Sopenharmony_ci 90662306a36Sopenharmony_ci#define MT_AFE_RG_ENCAL_WBTAC_IF_SW 0x070 90762306a36Sopenharmony_ci#define MT_ADIE_EFUSE_RDATA0 0x130 90862306a36Sopenharmony_ci 90962306a36Sopenharmony_ci#define MT_ADIE_EFUSE2_CTRL 0x148 91062306a36Sopenharmony_ci#define MT_ADIE_EFUSE_CTRL_MASK BIT(1) 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci#define MT_ADIE_EFUSE_CFG 0x144 91362306a36Sopenharmony_ci#define MT_ADIE_EFUSE_MODE_MASK GENMASK(7, 6) 91462306a36Sopenharmony_ci#define MT_ADIE_EFUSE_ADDR_MASK GENMASK(25, 16) 91562306a36Sopenharmony_ci#define MT_ADIE_EFUSE_VALID_MASK BIT(29) 91662306a36Sopenharmony_ci#define MT_ADIE_EFUSE_KICK_MASK BIT(30) 91762306a36Sopenharmony_ci 91862306a36Sopenharmony_ci#define MT_ADIE_THADC_ANALOG 0x3a6 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci#define MT_ADIE_THADC_SLOP 0x3a7 92162306a36Sopenharmony_ci#define MT_ADIE_ANA_EN_MASK BIT(7) 92262306a36Sopenharmony_ci 92362306a36Sopenharmony_ci#define MT_ADIE_7975_XTAL_CAL 0x3a1 92462306a36Sopenharmony_ci#define MT_ADIE_TRIM_MASK GENMASK(6, 0) 92562306a36Sopenharmony_ci#define MT_ADIE_EFUSE_TRIM_MASK GENMASK(5, 0) 92662306a36Sopenharmony_ci#define MT_ADIE_XO_TRIM_EN_MASK BIT(7) 92762306a36Sopenharmony_ci#define MT_ADIE_XTAL_DECREASE_MASK BIT(6) 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci#define MT_ADIE_7975_XO_TRIM2 0x3a2 93062306a36Sopenharmony_ci#define MT_ADIE_7975_XO_TRIM3 0x3a3 93162306a36Sopenharmony_ci#define MT_ADIE_7975_XO_TRIM4 0x3a4 93262306a36Sopenharmony_ci#define MT_ADIE_7975_XTAL_EN 0x3a5 93362306a36Sopenharmony_ci 93462306a36Sopenharmony_ci#define MT_ADIE_XO_TRIM_FLOW 0x3ac 93562306a36Sopenharmony_ci#define MT_ADIE_XTAL_AXM_80M_OSC 0x390 93662306a36Sopenharmony_ci#define MT_ADIE_XTAL_AXM_40M_OSC 0x391 93762306a36Sopenharmony_ci#define MT_ADIE_XTAL_TRIM1_80M_OSC 0x398 93862306a36Sopenharmony_ci#define MT_ADIE_XTAL_TRIM1_40M_OSC 0x399 93962306a36Sopenharmony_ci#define MT_ADIE_WRI_CK_SEL 0x4ac 94062306a36Sopenharmony_ci#define MT_ADIE_RG_STRAP_PIN_IN 0x4fc 94162306a36Sopenharmony_ci#define MT_ADIE_XTAL_C1 0x654 94262306a36Sopenharmony_ci#define MT_ADIE_XTAL_C2 0x658 94362306a36Sopenharmony_ci#define MT_ADIE_RG_XO_01 0x65c 94462306a36Sopenharmony_ci#define MT_ADIE_RG_XO_03 0x664 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci#define MT_ADIE_CLK_EN 0xa00 94762306a36Sopenharmony_ci 94862306a36Sopenharmony_ci#define MT_ADIE_7975_XTAL 0xa18 94962306a36Sopenharmony_ci#define MT_ADIE_7975_XTAL_EN_MASK BIT(29) 95062306a36Sopenharmony_ci 95162306a36Sopenharmony_ci#define MT_ADIE_7975_COCLK 0xa1c 95262306a36Sopenharmony_ci#define MT_ADIE_7975_XO_2 0xa84 95362306a36Sopenharmony_ci#define MT_ADIE_7975_XO_2_FIX_EN BIT(31) 95462306a36Sopenharmony_ci 95562306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL2 0xa94 95662306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL2_C1_MASK GENMASK(26, 20) 95762306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL2_C2_MASK GENMASK(18, 12) 95862306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL2_MASK (MT_ADIE_7975_XO_CTRL2_C1_MASK | \ 95962306a36Sopenharmony_ci MT_ADIE_7975_XO_CTRL2_C2_MASK) 96062306a36Sopenharmony_ci 96162306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL6 0xaa4 96262306a36Sopenharmony_ci#define MT_ADIE_7975_XO_CTRL6_MASK BIT(16) 96362306a36Sopenharmony_ci 96462306a36Sopenharmony_ci/* TOP SPI */ 96562306a36Sopenharmony_ci#define MT_TOP_SPI_ADIE_BASE(_band) (0x18004000 + ((_band) << 19)) 96662306a36Sopenharmony_ci#define MT_TOP_SPI_ADIE(_band, ofs) (MT_TOP_SPI_ADIE_BASE(_band) + (ofs)) 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci#define MT_TOP_SPI_BUSY_CR(_band) MT_TOP_SPI_ADIE(_band, 0) 96962306a36Sopenharmony_ci#define MT_TOP_SPI_POLLING_BIT BIT(5) 97062306a36Sopenharmony_ci 97162306a36Sopenharmony_ci#define MT_TOP_SPI_ADDR_CR(_band) MT_TOP_SPI_ADIE(_band, 0x50) 97262306a36Sopenharmony_ci#define MT_TOP_SPI_READ_ADDR_FORMAT (BIT(12) | BIT(13) | BIT(15)) 97362306a36Sopenharmony_ci#define MT_TOP_SPI_WRITE_ADDR_FORMAT (BIT(13) | BIT(15)) 97462306a36Sopenharmony_ci 97562306a36Sopenharmony_ci#define MT_TOP_SPI_WRITE_DATA_CR(_band) MT_TOP_SPI_ADIE(_band, 0x54) 97662306a36Sopenharmony_ci#define MT_TOP_SPI_READ_DATA_CR(_band) MT_TOP_SPI_ADIE(_band, 0x58) 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci/* CONN INFRA CKGEN */ 97962306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BASE 0x18009000 98062306a36Sopenharmony_ci#define MT_INFRA_CKGEN(ofs) (MT_INFRA_CKGEN_BASE + (ofs)) 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BUS MT_INFRA_CKGEN(0xa00) 98362306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BUS_CLK_SEL_MASK BIT(23) 98462306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BUS_RDY_SEL_MASK BIT(29) 98562306a36Sopenharmony_ci 98662306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BUS_WPLL_DIV_1 MT_INFRA_CKGEN(0x008) 98762306a36Sopenharmony_ci#define MT_INFRA_CKGEN_BUS_WPLL_DIV_2 MT_INFRA_CKGEN(0x00c) 98862306a36Sopenharmony_ci 98962306a36Sopenharmony_ci#define MT_INFRA_CKGEN_RFSPI_WPLL_DIV MT_INFRA_CKGEN(0x040) 99062306a36Sopenharmony_ci#define MT_INFRA_CKGEN_DIV_SEL_MASK GENMASK(7, 2) 99162306a36Sopenharmony_ci#define MT_INFRA_CKGEN_DIV_EN_MASK BIT(0) 99262306a36Sopenharmony_ci 99362306a36Sopenharmony_ci/* CONN INFRA BUS */ 99462306a36Sopenharmony_ci#define MT_INFRA_BUS_BASE 0x1800e000 99562306a36Sopenharmony_ci#define MT_INFRA_BUS(ofs) (MT_INFRA_BUS_BASE + (ofs)) 99662306a36Sopenharmony_ci 99762306a36Sopenharmony_ci#define MT_INFRA_BUS_OFF_TIMEOUT MT_INFRA_BUS(0x300) 99862306a36Sopenharmony_ci#define MT_INFRA_BUS_TIMEOUT_LIMIT_MASK GENMASK(14, 7) 99962306a36Sopenharmony_ci#define MT_INFRA_BUS_TIMEOUT_EN_MASK GENMASK(3, 0) 100062306a36Sopenharmony_ci 100162306a36Sopenharmony_ci#define MT_INFRA_BUS_ON_TIMEOUT MT_INFRA_BUS(0x31c) 100262306a36Sopenharmony_ci#define MT_INFRA_BUS_EMI_START MT_INFRA_BUS(0x360) 100362306a36Sopenharmony_ci#define MT_INFRA_BUS_EMI_END MT_INFRA_BUS(0x364) 100462306a36Sopenharmony_ci 100562306a36Sopenharmony_ci/* CONN_INFRA_SKU */ 100662306a36Sopenharmony_ci#define MT_CONNINFRA_SKU_DEC_ADDR 0x18050000 100762306a36Sopenharmony_ci#define MT_CONNINFRA_SKU_MASK GENMASK(15, 0) 100862306a36Sopenharmony_ci#define MT_ADIE_TYPE_MASK BIT(1) 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci/* FW MODE SYNC */ 101162306a36Sopenharmony_ci#define MT_FW_ASSERT_STAT __REG(FW_ASSERT_STAT_ADDR) 101262306a36Sopenharmony_ci#define MT_FW_EXCEPT_TYPE __REG(FW_EXCEPT_TYPE_ADDR) 101362306a36Sopenharmony_ci#define MT_FW_EXCEPT_COUNT __REG(FW_EXCEPT_COUNT_ADDR) 101462306a36Sopenharmony_ci#define MT_FW_CIRQ_COUNT __REG(FW_CIRQ_COUNT_ADDR) 101562306a36Sopenharmony_ci#define MT_FW_CIRQ_IDX __REG(FW_CIRQ_IDX_ADDR) 101662306a36Sopenharmony_ci#define MT_FW_CIRQ_LISR __REG(FW_CIRQ_LISR_ADDR) 101762306a36Sopenharmony_ci#define MT_FW_TASK_ID __REG(FW_TASK_ID_ADDR) 101862306a36Sopenharmony_ci#define MT_FW_TASK_IDX __REG(FW_TASK_IDX_ADDR) 101962306a36Sopenharmony_ci#define MT_FW_TASK_QID1 __REG(FW_TASK_QID1_ADDR) 102062306a36Sopenharmony_ci#define MT_FW_TASK_QID2 __REG(FW_TASK_QID2_ADDR) 102162306a36Sopenharmony_ci#define MT_FW_TASK_START __REG(FW_TASK_START_ADDR) 102262306a36Sopenharmony_ci#define MT_FW_TASK_END __REG(FW_TASK_END_ADDR) 102362306a36Sopenharmony_ci#define MT_FW_TASK_SIZE __REG(FW_TASK_SIZE_ADDR) 102462306a36Sopenharmony_ci#define MT_FW_LAST_MSG_ID __REG(FW_LAST_MSG_ID_ADDR) 102562306a36Sopenharmony_ci#define MT_FW_EINT_INFO __REG(FW_EINT_INFO_ADDR) 102662306a36Sopenharmony_ci#define MT_FW_SCHED_INFO __REG(FW_SCHED_INFO_ADDR) 102762306a36Sopenharmony_ci 102862306a36Sopenharmony_ci#define MT_SWDEF_BASE __REG(SWDEF_BASE_ADDR) 102962306a36Sopenharmony_ci 103062306a36Sopenharmony_ci#define MT_SWDEF(ofs) (MT_SWDEF_BASE + (ofs)) 103162306a36Sopenharmony_ci#define MT_SWDEF_MODE MT_SWDEF(0x3c) 103262306a36Sopenharmony_ci#define MT_SWDEF_NORMAL_MODE 0 103362306a36Sopenharmony_ci#define MT_SWDEF_ICAP_MODE 1 103462306a36Sopenharmony_ci#define MT_SWDEF_SPECTRUM_MODE 2 103562306a36Sopenharmony_ci 103662306a36Sopenharmony_ci#define MT_SWDEF_SER_STATS MT_SWDEF(0x040) 103762306a36Sopenharmony_ci#define MT_SWDEF_PLE_STATS MT_SWDEF(0x044) 103862306a36Sopenharmony_ci#define MT_SWDEF_PLE1_STATS MT_SWDEF(0x048) 103962306a36Sopenharmony_ci#define MT_SWDEF_PLE_AMSDU_STATS MT_SWDEF(0x04C) 104062306a36Sopenharmony_ci#define MT_SWDEF_PSE_STATS MT_SWDEF(0x050) 104162306a36Sopenharmony_ci#define MT_SWDEF_PSE1_STATS MT_SWDEF(0x054) 104262306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR6_BN0_STATS MT_SWDEF(0x058) 104362306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR6_BN1_STATS MT_SWDEF(0x05C) 104462306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR7_BN0_STATS MT_SWDEF(0x060) 104562306a36Sopenharmony_ci#define MT_SWDEF_LAMC_WISR7_BN1_STATS MT_SWDEF(0x064) 104662306a36Sopenharmony_ci 104762306a36Sopenharmony_ci#define MT_DIC_CMD_REG_BASE 0x41f000 104862306a36Sopenharmony_ci#define MT_DIC_CMD_REG(ofs) (MT_DIC_CMD_REG_BASE + (ofs)) 104962306a36Sopenharmony_ci#define MT_DIC_CMD_REG_CMD MT_DIC_CMD_REG(0x10) 105062306a36Sopenharmony_ci 105162306a36Sopenharmony_ci#define MT_CPU_UTIL_BASE 0x41f030 105262306a36Sopenharmony_ci#define MT_CPU_UTIL(ofs) (MT_CPU_UTIL_BASE + (ofs)) 105362306a36Sopenharmony_ci#define MT_CPU_UTIL_BUSY_PCT MT_CPU_UTIL(0x00) 105462306a36Sopenharmony_ci#define MT_CPU_UTIL_PEAK_BUSY_PCT MT_CPU_UTIL(0x04) 105562306a36Sopenharmony_ci#define MT_CPU_UTIL_IDLE_CNT MT_CPU_UTIL(0x08) 105662306a36Sopenharmony_ci#define MT_CPU_UTIL_PEAK_IDLE_CNT MT_CPU_UTIL(0x0c) 105762306a36Sopenharmony_ci#define MT_CPU_UTIL_CTRL MT_CPU_UTIL(0x1c) 105862306a36Sopenharmony_ci 105962306a36Sopenharmony_ci/* LED */ 106062306a36Sopenharmony_ci#define MT_LED_TOP_BASE 0x18013000 106162306a36Sopenharmony_ci#define MT_LED_PHYS(_n) (MT_LED_TOP_BASE + (_n)) 106262306a36Sopenharmony_ci 106362306a36Sopenharmony_ci#define MT_LED_CTRL(_n) MT_LED_PHYS(0x00 + ((_n) * 4)) 106462306a36Sopenharmony_ci#define MT_LED_CTRL_KICK BIT(7) 106562306a36Sopenharmony_ci#define MT_LED_CTRL_BAND BIT(4) 106662306a36Sopenharmony_ci#define MT_LED_CTRL_BLINK_MODE BIT(2) 106762306a36Sopenharmony_ci#define MT_LED_CTRL_POLARITY BIT(1) 106862306a36Sopenharmony_ci 106962306a36Sopenharmony_ci#define MT_LED_TX_BLINK(_n) MT_LED_PHYS(0x10 + ((_n) * 4)) 107062306a36Sopenharmony_ci#define MT_LED_TX_BLINK_ON_MASK GENMASK(7, 0) 107162306a36Sopenharmony_ci#define MT_LED_TX_BLINK_OFF_MASK GENMASK(15, 8) 107262306a36Sopenharmony_ci 107362306a36Sopenharmony_ci#define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x20 + ((_n) * 8)) 107462306a36Sopenharmony_ci#define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x24 + ((_n) * 8)) 107562306a36Sopenharmony_ci#define MT_LED_STATUS_OFF GENMASK(31, 24) 107662306a36Sopenharmony_ci#define MT_LED_STATUS_ON GENMASK(23, 16) 107762306a36Sopenharmony_ci#define MT_LED_STATUS_DURATION GENMASK(15, 0) 107862306a36Sopenharmony_ci 107962306a36Sopenharmony_ci#define MT_LED_EN(_n) MT_LED_PHYS(0x40 + ((_n) * 4)) 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci#define MT_LED_GPIO_MUX0 0x70005050 /* GPIO 1 and GPIO 2 */ 108262306a36Sopenharmony_ci#define MT_LED_GPIO_MUX1 0x70005054 /* GPIO 14 and 15 */ 108362306a36Sopenharmony_ci#define MT_LED_GPIO_MUX2 0x70005058 /* GPIO 18 */ 108462306a36Sopenharmony_ci#define MT_LED_GPIO_MUX3 0x7000505c /* GPIO 26 */ 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_ci/* MT TOP */ 108762306a36Sopenharmony_ci#define MT_TOP_BASE 0x18060000 108862306a36Sopenharmony_ci#define MT_TOP(ofs) (MT_TOP_BASE + (ofs)) 108962306a36Sopenharmony_ci 109062306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND(_band) MT_TOP(0x10 + ((_band) * 0x10)) 109162306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_FW_OWN BIT(0) 109262306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_DRV_OWN BIT(1) 109362306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_FW_OWN_STAT BIT(2) 109462306a36Sopenharmony_ci 109562306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND_IRQ_STAT(_band) MT_TOP(0x14 + ((_band) * 0x10)) 109662306a36Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND_STAT BIT(0) 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci#define MT_TOP_MISC MT_TOP(0xf0) 109962306a36Sopenharmony_ci#define MT_TOP_MISC_FW_STATE GENMASK(2, 0) 110062306a36Sopenharmony_ci 110162306a36Sopenharmony_ci#define MT_TOP_WFSYS_WAKEUP MT_TOP(0x1a4) 110262306a36Sopenharmony_ci#define MT_TOP_WFSYS_WAKEUP_MASK BIT(0) 110362306a36Sopenharmony_ci 110462306a36Sopenharmony_ci#define MT_TOP_MCU_EMI_BASE MT_TOP(0x1c4) 110562306a36Sopenharmony_ci#define MT_TOP_MCU_EMI_BASE_MASK GENMASK(19, 0) 110662306a36Sopenharmony_ci 110762306a36Sopenharmony_ci#define MT_TOP_WF_AP_PERI_BASE MT_TOP(0x1c8) 110862306a36Sopenharmony_ci#define MT_TOP_WF_AP_PERI_BASE_MASK GENMASK(19, 0) 110962306a36Sopenharmony_ci 111062306a36Sopenharmony_ci#define MT_TOP_EFUSE_BASE MT_TOP(0x1cc) 111162306a36Sopenharmony_ci#define MT_TOP_EFUSE_BASE_MASK GENMASK(19, 0) 111262306a36Sopenharmony_ci 111362306a36Sopenharmony_ci#define MT_TOP_CONN_INFRA_WAKEUP MT_TOP(0x1a0) 111462306a36Sopenharmony_ci#define MT_TOP_CONN_INFRA_WAKEUP_MASK BIT(0) 111562306a36Sopenharmony_ci 111662306a36Sopenharmony_ci#define MT_TOP_WFSYS_RESET_STATUS MT_TOP(0x2cc) 111762306a36Sopenharmony_ci#define MT_TOP_WFSYS_RESET_STATUS_MASK BIT(30) 111862306a36Sopenharmony_ci 111962306a36Sopenharmony_ci/* SEMA */ 112062306a36Sopenharmony_ci#define MT_SEMA_BASE 0x18070000 112162306a36Sopenharmony_ci#define MT_SEMA(ofs) (MT_SEMA_BASE + (ofs)) 112262306a36Sopenharmony_ci 112362306a36Sopenharmony_ci#define MT_SEMA_RFSPI_STATUS (MT_SEMA(0x2000) + (11 * 4)) 112462306a36Sopenharmony_ci#define MT_SEMA_RFSPI_RELEASE (MT_SEMA(0x2200) + (11 * 4)) 112562306a36Sopenharmony_ci#define MT_SEMA_RFSPI_STATUS_MASK BIT(1) 112662306a36Sopenharmony_ci 112762306a36Sopenharmony_ci/* MCU BUS */ 112862306a36Sopenharmony_ci#define MT_MCU_BUS_BASE 0x18400000 112962306a36Sopenharmony_ci#define MT_MCU_BUS(ofs) (MT_MCU_BUS_BASE + (ofs)) 113062306a36Sopenharmony_ci 113162306a36Sopenharmony_ci#define MT_MCU_BUS_TIMEOUT MT_MCU_BUS(0xf0440) 113262306a36Sopenharmony_ci#define MT_MCU_BUS_TIMEOUT_SET_MASK GENMASK(7, 0) 113362306a36Sopenharmony_ci#define MT_MCU_BUS_TIMEOUT_CG_EN_MASK BIT(28) 113462306a36Sopenharmony_ci#define MT_MCU_BUS_TIMEOUT_EN_MASK BIT(31) 113562306a36Sopenharmony_ci 113662306a36Sopenharmony_ci#define MT_MCU_BUS_REMAP MT_MCU_BUS(0x120) 113762306a36Sopenharmony_ci 113862306a36Sopenharmony_ci/* TOP CFG */ 113962306a36Sopenharmony_ci#define MT_TOP_CFG_BASE 0x184b0000 114062306a36Sopenharmony_ci#define MT_TOP_CFG(ofs) (MT_TOP_CFG_BASE + (ofs)) 114162306a36Sopenharmony_ci 114262306a36Sopenharmony_ci#define MT_TOP_CFG_IP_VERSION_ADDR MT_TOP_CFG(0x010) 114362306a36Sopenharmony_ci 114462306a36Sopenharmony_ci/* TOP CFG ON */ 114562306a36Sopenharmony_ci#define MT_TOP_CFG_ON_BASE 0x184c1000 114662306a36Sopenharmony_ci#define MT_TOP_CFG_ON(ofs) (MT_TOP_CFG_ON_BASE + (ofs)) 114762306a36Sopenharmony_ci 114862306a36Sopenharmony_ci#define MT_TOP_CFG_ON_ROM_IDX MT_TOP_CFG_ON(0x604) 114962306a36Sopenharmony_ci 115062306a36Sopenharmony_ci/* SLP CTRL */ 115162306a36Sopenharmony_ci#define MT_SLP_BASE 0x184c3000 115262306a36Sopenharmony_ci#define MT_SLP(ofs) (MT_SLP_BASE + (ofs)) 115362306a36Sopenharmony_ci 115462306a36Sopenharmony_ci#define MT_SLP_STATUS MT_SLP(0x00c) 115562306a36Sopenharmony_ci#define MT_SLP_WFDMA2CONN_MASK (BIT(21) | BIT(23)) 115662306a36Sopenharmony_ci#define MT_SLP_CTRL_EN_MASK BIT(0) 115762306a36Sopenharmony_ci#define MT_SLP_CTRL_BSY_MASK BIT(1) 115862306a36Sopenharmony_ci 115962306a36Sopenharmony_ci/* MCU BUS DBG */ 116062306a36Sopenharmony_ci#define MT_MCU_BUS_DBG_BASE 0x18500000 116162306a36Sopenharmony_ci#define MT_MCU_BUS_DBG(ofs) (MT_MCU_BUS_DBG_BASE + (ofs)) 116262306a36Sopenharmony_ci 116362306a36Sopenharmony_ci#define MT_MCU_BUS_DBG_TIMEOUT MT_MCU_BUS_DBG(0x0) 116462306a36Sopenharmony_ci#define MT_MCU_BUS_DBG_TIMEOUT_SET_MASK GENMASK(31, 16) 116562306a36Sopenharmony_ci#define MT_MCU_BUS_DBG_TIMEOUT_CK_EN_MASK BIT(3) 116662306a36Sopenharmony_ci#define MT_MCU_BUS_DBG_TIMEOUT_EN_MASK BIT(2) 116762306a36Sopenharmony_ci 116862306a36Sopenharmony_ci#define MT_HW_BOUND 0x70010020 116962306a36Sopenharmony_ci#define MT_HW_REV 0x70010204 117062306a36Sopenharmony_ci#define MT_WF_SUBSYS_RST 0x70002600 117162306a36Sopenharmony_ci 117262306a36Sopenharmony_ci/* PCIE MAC */ 117362306a36Sopenharmony_ci#define MT_PCIE_MAC_BASE 0x74030000 117462306a36Sopenharmony_ci#define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs)) 117562306a36Sopenharmony_ci#define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188) 117662306a36Sopenharmony_ci 117762306a36Sopenharmony_ci#define MT_PCIE1_MAC_INT_ENABLE 0x74020188 117862306a36Sopenharmony_ci#define MT_PCIE1_MAC_INT_ENABLE_MT7916 0x74090188 117962306a36Sopenharmony_ci 118062306a36Sopenharmony_ci#define MT_WM_MCU_PC 0x7c060204 118162306a36Sopenharmony_ci#define MT_WA_MCU_PC 0x7c06020c 118262306a36Sopenharmony_ci 118362306a36Sopenharmony_ci/* PP TOP */ 118462306a36Sopenharmony_ci#define MT_WF_PP_TOP_BASE 0x820cc000 118562306a36Sopenharmony_ci#define MT_WF_PP_TOP(ofs) (MT_WF_PP_TOP_BASE + (ofs)) 118662306a36Sopenharmony_ci 118762306a36Sopenharmony_ci#define MT_WF_PP_TOP_RXQ_WFDMA_CF_5 MT_WF_PP_TOP(0x0e8) 118862306a36Sopenharmony_ci#define MT_WF_PP_TOP_RXQ_QID6_WFDMA_HIF_SEL_MASK BIT(6) 118962306a36Sopenharmony_ci 119062306a36Sopenharmony_ci#define MT_WF_IRPI_BASE 0x83000000 119162306a36Sopenharmony_ci#define MT_WF_IRPI(ofs) (MT_WF_IRPI_BASE + (ofs)) 119262306a36Sopenharmony_ci 119362306a36Sopenharmony_ci#define MT_WF_IRPI_NSS(phy, nss) MT_WF_IRPI(0x6000 + ((phy) << 20) + ((nss) << 16)) 119462306a36Sopenharmony_ci#define MT_WF_IRPI_NSS_MT7916(phy, nss) MT_WF_IRPI(0x1000 + ((phy) << 20) + ((nss) << 16)) 119562306a36Sopenharmony_ci 119662306a36Sopenharmony_ci/* PHY */ 119762306a36Sopenharmony_ci#define MT_WF_PHY_BASE 0x83080000 119862306a36Sopenharmony_ci#define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs)) 119962306a36Sopenharmony_ci 120062306a36Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1(_phy) MT_WF_PHY(0x2004 + ((_phy) << 16)) 120162306a36Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1_MT7916(_phy) MT_WF_PHY(0x2004 + ((_phy) << 20)) 120262306a36Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1_IPI_EN GENMASK(2, 0) 120362306a36Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1_STSCNT_EN GENMASK(11, 9) 120462306a36Sopenharmony_ci 120562306a36Sopenharmony_ci#define MT_WF_PHY_RXTD12(_phy) MT_WF_PHY(0x8230 + ((_phy) << 16)) 120662306a36Sopenharmony_ci#define MT_WF_PHY_RXTD12_MT7916(_phy) MT_WF_PHY(0x8230 + ((_phy) << 20)) 120762306a36Sopenharmony_ci#define MT_WF_PHY_RXTD12_IRPI_SW_CLR_ONLY BIT(18) 120862306a36Sopenharmony_ci#define MT_WF_PHY_RXTD12_IRPI_SW_CLR BIT(29) 120962306a36Sopenharmony_ci 121062306a36Sopenharmony_ci#define MT_WF_PHY_TPC_CTRL_STAT(_phy) MT_WF_PHY(0xe7a0 + ((_phy) << 16)) 121162306a36Sopenharmony_ci#define MT_WF_PHY_TPC_CTRL_STAT_MT7916(_phy) MT_WF_PHY(0xe7a0 + ((_phy) << 20)) 121262306a36Sopenharmony_ci#define MT_WF_PHY_TPC_POWER GENMASK(15, 8) 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ_BASE 0x89010000 121562306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ(ofs) (MT_MCU_WM_CIRQ_BASE + (ofs)) 121662306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ_IRQ_MASK_CLR_ADDR MT_MCU_WM_CIRQ(0x80) 121762306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ_IRQ_SOFT_ADDR MT_MCU_WM_CIRQ(0xc0) 121862306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ_EINT_MASK_CLR_ADDR MT_MCU_WM_CIRQ(0x108) 121962306a36Sopenharmony_ci#define MT_MCU_WM_CIRQ_EINT_SOFT_ADDR MT_MCU_WM_CIRQ(0x118) 122062306a36Sopenharmony_ci 122162306a36Sopenharmony_ci#endif 1222