104b8e659SRyder Lee /* SPDX-License-Identifier: ISC */ 204b8e659SRyder Lee /* Copyright (C) 2019 MediaTek Inc. */ 304b8e659SRyder Lee 404b8e659SRyder Lee #ifndef __MT7615_REGS_H 504b8e659SRyder Lee #define __MT7615_REGS_H 604b8e659SRyder Lee 794f83b66SLorenzo Bianconi enum mt7615_reg_base { 894f83b66SLorenzo Bianconi MT_TOP_CFG_BASE, 994f83b66SLorenzo Bianconi MT_HW_BASE, 10f40ac0f3SLorenzo Bianconi MT_DMA_SHDL_BASE, 1194f83b66SLorenzo Bianconi MT_PCIE_REMAP_2, 12f40ac0f3SLorenzo Bianconi MT_ARB_BASE, 1394f83b66SLorenzo Bianconi MT_HIF_BASE, 1494f83b66SLorenzo Bianconi MT_CSR_BASE, 156dd4072cSLorenzo Bianconi MT_PLE_BASE, 166dd4072cSLorenzo Bianconi MT_PSE_BASE, 1794f83b66SLorenzo Bianconi MT_CFG_BASE, 1894f83b66SLorenzo Bianconi MT_AGG_BASE, 1994f83b66SLorenzo Bianconi MT_TMAC_BASE, 2094f83b66SLorenzo Bianconi MT_RMAC_BASE, 2194f83b66SLorenzo Bianconi MT_DMA_BASE, 22dd89a013SLorenzo Bianconi MT_PF_BASE, 2394f83b66SLorenzo Bianconi MT_WTBL_BASE_ON, 2494f83b66SLorenzo Bianconi MT_WTBL_BASE_OFF, 2594f83b66SLorenzo Bianconi MT_LPON_BASE, 2694f83b66SLorenzo Bianconi MT_MIB_BASE, 2794f83b66SLorenzo Bianconi MT_WTBL_BASE_ADDR, 2894f83b66SLorenzo Bianconi MT_PCIE_REMAP_BASE2, 2994f83b66SLorenzo Bianconi MT_TOP_MISC_BASE, 3094f83b66SLorenzo Bianconi MT_EFUSE_ADDR_BASE, 31a66cbdd6SSean Wang MT_PP_BASE, 3294f83b66SLorenzo Bianconi __MT_BASE_MAX, 3394f83b66SLorenzo Bianconi }; 3494f83b66SLorenzo Bianconi 3594f83b66SLorenzo Bianconi #define MT_HW_INFO_BASE ((dev)->reg_map[MT_HW_BASE]) 3694f83b66SLorenzo Bianconi #define MT_HW_INFO(ofs) (MT_HW_INFO_BASE + (ofs)) 3794f83b66SLorenzo Bianconi #define MT_HW_REV MT_HW_INFO(0x000) 3894f83b66SLorenzo Bianconi #define MT_HW_CHIPID MT_HW_INFO(0x008) 3994f83b66SLorenzo Bianconi #define MT_TOP_STRAP_STA MT_HW_INFO(0x010) 40acf5457fSLorenzo Bianconi #define MT_TOP_3NSS BIT(24) 4135da599fSFelix Fietkau 4235da599fSFelix Fietkau #define MT_TOP_OFF_RSV 0x1128 4335da599fSFelix Fietkau #define MT_TOP_OFF_RSV_FW_STATE GENMASK(18, 16) 4435da599fSFelix Fietkau 4594f83b66SLorenzo Bianconi #define MT_TOP_MISC2 ((dev)->reg_map[MT_TOP_CFG_BASE] + 0x134) 4604b8e659SRyder Lee #define MT_TOP_MISC2_FW_STATE GENMASK(2, 0) 4704b8e659SRyder Lee 48f40ac0f3SLorenzo Bianconi #define MT7663_TOP_MISC2_FW_STATE GENMASK(3, 1) 49eb99cc95SLorenzo Bianconi #define MT_TOP_MISC2_FW_PWR_ON BIT(1) 50f40ac0f3SLorenzo Bianconi 5104b8e659SRyder Lee #define MT_MCU_BASE 0x2000 5204b8e659SRyder Lee #define MT_MCU(ofs) (MT_MCU_BASE + (ofs)) 5304b8e659SRyder Lee 5404b8e659SRyder Lee #define MT_MCU_PCIE_REMAP_1 MT_MCU(0x500) 5504b8e659SRyder Lee #define MT_MCU_PCIE_REMAP_1_OFFSET GENMASK(17, 0) 5604b8e659SRyder Lee #define MT_MCU_PCIE_REMAP_1_BASE GENMASK(31, 18) 5704b8e659SRyder Lee #define MT_PCIE_REMAP_BASE_1 0x40000 5804b8e659SRyder Lee 5994f83b66SLorenzo Bianconi #define MT_MCU_PCIE_REMAP_2 ((dev)->reg_map[MT_PCIE_REMAP_2]) 6004b8e659SRyder Lee #define MT_MCU_PCIE_REMAP_2_OFFSET GENMASK(18, 0) 6104b8e659SRyder Lee #define MT_MCU_PCIE_REMAP_2_BASE GENMASK(31, 19) 6294f83b66SLorenzo Bianconi #define MT_PCIE_REMAP_BASE_2 ((dev)->reg_map[MT_PCIE_REMAP_BASE2]) 6304b8e659SRyder Lee 6445387363SFelix Fietkau #define MT_MCU_CIRQ_BASE 0xc0000 6545387363SFelix Fietkau #define MT_MCU_CIRQ(ofs) (MT_MCU_CIRQ_BASE + (ofs)) 6645387363SFelix Fietkau 6745387363SFelix Fietkau #define MT_MCU_CIRQ_IRQ_SEL(n) MT_MCU_CIRQ((n) << 2) 6845387363SFelix Fietkau 6994f83b66SLorenzo Bianconi #define MT_HIF(ofs) ((dev)->reg_map[MT_HIF_BASE] + (ofs)) 70eb99cc95SLorenzo Bianconi #define MT_HIF_RST MT_HIF(0x100) 71eb99cc95SLorenzo Bianconi #define MT_HIF_LOGIC_RST_N BIT(4) 7204b8e659SRyder Lee 736dd4072cSLorenzo Bianconi #define MT_PDMA_SLP_PROT MT_HIF(0x154) 746dd4072cSLorenzo Bianconi #define MT_PDMA_AXI_SLPPROT_ENABLE BIT(0) 756dd4072cSLorenzo Bianconi #define MT_PDMA_AXI_SLPPROT_RDY BIT(16) 766dd4072cSLorenzo Bianconi 776dd4072cSLorenzo Bianconi #define MT_PDMA_BUSY_STATUS MT_HIF(0x168) 786dd4072cSLorenzo Bianconi #define MT_PDMA_TX_IDX_BUSY BIT(2) 796dd4072cSLorenzo Bianconi #define MT_PDMA_BUSY_IDX BIT(31) 806dd4072cSLorenzo Bianconi 816dd4072cSLorenzo Bianconi #define MT_WPDMA_TX_RING0_CTRL0 MT_HIF(0x300) 826dd4072cSLorenzo Bianconi #define MT_WPDMA_TX_RING0_CTRL1 MT_HIF(0x304) 836dd4072cSLorenzo Bianconi 84f82282efSLorenzo Bianconi #define MT7663_MCU_PCIE_REMAP_2_OFFSET GENMASK(15, 0) 85f82282efSLorenzo Bianconi #define MT7663_MCU_PCIE_REMAP_2_BASE GENMASK(31, 16) 86f82282efSLorenzo Bianconi 87f40ac0f3SLorenzo Bianconi #define MT_HIF2_BASE 0xf0000 88f40ac0f3SLorenzo Bianconi #define MT_HIF2(ofs) (MT_HIF2_BASE + (ofs)) 89f40ac0f3SLorenzo Bianconi #define MT_PCIE_IRQ_ENABLE MT_HIF2(0x188) 9033806161SLorenzo Bianconi #define MT_PCIE_DOORBELL_PUSH MT_HIF2(0x1484) 91f40ac0f3SLorenzo Bianconi 9204b8e659SRyder Lee #define MT_CFG_LPCR_HOST MT_HIF(0x1f0) 9304b8e659SRyder Lee #define MT_CFG_LPCR_HOST_FW_OWN BIT(0) 9404b8e659SRyder Lee #define MT_CFG_LPCR_HOST_DRV_OWN BIT(1) 9504b8e659SRyder Lee 9645387363SFelix Fietkau #define MT_MCU2HOST_INT_STATUS MT_HIF(0x1f0) 9745387363SFelix Fietkau #define MT_MCU2HOST_INT_ENABLE MT_HIF(0x1f4) 9845387363SFelix Fietkau 9945387363SFelix Fietkau #define MT7663_MCU_INT_EVENT MT_HIF(0x108) 10061c4fa72SFelix Fietkau #define MT_MCU_INT_EVENT MT_HIF(0x1f8) 10161c4fa72SFelix Fietkau #define MT_MCU_INT_EVENT_PDMA_STOPPED BIT(0) 10261c4fa72SFelix Fietkau #define MT_MCU_INT_EVENT_PDMA_INIT BIT(1) 10361c4fa72SFelix Fietkau #define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2) 10461c4fa72SFelix Fietkau #define MT_MCU_INT_EVENT_RESET_DONE BIT(3) 10561c4fa72SFelix Fietkau 10604b8e659SRyder Lee #define MT_INT_SOURCE_CSR MT_HIF(0x200) 10704b8e659SRyder Lee #define MT_INT_MASK_CSR MT_HIF(0x204) 10804b8e659SRyder Lee #define MT_DELAY_INT_CFG MT_HIF(0x210) 10904b8e659SRyder Lee 11004b8e659SRyder Lee #define MT_INT_RX_DONE(_n) BIT(_n) 11104b8e659SRyder Lee #define MT_INT_RX_DONE_ALL GENMASK(1, 0) 112853fb35cSFelix Fietkau #define MT_INT_TX_DONE_ALL GENMASK(19, 4) 11304b8e659SRyder Lee #define MT_INT_TX_DONE(_n) BIT((_n) + 4) 11445387363SFelix Fietkau #define MT7663_INT_MCU_CMD BIT(29) 11561c4fa72SFelix Fietkau #define MT_INT_MCU_CMD BIT(30) 11604b8e659SRyder Lee 11704b8e659SRyder Lee #define MT_WPDMA_GLO_CFG MT_HIF(0x208) 11804b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0) 11904b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1) 12004b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2) 12104b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3) 12204b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4) 12304b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6) 12404b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7) 12504b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0 BIT(9) 12635da599fSFelix Fietkau #define MT_WPDMA_GLO_CFG_BYPASS_TX_SCH BIT(9) /* MT7622 */ 12704b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 12804b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 12904b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT21 GENMASK(23, 22) 13004b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_SW_RESET BIT(24) 13104b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 13204b8e659SRyder Lee #define MT_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28) 13304b8e659SRyder Lee 13404b8e659SRyder Lee #define MT_WPDMA_RST_IDX MT_HIF(0x20c) 13504b8e659SRyder Lee 13661c4fa72SFelix Fietkau #define MT_WPDMA_MEM_RNG_ERR MT_HIF(0x224) 13761c4fa72SFelix Fietkau 13861c4fa72SFelix Fietkau #define MT_MCU_CMD MT_HIF(0x234) 13961c4fa72SFelix Fietkau #define MT_MCU_CMD_CLEAR_FW_OWN BIT(0) 14061c4fa72SFelix Fietkau #define MT_MCU_CMD_STOP_PDMA_FW_RELOAD BIT(1) 14161c4fa72SFelix Fietkau #define MT_MCU_CMD_STOP_PDMA BIT(2) 14261c4fa72SFelix Fietkau #define MT_MCU_CMD_RESET_DONE BIT(3) 14361c4fa72SFelix Fietkau #define MT_MCU_CMD_RECOVERY_DONE BIT(4) 14461c4fa72SFelix Fietkau #define MT_MCU_CMD_NORMAL_STATE BIT(5) 14561c4fa72SFelix Fietkau #define MT_MCU_CMD_LMAC_ERROR BIT(24) 14661c4fa72SFelix Fietkau #define MT_MCU_CMD_PSE_ERROR BIT(25) 14761c4fa72SFelix Fietkau #define MT_MCU_CMD_PLE_ERROR BIT(26) 14861c4fa72SFelix Fietkau #define MT_MCU_CMD_PDMA_ERROR BIT(27) 14961c4fa72SFelix Fietkau #define MT_MCU_CMD_PCIE_ERROR BIT(28) 15061c4fa72SFelix Fietkau #define MT_MCU_CMD_ERROR_MASK (GENMASK(5, 1) | GENMASK(28, 24)) 15145387363SFelix Fietkau #define MT7663_MCU_CMD_ERROR_MASK GENMASK(5, 2) 15261c4fa72SFelix Fietkau 15304b8e659SRyder Lee #define MT_TX_RING_BASE MT_HIF(0x300) 15404b8e659SRyder Lee #define MT_RX_RING_BASE MT_HIF(0x400) 15504b8e659SRyder Lee 15604b8e659SRyder Lee #define MT_WPDMA_GLO_CFG1 MT_HIF(0x500) 15704b8e659SRyder Lee #define MT_WPDMA_TX_PRE_CFG MT_HIF(0x510) 15804b8e659SRyder Lee #define MT_WPDMA_RX_PRE_CFG MT_HIF(0x520) 15904b8e659SRyder Lee #define MT_WPDMA_ABT_CFG MT_HIF(0x530) 16004b8e659SRyder Lee #define MT_WPDMA_ABT_CFG1 MT_HIF(0x534) 16104b8e659SRyder Lee 16294f83b66SLorenzo Bianconi #define MT_CSR(ofs) ((dev)->reg_map[MT_CSR_BASE] + (ofs)) 16394f83b66SLorenzo Bianconi #define MT_CONN_HIF_ON_LPCTL MT_CSR(0x000) 16494f83b66SLorenzo Bianconi 1656dd4072cSLorenzo Bianconi #define MT_PLE(ofs) ((dev)->reg_map[MT_PLE_BASE] + (ofs)) 16625990ed3SLorenzo Bianconi 167a66cbdd6SSean Wang #define MT_PLE_PG_HIF0_GROUP MT_PLE(0x110) 168a66cbdd6SSean Wang #define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 16925990ed3SLorenzo Bianconi #define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) 17025990ed3SLorenzo Bianconi #define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) 17125990ed3SLorenzo Bianconi #define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) 17225990ed3SLorenzo Bianconi #define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) 17325990ed3SLorenzo Bianconi 17425990ed3SLorenzo Bianconi #define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ 17525990ed3SLorenzo Bianconi ((n) << 2)) 17625990ed3SLorenzo Bianconi 1776dd4072cSLorenzo Bianconi #define MT_PSE(ofs) ((dev)->reg_map[MT_PSE_BASE] + (ofs)) 178a66cbdd6SSean Wang #define MT_PSE_PG_HIF0_GROUP MT_PSE(0x110) 179a66cbdd6SSean Wang #define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 180a66cbdd6SSean Wang #define MT_PSE_PG_HIF1_GROUP MT_PSE(0x118) 181a66cbdd6SSean Wang #define MT_HIF1_MIN_QUOTA GENMASK(11, 0) 1826dd4072cSLorenzo Bianconi #define MT_PSE_QUEUE_EMPTY MT_PSE(0x0b4) 1836dd4072cSLorenzo Bianconi #define MT_HIF_0_EMPTY_MASK BIT(16) 1846dd4072cSLorenzo Bianconi #define MT_HIF_1_EMPTY_MASK BIT(17) 1856dd4072cSLorenzo Bianconi #define MT_HIF_ALL_EMPTY_MASK GENMASK(17, 16) 1866dd4072cSLorenzo Bianconi #define MT_PSE_PG_INFO MT_PSE(0x194) 1876dd4072cSLorenzo Bianconi #define MT_PSE_SRC_CNT GENMASK(27, 16) 1886dd4072cSLorenzo Bianconi 189a66cbdd6SSean Wang #define MT_PP(ofs) ((dev)->reg_map[MT_PP_BASE] + (ofs)) 190a66cbdd6SSean Wang #define MT_PP_TXDWCNT MT_PP(0x0) 191a66cbdd6SSean Wang #define MT_PP_TXDWCNT_TX0_ADD_DW_CNT GENMASK(7, 0) 192a66cbdd6SSean Wang #define MT_PP_TXDWCNT_TX1_ADD_DW_CNT GENMASK(15, 8) 193a66cbdd6SSean Wang 194b8c97866SFelix Fietkau #define MT_WF_PHY_BASE 0x82070000 19504b8e659SRyder Lee #define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs)) 19604b8e659SRyder Lee 1972cad515eSRyder Lee #define MT_WF_PHY_WF2_RFCTRL0(n) MT_WF_PHY(0x1900 + (n) * 0x400) 19804b8e659SRyder Lee #define MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN BIT(9) 19904b8e659SRyder Lee 200d446a20fSFelix Fietkau #define MT_WF_PHY_R0_PHYMUX_5(_phy) MT_WF_PHY(0x0614 + ((_phy) << 9)) 201886a862dSLorenzo Bianconi #define MT7663_WF_PHY_R0_PHYMUX_5 MT_WF_PHY(0x0414) 20249de79adSLorenzo Bianconi 203d446a20fSFelix Fietkau #define MT_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x020c + ((_phy) << 9)) 20449de79adSLorenzo Bianconi #define MT_WF_PHYCTRL_STAT_PD_OFDM GENMASK(31, 16) 20549de79adSLorenzo Bianconi #define MT_WF_PHYCTRL_STAT_PD_CCK GENMASK(15, 0) 20649de79adSLorenzo Bianconi 207ad6b0be6SLorenzo Bianconi #define MT7663_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x0210 + ((_phy) << 12)) 208ad6b0be6SLorenzo Bianconi 209d446a20fSFelix Fietkau #define MT_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0220 + ((_phy) << 9)) 21049de79adSLorenzo Bianconi #define MT_WF_PHYCTRL_STAT_MDRDY_OFDM GENMASK(31, 16) 21149de79adSLorenzo Bianconi #define MT_WF_PHYCTRL_STAT_MDRDY_CCK GENMASK(15, 0) 21249de79adSLorenzo Bianconi 213ad6b0be6SLorenzo Bianconi #define MT7663_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0224 + ((_phy) << 12)) 214ad6b0be6SLorenzo Bianconi 215*905a0a6aSRyder Lee #define MT_WF_PHY_GID_TAB_VLD(_phy, i) MT_WF_PHY(0x0254 + (i) * 4 + \ 216*905a0a6aSRyder Lee ((_phy) << 9)) 217*905a0a6aSRyder Lee #define MT7663_WF_PHY_GID_TAB_VLD(_phy, i) MT_WF_PHY(0x0254 + (i) * 4 + \ 218*905a0a6aSRyder Lee ((_phy) << 12)) 219*905a0a6aSRyder Lee #define MT_WF_PHY_GID_TAB_POS(_phy, i) MT_WF_PHY(0x025c + (i) * 4 + \ 220*905a0a6aSRyder Lee ((_phy) << 9)) 221*905a0a6aSRyder Lee #define MT7663_WF_PHY_GID_TAB_POS(_phy, i) MT_WF_PHY(0x025c + (i) * 4 + \ 222*905a0a6aSRyder Lee ((_phy) << 12)) 223*905a0a6aSRyder Lee 2242cad515eSRyder Lee #define MT_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x084 : 0x229c) 2252cad515eSRyder Lee #define MT_WF_PHY_PD_OFDM_MASK(_phy) ((_phy) ? GENMASK(24, 16) : \ 2262cad515eSRyder Lee GENMASK(28, 20)) 2272cad515eSRyder Lee #define MT_WF_PHY_PD_OFDM(_phy, v) ((v) << ((_phy) ? 16 : 20)) 2282cad515eSRyder Lee #define MT_WF_PHY_PD_BLK(_phy) ((_phy) ? BIT(25) : BIT(19)) 22949de79adSLorenzo Bianconi 230ad6b0be6SLorenzo Bianconi #define MT7663_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x2aec : 0x22f0) 231ad6b0be6SLorenzo Bianconi 232e5051965SFelix Fietkau #define MT_WF_PHY_RXTD_BASE MT_WF_PHY(0x2200) 233e5051965SFelix Fietkau #define MT_WF_PHY_RXTD(_n) (MT_WF_PHY_RXTD_BASE + ((_n) << 2)) 234e5051965SFelix Fietkau 235b61e45ebSLorenzo Bianconi #define MT7663_WF_PHY_RXTD(_n) (MT_WF_PHY(0x25b0) + ((_n) << 2)) 236b61e45ebSLorenzo Bianconi 2372cad515eSRyder Lee #define MT_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2314 : 0x2310) 2382cad515eSRyder Lee #define MT_WF_PHY_PD_CCK_MASK(_phy) (_phy) ? GENMASK(31, 24) : \ 2392cad515eSRyder Lee GENMASK(8, 1) 2402cad515eSRyder Lee #define MT_WF_PHY_PD_CCK(_phy, v) ((v) << ((_phy) ? 24 : 1)) 24149de79adSLorenzo Bianconi 242ad6b0be6SLorenzo Bianconi #define MT7663_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2350 : 0x234c) 243ad6b0be6SLorenzo Bianconi 244e5051965SFelix Fietkau #define MT_WF_PHY_RXTD2_BASE MT_WF_PHY(0x2a00) 245e5051965SFelix Fietkau #define MT_WF_PHY_RXTD2(_n) (MT_WF_PHY_RXTD2_BASE + ((_n) << 2)) 246e5051965SFelix Fietkau 2474f0bce1cSFelix Fietkau #define MT_WF_PHY_RFINTF3_0(_n) MT_WF_PHY(0x1100 + (_n) * 0x400) 2484f0bce1cSFelix Fietkau #define MT_WF_PHY_RFINTF3_0_ANT GENMASK(7, 4) 2494f0bce1cSFelix Fietkau 25094f83b66SLorenzo Bianconi #define MT_WF_CFG_BASE ((dev)->reg_map[MT_CFG_BASE]) 25104b8e659SRyder Lee #define MT_WF_CFG(ofs) (MT_WF_CFG_BASE + (ofs)) 25204b8e659SRyder Lee 25304b8e659SRyder Lee #define MT_CFG_CCR MT_WF_CFG(0x000) 25404b8e659SRyder Lee #define MT_CFG_CCR_MAC_D1_1X_GC_EN BIT(24) 25504b8e659SRyder Lee #define MT_CFG_CCR_MAC_D0_1X_GC_EN BIT(25) 25604b8e659SRyder Lee #define MT_CFG_CCR_MAC_D1_2X_GC_EN BIT(30) 25704b8e659SRyder Lee #define MT_CFG_CCR_MAC_D0_2X_GC_EN BIT(31) 25804b8e659SRyder Lee 25994f83b66SLorenzo Bianconi #define MT_WF_AGG_BASE ((dev)->reg_map[MT_AGG_BASE]) 26004b8e659SRyder Lee #define MT_WF_AGG(ofs) (MT_WF_AGG_BASE + (ofs)) 26104b8e659SRyder Lee 26204b8e659SRyder Lee #define MT_AGG_ARCR MT_WF_AGG(0x010) 26304b8e659SRyder Lee #define MT_AGG_ARCR_INIT_RATE1 BIT(0) 26404b8e659SRyder Lee #define MT_AGG_ARCR_RTS_RATE_THR GENMASK(12, 8) 26504b8e659SRyder Lee #define MT_AGG_ARCR_RATE_DOWN_RATIO GENMASK(17, 16) 26604b8e659SRyder Lee #define MT_AGG_ARCR_RATE_DOWN_RATIO_EN BIT(19) 26704b8e659SRyder Lee #define MT_AGG_ARCR_RATE_UP_EXTRA_TH GENMASK(22, 20) 26804b8e659SRyder Lee 2692cad515eSRyder Lee #define MT_AGG_ARUCR(_band) MT_WF_AGG(0x018 + (_band) * 0x100) 2702cad515eSRyder Lee #define MT_AGG_ARDCR(_band) MT_WF_AGG(0x01c + (_band) * 0x100) 27104b8e659SRyder Lee #define MT_AGG_ARxCR_LIMIT_SHIFT(_n) (4 * (_n)) 27204b8e659SRyder Lee #define MT_AGG_ARxCR_LIMIT(_n) GENMASK(2 + \ 27304b8e659SRyder Lee MT_AGG_ARxCR_LIMIT_SHIFT(_n), \ 27404b8e659SRyder Lee MT_AGG_ARxCR_LIMIT_SHIFT(_n)) 27504b8e659SRyder Lee 27675601194SLorenzo Bianconi #define MT_AGG_ASRCR0 MT_WF_AGG(0x060) 27775601194SLorenzo Bianconi #define MT_AGG_ASRCR1 MT_WF_AGG(0x064) 27875601194SLorenzo Bianconi #define MT_AGG_ASRCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(5, 0)) 27975601194SLorenzo Bianconi 2802cad515eSRyder Lee #define MT_AGG_ACR(_band) MT_WF_AGG(0x070 + (_band) * 0x100) 281880495e2SFelix Fietkau #define MT_AGG_ACR_NO_BA_RULE BIT(0) 282880495e2SFelix Fietkau #define MT_AGG_ACR_NO_BA_AR_RULE BIT(1) 283880495e2SFelix Fietkau #define MT_AGG_ACR_PKT_TIME_EN BIT(2) 284880495e2SFelix Fietkau #define MT_AGG_ACR_CFEND_RATE GENMASK(15, 4) 285880495e2SFelix Fietkau #define MT_AGG_ACR_BAR_RATE GENMASK(31, 20) 286880495e2SFelix Fietkau 28704b8e659SRyder Lee #define MT_AGG_SCR MT_WF_AGG(0x0fc) 28804b8e659SRyder Lee #define MT_AGG_SCR_NLNAV_MID_PTEC_DIS BIT(3) 28904b8e659SRyder Lee 290f40ac0f3SLorenzo Bianconi #define MT_WF_ARB_BASE ((dev)->reg_map[MT_ARB_BASE]) 291183d1fcfSLorenzo Bianconi #define MT_WF_ARB(ofs) (MT_WF_ARB_BASE + (ofs)) 292183d1fcfSLorenzo Bianconi 2934f0bce1cSFelix Fietkau #define MT_ARB_RQCR MT_WF_ARB(0x070) 2944f0bce1cSFelix Fietkau #define MT_ARB_RQCR_RX_START BIT(0) 2954f0bce1cSFelix Fietkau #define MT_ARB_RQCR_RXV_START BIT(4) 2964f0bce1cSFelix Fietkau #define MT_ARB_RQCR_RXV_R_EN BIT(7) 2974f0bce1cSFelix Fietkau #define MT_ARB_RQCR_RXV_T_EN BIT(8) 2984f0bce1cSFelix Fietkau #define MT_ARB_RQCR_BAND_SHIFT 16 2994f0bce1cSFelix Fietkau 300183d1fcfSLorenzo Bianconi #define MT_ARB_SCR MT_WF_ARB(0x080) 301183d1fcfSLorenzo Bianconi #define MT_ARB_SCR_TX0_DISABLE BIT(8) 302183d1fcfSLorenzo Bianconi #define MT_ARB_SCR_RX0_DISABLE BIT(9) 303183d1fcfSLorenzo Bianconi #define MT_ARB_SCR_TX1_DISABLE BIT(10) 304183d1fcfSLorenzo Bianconi #define MT_ARB_SCR_RX1_DISABLE BIT(11) 305183d1fcfSLorenzo Bianconi 30694f83b66SLorenzo Bianconi #define MT_WF_TMAC_BASE ((dev)->reg_map[MT_TMAC_BASE]) 30704b8e659SRyder Lee #define MT_WF_TMAC(ofs) (MT_WF_TMAC_BASE + (ofs)) 30804b8e659SRyder Lee 309183d1fcfSLorenzo Bianconi #define MT_TMAC_CDTR MT_WF_TMAC(0x090) 310183d1fcfSLorenzo Bianconi #define MT_TMAC_ODTR MT_WF_TMAC(0x094) 311183d1fcfSLorenzo Bianconi #define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0) 312183d1fcfSLorenzo Bianconi #define MT_TIMEOUT_VAL_CCA GENMASK(31, 16) 313183d1fcfSLorenzo Bianconi 3142cad515eSRyder Lee #define MT_TMAC_TRCR(_band) MT_WF_TMAC((_band) ? 0x070 : 0x09c) 315880495e2SFelix Fietkau #define MT_TMAC_TRCR_CCA_SEL GENMASK(31, 30) 316880495e2SFelix Fietkau #define MT_TMAC_TRCR_SEC_CCA_SEL GENMASK(29, 28) 317880495e2SFelix Fietkau 3182cad515eSRyder Lee #define MT_TMAC_ICR(_band) MT_WF_TMAC((_band) ? 0x074 : 0x0a4) 319183d1fcfSLorenzo Bianconi #define MT_IFS_EIFS GENMASK(8, 0) 320183d1fcfSLorenzo Bianconi #define MT_IFS_RIFS GENMASK(14, 10) 321183d1fcfSLorenzo Bianconi #define MT_IFS_SIFS GENMASK(22, 16) 322183d1fcfSLorenzo Bianconi #define MT_IFS_SLOT GENMASK(30, 24) 323183d1fcfSLorenzo Bianconi 32404b8e659SRyder Lee #define MT_TMAC_CTCR0 MT_WF_TMAC(0x0f4) 32504b8e659SRyder Lee #define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0) 32604b8e659SRyder Lee #define MT_TMAC_CTCR0_INS_DDLMT_DENSITY GENMASK(15, 12) 32704b8e659SRyder Lee #define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17) 32804b8e659SRyder Lee #define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18) 32904b8e659SRyder Lee 33094f83b66SLorenzo Bianconi #define MT_WF_RMAC_BASE ((dev)->reg_map[MT_RMAC_BASE]) 33104b8e659SRyder Lee #define MT_WF_RMAC(ofs) (MT_WF_RMAC_BASE + (ofs)) 33204b8e659SRyder Lee 333fdd2e570SFelix Fietkau #define MT_WF_RFCR(_band) MT_WF_RMAC((_band) ? 0x100 : 0x000) 33404b8e659SRyder Lee #define MT_WF_RFCR_DROP_STBC_MULTI BIT(0) 33504b8e659SRyder Lee #define MT_WF_RFCR_DROP_FCSFAIL BIT(1) 33604b8e659SRyder Lee #define MT_WF_RFCR_DROP_VERSION BIT(3) 33704b8e659SRyder Lee #define MT_WF_RFCR_DROP_PROBEREQ BIT(4) 33804b8e659SRyder Lee #define MT_WF_RFCR_DROP_MCAST BIT(5) 33904b8e659SRyder Lee #define MT_WF_RFCR_DROP_BCAST BIT(6) 34004b8e659SRyder Lee #define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7) 34104b8e659SRyder Lee #define MT_WF_RFCR_DROP_A3_MAC BIT(8) 34204b8e659SRyder Lee #define MT_WF_RFCR_DROP_A3_BSSID BIT(9) 34304b8e659SRyder Lee #define MT_WF_RFCR_DROP_A2_BSSID BIT(10) 34404b8e659SRyder Lee #define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11) 34504b8e659SRyder Lee #define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12) 34604b8e659SRyder Lee #define MT_WF_RFCR_DROP_CTL_RSV BIT(13) 34704b8e659SRyder Lee #define MT_WF_RFCR_DROP_CTS BIT(14) 34804b8e659SRyder Lee #define MT_WF_RFCR_DROP_RTS BIT(15) 34904b8e659SRyder Lee #define MT_WF_RFCR_DROP_DUPLICATE BIT(16) 35004b8e659SRyder Lee #define MT_WF_RFCR_DROP_OTHER_BSS BIT(17) 35104b8e659SRyder Lee #define MT_WF_RFCR_DROP_OTHER_UC BIT(18) 35204b8e659SRyder Lee #define MT_WF_RFCR_DROP_OTHER_TIM BIT(19) 35304b8e659SRyder Lee #define MT_WF_RFCR_DROP_NDPA BIT(20) 35404b8e659SRyder Lee #define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21) 35504b8e659SRyder Lee 356d22da028SFelix Fietkau #define MT_WF_RMAC_MORE(_band) MT_WF_RMAC((_band) ? 0x124 : 0x024) 357d22da028SFelix Fietkau #define MT_WF_RMAC_MORE_MUAR_MODE GENMASK(31, 30) 358d22da028SFelix Fietkau 359fdd2e570SFelix Fietkau #define MT_WF_RFCR1(_band) MT_WF_RMAC((_band) ? 0x104 : 0x004) 360b4124a5bSFelix Fietkau #define MT_WF_RFCR1_DROP_ACK BIT(4) 361b4124a5bSFelix Fietkau #define MT_WF_RFCR1_DROP_BF_POLL BIT(5) 362b4124a5bSFelix Fietkau #define MT_WF_RFCR1_DROP_BA BIT(6) 363b4124a5bSFelix Fietkau #define MT_WF_RFCR1_DROP_CFEND BIT(7) 364b4124a5bSFelix Fietkau #define MT_WF_RFCR1_DROP_CFACK BIT(8) 365b4124a5bSFelix Fietkau 36627ae7219SFelix Fietkau #define MT_CHFREQ(_band) MT_WF_RMAC((_band) ? 0x130 : 0x030) 36727ae7219SFelix Fietkau 368d22da028SFelix Fietkau #define MT_WF_RMAC_MAR0 MT_WF_RMAC(0x025c) 369d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1 MT_WF_RMAC(0x0260) 370d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1_ADDR GENMASK(15, 0) 371d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1_START BIT(16) 372d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1_WRITE BIT(17) 373d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1_IDX GENMASK(29, 24) 374d22da028SFelix Fietkau #define MT_WF_RMAC_MAR1_GROUP GENMASK(31, 30) 375d22da028SFelix Fietkau 3766bfa6e38SLorenzo Bianconi #define MT_WF_RMAC_MIB_TIME0 MT_WF_RMAC(0x03c4) 3776bfa6e38SLorenzo Bianconi #define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31) 3786bfa6e38SLorenzo Bianconi #define MT_WF_RMAC_MIB_RXTIME_EN BIT(30) 3796bfa6e38SLorenzo Bianconi 380b2c2f029SLorenzo Bianconi #define MT_WF_RMAC_MIB_AIRTIME0 MT_WF_RMAC(0x0380) 381b2c2f029SLorenzo Bianconi 3826bfa6e38SLorenzo Bianconi #define MT_WF_RMAC_MIB_TIME5 MT_WF_RMAC(0x03d8) 383fdd2e570SFelix Fietkau #define MT_WF_RMAC_MIB_TIME6 MT_WF_RMAC(0x03dc) 3846bfa6e38SLorenzo Bianconi #define MT_MIB_OBSSTIME_MASK GENMASK(23, 0) 3856bfa6e38SLorenzo Bianconi 38694f83b66SLorenzo Bianconi #define MT_WF_DMA_BASE ((dev)->reg_map[MT_DMA_BASE]) 38704b8e659SRyder Lee #define MT_WF_DMA(ofs) (MT_WF_DMA_BASE + (ofs)) 38804b8e659SRyder Lee 38904b8e659SRyder Lee #define MT_DMA_DCR0 MT_WF_DMA(0x000) 39004b8e659SRyder Lee #define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 2) 391e78d73e0SRyder Lee #define MT_DMA_DCR0_DAMSDU_EN BIT(16) 39204b8e659SRyder Lee #define MT_DMA_DCR0_RX_VEC_DROP BIT(17) 393d4b98c63SRyder Lee #define MT_DMA_DCR0_RX_HDR_TRANS_EN BIT(19) 39404b8e659SRyder Lee 3952cad515eSRyder Lee #define MT_DMA_RCFR0(_band) MT_WF_DMA(0x070 + (_band) * 0x40) 396b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_MCU_RX_MGMT BIT(2) 397b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR BIT(3) 398b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_MCU_RX_CTL_BAR BIT(4) 399dd89a013SLorenzo Bianconi #define MT_DMA_RCFR0_MCU_RX_TDLS BIT(19) 400b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_MCU_RX_BYPASS BIT(21) 401b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_RX_DROPPED_UCAST GENMASK(25, 24) 402b4124a5bSFelix Fietkau #define MT_DMA_RCFR0_RX_DROPPED_MCAST GENMASK(27, 26) 403b4124a5bSFelix Fietkau 404dd89a013SLorenzo Bianconi #define MT_WF_PF_BASE ((dev)->reg_map[MT_PF_BASE]) 405dd89a013SLorenzo Bianconi #define MT_WF_PF(ofs) (MT_WF_PF_BASE + (ofs)) 406dd89a013SLorenzo Bianconi 407dd89a013SLorenzo Bianconi #define MT_WF_PFCR MT_WF_PF(0x000) 408dd89a013SLorenzo Bianconi #define MT_WF_PFCR_TDLS_EN BIT(9) 409dd89a013SLorenzo Bianconi 41094f83b66SLorenzo Bianconi #define MT_WTBL_BASE(dev) ((dev)->reg_map[MT_WTBL_BASE_ADDR]) 41104b8e659SRyder Lee #define MT_WTBL_ENTRY_SIZE 256 41204b8e659SRyder Lee 41394f83b66SLorenzo Bianconi #define MT_WTBL_OFF_BASE ((dev)->reg_map[MT_WTBL_BASE_OFF]) 41404b8e659SRyder Lee #define MT_WTBL_OFF(n) (MT_WTBL_OFF_BASE + (n)) 41504b8e659SRyder Lee 41645db4400SLorenzo Bianconi #define MT_WTBL_W0_KEY_IDX GENMASK(24, 23) 41745db4400SLorenzo Bianconi #define MT_WTBL_W0_RX_KEY_VALID BIT(26) 41845db4400SLorenzo Bianconi #define MT_WTBL_W0_RX_IK_VALID BIT(27) 41945db4400SLorenzo Bianconi 42045db4400SLorenzo Bianconi #define MT_WTBL_W2_KEY_TYPE GENMASK(7, 4) 42145db4400SLorenzo Bianconi 42204b8e659SRyder Lee #define MT_WTBL_UPDATE MT_WTBL_OFF(0x030) 42304b8e659SRyder Lee #define MT_WTBL_UPDATE_WLAN_IDX GENMASK(7, 0) 42445db4400SLorenzo Bianconi #define MT_WTBL_UPDATE_RXINFO_UPDATE BIT(11) 425b2c2f029SLorenzo Bianconi #define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12) 42604b8e659SRyder Lee #define MT_WTBL_UPDATE_RATE_UPDATE BIT(13) 42704b8e659SRyder Lee #define MT_WTBL_UPDATE_TX_COUNT_CLEAR BIT(14) 42804b8e659SRyder Lee #define MT_WTBL_UPDATE_BUSY BIT(31) 42904b8e659SRyder Lee 43094f83b66SLorenzo Bianconi #define MT_TOP_MISC(ofs) ((dev)->reg_map[MT_TOP_MISC_BASE] + (ofs)) 43194f83b66SLorenzo Bianconi #define MT_CONN_ON_MISC MT_TOP_MISC(0x1140) 43294f83b66SLorenzo Bianconi #define MT_TOP_MISC2_FW_N9_RDY BIT(2) 43394f83b66SLorenzo Bianconi 43494f83b66SLorenzo Bianconi #define MT_WTBL_ON_BASE ((dev)->reg_map[MT_WTBL_BASE_ON]) 43504b8e659SRyder Lee #define MT_WTBL_ON(_n) (MT_WTBL_ON_BASE + (_n)) 43604b8e659SRyder Lee 43745db4400SLorenzo Bianconi #define MT_WTBL_RICR0 MT_WTBL_ON(0x010) 43845db4400SLorenzo Bianconi #define MT_WTBL_RICR1 MT_WTBL_ON(0x014) 43945db4400SLorenzo Bianconi 44004b8e659SRyder Lee #define MT_WTBL_RIUCR0 MT_WTBL_ON(0x020) 44104b8e659SRyder Lee 44204b8e659SRyder Lee #define MT_WTBL_RIUCR1 MT_WTBL_ON(0x024) 44304b8e659SRyder Lee #define MT_WTBL_RIUCR1_RATE0 GENMASK(11, 0) 44404b8e659SRyder Lee #define MT_WTBL_RIUCR1_RATE1 GENMASK(23, 12) 44504b8e659SRyder Lee #define MT_WTBL_RIUCR1_RATE2_LO GENMASK(31, 24) 44604b8e659SRyder Lee 44704b8e659SRyder Lee #define MT_WTBL_RIUCR2 MT_WTBL_ON(0x028) 44804b8e659SRyder Lee #define MT_WTBL_RIUCR2_RATE2_HI GENMASK(3, 0) 44904b8e659SRyder Lee #define MT_WTBL_RIUCR2_RATE3 GENMASK(15, 4) 45004b8e659SRyder Lee #define MT_WTBL_RIUCR2_RATE4 GENMASK(27, 16) 45104b8e659SRyder Lee #define MT_WTBL_RIUCR2_RATE5_LO GENMASK(31, 28) 45204b8e659SRyder Lee 45304b8e659SRyder Lee #define MT_WTBL_RIUCR3 MT_WTBL_ON(0x02c) 45404b8e659SRyder Lee #define MT_WTBL_RIUCR3_RATE5_HI GENMASK(7, 0) 45504b8e659SRyder Lee #define MT_WTBL_RIUCR3_RATE6 GENMASK(19, 8) 45604b8e659SRyder Lee #define MT_WTBL_RIUCR3_RATE7 GENMASK(31, 20) 45704b8e659SRyder Lee 458e34235ccSRyder Lee #define MT_WTBL_W3_RTS BIT(22) 459e34235ccSRyder Lee 46004b8e659SRyder Lee #define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5) 46104b8e659SRyder Lee #define MT_WTBL_W5_SHORT_GI_20 BIT(8) 46204b8e659SRyder Lee #define MT_WTBL_W5_SHORT_GI_40 BIT(9) 46304b8e659SRyder Lee #define MT_WTBL_W5_SHORT_GI_80 BIT(10) 46404b8e659SRyder Lee #define MT_WTBL_W5_SHORT_GI_160 BIT(11) 46504b8e659SRyder Lee #define MT_WTBL_W5_BW_CAP GENMASK(13, 12) 4665f3413fcSFelix Fietkau #define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23) 4675f3413fcSFelix Fietkau #define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26) 4685f3413fcSFelix Fietkau #define MT_WTBL_W5_RATE_IDX GENMASK(31, 29) 4695f3413fcSFelix Fietkau 47004b8e659SRyder Lee #define MT_WTBL_W27_CC_BW_SEL GENMASK(6, 5) 47104b8e659SRyder Lee 47294f83b66SLorenzo Bianconi #define MT_LPON(_n) ((dev)->reg_map[MT_LPON_BASE] + (_n)) 4734af81f02SFelix Fietkau 474a4a5a430SRyder Lee #define MT_LPON_TCR0(_n) MT_LPON(0x010 + ((_n) * 4)) 475a4a5a430SRyder Lee #define MT_LPON_TCR2(_n) MT_LPON(0x0f8 + ((_n) - 2) * 4) 476a4a5a430SRyder Lee #define MT_LPON_TCR_MODE GENMASK(1, 0) 477accbcea4SRyder Lee #define MT_LPON_TCR_READ GENMASK(1, 0) 478a4a5a430SRyder Lee #define MT_LPON_TCR_WRITE BIT(0) 479accbcea4SRyder Lee #define MT_LPON_TCR_ADJUST BIT(1) 4804af81f02SFelix Fietkau 4814af81f02SFelix Fietkau #define MT_LPON_UTTR0 MT_LPON(0x018) 4824af81f02SFelix Fietkau #define MT_LPON_UTTR1 MT_LPON(0x01c) 4834af81f02SFelix Fietkau 48494f83b66SLorenzo Bianconi #define MT_WF_MIB_BASE (dev->reg_map[MT_MIB_BASE]) 485b7825ca0SRyder Lee #define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE + (ofs) + (_band) * 0x200) 48649de79adSLorenzo Bianconi 4876bcfdabbSLorenzo Bianconi #define MT_WF_MIB_SCR0 MT_WF_MIB(0, 0) 4886bcfdabbSLorenzo Bianconi #define MT_MIB_SCR0_AGG_CNT_RANGE_EN BIT(21) 4896bcfdabbSLorenzo Bianconi 490b7825ca0SRyder Lee #define MT_MIB_M0_MISC_CR(_band) MT_WF_MIB(_band, 0x00c) 491679b23feSRyder Lee 492b7825ca0SRyder Lee #define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x014) 493679b23feSRyder Lee #define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0) 49449de79adSLorenzo Bianconi 495b7825ca0SRyder Lee #define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c) 49629ed2a79SFelix Fietkau #define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0) 49729ed2a79SFelix Fietkau 498aef16345SRyder Lee #define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x040) 499aef16345SRyder Lee #define MT_MIB_AMPDU_MPDU_COUNT GENMASK(23, 0) 500aef16345SRyder Lee 501aef16345SRyder Lee #define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x044) 502aef16345SRyder Lee #define MT_MIB_AMPDU_ACK_COUNT GENMASK(23, 0) 503aef16345SRyder Lee 504b7825ca0SRyder Lee #define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048) 50529ed2a79SFelix Fietkau #define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0) 506863c15a1SLorenzo Bianconi 507b7825ca0SRyder Lee #define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x098) 5086bfa6e38SLorenzo Bianconi #define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0) 509b7825ca0SRyder Lee #define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x09c) 5106bfa6e38SLorenzo Bianconi #define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0) 5116bfa6e38SLorenzo Bianconi 512b7825ca0SRyder Lee #define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4)) 513679b23feSRyder Lee #define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16) 514679b23feSRyder Lee #define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) 515679b23feSRyder Lee 516b7825ca0SRyder Lee #define MT_MIB_MB_SDR1(_band, n) MT_WF_MIB(_band, 0x104 + ((n) << 4)) 517aef16345SRyder Lee #define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0) 518679b23feSRyder Lee #define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16) 519679b23feSRyder Lee 5206bcfdabbSLorenzo Bianconi #define MT_MIB_ARNG(n) MT_WF_MIB(0, 0x4b8 + ((n) << 2)) 5216bcfdabbSLorenzo Bianconi 522b7825ca0SRyder Lee #define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0xa8 + ((n) << 2)) 52375601194SLorenzo Bianconi 524f40ac0f3SLorenzo Bianconi #define MT_DMA_SHDL(ofs) (dev->reg_map[MT_DMA_SHDL_BASE] + (ofs)) 525f40ac0f3SLorenzo Bianconi 526cdad4874SFelix Fietkau #define MT_DMASHDL_BASE 0x5000a000 527cdad4874SFelix Fietkau #define MT_DMASHDL_OPTIONAL 0x008 528cdad4874SFelix Fietkau #define MT_DMASHDL_PAGE 0x00c 529cdad4874SFelix Fietkau 530cdad4874SFelix Fietkau #define MT_DMASHDL_REFILL 0x010 531cdad4874SFelix Fietkau 532cdad4874SFelix Fietkau #define MT_DMASHDL_PKT_MAX_SIZE 0x01c 533cdad4874SFelix Fietkau #define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0) 534cdad4874SFelix Fietkau #define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16) 535cdad4874SFelix Fietkau 536cdad4874SFelix Fietkau #define MT_DMASHDL_GROUP_QUOTA(_n) (0x020 + ((_n) << 2)) 537cdad4874SFelix Fietkau #define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0) 538cdad4874SFelix Fietkau #define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16) 539cdad4874SFelix Fietkau 540cdad4874SFelix Fietkau #define MT_DMASHDL_SCHED_SET0 0x0b0 541cdad4874SFelix Fietkau #define MT_DMASHDL_SCHED_SET1 0x0b4 542cdad4874SFelix Fietkau 543cdad4874SFelix Fietkau #define MT_DMASHDL_Q_MAP(_n) (0x0d0 + ((_n) << 2)) 544cdad4874SFelix Fietkau #define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0) 545cdad4874SFelix Fietkau #define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8)) 546cdad4874SFelix Fietkau 547ff913979SLorenzo Bianconi #define MT_LED_BASE_PHYS 0x80024000 548ff913979SLorenzo Bianconi #define MT_LED_PHYS(_n) (MT_LED_BASE_PHYS + (_n)) 549ff913979SLorenzo Bianconi 550ff913979SLorenzo Bianconi #define MT_LED_CTRL MT_LED_PHYS(0x00) 551ff913979SLorenzo Bianconi 552ff913979SLorenzo Bianconi #define MT_LED_CTRL_REPLAY(_n) BIT(0 + (8 * (_n))) 553ff913979SLorenzo Bianconi #define MT_LED_CTRL_POLARITY(_n) BIT(1 + (8 * (_n))) 554ff913979SLorenzo Bianconi #define MT_LED_CTRL_TX_BLINK_MODE(_n) BIT(2 + (8 * (_n))) 555ff913979SLorenzo Bianconi #define MT_LED_CTRL_TX_MANUAL_BLINK(_n) BIT(3 + (8 * (_n))) 55612a88d4dSLorenzo Bianconi #define MT_LED_CTRL_BAND(_n) BIT(4 + (8 * (_n))) 557ff913979SLorenzo Bianconi #define MT_LED_CTRL_TX_OVER_BLINK(_n) BIT(5 + (8 * (_n))) 558ff913979SLorenzo Bianconi #define MT_LED_CTRL_KICK(_n) BIT(7 + (8 * (_n))) 559ff913979SLorenzo Bianconi 560ff913979SLorenzo Bianconi #define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x10 + ((_n) * 8)) 561ff913979SLorenzo Bianconi #define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x14 + ((_n) * 8)) 562ff913979SLorenzo Bianconi #define MT_LED_STATUS_OFF GENMASK(31, 24) 563ff913979SLorenzo Bianconi #define MT_LED_STATUS_ON GENMASK(23, 16) 564ff913979SLorenzo Bianconi #define MT_LED_STATUS_DURATION GENMASK(15, 0) 565ff913979SLorenzo Bianconi 5666dd4072cSLorenzo Bianconi #define MT_PDMA_BUSY 0x82000504 5676dd4072cSLorenzo Bianconi #define MT_PDMA_TX_BUSY BIT(0) 5686dd4072cSLorenzo Bianconi #define MT_PDMA_RX_BUSY BIT(1) 5696dd4072cSLorenzo Bianconi 57094f83b66SLorenzo Bianconi #define MT_EFUSE_BASE ((dev)->reg_map[MT_EFUSE_ADDR_BASE]) 57104b8e659SRyder Lee #define MT_EFUSE_BASE_CTRL 0x000 57204b8e659SRyder Lee #define MT_EFUSE_BASE_CTRL_EMPTY BIT(30) 57304b8e659SRyder Lee 57404b8e659SRyder Lee #define MT_EFUSE_CTRL 0x008 57504b8e659SRyder Lee #define MT_EFUSE_CTRL_AOUT GENMASK(5, 0) 57604b8e659SRyder Lee #define MT_EFUSE_CTRL_MODE GENMASK(7, 6) 57704b8e659SRyder Lee #define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8) 57804b8e659SRyder Lee #define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14) 57904b8e659SRyder Lee #define MT_EFUSE_CTRL_AIN GENMASK(25, 16) 58004b8e659SRyder Lee #define MT_EFUSE_CTRL_VALID BIT(29) 58104b8e659SRyder Lee #define MT_EFUSE_CTRL_KICK BIT(30) 58204b8e659SRyder Lee #define MT_EFUSE_CTRL_SEL BIT(31) 58304b8e659SRyder Lee 58404b8e659SRyder Lee #define MT_EFUSE_WDATA(_i) (0x010 + ((_i) * 4)) 58504b8e659SRyder Lee #define MT_EFUSE_RDATA(_i) (0x030 + ((_i) * 4)) 58604b8e659SRyder Lee 58735da599fSFelix Fietkau /* INFRACFG host register range on MT7622 */ 58835da599fSFelix Fietkau #define MT_INFRACFG_MISC 0x700 58935da599fSFelix Fietkau #define MT_INFRACFG_MISC_AP2CONN_WAKE BIT(1) 59035da599fSFelix Fietkau 591eb99cc95SLorenzo Bianconi #define MT_UMAC_BASE 0x7c000000 592eb99cc95SLorenzo Bianconi #define MT_UMAC(ofs) (MT_UMAC_BASE + (ofs)) 593eb99cc95SLorenzo Bianconi #define MT_UDMA_TX_QSEL MT_UMAC(0x008) 594eb99cc95SLorenzo Bianconi #define MT_FW_DL_EN BIT(3) 595eb99cc95SLorenzo Bianconi 596eb99cc95SLorenzo Bianconi #define MT_UDMA_WLCFG_1 MT_UMAC(0x00c) 597eb99cc95SLorenzo Bianconi #define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0) 598eb99cc95SLorenzo Bianconi #define MT_WL_TX_TMOUT_LMT GENMASK(27, 8) 599eb99cc95SLorenzo Bianconi 600eb99cc95SLorenzo Bianconi #define MT_UDMA_WLCFG_0 MT_UMAC(0x18) 601eb99cc95SLorenzo Bianconi #define MT_WL_RX_AGG_TO GENMASK(7, 0) 602eb99cc95SLorenzo Bianconi #define MT_WL_RX_AGG_LMT GENMASK(15, 8) 603eb99cc95SLorenzo Bianconi #define MT_WL_TX_TMOUT_FUNC_EN BIT(16) 604eb99cc95SLorenzo Bianconi #define MT_WL_TX_DPH_CHK_EN BIT(17) 605eb99cc95SLorenzo Bianconi #define MT_WL_RX_MPSZ_PAD0 BIT(18) 606eb99cc95SLorenzo Bianconi #define MT_WL_RX_FLUSH BIT(19) 607eb99cc95SLorenzo Bianconi #define MT_TICK_1US_EN BIT(20) 608eb99cc95SLorenzo Bianconi #define MT_WL_RX_AGG_EN BIT(21) 609eb99cc95SLorenzo Bianconi #define MT_WL_RX_EN BIT(22) 610eb99cc95SLorenzo Bianconi #define MT_WL_TX_EN BIT(23) 611eb99cc95SLorenzo Bianconi #define MT_WL_RX_BUSY BIT(30) 612eb99cc95SLorenzo Bianconi #define MT_WL_TX_BUSY BIT(31) 613eb99cc95SLorenzo Bianconi 6144f0bce1cSFelix Fietkau #define MT_MCU_PTA_BASE 0x81060000 6154f0bce1cSFelix Fietkau #define MT_MCU_PTA(_n) (MT_MCU_PTA_BASE + (_n)) 6164f0bce1cSFelix Fietkau 617f353269dSFelix Fietkau #define MT_ANT_SWITCH_CON(_n) MT_MCU_PTA(0x0c8 + ((_n) - 1) * 4) 6184f0bce1cSFelix Fietkau #define MT_ANT_SWITCH_CON_MODE(_n) (GENMASK(4, 0) << (_n * 8)) 6194f0bce1cSFelix Fietkau #define MT_ANT_SWITCH_CON_MODE1(_n) (GENMASK(3, 0) << (_n * 8)) 6204f0bce1cSFelix Fietkau 62104b8e659SRyder Lee #endif 622