0001
0002
0003
0004 #ifndef __MT7615_REGS_H
0005 #define __MT7615_REGS_H
0006
0007 enum mt7615_reg_base {
0008 MT_TOP_CFG_BASE,
0009 MT_HW_BASE,
0010 MT_DMA_SHDL_BASE,
0011 MT_PCIE_REMAP_2,
0012 MT_ARB_BASE,
0013 MT_HIF_BASE,
0014 MT_CSR_BASE,
0015 MT_PLE_BASE,
0016 MT_PSE_BASE,
0017 MT_CFG_BASE,
0018 MT_AGG_BASE,
0019 MT_TMAC_BASE,
0020 MT_RMAC_BASE,
0021 MT_DMA_BASE,
0022 MT_PF_BASE,
0023 MT_WTBL_BASE_ON,
0024 MT_WTBL_BASE_OFF,
0025 MT_LPON_BASE,
0026 MT_MIB_BASE,
0027 MT_WTBL_BASE_ADDR,
0028 MT_PCIE_REMAP_BASE2,
0029 MT_TOP_MISC_BASE,
0030 MT_EFUSE_ADDR_BASE,
0031 MT_PP_BASE,
0032 __MT_BASE_MAX,
0033 };
0034
0035 #define MT_HW_INFO_BASE ((dev)->reg_map[MT_HW_BASE])
0036 #define MT_HW_INFO(ofs) (MT_HW_INFO_BASE + (ofs))
0037 #define MT_HW_REV MT_HW_INFO(0x000)
0038 #define MT_HW_CHIPID MT_HW_INFO(0x008)
0039 #define MT_TOP_STRAP_STA MT_HW_INFO(0x010)
0040 #define MT_TOP_3NSS BIT(24)
0041
0042 #define MT_TOP_OFF_RSV 0x1128
0043 #define MT_TOP_OFF_RSV_FW_STATE GENMASK(18, 16)
0044
0045 #define MT_TOP_MISC2 ((dev)->reg_map[MT_TOP_CFG_BASE] + 0x134)
0046 #define MT_TOP_MISC2_FW_STATE GENMASK(2, 0)
0047
0048 #define MT7663_TOP_MISC2_FW_STATE GENMASK(3, 1)
0049 #define MT_TOP_MISC2_FW_PWR_ON BIT(1)
0050
0051 #define MT_MCU_BASE 0x2000
0052 #define MT_MCU(ofs) (MT_MCU_BASE + (ofs))
0053
0054 #define MT_MCU_PCIE_REMAP_1 MT_MCU(0x500)
0055 #define MT_MCU_PCIE_REMAP_1_OFFSET GENMASK(17, 0)
0056 #define MT_MCU_PCIE_REMAP_1_BASE GENMASK(31, 18)
0057 #define MT_PCIE_REMAP_BASE_1 0x40000
0058
0059 #define MT_MCU_PCIE_REMAP_2 ((dev)->reg_map[MT_PCIE_REMAP_2])
0060 #define MT_MCU_PCIE_REMAP_2_OFFSET GENMASK(18, 0)
0061 #define MT_MCU_PCIE_REMAP_2_BASE GENMASK(31, 19)
0062 #define MT_PCIE_REMAP_BASE_2 ((dev)->reg_map[MT_PCIE_REMAP_BASE2])
0063
0064 #define MT_MCU_CIRQ_BASE 0xc0000
0065 #define MT_MCU_CIRQ(ofs) (MT_MCU_CIRQ_BASE + (ofs))
0066
0067 #define MT_MCU_CIRQ_IRQ_SEL(n) MT_MCU_CIRQ((n) << 2)
0068
0069 #define MT_HIF(ofs) ((dev)->reg_map[MT_HIF_BASE] + (ofs))
0070 #define MT_HIF_RST MT_HIF(0x100)
0071 #define MT_HIF_LOGIC_RST_N BIT(4)
0072
0073 #define MT_PDMA_SLP_PROT MT_HIF(0x154)
0074 #define MT_PDMA_AXI_SLPPROT_ENABLE BIT(0)
0075 #define MT_PDMA_AXI_SLPPROT_RDY BIT(16)
0076
0077 #define MT_PDMA_BUSY_STATUS MT_HIF(0x168)
0078 #define MT_PDMA_TX_IDX_BUSY BIT(2)
0079 #define MT_PDMA_BUSY_IDX BIT(31)
0080
0081 #define MT_WPDMA_TX_RING0_CTRL0 MT_HIF(0x300)
0082 #define MT_WPDMA_TX_RING0_CTRL1 MT_HIF(0x304)
0083
0084 #define MT7663_MCU_PCIE_REMAP_2_OFFSET GENMASK(15, 0)
0085 #define MT7663_MCU_PCIE_REMAP_2_BASE GENMASK(31, 16)
0086
0087 #define MT_HIF2_BASE 0xf0000
0088 #define MT_HIF2(ofs) (MT_HIF2_BASE + (ofs))
0089 #define MT_PCIE_IRQ_ENABLE MT_HIF2(0x188)
0090 #define MT_PCIE_DOORBELL_PUSH MT_HIF2(0x1484)
0091
0092 #define MT_CFG_LPCR_HOST MT_HIF(0x1f0)
0093 #define MT_CFG_LPCR_HOST_FW_OWN BIT(0)
0094 #define MT_CFG_LPCR_HOST_DRV_OWN BIT(1)
0095
0096 #define MT_MCU2HOST_INT_STATUS MT_HIF(0x1f0)
0097 #define MT_MCU2HOST_INT_ENABLE MT_HIF(0x1f4)
0098
0099 #define MT7663_MCU_INT_EVENT MT_HIF(0x108)
0100 #define MT_MCU_INT_EVENT MT_HIF(0x1f8)
0101 #define MT_MCU_INT_EVENT_PDMA_STOPPED BIT(0)
0102 #define MT_MCU_INT_EVENT_PDMA_INIT BIT(1)
0103 #define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2)
0104 #define MT_MCU_INT_EVENT_RESET_DONE BIT(3)
0105
0106 #define MT_INT_SOURCE_CSR MT_HIF(0x200)
0107 #define MT_INT_MASK_CSR MT_HIF(0x204)
0108 #define MT_DELAY_INT_CFG MT_HIF(0x210)
0109
0110 #define MT_INT_RX_DONE(_n) BIT(_n)
0111 #define MT_INT_RX_DONE_ALL GENMASK(1, 0)
0112 #define MT_INT_TX_DONE_ALL GENMASK(19, 4)
0113 #define MT_INT_TX_DONE(_n) BIT((_n) + 4)
0114 #define MT7663_INT_MCU_CMD BIT(29)
0115 #define MT_INT_MCU_CMD BIT(30)
0116
0117 #define MT_WPDMA_GLO_CFG MT_HIF(0x208)
0118 #define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0)
0119 #define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1)
0120 #define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2)
0121 #define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3)
0122 #define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4)
0123 #define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6)
0124 #define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7)
0125 #define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0 BIT(9)
0126 #define MT_WPDMA_GLO_CFG_BYPASS_TX_SCH BIT(9)
0127 #define MT_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10)
0128 #define MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12)
0129 #define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT21 GENMASK(23, 22)
0130 #define MT_WPDMA_GLO_CFG_SW_RESET BIT(24)
0131 #define MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26)
0132 #define MT_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28)
0133
0134 #define MT_WPDMA_RST_IDX MT_HIF(0x20c)
0135
0136 #define MT_WPDMA_MEM_RNG_ERR MT_HIF(0x224)
0137
0138 #define MT_MCU_CMD MT_HIF(0x234)
0139 #define MT_MCU_CMD_CLEAR_FW_OWN BIT(0)
0140 #define MT_MCU_CMD_STOP_PDMA_FW_RELOAD BIT(1)
0141 #define MT_MCU_CMD_STOP_PDMA BIT(2)
0142 #define MT_MCU_CMD_RESET_DONE BIT(3)
0143 #define MT_MCU_CMD_RECOVERY_DONE BIT(4)
0144 #define MT_MCU_CMD_NORMAL_STATE BIT(5)
0145 #define MT_MCU_CMD_LMAC_ERROR BIT(24)
0146 #define MT_MCU_CMD_PSE_ERROR BIT(25)
0147 #define MT_MCU_CMD_PLE_ERROR BIT(26)
0148 #define MT_MCU_CMD_PDMA_ERROR BIT(27)
0149 #define MT_MCU_CMD_PCIE_ERROR BIT(28)
0150 #define MT_MCU_CMD_ERROR_MASK (GENMASK(5, 1) | GENMASK(28, 24))
0151 #define MT7663_MCU_CMD_ERROR_MASK GENMASK(5, 2)
0152
0153 #define MT_TX_RING_BASE MT_HIF(0x300)
0154 #define MT_RX_RING_BASE MT_HIF(0x400)
0155
0156 #define MT_WPDMA_GLO_CFG1 MT_HIF(0x500)
0157 #define MT_WPDMA_TX_PRE_CFG MT_HIF(0x510)
0158 #define MT_WPDMA_RX_PRE_CFG MT_HIF(0x520)
0159 #define MT_WPDMA_ABT_CFG MT_HIF(0x530)
0160 #define MT_WPDMA_ABT_CFG1 MT_HIF(0x534)
0161
0162 #define MT_CSR(ofs) ((dev)->reg_map[MT_CSR_BASE] + (ofs))
0163 #define MT_CONN_HIF_ON_LPCTL MT_CSR(0x000)
0164
0165 #define MT_PLE(ofs) ((dev)->reg_map[MT_PLE_BASE] + (ofs))
0166
0167 #define MT_PLE_PG_HIF0_GROUP MT_PLE(0x110)
0168 #define MT_HIF0_MIN_QUOTA GENMASK(11, 0)
0169 #define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0)
0170 #define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4)
0171 #define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8)
0172 #define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc)
0173
0174 #define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \
0175 ((n) << 2))
0176
0177 #define MT_PSE(ofs) ((dev)->reg_map[MT_PSE_BASE] + (ofs))
0178 #define MT_PSE_PG_HIF0_GROUP MT_PSE(0x110)
0179 #define MT_HIF0_MIN_QUOTA GENMASK(11, 0)
0180 #define MT_PSE_PG_HIF1_GROUP MT_PSE(0x118)
0181 #define MT_HIF1_MIN_QUOTA GENMASK(11, 0)
0182 #define MT_PSE_QUEUE_EMPTY MT_PSE(0x0b4)
0183 #define MT_HIF_0_EMPTY_MASK BIT(16)
0184 #define MT_HIF_1_EMPTY_MASK BIT(17)
0185 #define MT_HIF_ALL_EMPTY_MASK GENMASK(17, 16)
0186 #define MT_PSE_PG_INFO MT_PSE(0x194)
0187 #define MT_PSE_SRC_CNT GENMASK(27, 16)
0188
0189 #define MT_PP(ofs) ((dev)->reg_map[MT_PP_BASE] + (ofs))
0190 #define MT_PP_TXDWCNT MT_PP(0x0)
0191 #define MT_PP_TXDWCNT_TX0_ADD_DW_CNT GENMASK(7, 0)
0192 #define MT_PP_TXDWCNT_TX1_ADD_DW_CNT GENMASK(15, 8)
0193
0194 #define MT_WF_PHY_BASE 0x82070000
0195 #define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs))
0196
0197 #define MT_WF_PHY_WF2_RFCTRL0(n) MT_WF_PHY(0x1900 + (n) * 0x400)
0198 #define MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN BIT(9)
0199
0200 #define MT_WF_PHY_R0_PHYMUX_5(_phy) MT_WF_PHY(0x0614 + ((_phy) << 9))
0201 #define MT7663_WF_PHY_R0_PHYMUX_5 MT_WF_PHY(0x0414)
0202
0203 #define MT_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x020c + ((_phy) << 9))
0204 #define MT_WF_PHYCTRL_STAT_PD_OFDM GENMASK(31, 16)
0205 #define MT_WF_PHYCTRL_STAT_PD_CCK GENMASK(15, 0)
0206
0207 #define MT7663_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x0210 + ((_phy) << 12))
0208
0209 #define MT_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0220 + ((_phy) << 9))
0210 #define MT_WF_PHYCTRL_STAT_MDRDY_OFDM GENMASK(31, 16)
0211 #define MT_WF_PHYCTRL_STAT_MDRDY_CCK GENMASK(15, 0)
0212
0213 #define MT7663_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0224 + ((_phy) << 12))
0214
0215 #define MT_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x084 : 0x229c)
0216 #define MT_WF_PHY_PD_OFDM_MASK(_phy) ((_phy) ? GENMASK(24, 16) : \
0217 GENMASK(28, 20))
0218 #define MT_WF_PHY_PD_OFDM(_phy, v) ((v) << ((_phy) ? 16 : 20))
0219 #define MT_WF_PHY_PD_BLK(_phy) ((_phy) ? BIT(25) : BIT(19))
0220
0221 #define MT7663_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x2aec : 0x22f0)
0222
0223 #define MT_WF_PHY_RXTD_BASE MT_WF_PHY(0x2200)
0224 #define MT_WF_PHY_RXTD(_n) (MT_WF_PHY_RXTD_BASE + ((_n) << 2))
0225
0226 #define MT7663_WF_PHY_RXTD(_n) (MT_WF_PHY(0x25b0) + ((_n) << 2))
0227
0228 #define MT_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2314 : 0x2310)
0229 #define MT_WF_PHY_PD_CCK_MASK(_phy) (_phy) ? GENMASK(31, 24) : \
0230 GENMASK(8, 1)
0231 #define MT_WF_PHY_PD_CCK(_phy, v) ((v) << ((_phy) ? 24 : 1))
0232
0233 #define MT7663_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2350 : 0x234c)
0234
0235 #define MT_WF_PHY_RXTD2_BASE MT_WF_PHY(0x2a00)
0236 #define MT_WF_PHY_RXTD2(_n) (MT_WF_PHY_RXTD2_BASE + ((_n) << 2))
0237
0238 #define MT_WF_PHY_RFINTF3_0(_n) MT_WF_PHY(0x1100 + (_n) * 0x400)
0239 #define MT_WF_PHY_RFINTF3_0_ANT GENMASK(7, 4)
0240
0241 #define MT_WF_CFG_BASE ((dev)->reg_map[MT_CFG_BASE])
0242 #define MT_WF_CFG(ofs) (MT_WF_CFG_BASE + (ofs))
0243
0244 #define MT_CFG_CCR MT_WF_CFG(0x000)
0245 #define MT_CFG_CCR_MAC_D1_1X_GC_EN BIT(24)
0246 #define MT_CFG_CCR_MAC_D0_1X_GC_EN BIT(25)
0247 #define MT_CFG_CCR_MAC_D1_2X_GC_EN BIT(30)
0248 #define MT_CFG_CCR_MAC_D0_2X_GC_EN BIT(31)
0249
0250 #define MT_WF_AGG_BASE ((dev)->reg_map[MT_AGG_BASE])
0251 #define MT_WF_AGG(ofs) (MT_WF_AGG_BASE + (ofs))
0252
0253 #define MT_AGG_ARCR MT_WF_AGG(0x010)
0254 #define MT_AGG_ARCR_INIT_RATE1 BIT(0)
0255 #define MT_AGG_ARCR_RTS_RATE_THR GENMASK(12, 8)
0256 #define MT_AGG_ARCR_RATE_DOWN_RATIO GENMASK(17, 16)
0257 #define MT_AGG_ARCR_RATE_DOWN_RATIO_EN BIT(19)
0258 #define MT_AGG_ARCR_RATE_UP_EXTRA_TH GENMASK(22, 20)
0259
0260 #define MT_AGG_ARUCR(_band) MT_WF_AGG(0x018 + (_band) * 0x100)
0261 #define MT_AGG_ARDCR(_band) MT_WF_AGG(0x01c + (_band) * 0x100)
0262 #define MT_AGG_ARxCR_LIMIT_SHIFT(_n) (4 * (_n))
0263 #define MT_AGG_ARxCR_LIMIT(_n) GENMASK(2 + \
0264 MT_AGG_ARxCR_LIMIT_SHIFT(_n), \
0265 MT_AGG_ARxCR_LIMIT_SHIFT(_n))
0266
0267 #define MT_AGG_ASRCR0 MT_WF_AGG(0x060)
0268 #define MT_AGG_ASRCR1 MT_WF_AGG(0x064)
0269 #define MT_AGG_ASRCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(5, 0))
0270
0271 #define MT_AGG_ACR(_band) MT_WF_AGG(0x070 + (_band) * 0x100)
0272 #define MT_AGG_ACR_NO_BA_RULE BIT(0)
0273 #define MT_AGG_ACR_NO_BA_AR_RULE BIT(1)
0274 #define MT_AGG_ACR_PKT_TIME_EN BIT(2)
0275 #define MT_AGG_ACR_CFEND_RATE GENMASK(15, 4)
0276 #define MT_AGG_ACR_BAR_RATE GENMASK(31, 20)
0277
0278 #define MT_AGG_SCR MT_WF_AGG(0x0fc)
0279 #define MT_AGG_SCR_NLNAV_MID_PTEC_DIS BIT(3)
0280
0281 #define MT_WF_ARB_BASE ((dev)->reg_map[MT_ARB_BASE])
0282 #define MT_WF_ARB(ofs) (MT_WF_ARB_BASE + (ofs))
0283
0284 #define MT_ARB_RQCR MT_WF_ARB(0x070)
0285 #define MT_ARB_RQCR_RX_START BIT(0)
0286 #define MT_ARB_RQCR_RXV_START BIT(4)
0287 #define MT_ARB_RQCR_RXV_R_EN BIT(7)
0288 #define MT_ARB_RQCR_RXV_T_EN BIT(8)
0289 #define MT_ARB_RQCR_BAND_SHIFT 16
0290
0291 #define MT_ARB_SCR MT_WF_ARB(0x080)
0292 #define MT_ARB_SCR_TX0_DISABLE BIT(8)
0293 #define MT_ARB_SCR_RX0_DISABLE BIT(9)
0294 #define MT_ARB_SCR_TX1_DISABLE BIT(10)
0295 #define MT_ARB_SCR_RX1_DISABLE BIT(11)
0296
0297 #define MT_WF_TMAC_BASE ((dev)->reg_map[MT_TMAC_BASE])
0298 #define MT_WF_TMAC(ofs) (MT_WF_TMAC_BASE + (ofs))
0299
0300 #define MT_TMAC_CDTR MT_WF_TMAC(0x090)
0301 #define MT_TMAC_ODTR MT_WF_TMAC(0x094)
0302 #define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0)
0303 #define MT_TIMEOUT_VAL_CCA GENMASK(31, 16)
0304
0305 #define MT_TMAC_TRCR(_band) MT_WF_TMAC((_band) ? 0x070 : 0x09c)
0306 #define MT_TMAC_TRCR_CCA_SEL GENMASK(31, 30)
0307 #define MT_TMAC_TRCR_SEC_CCA_SEL GENMASK(29, 28)
0308
0309 #define MT_TMAC_ICR(_band) MT_WF_TMAC((_band) ? 0x074 : 0x0a4)
0310 #define MT_IFS_EIFS GENMASK(8, 0)
0311 #define MT_IFS_RIFS GENMASK(14, 10)
0312 #define MT_IFS_SIFS GENMASK(22, 16)
0313 #define MT_IFS_SLOT GENMASK(30, 24)
0314
0315 #define MT_TMAC_CTCR0 MT_WF_TMAC(0x0f4)
0316 #define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0)
0317 #define MT_TMAC_CTCR0_INS_DDLMT_DENSITY GENMASK(15, 12)
0318 #define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17)
0319 #define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18)
0320
0321 #define MT_WF_RMAC_BASE ((dev)->reg_map[MT_RMAC_BASE])
0322 #define MT_WF_RMAC(ofs) (MT_WF_RMAC_BASE + (ofs))
0323
0324 #define MT_WF_RFCR(_band) MT_WF_RMAC((_band) ? 0x100 : 0x000)
0325 #define MT_WF_RFCR_DROP_STBC_MULTI BIT(0)
0326 #define MT_WF_RFCR_DROP_FCSFAIL BIT(1)
0327 #define MT_WF_RFCR_DROP_VERSION BIT(3)
0328 #define MT_WF_RFCR_DROP_PROBEREQ BIT(4)
0329 #define MT_WF_RFCR_DROP_MCAST BIT(5)
0330 #define MT_WF_RFCR_DROP_BCAST BIT(6)
0331 #define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7)
0332 #define MT_WF_RFCR_DROP_A3_MAC BIT(8)
0333 #define MT_WF_RFCR_DROP_A3_BSSID BIT(9)
0334 #define MT_WF_RFCR_DROP_A2_BSSID BIT(10)
0335 #define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11)
0336 #define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12)
0337 #define MT_WF_RFCR_DROP_CTL_RSV BIT(13)
0338 #define MT_WF_RFCR_DROP_CTS BIT(14)
0339 #define MT_WF_RFCR_DROP_RTS BIT(15)
0340 #define MT_WF_RFCR_DROP_DUPLICATE BIT(16)
0341 #define MT_WF_RFCR_DROP_OTHER_BSS BIT(17)
0342 #define MT_WF_RFCR_DROP_OTHER_UC BIT(18)
0343 #define MT_WF_RFCR_DROP_OTHER_TIM BIT(19)
0344 #define MT_WF_RFCR_DROP_NDPA BIT(20)
0345 #define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21)
0346
0347 #define MT_WF_RMAC_MORE(_band) MT_WF_RMAC((_band) ? 0x124 : 0x024)
0348 #define MT_WF_RMAC_MORE_MUAR_MODE GENMASK(31, 30)
0349
0350 #define MT_WF_RFCR1(_band) MT_WF_RMAC((_band) ? 0x104 : 0x004)
0351 #define MT_WF_RFCR1_DROP_ACK BIT(4)
0352 #define MT_WF_RFCR1_DROP_BF_POLL BIT(5)
0353 #define MT_WF_RFCR1_DROP_BA BIT(6)
0354 #define MT_WF_RFCR1_DROP_CFEND BIT(7)
0355 #define MT_WF_RFCR1_DROP_CFACK BIT(8)
0356
0357 #define MT_CHFREQ(_band) MT_WF_RMAC((_band) ? 0x130 : 0x030)
0358
0359 #define MT_WF_RMAC_MAR0 MT_WF_RMAC(0x025c)
0360 #define MT_WF_RMAC_MAR1 MT_WF_RMAC(0x0260)
0361 #define MT_WF_RMAC_MAR1_ADDR GENMASK(15, 0)
0362 #define MT_WF_RMAC_MAR1_START BIT(16)
0363 #define MT_WF_RMAC_MAR1_WRITE BIT(17)
0364 #define MT_WF_RMAC_MAR1_IDX GENMASK(29, 24)
0365 #define MT_WF_RMAC_MAR1_GROUP GENMASK(31, 30)
0366
0367 #define MT_WF_RMAC_MIB_TIME0 MT_WF_RMAC(0x03c4)
0368 #define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31)
0369 #define MT_WF_RMAC_MIB_RXTIME_EN BIT(30)
0370
0371 #define MT_WF_RMAC_MIB_AIRTIME0 MT_WF_RMAC(0x0380)
0372
0373 #define MT_WF_RMAC_MIB_TIME5 MT_WF_RMAC(0x03d8)
0374 #define MT_WF_RMAC_MIB_TIME6 MT_WF_RMAC(0x03dc)
0375 #define MT_MIB_OBSSTIME_MASK GENMASK(23, 0)
0376
0377 #define MT_WF_DMA_BASE ((dev)->reg_map[MT_DMA_BASE])
0378 #define MT_WF_DMA(ofs) (MT_WF_DMA_BASE + (ofs))
0379
0380 #define MT_DMA_DCR0 MT_WF_DMA(0x000)
0381 #define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 2)
0382 #define MT_DMA_DCR0_DAMSDU_EN BIT(16)
0383 #define MT_DMA_DCR0_RX_VEC_DROP BIT(17)
0384 #define MT_DMA_DCR0_RX_HDR_TRANS_EN BIT(19)
0385
0386 #define MT_DMA_RCFR0(_band) MT_WF_DMA(0x070 + (_band) * 0x40)
0387 #define MT_DMA_RCFR0_MCU_RX_MGMT BIT(2)
0388 #define MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR BIT(3)
0389 #define MT_DMA_RCFR0_MCU_RX_CTL_BAR BIT(4)
0390 #define MT_DMA_RCFR0_MCU_RX_TDLS BIT(19)
0391 #define MT_DMA_RCFR0_MCU_RX_BYPASS BIT(21)
0392 #define MT_DMA_RCFR0_RX_DROPPED_UCAST GENMASK(25, 24)
0393 #define MT_DMA_RCFR0_RX_DROPPED_MCAST GENMASK(27, 26)
0394
0395 #define MT_WF_PF_BASE ((dev)->reg_map[MT_PF_BASE])
0396 #define MT_WF_PF(ofs) (MT_WF_PF_BASE + (ofs))
0397
0398 #define MT_WF_PFCR MT_WF_PF(0x000)
0399 #define MT_WF_PFCR_TDLS_EN BIT(9)
0400
0401 #define MT_WTBL_BASE(dev) ((dev)->reg_map[MT_WTBL_BASE_ADDR])
0402 #define MT_WTBL_ENTRY_SIZE 256
0403
0404 #define MT_WTBL_OFF_BASE ((dev)->reg_map[MT_WTBL_BASE_OFF])
0405 #define MT_WTBL_OFF(n) (MT_WTBL_OFF_BASE + (n))
0406
0407 #define MT_WTBL_W0_KEY_IDX GENMASK(24, 23)
0408 #define MT_WTBL_W0_RX_KEY_VALID BIT(26)
0409 #define MT_WTBL_W0_RX_IK_VALID BIT(27)
0410
0411 #define MT_WTBL_W2_KEY_TYPE GENMASK(7, 4)
0412
0413 #define MT_WTBL_UPDATE MT_WTBL_OFF(0x030)
0414 #define MT_WTBL_UPDATE_WLAN_IDX GENMASK(7, 0)
0415 #define MT_WTBL_UPDATE_RXINFO_UPDATE BIT(11)
0416 #define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12)
0417 #define MT_WTBL_UPDATE_RATE_UPDATE BIT(13)
0418 #define MT_WTBL_UPDATE_TX_COUNT_CLEAR BIT(14)
0419 #define MT_WTBL_UPDATE_BUSY BIT(31)
0420
0421 #define MT_TOP_MISC(ofs) ((dev)->reg_map[MT_TOP_MISC_BASE] + (ofs))
0422 #define MT_CONN_ON_MISC MT_TOP_MISC(0x1140)
0423 #define MT_TOP_MISC2_FW_N9_RDY BIT(2)
0424
0425 #define MT_WTBL_ON_BASE ((dev)->reg_map[MT_WTBL_BASE_ON])
0426 #define MT_WTBL_ON(_n) (MT_WTBL_ON_BASE + (_n))
0427
0428 #define MT_WTBL_RICR0 MT_WTBL_ON(0x010)
0429 #define MT_WTBL_RICR1 MT_WTBL_ON(0x014)
0430
0431 #define MT_WTBL_RIUCR0 MT_WTBL_ON(0x020)
0432
0433 #define MT_WTBL_RIUCR1 MT_WTBL_ON(0x024)
0434 #define MT_WTBL_RIUCR1_RATE0 GENMASK(11, 0)
0435 #define MT_WTBL_RIUCR1_RATE1 GENMASK(23, 12)
0436 #define MT_WTBL_RIUCR1_RATE2_LO GENMASK(31, 24)
0437
0438 #define MT_WTBL_RIUCR2 MT_WTBL_ON(0x028)
0439 #define MT_WTBL_RIUCR2_RATE2_HI GENMASK(3, 0)
0440 #define MT_WTBL_RIUCR2_RATE3 GENMASK(15, 4)
0441 #define MT_WTBL_RIUCR2_RATE4 GENMASK(27, 16)
0442 #define MT_WTBL_RIUCR2_RATE5_LO GENMASK(31, 28)
0443
0444 #define MT_WTBL_RIUCR3 MT_WTBL_ON(0x02c)
0445 #define MT_WTBL_RIUCR3_RATE5_HI GENMASK(7, 0)
0446 #define MT_WTBL_RIUCR3_RATE6 GENMASK(19, 8)
0447 #define MT_WTBL_RIUCR3_RATE7 GENMASK(31, 20)
0448
0449 #define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5)
0450 #define MT_WTBL_W5_SHORT_GI_20 BIT(8)
0451 #define MT_WTBL_W5_SHORT_GI_40 BIT(9)
0452 #define MT_WTBL_W5_SHORT_GI_80 BIT(10)
0453 #define MT_WTBL_W5_SHORT_GI_160 BIT(11)
0454 #define MT_WTBL_W5_BW_CAP GENMASK(13, 12)
0455 #define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23)
0456 #define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26)
0457 #define MT_WTBL_W5_RATE_IDX GENMASK(31, 29)
0458
0459 #define MT_WTBL_W27_CC_BW_SEL GENMASK(6, 5)
0460
0461 #define MT_LPON(_n) ((dev)->reg_map[MT_LPON_BASE] + (_n))
0462
0463 #define MT_LPON_TCR0(_n) MT_LPON(0x010 + ((_n) * 4))
0464 #define MT_LPON_TCR2(_n) MT_LPON(0x0f8 + ((_n) - 2) * 4)
0465 #define MT_LPON_TCR_MODE GENMASK(1, 0)
0466 #define MT_LPON_TCR_READ GENMASK(1, 0)
0467 #define MT_LPON_TCR_WRITE BIT(0)
0468 #define MT_LPON_TCR_ADJUST BIT(1)
0469
0470 #define MT_LPON_UTTR0 MT_LPON(0x018)
0471 #define MT_LPON_UTTR1 MT_LPON(0x01c)
0472
0473 #define MT_WF_MIB_BASE (dev->reg_map[MT_MIB_BASE])
0474 #define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE + (ofs) + (_band) * 0x200)
0475
0476 #define MT_WF_MIB_SCR0 MT_WF_MIB(0, 0)
0477 #define MT_MIB_SCR0_AGG_CNT_RANGE_EN BIT(21)
0478
0479 #define MT_MIB_M0_MISC_CR(_band) MT_WF_MIB(_band, 0x00c)
0480
0481 #define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x014)
0482 #define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0)
0483
0484 #define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c)
0485 #define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0)
0486
0487 #define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x040)
0488 #define MT_MIB_AMPDU_MPDU_COUNT GENMASK(23, 0)
0489
0490 #define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x044)
0491 #define MT_MIB_AMPDU_ACK_COUNT GENMASK(23, 0)
0492
0493 #define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048)
0494 #define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0)
0495
0496 #define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x098)
0497 #define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0)
0498 #define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x09c)
0499 #define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0)
0500
0501 #define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4))
0502 #define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16)
0503 #define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0)
0504
0505 #define MT_MIB_MB_SDR1(_band, n) MT_WF_MIB(_band, 0x104 + ((n) << 4))
0506 #define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0)
0507 #define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16)
0508
0509 #define MT_MIB_ARNG(n) MT_WF_MIB(0, 0x4b8 + ((n) << 2))
0510
0511 #define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0xa8 + ((n) << 2))
0512
0513 #define MT_DMA_SHDL(ofs) (dev->reg_map[MT_DMA_SHDL_BASE] + (ofs))
0514
0515 #define MT_DMASHDL_BASE 0x5000a000
0516 #define MT_DMASHDL_OPTIONAL 0x008
0517 #define MT_DMASHDL_PAGE 0x00c
0518
0519 #define MT_DMASHDL_REFILL 0x010
0520
0521 #define MT_DMASHDL_PKT_MAX_SIZE 0x01c
0522 #define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0)
0523 #define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16)
0524
0525 #define MT_DMASHDL_GROUP_QUOTA(_n) (0x020 + ((_n) << 2))
0526 #define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0)
0527 #define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16)
0528
0529 #define MT_DMASHDL_SCHED_SET0 0x0b0
0530 #define MT_DMASHDL_SCHED_SET1 0x0b4
0531
0532 #define MT_DMASHDL_Q_MAP(_n) (0x0d0 + ((_n) << 2))
0533 #define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0)
0534 #define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8))
0535
0536 #define MT_LED_BASE_PHYS 0x80024000
0537 #define MT_LED_PHYS(_n) (MT_LED_BASE_PHYS + (_n))
0538
0539 #define MT_LED_CTRL MT_LED_PHYS(0x00)
0540
0541 #define MT_LED_CTRL_REPLAY(_n) BIT(0 + (8 * (_n)))
0542 #define MT_LED_CTRL_POLARITY(_n) BIT(1 + (8 * (_n)))
0543 #define MT_LED_CTRL_TX_BLINK_MODE(_n) BIT(2 + (8 * (_n)))
0544 #define MT_LED_CTRL_TX_MANUAL_BLINK(_n) BIT(3 + (8 * (_n)))
0545 #define MT_LED_CTRL_TX_OVER_BLINK(_n) BIT(5 + (8 * (_n)))
0546 #define MT_LED_CTRL_KICK(_n) BIT(7 + (8 * (_n)))
0547
0548 #define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x10 + ((_n) * 8))
0549 #define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x14 + ((_n) * 8))
0550 #define MT_LED_STATUS_OFF GENMASK(31, 24)
0551 #define MT_LED_STATUS_ON GENMASK(23, 16)
0552 #define MT_LED_STATUS_DURATION GENMASK(15, 0)
0553
0554 #define MT_PDMA_BUSY 0x82000504
0555 #define MT_PDMA_TX_BUSY BIT(0)
0556 #define MT_PDMA_RX_BUSY BIT(1)
0557
0558 #define MT_EFUSE_BASE ((dev)->reg_map[MT_EFUSE_ADDR_BASE])
0559 #define MT_EFUSE_BASE_CTRL 0x000
0560 #define MT_EFUSE_BASE_CTRL_EMPTY BIT(30)
0561
0562 #define MT_EFUSE_CTRL 0x008
0563 #define MT_EFUSE_CTRL_AOUT GENMASK(5, 0)
0564 #define MT_EFUSE_CTRL_MODE GENMASK(7, 6)
0565 #define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8)
0566 #define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14)
0567 #define MT_EFUSE_CTRL_AIN GENMASK(25, 16)
0568 #define MT_EFUSE_CTRL_VALID BIT(29)
0569 #define MT_EFUSE_CTRL_KICK BIT(30)
0570 #define MT_EFUSE_CTRL_SEL BIT(31)
0571
0572 #define MT_EFUSE_WDATA(_i) (0x010 + ((_i) * 4))
0573 #define MT_EFUSE_RDATA(_i) (0x030 + ((_i) * 4))
0574
0575
0576 #define MT_INFRACFG_MISC 0x700
0577 #define MT_INFRACFG_MISC_AP2CONN_WAKE BIT(1)
0578
0579 #define MT_UMAC_BASE 0x7c000000
0580 #define MT_UMAC(ofs) (MT_UMAC_BASE + (ofs))
0581 #define MT_UDMA_TX_QSEL MT_UMAC(0x008)
0582 #define MT_FW_DL_EN BIT(3)
0583
0584 #define MT_UDMA_WLCFG_1 MT_UMAC(0x00c)
0585 #define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0)
0586 #define MT_WL_TX_TMOUT_LMT GENMASK(27, 8)
0587
0588 #define MT_UDMA_WLCFG_0 MT_UMAC(0x18)
0589 #define MT_WL_RX_AGG_TO GENMASK(7, 0)
0590 #define MT_WL_RX_AGG_LMT GENMASK(15, 8)
0591 #define MT_WL_TX_TMOUT_FUNC_EN BIT(16)
0592 #define MT_WL_TX_DPH_CHK_EN BIT(17)
0593 #define MT_WL_RX_MPSZ_PAD0 BIT(18)
0594 #define MT_WL_RX_FLUSH BIT(19)
0595 #define MT_TICK_1US_EN BIT(20)
0596 #define MT_WL_RX_AGG_EN BIT(21)
0597 #define MT_WL_RX_EN BIT(22)
0598 #define MT_WL_TX_EN BIT(23)
0599 #define MT_WL_RX_BUSY BIT(30)
0600 #define MT_WL_TX_BUSY BIT(31)
0601
0602 #define MT_MCU_PTA_BASE 0x81060000
0603 #define MT_MCU_PTA(_n) (MT_MCU_PTA_BASE + (_n))
0604
0605 #define MT_ANT_SWITCH_CON(_n) MT_MCU_PTA(0x0c8 + ((_n) - 1) * 4)
0606 #define MT_ANT_SWITCH_CON_MODE(_n) (GENMASK(4, 0) << (_n * 8))
0607 #define MT_ANT_SWITCH_CON_MODE1(_n) (GENMASK(3, 0) << (_n * 8))
0608
0609 #endif