18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2019 MediaTek Inc. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __MT7615_REGS_H 58c2ecf20Sopenharmony_ci#define __MT7615_REGS_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cienum mt7615_reg_base { 88c2ecf20Sopenharmony_ci MT_TOP_CFG_BASE, 98c2ecf20Sopenharmony_ci MT_HW_BASE, 108c2ecf20Sopenharmony_ci MT_DMA_SHDL_BASE, 118c2ecf20Sopenharmony_ci MT_PCIE_REMAP_2, 128c2ecf20Sopenharmony_ci MT_ARB_BASE, 138c2ecf20Sopenharmony_ci MT_HIF_BASE, 148c2ecf20Sopenharmony_ci MT_CSR_BASE, 158c2ecf20Sopenharmony_ci MT_PLE_BASE, 168c2ecf20Sopenharmony_ci MT_PSE_BASE, 178c2ecf20Sopenharmony_ci MT_CFG_BASE, 188c2ecf20Sopenharmony_ci MT_AGG_BASE, 198c2ecf20Sopenharmony_ci MT_TMAC_BASE, 208c2ecf20Sopenharmony_ci MT_RMAC_BASE, 218c2ecf20Sopenharmony_ci MT_DMA_BASE, 228c2ecf20Sopenharmony_ci MT_PF_BASE, 238c2ecf20Sopenharmony_ci MT_WTBL_BASE_ON, 248c2ecf20Sopenharmony_ci MT_WTBL_BASE_OFF, 258c2ecf20Sopenharmony_ci MT_LPON_BASE, 268c2ecf20Sopenharmony_ci MT_MIB_BASE, 278c2ecf20Sopenharmony_ci MT_WTBL_BASE_ADDR, 288c2ecf20Sopenharmony_ci MT_PCIE_REMAP_BASE2, 298c2ecf20Sopenharmony_ci MT_TOP_MISC_BASE, 308c2ecf20Sopenharmony_ci MT_EFUSE_ADDR_BASE, 318c2ecf20Sopenharmony_ci MT_PP_BASE, 328c2ecf20Sopenharmony_ci __MT_BASE_MAX, 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define MT_HW_INFO_BASE ((dev)->reg_map[MT_HW_BASE]) 368c2ecf20Sopenharmony_ci#define MT_HW_INFO(ofs) (MT_HW_INFO_BASE + (ofs)) 378c2ecf20Sopenharmony_ci#define MT_HW_REV MT_HW_INFO(0x000) 388c2ecf20Sopenharmony_ci#define MT_HW_CHIPID MT_HW_INFO(0x008) 398c2ecf20Sopenharmony_ci#define MT_TOP_STRAP_STA MT_HW_INFO(0x010) 408c2ecf20Sopenharmony_ci#define MT_TOP_3NSS BIT(24) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define MT_TOP_OFF_RSV 0x1128 438c2ecf20Sopenharmony_ci#define MT_TOP_OFF_RSV_FW_STATE GENMASK(18, 16) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define MT_TOP_MISC2 ((dev)->reg_map[MT_TOP_CFG_BASE] + 0x134) 468c2ecf20Sopenharmony_ci#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define MT7663_TOP_MISC2_FW_STATE GENMASK(3, 1) 498c2ecf20Sopenharmony_ci#define MT_TOP_MISC2_FW_PWR_ON BIT(1) 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define MT_MCU_BASE 0x2000 528c2ecf20Sopenharmony_ci#define MT_MCU(ofs) (MT_MCU_BASE + (ofs)) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1 MT_MCU(0x500) 558c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1_OFFSET GENMASK(17, 0) 568c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1_BASE GENMASK(31, 18) 578c2ecf20Sopenharmony_ci#define MT_PCIE_REMAP_BASE_1 0x40000 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2 ((dev)->reg_map[MT_PCIE_REMAP_2]) 608c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2_OFFSET GENMASK(18, 0) 618c2ecf20Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2_BASE GENMASK(31, 19) 628c2ecf20Sopenharmony_ci#define MT_PCIE_REMAP_BASE_2 ((dev)->reg_map[MT_PCIE_REMAP_BASE2]) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define MT_HIF(ofs) ((dev)->reg_map[MT_HIF_BASE] + (ofs)) 658c2ecf20Sopenharmony_ci#define MT_HIF_RST MT_HIF(0x100) 668c2ecf20Sopenharmony_ci#define MT_HIF_LOGIC_RST_N BIT(4) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#define MT_PDMA_SLP_PROT MT_HIF(0x154) 698c2ecf20Sopenharmony_ci#define MT_PDMA_AXI_SLPPROT_ENABLE BIT(0) 708c2ecf20Sopenharmony_ci#define MT_PDMA_AXI_SLPPROT_RDY BIT(16) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define MT_PDMA_BUSY_STATUS MT_HIF(0x168) 738c2ecf20Sopenharmony_ci#define MT_PDMA_TX_IDX_BUSY BIT(2) 748c2ecf20Sopenharmony_ci#define MT_PDMA_BUSY_IDX BIT(31) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define MT_WPDMA_TX_RING0_CTRL0 MT_HIF(0x300) 778c2ecf20Sopenharmony_ci#define MT_WPDMA_TX_RING0_CTRL1 MT_HIF(0x304) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define MT7663_MCU_PCIE_REMAP_2_OFFSET GENMASK(15, 0) 808c2ecf20Sopenharmony_ci#define MT7663_MCU_PCIE_REMAP_2_BASE GENMASK(31, 16) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define MT_HIF2_BASE 0xf0000 838c2ecf20Sopenharmony_ci#define MT_HIF2(ofs) (MT_HIF2_BASE + (ofs)) 848c2ecf20Sopenharmony_ci#define MT_PCIE_IRQ_ENABLE MT_HIF2(0x188) 858c2ecf20Sopenharmony_ci#define MT_PCIE_DOORBELL_PUSH MT_HIF2(0x1484) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define MT_CFG_LPCR_HOST MT_HIF(0x1f0) 888c2ecf20Sopenharmony_ci#define MT_CFG_LPCR_HOST_FW_OWN BIT(0) 898c2ecf20Sopenharmony_ci#define MT_CFG_LPCR_HOST_DRV_OWN BIT(1) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT MT_HIF(0x1f8) 928c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_PDMA_STOPPED BIT(0) 938c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_PDMA_INIT BIT(1) 948c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2) 958c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_RESET_DONE BIT(3) 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define MT_INT_SOURCE_CSR MT_HIF(0x200) 988c2ecf20Sopenharmony_ci#define MT_INT_MASK_CSR MT_HIF(0x204) 998c2ecf20Sopenharmony_ci#define MT_DELAY_INT_CFG MT_HIF(0x210) 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE(_n) BIT(_n) 1028c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_ALL GENMASK(1, 0) 1038c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_ALL GENMASK(19, 4) 1048c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE(_n) BIT((_n) + 4) 1058c2ecf20Sopenharmony_ci#define MT_INT_MCU_CMD BIT(30) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG MT_HIF(0x208) 1088c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0) 1098c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1) 1108c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2) 1118c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3) 1128c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4) 1138c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6) 1148c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7) 1158c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0 BIT(9) 1168c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_BYPASS_TX_SCH BIT(9) /* MT7622 */ 1178c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 1188c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 1198c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT21 GENMASK(23, 22) 1208c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_SW_RESET BIT(24) 1218c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 1228c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci#define MT_WPDMA_RST_IDX MT_HIF(0x20c) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define MT_WPDMA_MEM_RNG_ERR MT_HIF(0x224) 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define MT_MCU_CMD MT_HIF(0x234) 1298c2ecf20Sopenharmony_ci#define MT_MCU_CMD_CLEAR_FW_OWN BIT(0) 1308c2ecf20Sopenharmony_ci#define MT_MCU_CMD_STOP_PDMA_FW_RELOAD BIT(1) 1318c2ecf20Sopenharmony_ci#define MT_MCU_CMD_STOP_PDMA BIT(2) 1328c2ecf20Sopenharmony_ci#define MT_MCU_CMD_RESET_DONE BIT(3) 1338c2ecf20Sopenharmony_ci#define MT_MCU_CMD_RECOVERY_DONE BIT(4) 1348c2ecf20Sopenharmony_ci#define MT_MCU_CMD_NORMAL_STATE BIT(5) 1358c2ecf20Sopenharmony_ci#define MT_MCU_CMD_LMAC_ERROR BIT(24) 1368c2ecf20Sopenharmony_ci#define MT_MCU_CMD_PSE_ERROR BIT(25) 1378c2ecf20Sopenharmony_ci#define MT_MCU_CMD_PLE_ERROR BIT(26) 1388c2ecf20Sopenharmony_ci#define MT_MCU_CMD_PDMA_ERROR BIT(27) 1398c2ecf20Sopenharmony_ci#define MT_MCU_CMD_PCIE_ERROR BIT(28) 1408c2ecf20Sopenharmony_ci#define MT_MCU_CMD_ERROR_MASK (GENMASK(5, 1) | GENMASK(28, 24)) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define MT_TX_RING_BASE MT_HIF(0x300) 1438c2ecf20Sopenharmony_ci#define MT_RX_RING_BASE MT_HIF(0x400) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define MT_WPDMA_GLO_CFG1 MT_HIF(0x500) 1468c2ecf20Sopenharmony_ci#define MT_WPDMA_TX_PRE_CFG MT_HIF(0x510) 1478c2ecf20Sopenharmony_ci#define MT_WPDMA_RX_PRE_CFG MT_HIF(0x520) 1488c2ecf20Sopenharmony_ci#define MT_WPDMA_ABT_CFG MT_HIF(0x530) 1498c2ecf20Sopenharmony_ci#define MT_WPDMA_ABT_CFG1 MT_HIF(0x534) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci#define MT_CSR(ofs) ((dev)->reg_map[MT_CSR_BASE] + (ofs)) 1528c2ecf20Sopenharmony_ci#define MT_CONN_HIF_ON_LPCTL MT_CSR(0x000) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define MT_PLE(ofs) ((dev)->reg_map[MT_PLE_BASE] + (ofs)) 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#define MT_PLE_PG_HIF0_GROUP MT_PLE(0x110) 1578c2ecf20Sopenharmony_ci#define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 1588c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) 1598c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) 1608c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) 1618c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ 1648c2ecf20Sopenharmony_ci ((n) << 2)) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#define MT_PSE(ofs) ((dev)->reg_map[MT_PSE_BASE] + (ofs)) 1678c2ecf20Sopenharmony_ci#define MT_PSE_PG_HIF0_GROUP MT_PSE(0x110) 1688c2ecf20Sopenharmony_ci#define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 1698c2ecf20Sopenharmony_ci#define MT_PSE_PG_HIF1_GROUP MT_PSE(0x118) 1708c2ecf20Sopenharmony_ci#define MT_HIF1_MIN_QUOTA GENMASK(11, 0) 1718c2ecf20Sopenharmony_ci#define MT_PSE_QUEUE_EMPTY MT_PSE(0x0b4) 1728c2ecf20Sopenharmony_ci#define MT_HIF_0_EMPTY_MASK BIT(16) 1738c2ecf20Sopenharmony_ci#define MT_HIF_1_EMPTY_MASK BIT(17) 1748c2ecf20Sopenharmony_ci#define MT_HIF_ALL_EMPTY_MASK GENMASK(17, 16) 1758c2ecf20Sopenharmony_ci#define MT_PSE_PG_INFO MT_PSE(0x194) 1768c2ecf20Sopenharmony_ci#define MT_PSE_SRC_CNT GENMASK(27, 16) 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci#define MT_PP(ofs) ((dev)->reg_map[MT_PP_BASE] + (ofs)) 1798c2ecf20Sopenharmony_ci#define MT_PP_TXDWCNT MT_PP(0x0) 1808c2ecf20Sopenharmony_ci#define MT_PP_TXDWCNT_TX0_ADD_DW_CNT GENMASK(7, 0) 1818c2ecf20Sopenharmony_ci#define MT_PP_TXDWCNT_TX1_ADD_DW_CNT GENMASK(15, 8) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define MT_WF_PHY_BASE 0x82070000 1848c2ecf20Sopenharmony_ci#define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs)) 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define MT_WF_PHY_WF2_RFCTRL0(n) MT_WF_PHY(0x1900 + (n) * 0x400) 1878c2ecf20Sopenharmony_ci#define MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN BIT(9) 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define MT_WF_PHY_R0_PHYMUX_5(_phy) MT_WF_PHY(0x0614 + ((_phy) << 9)) 1908c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYMUX_5 MT_WF_PHY(0x0414) 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#define MT_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x020c + ((_phy) << 9)) 1938c2ecf20Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_PD_OFDM GENMASK(31, 16) 1948c2ecf20Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_PD_CCK GENMASK(15, 0) 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x0210 + ((_phy) << 12)) 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci#define MT_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0220 + ((_phy) << 9)) 1998c2ecf20Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_MDRDY_OFDM GENMASK(31, 16) 2008c2ecf20Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_MDRDY_CCK GENMASK(15, 0) 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0224 + ((_phy) << 12)) 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci#define MT_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x084 : 0x229c) 2058c2ecf20Sopenharmony_ci#define MT_WF_PHY_PD_OFDM_MASK(_phy) ((_phy) ? GENMASK(24, 16) : \ 2068c2ecf20Sopenharmony_ci GENMASK(28, 20)) 2078c2ecf20Sopenharmony_ci#define MT_WF_PHY_PD_OFDM(_phy, v) ((v) << ((_phy) ? 16 : 20)) 2088c2ecf20Sopenharmony_ci#define MT_WF_PHY_PD_BLK(_phy) ((_phy) ? BIT(25) : BIT(19)) 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x2aec : 0x22f0) 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci#define MT_WF_PHY_RXTD_BASE MT_WF_PHY(0x2200) 2138c2ecf20Sopenharmony_ci#define MT_WF_PHY_RXTD(_n) (MT_WF_PHY_RXTD_BASE + ((_n) << 2)) 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_RXTD(_n) (MT_WF_PHY(0x25b0) + ((_n) << 2)) 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci#define MT_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2314 : 0x2310) 2188c2ecf20Sopenharmony_ci#define MT_WF_PHY_PD_CCK_MASK(_phy) (_phy) ? GENMASK(31, 24) : \ 2198c2ecf20Sopenharmony_ci GENMASK(8, 1) 2208c2ecf20Sopenharmony_ci#define MT_WF_PHY_PD_CCK(_phy, v) ((v) << ((_phy) ? 24 : 1)) 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define MT7663_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2350 : 0x234c) 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci#define MT_WF_PHY_RXTD2_BASE MT_WF_PHY(0x2a00) 2258c2ecf20Sopenharmony_ci#define MT_WF_PHY_RXTD2(_n) (MT_WF_PHY_RXTD2_BASE + ((_n) << 2)) 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci#define MT_WF_PHY_RFINTF3_0(_n) MT_WF_PHY(0x1100 + (_n) * 0x400) 2288c2ecf20Sopenharmony_ci#define MT_WF_PHY_RFINTF3_0_ANT GENMASK(7, 4) 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci#define MT_WF_CFG_BASE ((dev)->reg_map[MT_CFG_BASE]) 2318c2ecf20Sopenharmony_ci#define MT_WF_CFG(ofs) (MT_WF_CFG_BASE + (ofs)) 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci#define MT_CFG_CCR MT_WF_CFG(0x000) 2348c2ecf20Sopenharmony_ci#define MT_CFG_CCR_MAC_D1_1X_GC_EN BIT(24) 2358c2ecf20Sopenharmony_ci#define MT_CFG_CCR_MAC_D0_1X_GC_EN BIT(25) 2368c2ecf20Sopenharmony_ci#define MT_CFG_CCR_MAC_D1_2X_GC_EN BIT(30) 2378c2ecf20Sopenharmony_ci#define MT_CFG_CCR_MAC_D0_2X_GC_EN BIT(31) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define MT_WF_AGG_BASE ((dev)->reg_map[MT_AGG_BASE]) 2408c2ecf20Sopenharmony_ci#define MT_WF_AGG(ofs) (MT_WF_AGG_BASE + (ofs)) 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci#define MT_AGG_ARCR MT_WF_AGG(0x010) 2438c2ecf20Sopenharmony_ci#define MT_AGG_ARCR_INIT_RATE1 BIT(0) 2448c2ecf20Sopenharmony_ci#define MT_AGG_ARCR_RTS_RATE_THR GENMASK(12, 8) 2458c2ecf20Sopenharmony_ci#define MT_AGG_ARCR_RATE_DOWN_RATIO GENMASK(17, 16) 2468c2ecf20Sopenharmony_ci#define MT_AGG_ARCR_RATE_DOWN_RATIO_EN BIT(19) 2478c2ecf20Sopenharmony_ci#define MT_AGG_ARCR_RATE_UP_EXTRA_TH GENMASK(22, 20) 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci#define MT_AGG_ARUCR(_band) MT_WF_AGG(0x018 + (_band) * 0x100) 2508c2ecf20Sopenharmony_ci#define MT_AGG_ARDCR(_band) MT_WF_AGG(0x01c + (_band) * 0x100) 2518c2ecf20Sopenharmony_ci#define MT_AGG_ARxCR_LIMIT_SHIFT(_n) (4 * (_n)) 2528c2ecf20Sopenharmony_ci#define MT_AGG_ARxCR_LIMIT(_n) GENMASK(2 + \ 2538c2ecf20Sopenharmony_ci MT_AGG_ARxCR_LIMIT_SHIFT(_n), \ 2548c2ecf20Sopenharmony_ci MT_AGG_ARxCR_LIMIT_SHIFT(_n)) 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#define MT_AGG_ASRCR0 MT_WF_AGG(0x060) 2578c2ecf20Sopenharmony_ci#define MT_AGG_ASRCR1 MT_WF_AGG(0x064) 2588c2ecf20Sopenharmony_ci#define MT_AGG_ASRCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(5, 0)) 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci#define MT_AGG_ACR(_band) MT_WF_AGG(0x070 + (_band) * 0x100) 2618c2ecf20Sopenharmony_ci#define MT_AGG_ACR_NO_BA_RULE BIT(0) 2628c2ecf20Sopenharmony_ci#define MT_AGG_ACR_NO_BA_AR_RULE BIT(1) 2638c2ecf20Sopenharmony_ci#define MT_AGG_ACR_PKT_TIME_EN BIT(2) 2648c2ecf20Sopenharmony_ci#define MT_AGG_ACR_CFEND_RATE GENMASK(15, 4) 2658c2ecf20Sopenharmony_ci#define MT_AGG_ACR_BAR_RATE GENMASK(31, 20) 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci#define MT_AGG_SCR MT_WF_AGG(0x0fc) 2688c2ecf20Sopenharmony_ci#define MT_AGG_SCR_NLNAV_MID_PTEC_DIS BIT(3) 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci#define MT_WF_ARB_BASE ((dev)->reg_map[MT_ARB_BASE]) 2718c2ecf20Sopenharmony_ci#define MT_WF_ARB(ofs) (MT_WF_ARB_BASE + (ofs)) 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci#define MT_ARB_RQCR MT_WF_ARB(0x070) 2748c2ecf20Sopenharmony_ci#define MT_ARB_RQCR_RX_START BIT(0) 2758c2ecf20Sopenharmony_ci#define MT_ARB_RQCR_RXV_START BIT(4) 2768c2ecf20Sopenharmony_ci#define MT_ARB_RQCR_RXV_R_EN BIT(7) 2778c2ecf20Sopenharmony_ci#define MT_ARB_RQCR_RXV_T_EN BIT(8) 2788c2ecf20Sopenharmony_ci#define MT_ARB_RQCR_BAND_SHIFT 16 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci#define MT_ARB_SCR MT_WF_ARB(0x080) 2818c2ecf20Sopenharmony_ci#define MT_ARB_SCR_TX0_DISABLE BIT(8) 2828c2ecf20Sopenharmony_ci#define MT_ARB_SCR_RX0_DISABLE BIT(9) 2838c2ecf20Sopenharmony_ci#define MT_ARB_SCR_TX1_DISABLE BIT(10) 2848c2ecf20Sopenharmony_ci#define MT_ARB_SCR_RX1_DISABLE BIT(11) 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci#define MT_WF_TMAC_BASE ((dev)->reg_map[MT_TMAC_BASE]) 2878c2ecf20Sopenharmony_ci#define MT_WF_TMAC(ofs) (MT_WF_TMAC_BASE + (ofs)) 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci#define MT_TMAC_CDTR MT_WF_TMAC(0x090) 2908c2ecf20Sopenharmony_ci#define MT_TMAC_ODTR MT_WF_TMAC(0x094) 2918c2ecf20Sopenharmony_ci#define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0) 2928c2ecf20Sopenharmony_ci#define MT_TIMEOUT_VAL_CCA GENMASK(31, 16) 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci#define MT_TMAC_TRCR(_band) MT_WF_TMAC((_band) ? 0x070 : 0x09c) 2958c2ecf20Sopenharmony_ci#define MT_TMAC_TRCR_CCA_SEL GENMASK(31, 30) 2968c2ecf20Sopenharmony_ci#define MT_TMAC_TRCR_SEC_CCA_SEL GENMASK(29, 28) 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci#define MT_TMAC_ICR(_band) MT_WF_TMAC((_band) ? 0x074 : 0x0a4) 2998c2ecf20Sopenharmony_ci#define MT_IFS_EIFS GENMASK(8, 0) 3008c2ecf20Sopenharmony_ci#define MT_IFS_RIFS GENMASK(14, 10) 3018c2ecf20Sopenharmony_ci#define MT_IFS_SIFS GENMASK(22, 16) 3028c2ecf20Sopenharmony_ci#define MT_IFS_SLOT GENMASK(30, 24) 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0 MT_WF_TMAC(0x0f4) 3058c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0) 3068c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_DENSITY GENMASK(15, 12) 3078c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17) 3088c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18) 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci#define MT_WF_RMAC_BASE ((dev)->reg_map[MT_RMAC_BASE]) 3118c2ecf20Sopenharmony_ci#define MT_WF_RMAC(ofs) (MT_WF_RMAC_BASE + (ofs)) 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define MT_WF_RFCR(_band) MT_WF_RMAC((_band) ? 0x100 : 0x000) 3148c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_STBC_MULTI BIT(0) 3158c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_FCSFAIL BIT(1) 3168c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_VERSION BIT(3) 3178c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_PROBEREQ BIT(4) 3188c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST BIT(5) 3198c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_BCAST BIT(6) 3208c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7) 3218c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_MAC BIT(8) 3228c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_BSSID BIT(9) 3238c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A2_BSSID BIT(10) 3248c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11) 3258c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12) 3268c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_CTL_RSV BIT(13) 3278c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_CTS BIT(14) 3288c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_RTS BIT(15) 3298c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_DUPLICATE BIT(16) 3308c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BSS BIT(17) 3318c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_UC BIT(18) 3328c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_TIM BIT(19) 3338c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_NDPA BIT(20) 3348c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21) 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci#define MT_WF_RFCR1(_band) MT_WF_RMAC((_band) ? 0x104 : 0x004) 3378c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_ACK BIT(4) 3388c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_BF_POLL BIT(5) 3398c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_BA BIT(6) 3408c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFEND BIT(7) 3418c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFACK BIT(8) 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci#define MT_CHFREQ(_band) MT_WF_RMAC((_band) ? 0x130 : 0x030) 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME0 MT_WF_RMAC(0x03c4) 3468c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31) 3478c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_EN BIT(30) 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME0 MT_WF_RMAC(0x0380) 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME5 MT_WF_RMAC(0x03d8) 3528c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME6 MT_WF_RMAC(0x03dc) 3538c2ecf20Sopenharmony_ci#define MT_MIB_OBSSTIME_MASK GENMASK(23, 0) 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci#define MT_WF_DMA_BASE ((dev)->reg_map[MT_DMA_BASE]) 3568c2ecf20Sopenharmony_ci#define MT_WF_DMA(ofs) (MT_WF_DMA_BASE + (ofs)) 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci#define MT_DMA_DCR0 MT_WF_DMA(0x000) 3598c2ecf20Sopenharmony_ci#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 2) 3608c2ecf20Sopenharmony_ci#define MT_DMA_DCR0_RX_VEC_DROP BIT(17) 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0(_band) MT_WF_DMA(0x070 + (_band) * 0x40) 3638c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_MGMT BIT(2) 3648c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR BIT(3) 3658c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_CTL_BAR BIT(4) 3668c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_TDLS BIT(19) 3678c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_BYPASS BIT(21) 3688c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_RX_DROPPED_UCAST GENMASK(25, 24) 3698c2ecf20Sopenharmony_ci#define MT_DMA_RCFR0_RX_DROPPED_MCAST GENMASK(27, 26) 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci#define MT_WF_PF_BASE ((dev)->reg_map[MT_PF_BASE]) 3728c2ecf20Sopenharmony_ci#define MT_WF_PF(ofs) (MT_WF_PF_BASE + (ofs)) 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci#define MT_WF_PFCR MT_WF_PF(0x000) 3758c2ecf20Sopenharmony_ci#define MT_WF_PFCR_TDLS_EN BIT(9) 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define MT_WTBL_BASE(dev) ((dev)->reg_map[MT_WTBL_BASE_ADDR]) 3788c2ecf20Sopenharmony_ci#define MT_WTBL_ENTRY_SIZE 256 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci#define MT_WTBL_OFF_BASE ((dev)->reg_map[MT_WTBL_BASE_OFF]) 3818c2ecf20Sopenharmony_ci#define MT_WTBL_OFF(n) (MT_WTBL_OFF_BASE + (n)) 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci#define MT_WTBL_W0_KEY_IDX GENMASK(24, 23) 3848c2ecf20Sopenharmony_ci#define MT_WTBL_W0_RX_KEY_VALID BIT(26) 3858c2ecf20Sopenharmony_ci#define MT_WTBL_W0_RX_IK_VALID BIT(27) 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci#define MT_WTBL_W2_KEY_TYPE GENMASK(7, 4) 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE MT_WTBL_OFF(0x030) 3908c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(7, 0) 3918c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_RXINFO_UPDATE BIT(11) 3928c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12) 3938c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_RATE_UPDATE BIT(13) 3948c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_TX_COUNT_CLEAR BIT(14) 3958c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_BUSY BIT(31) 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci#define MT_TOP_MISC(ofs) ((dev)->reg_map[MT_TOP_MISC_BASE] + (ofs)) 3988c2ecf20Sopenharmony_ci#define MT_CONN_ON_MISC MT_TOP_MISC(0x1140) 3998c2ecf20Sopenharmony_ci#define MT_TOP_MISC2_FW_N9_RDY BIT(2) 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci#define MT_WTBL_ON_BASE ((dev)->reg_map[MT_WTBL_BASE_ON]) 4028c2ecf20Sopenharmony_ci#define MT_WTBL_ON(_n) (MT_WTBL_ON_BASE + (_n)) 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci#define MT_WTBL_RICR0 MT_WTBL_ON(0x010) 4058c2ecf20Sopenharmony_ci#define MT_WTBL_RICR1 MT_WTBL_ON(0x014) 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR0 MT_WTBL_ON(0x020) 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR1 MT_WTBL_ON(0x024) 4108c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE0 GENMASK(11, 0) 4118c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE1 GENMASK(23, 12) 4128c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE2_LO GENMASK(31, 24) 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR2 MT_WTBL_ON(0x028) 4158c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE2_HI GENMASK(3, 0) 4168c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE3 GENMASK(15, 4) 4178c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE4 GENMASK(27, 16) 4188c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE5_LO GENMASK(31, 28) 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR3 MT_WTBL_ON(0x02c) 4218c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE5_HI GENMASK(7, 0) 4228c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE6 GENMASK(19, 8) 4238c2ecf20Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE7 GENMASK(31, 20) 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_ci#define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5) 4268c2ecf20Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_20 BIT(8) 4278c2ecf20Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_40 BIT(9) 4288c2ecf20Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_80 BIT(10) 4298c2ecf20Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_160 BIT(11) 4308c2ecf20Sopenharmony_ci#define MT_WTBL_W5_BW_CAP GENMASK(13, 12) 4318c2ecf20Sopenharmony_ci#define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23) 4328c2ecf20Sopenharmony_ci#define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26) 4338c2ecf20Sopenharmony_ci#define MT_WTBL_W5_RATE_IDX GENMASK(31, 29) 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_ci#define MT_WTBL_W27_CC_BW_SEL GENMASK(6, 5) 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci#define MT_LPON(_n) ((dev)->reg_map[MT_LPON_BASE] + (_n)) 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci#define MT_LPON_T0CR MT_LPON(0x010) 4408c2ecf20Sopenharmony_ci#define MT_LPON_T0CR_MODE GENMASK(1, 0) 4418c2ecf20Sopenharmony_ci#define MT_LPON_T0CR_WRITE BIT(0) 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_ci#define MT_LPON_UTTR0 MT_LPON(0x018) 4448c2ecf20Sopenharmony_ci#define MT_LPON_UTTR1 MT_LPON(0x01c) 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci#define MT_WF_MIB_BASE (dev->reg_map[MT_MIB_BASE]) 4478c2ecf20Sopenharmony_ci#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE + (ofs) + (_band) * 0x200) 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci#define MT_WF_MIB_SCR0 MT_WF_MIB(0, 0) 4508c2ecf20Sopenharmony_ci#define MT_MIB_SCR0_AGG_CNT_RANGE_EN BIT(21) 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci#define MT_MIB_M0_MISC_CR(_band) MT_WF_MIB(_band, 0x00c) 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci#define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x014) 4558c2ecf20Sopenharmony_ci#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0) 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci#define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c) 4588c2ecf20Sopenharmony_ci#define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0) 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci#define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x040) 4618c2ecf20Sopenharmony_ci#define MT_MIB_AMPDU_MPDU_COUNT GENMASK(23, 0) 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci#define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x044) 4648c2ecf20Sopenharmony_ci#define MT_MIB_AMPDU_ACK_COUNT GENMASK(23, 0) 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci#define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048) 4678c2ecf20Sopenharmony_ci#define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0) 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci#define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x098) 4708c2ecf20Sopenharmony_ci#define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0) 4718c2ecf20Sopenharmony_ci#define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x09c) 4728c2ecf20Sopenharmony_ci#define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0) 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci#define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4)) 4758c2ecf20Sopenharmony_ci#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16) 4768c2ecf20Sopenharmony_ci#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci#define MT_MIB_MB_SDR1(_band, n) MT_WF_MIB(_band, 0x104 + ((n) << 4)) 4798c2ecf20Sopenharmony_ci#define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0) 4808c2ecf20Sopenharmony_ci#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16) 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci#define MT_MIB_ARNG(n) MT_WF_MIB(0, 0x4b8 + ((n) << 2)) 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0xa8 + ((n) << 2)) 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci#define MT_DMA_SHDL(ofs) (dev->reg_map[MT_DMA_SHDL_BASE] + (ofs)) 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci#define MT_DMASHDL_BASE 0x5000a000 4898c2ecf20Sopenharmony_ci#define MT_DMASHDL_OPTIONAL 0x008 4908c2ecf20Sopenharmony_ci#define MT_DMASHDL_PAGE 0x00c 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci#define MT_DMASHDL_REFILL 0x010 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE 0x01c 4958c2ecf20Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0) 4968c2ecf20Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16) 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA(_n) (0x020 + ((_n) << 2)) 4998c2ecf20Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0) 5008c2ecf20Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16) 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci#define MT_DMASHDL_SCHED_SET0 0x0b0 5038c2ecf20Sopenharmony_ci#define MT_DMASHDL_SCHED_SET1 0x0b4 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci#define MT_DMASHDL_Q_MAP(_n) (0x0d0 + ((_n) << 2)) 5068c2ecf20Sopenharmony_ci#define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0) 5078c2ecf20Sopenharmony_ci#define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8)) 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci#define MT_LED_BASE_PHYS 0x80024000 5108c2ecf20Sopenharmony_ci#define MT_LED_PHYS(_n) (MT_LED_BASE_PHYS + (_n)) 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci#define MT_LED_CTRL MT_LED_PHYS(0x00) 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci#define MT_LED_CTRL_REPLAY(_n) BIT(0 + (8 * (_n))) 5158c2ecf20Sopenharmony_ci#define MT_LED_CTRL_POLARITY(_n) BIT(1 + (8 * (_n))) 5168c2ecf20Sopenharmony_ci#define MT_LED_CTRL_TX_BLINK_MODE(_n) BIT(2 + (8 * (_n))) 5178c2ecf20Sopenharmony_ci#define MT_LED_CTRL_TX_MANUAL_BLINK(_n) BIT(3 + (8 * (_n))) 5188c2ecf20Sopenharmony_ci#define MT_LED_CTRL_TX_OVER_BLINK(_n) BIT(5 + (8 * (_n))) 5198c2ecf20Sopenharmony_ci#define MT_LED_CTRL_KICK(_n) BIT(7 + (8 * (_n))) 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci#define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x10 + ((_n) * 8)) 5228c2ecf20Sopenharmony_ci#define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x14 + ((_n) * 8)) 5238c2ecf20Sopenharmony_ci#define MT_LED_STATUS_OFF GENMASK(31, 24) 5248c2ecf20Sopenharmony_ci#define MT_LED_STATUS_ON GENMASK(23, 16) 5258c2ecf20Sopenharmony_ci#define MT_LED_STATUS_DURATION GENMASK(15, 0) 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci#define MT_PDMA_BUSY 0x82000504 5288c2ecf20Sopenharmony_ci#define MT_PDMA_TX_BUSY BIT(0) 5298c2ecf20Sopenharmony_ci#define MT_PDMA_RX_BUSY BIT(1) 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci#define MT_EFUSE_BASE ((dev)->reg_map[MT_EFUSE_ADDR_BASE]) 5328c2ecf20Sopenharmony_ci#define MT_EFUSE_BASE_CTRL 0x000 5338c2ecf20Sopenharmony_ci#define MT_EFUSE_BASE_CTRL_EMPTY BIT(30) 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL 0x008 5368c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_AOUT GENMASK(5, 0) 5378c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_MODE GENMASK(7, 6) 5388c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8) 5398c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14) 5408c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_AIN GENMASK(25, 16) 5418c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_VALID BIT(29) 5428c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_KICK BIT(30) 5438c2ecf20Sopenharmony_ci#define MT_EFUSE_CTRL_SEL BIT(31) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#define MT_EFUSE_WDATA(_i) (0x010 + ((_i) * 4)) 5468c2ecf20Sopenharmony_ci#define MT_EFUSE_RDATA(_i) (0x030 + ((_i) * 4)) 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci/* INFRACFG host register range on MT7622 */ 5498c2ecf20Sopenharmony_ci#define MT_INFRACFG_MISC 0x700 5508c2ecf20Sopenharmony_ci#define MT_INFRACFG_MISC_AP2CONN_WAKE BIT(1) 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci#define MT_UMAC_BASE 0x7c000000 5538c2ecf20Sopenharmony_ci#define MT_UMAC(ofs) (MT_UMAC_BASE + (ofs)) 5548c2ecf20Sopenharmony_ci#define MT_UDMA_TX_QSEL MT_UMAC(0x008) 5558c2ecf20Sopenharmony_ci#define MT_FW_DL_EN BIT(3) 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci#define MT_UDMA_WLCFG_1 MT_UMAC(0x00c) 5588c2ecf20Sopenharmony_ci#define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0) 5598c2ecf20Sopenharmony_ci#define MT_WL_TX_TMOUT_LMT GENMASK(27, 8) 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci#define MT_UDMA_WLCFG_0 MT_UMAC(0x18) 5628c2ecf20Sopenharmony_ci#define MT_WL_RX_AGG_TO GENMASK(7, 0) 5638c2ecf20Sopenharmony_ci#define MT_WL_RX_AGG_LMT GENMASK(15, 8) 5648c2ecf20Sopenharmony_ci#define MT_WL_TX_TMOUT_FUNC_EN BIT(16) 5658c2ecf20Sopenharmony_ci#define MT_WL_TX_DPH_CHK_EN BIT(17) 5668c2ecf20Sopenharmony_ci#define MT_WL_RX_MPSZ_PAD0 BIT(18) 5678c2ecf20Sopenharmony_ci#define MT_WL_RX_FLUSH BIT(19) 5688c2ecf20Sopenharmony_ci#define MT_TICK_1US_EN BIT(20) 5698c2ecf20Sopenharmony_ci#define MT_WL_RX_AGG_EN BIT(21) 5708c2ecf20Sopenharmony_ci#define MT_WL_RX_EN BIT(22) 5718c2ecf20Sopenharmony_ci#define MT_WL_TX_EN BIT(23) 5728c2ecf20Sopenharmony_ci#define MT_WL_RX_BUSY BIT(30) 5738c2ecf20Sopenharmony_ci#define MT_WL_TX_BUSY BIT(31) 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci#define MT_MCU_PTA_BASE 0x81060000 5768c2ecf20Sopenharmony_ci#define MT_MCU_PTA(_n) (MT_MCU_PTA_BASE + (_n)) 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci#define MT_ANT_SWITCH_CON(_n) MT_MCU_PTA(0x0c8 + ((_n) - 1) * 4) 5798c2ecf20Sopenharmony_ci#define MT_ANT_SWITCH_CON_MODE(_n) (GENMASK(4, 0) << (_n * 8)) 5808c2ecf20Sopenharmony_ci#define MT_ANT_SWITCH_CON_MODE1(_n) (GENMASK(3, 0) << (_n * 8)) 5818c2ecf20Sopenharmony_ci 5828c2ecf20Sopenharmony_ci#endif 583