162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 262306a36Sopenharmony_ci/* Copyright (C) 2019 MediaTek Inc. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __MT7615_REGS_H 562306a36Sopenharmony_ci#define __MT7615_REGS_H 662306a36Sopenharmony_ci 762306a36Sopenharmony_cienum mt7615_reg_base { 862306a36Sopenharmony_ci MT_TOP_CFG_BASE, 962306a36Sopenharmony_ci MT_HW_BASE, 1062306a36Sopenharmony_ci MT_DMA_SHDL_BASE, 1162306a36Sopenharmony_ci MT_PCIE_REMAP_2, 1262306a36Sopenharmony_ci MT_ARB_BASE, 1362306a36Sopenharmony_ci MT_HIF_BASE, 1462306a36Sopenharmony_ci MT_CSR_BASE, 1562306a36Sopenharmony_ci MT_PLE_BASE, 1662306a36Sopenharmony_ci MT_PSE_BASE, 1762306a36Sopenharmony_ci MT_CFG_BASE, 1862306a36Sopenharmony_ci MT_AGG_BASE, 1962306a36Sopenharmony_ci MT_TMAC_BASE, 2062306a36Sopenharmony_ci MT_RMAC_BASE, 2162306a36Sopenharmony_ci MT_DMA_BASE, 2262306a36Sopenharmony_ci MT_PF_BASE, 2362306a36Sopenharmony_ci MT_WTBL_BASE_ON, 2462306a36Sopenharmony_ci MT_WTBL_BASE_OFF, 2562306a36Sopenharmony_ci MT_LPON_BASE, 2662306a36Sopenharmony_ci MT_MIB_BASE, 2762306a36Sopenharmony_ci MT_WTBL_BASE_ADDR, 2862306a36Sopenharmony_ci MT_PCIE_REMAP_BASE2, 2962306a36Sopenharmony_ci MT_TOP_MISC_BASE, 3062306a36Sopenharmony_ci MT_EFUSE_ADDR_BASE, 3162306a36Sopenharmony_ci MT_PP_BASE, 3262306a36Sopenharmony_ci __MT_BASE_MAX, 3362306a36Sopenharmony_ci}; 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define MT_HW_INFO_BASE ((dev)->reg_map[MT_HW_BASE]) 3662306a36Sopenharmony_ci#define MT_HW_INFO(ofs) (MT_HW_INFO_BASE + (ofs)) 3762306a36Sopenharmony_ci#define MT_HW_REV MT_HW_INFO(0x000) 3862306a36Sopenharmony_ci#define MT_HW_CHIPID MT_HW_INFO(0x008) 3962306a36Sopenharmony_ci#define MT_TOP_STRAP_STA MT_HW_INFO(0x010) 4062306a36Sopenharmony_ci#define MT_TOP_3NSS BIT(24) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define MT_TOP_OFF_RSV 0x1128 4362306a36Sopenharmony_ci#define MT_TOP_OFF_RSV_FW_STATE GENMASK(18, 16) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define MT_TOP_MISC2 ((dev)->reg_map[MT_TOP_CFG_BASE] + 0x134) 4662306a36Sopenharmony_ci#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define MT7663_TOP_MISC2_FW_STATE GENMASK(3, 1) 4962306a36Sopenharmony_ci#define MT_TOP_MISC2_FW_PWR_ON BIT(1) 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define MT_MCU_BASE 0x2000 5262306a36Sopenharmony_ci#define MT_MCU(ofs) (MT_MCU_BASE + (ofs)) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1 MT_MCU(0x500) 5562306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1_OFFSET GENMASK(17, 0) 5662306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_1_BASE GENMASK(31, 18) 5762306a36Sopenharmony_ci#define MT_PCIE_REMAP_BASE_1 0x40000 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2 ((dev)->reg_map[MT_PCIE_REMAP_2]) 6062306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2_OFFSET GENMASK(18, 0) 6162306a36Sopenharmony_ci#define MT_MCU_PCIE_REMAP_2_BASE GENMASK(31, 19) 6262306a36Sopenharmony_ci#define MT_PCIE_REMAP_BASE_2 ((dev)->reg_map[MT_PCIE_REMAP_BASE2]) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define MT_MCU_CIRQ_BASE 0xc0000 6562306a36Sopenharmony_ci#define MT_MCU_CIRQ(ofs) (MT_MCU_CIRQ_BASE + (ofs)) 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define MT_MCU_CIRQ_IRQ_SEL(n) MT_MCU_CIRQ((n) << 2) 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define MT_HIF(ofs) ((dev)->reg_map[MT_HIF_BASE] + (ofs)) 7062306a36Sopenharmony_ci#define MT_HIF_RST MT_HIF(0x100) 7162306a36Sopenharmony_ci#define MT_HIF_LOGIC_RST_N BIT(4) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define MT_PDMA_SLP_PROT MT_HIF(0x154) 7462306a36Sopenharmony_ci#define MT_PDMA_AXI_SLPPROT_ENABLE BIT(0) 7562306a36Sopenharmony_ci#define MT_PDMA_AXI_SLPPROT_RDY BIT(16) 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define MT_PDMA_BUSY_STATUS MT_HIF(0x168) 7862306a36Sopenharmony_ci#define MT_PDMA_TX_IDX_BUSY BIT(2) 7962306a36Sopenharmony_ci#define MT_PDMA_BUSY_IDX BIT(31) 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci#define MT_WPDMA_TX_RING0_CTRL0 MT_HIF(0x300) 8262306a36Sopenharmony_ci#define MT_WPDMA_TX_RING0_CTRL1 MT_HIF(0x304) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define MT7663_MCU_PCIE_REMAP_2_OFFSET GENMASK(15, 0) 8562306a36Sopenharmony_ci#define MT7663_MCU_PCIE_REMAP_2_BASE GENMASK(31, 16) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci#define MT_HIF2_BASE 0xf0000 8862306a36Sopenharmony_ci#define MT_HIF2(ofs) (MT_HIF2_BASE + (ofs)) 8962306a36Sopenharmony_ci#define MT_PCIE_IRQ_ENABLE MT_HIF2(0x188) 9062306a36Sopenharmony_ci#define MT_PCIE_DOORBELL_PUSH MT_HIF2(0x1484) 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#define MT_CFG_LPCR_HOST MT_HIF(0x1f0) 9362306a36Sopenharmony_ci#define MT_CFG_LPCR_HOST_FW_OWN BIT(0) 9462306a36Sopenharmony_ci#define MT_CFG_LPCR_HOST_DRV_OWN BIT(1) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define MT_MCU2HOST_INT_STATUS MT_HIF(0x1f0) 9762306a36Sopenharmony_ci#define MT_MCU2HOST_INT_ENABLE MT_HIF(0x1f4) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define MT7663_MCU_INT_EVENT MT_HIF(0x108) 10062306a36Sopenharmony_ci#define MT_MCU_INT_EVENT MT_HIF(0x1f8) 10162306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_PDMA_STOPPED BIT(0) 10262306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_PDMA_INIT BIT(1) 10362306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2) 10462306a36Sopenharmony_ci#define MT_MCU_INT_EVENT_RESET_DONE BIT(3) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#define MT_INT_SOURCE_CSR MT_HIF(0x200) 10762306a36Sopenharmony_ci#define MT_INT_MASK_CSR MT_HIF(0x204) 10862306a36Sopenharmony_ci#define MT_DELAY_INT_CFG MT_HIF(0x210) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define MT_INT_RX_DONE(_n) BIT(_n) 11162306a36Sopenharmony_ci#define MT_INT_RX_DONE_ALL GENMASK(1, 0) 11262306a36Sopenharmony_ci#define MT_INT_TX_DONE_ALL GENMASK(19, 4) 11362306a36Sopenharmony_ci#define MT_INT_TX_DONE(_n) BIT((_n) + 4) 11462306a36Sopenharmony_ci#define MT7663_INT_MCU_CMD BIT(29) 11562306a36Sopenharmony_ci#define MT_INT_MCU_CMD BIT(30) 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG MT_HIF(0x208) 11862306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0) 11962306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1) 12062306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2) 12162306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3) 12262306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4) 12362306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6) 12462306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7) 12562306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0 BIT(9) 12662306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_BYPASS_TX_SCH BIT(9) /* MT7622 */ 12762306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 12862306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 12962306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT21 GENMASK(23, 22) 13062306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_SW_RESET BIT(24) 13162306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 13262306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28) 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define MT_WPDMA_RST_IDX MT_HIF(0x20c) 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#define MT_WPDMA_MEM_RNG_ERR MT_HIF(0x224) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define MT_MCU_CMD MT_HIF(0x234) 13962306a36Sopenharmony_ci#define MT_MCU_CMD_CLEAR_FW_OWN BIT(0) 14062306a36Sopenharmony_ci#define MT_MCU_CMD_STOP_PDMA_FW_RELOAD BIT(1) 14162306a36Sopenharmony_ci#define MT_MCU_CMD_STOP_PDMA BIT(2) 14262306a36Sopenharmony_ci#define MT_MCU_CMD_RESET_DONE BIT(3) 14362306a36Sopenharmony_ci#define MT_MCU_CMD_RECOVERY_DONE BIT(4) 14462306a36Sopenharmony_ci#define MT_MCU_CMD_NORMAL_STATE BIT(5) 14562306a36Sopenharmony_ci#define MT_MCU_CMD_LMAC_ERROR BIT(24) 14662306a36Sopenharmony_ci#define MT_MCU_CMD_PSE_ERROR BIT(25) 14762306a36Sopenharmony_ci#define MT_MCU_CMD_PLE_ERROR BIT(26) 14862306a36Sopenharmony_ci#define MT_MCU_CMD_PDMA_ERROR BIT(27) 14962306a36Sopenharmony_ci#define MT_MCU_CMD_PCIE_ERROR BIT(28) 15062306a36Sopenharmony_ci#define MT_MCU_CMD_ERROR_MASK (GENMASK(5, 1) | GENMASK(28, 24)) 15162306a36Sopenharmony_ci#define MT7663_MCU_CMD_ERROR_MASK GENMASK(5, 2) 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci#define MT_TX_RING_BASE MT_HIF(0x300) 15462306a36Sopenharmony_ci#define MT_RX_RING_BASE MT_HIF(0x400) 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define MT_WPDMA_GLO_CFG1 MT_HIF(0x500) 15762306a36Sopenharmony_ci#define MT_WPDMA_TX_PRE_CFG MT_HIF(0x510) 15862306a36Sopenharmony_ci#define MT_WPDMA_RX_PRE_CFG MT_HIF(0x520) 15962306a36Sopenharmony_ci#define MT_WPDMA_ABT_CFG MT_HIF(0x530) 16062306a36Sopenharmony_ci#define MT_WPDMA_ABT_CFG1 MT_HIF(0x534) 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci#define MT_CSR(ofs) ((dev)->reg_map[MT_CSR_BASE] + (ofs)) 16362306a36Sopenharmony_ci#define MT_CONN_HIF_ON_LPCTL MT_CSR(0x000) 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci#define MT_PLE(ofs) ((dev)->reg_map[MT_PLE_BASE] + (ofs)) 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci#define MT_PLE_PG_HIF0_GROUP MT_PLE(0x110) 16862306a36Sopenharmony_ci#define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 16962306a36Sopenharmony_ci#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) 17062306a36Sopenharmony_ci#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) 17162306a36Sopenharmony_ci#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) 17262306a36Sopenharmony_ci#define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci#define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ 17562306a36Sopenharmony_ci ((n) << 2)) 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci#define MT_PSE(ofs) ((dev)->reg_map[MT_PSE_BASE] + (ofs)) 17862306a36Sopenharmony_ci#define MT_PSE_PG_HIF0_GROUP MT_PSE(0x110) 17962306a36Sopenharmony_ci#define MT_HIF0_MIN_QUOTA GENMASK(11, 0) 18062306a36Sopenharmony_ci#define MT_PSE_PG_HIF1_GROUP MT_PSE(0x118) 18162306a36Sopenharmony_ci#define MT_HIF1_MIN_QUOTA GENMASK(11, 0) 18262306a36Sopenharmony_ci#define MT_PSE_QUEUE_EMPTY MT_PSE(0x0b4) 18362306a36Sopenharmony_ci#define MT_HIF_0_EMPTY_MASK BIT(16) 18462306a36Sopenharmony_ci#define MT_HIF_1_EMPTY_MASK BIT(17) 18562306a36Sopenharmony_ci#define MT_HIF_ALL_EMPTY_MASK GENMASK(17, 16) 18662306a36Sopenharmony_ci#define MT_PSE_PG_INFO MT_PSE(0x194) 18762306a36Sopenharmony_ci#define MT_PSE_SRC_CNT GENMASK(27, 16) 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci#define MT_PP(ofs) ((dev)->reg_map[MT_PP_BASE] + (ofs)) 19062306a36Sopenharmony_ci#define MT_PP_TXDWCNT MT_PP(0x0) 19162306a36Sopenharmony_ci#define MT_PP_TXDWCNT_TX0_ADD_DW_CNT GENMASK(7, 0) 19262306a36Sopenharmony_ci#define MT_PP_TXDWCNT_TX1_ADD_DW_CNT GENMASK(15, 8) 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ci#define MT_WF_PHY_BASE 0x82070000 19562306a36Sopenharmony_ci#define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs)) 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci#define MT_WF_PHY_WF2_RFCTRL0(n) MT_WF_PHY(0x1900 + (n) * 0x400) 19862306a36Sopenharmony_ci#define MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN BIT(9) 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#define MT_WF_PHY_R0_PHYMUX_5(_phy) MT_WF_PHY(0x0614 + ((_phy) << 9)) 20162306a36Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYMUX_5 MT_WF_PHY(0x0414) 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci#define MT_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x020c + ((_phy) << 9)) 20462306a36Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_PD_OFDM GENMASK(31, 16) 20562306a36Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_PD_CCK GENMASK(15, 0) 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYCTRL_STS0(_phy) MT_WF_PHY(0x0210 + ((_phy) << 12)) 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci#define MT_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0220 + ((_phy) << 9)) 21062306a36Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_MDRDY_OFDM GENMASK(31, 16) 21162306a36Sopenharmony_ci#define MT_WF_PHYCTRL_STAT_MDRDY_CCK GENMASK(15, 0) 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci#define MT7663_WF_PHY_R0_PHYCTRL_STS5(_phy) MT_WF_PHY(0x0224 + ((_phy) << 12)) 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci#define MT_WF_PHY_GID_TAB_VLD(_phy, i) MT_WF_PHY(0x0254 + (i) * 4 + \ 21662306a36Sopenharmony_ci ((_phy) << 9)) 21762306a36Sopenharmony_ci#define MT7663_WF_PHY_GID_TAB_VLD(_phy, i) MT_WF_PHY(0x0254 + (i) * 4 + \ 21862306a36Sopenharmony_ci ((_phy) << 12)) 21962306a36Sopenharmony_ci#define MT_WF_PHY_GID_TAB_POS(_phy, i) MT_WF_PHY(0x025c + (i) * 4 + \ 22062306a36Sopenharmony_ci ((_phy) << 9)) 22162306a36Sopenharmony_ci#define MT7663_WF_PHY_GID_TAB_POS(_phy, i) MT_WF_PHY(0x025c + (i) * 4 + \ 22262306a36Sopenharmony_ci ((_phy) << 12)) 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#define MT_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x084 : 0x229c) 22562306a36Sopenharmony_ci#define MT_WF_PHY_PD_OFDM_MASK(_phy) ((_phy) ? GENMASK(24, 16) : \ 22662306a36Sopenharmony_ci GENMASK(28, 20)) 22762306a36Sopenharmony_ci#define MT_WF_PHY_PD_OFDM(_phy, v) ((v) << ((_phy) ? 16 : 20)) 22862306a36Sopenharmony_ci#define MT_WF_PHY_PD_BLK(_phy) ((_phy) ? BIT(25) : BIT(19)) 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci#define MT7663_WF_PHY_MIN_PRI_PWR(_phy) MT_WF_PHY((_phy) ? 0x2aec : 0x22f0) 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci#define MT_WF_PHY_RXTD_BASE MT_WF_PHY(0x2200) 23362306a36Sopenharmony_ci#define MT_WF_PHY_RXTD(_n) (MT_WF_PHY_RXTD_BASE + ((_n) << 2)) 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci#define MT7663_WF_PHY_RXTD(_n) (MT_WF_PHY(0x25b0) + ((_n) << 2)) 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci#define MT_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2314 : 0x2310) 23862306a36Sopenharmony_ci#define MT_WF_PHY_PD_CCK_MASK(_phy) (_phy) ? GENMASK(31, 24) : \ 23962306a36Sopenharmony_ci GENMASK(8, 1) 24062306a36Sopenharmony_ci#define MT_WF_PHY_PD_CCK(_phy, v) ((v) << ((_phy) ? 24 : 1)) 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ci#define MT7663_WF_PHY_RXTD_CCK_PD(_phy) MT_WF_PHY((_phy) ? 0x2350 : 0x234c) 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci#define MT_WF_PHY_RXTD2_BASE MT_WF_PHY(0x2a00) 24562306a36Sopenharmony_ci#define MT_WF_PHY_RXTD2(_n) (MT_WF_PHY_RXTD2_BASE + ((_n) << 2)) 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci#define MT_WF_PHY_RFINTF3_0(_n) MT_WF_PHY(0x1100 + (_n) * 0x400) 24862306a36Sopenharmony_ci#define MT_WF_PHY_RFINTF3_0_ANT GENMASK(7, 4) 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci#define MT_WF_CFG_BASE ((dev)->reg_map[MT_CFG_BASE]) 25162306a36Sopenharmony_ci#define MT_WF_CFG(ofs) (MT_WF_CFG_BASE + (ofs)) 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci#define MT_CFG_CCR MT_WF_CFG(0x000) 25462306a36Sopenharmony_ci#define MT_CFG_CCR_MAC_D1_1X_GC_EN BIT(24) 25562306a36Sopenharmony_ci#define MT_CFG_CCR_MAC_D0_1X_GC_EN BIT(25) 25662306a36Sopenharmony_ci#define MT_CFG_CCR_MAC_D1_2X_GC_EN BIT(30) 25762306a36Sopenharmony_ci#define MT_CFG_CCR_MAC_D0_2X_GC_EN BIT(31) 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci#define MT_WF_AGG_BASE ((dev)->reg_map[MT_AGG_BASE]) 26062306a36Sopenharmony_ci#define MT_WF_AGG(ofs) (MT_WF_AGG_BASE + (ofs)) 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define MT_AGG_ARCR MT_WF_AGG(0x010) 26362306a36Sopenharmony_ci#define MT_AGG_ARCR_INIT_RATE1 BIT(0) 26462306a36Sopenharmony_ci#define MT_AGG_ARCR_RTS_RATE_THR GENMASK(12, 8) 26562306a36Sopenharmony_ci#define MT_AGG_ARCR_RATE_DOWN_RATIO GENMASK(17, 16) 26662306a36Sopenharmony_ci#define MT_AGG_ARCR_RATE_DOWN_RATIO_EN BIT(19) 26762306a36Sopenharmony_ci#define MT_AGG_ARCR_RATE_UP_EXTRA_TH GENMASK(22, 20) 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci#define MT_AGG_ARUCR(_band) MT_WF_AGG(0x018 + (_band) * 0x100) 27062306a36Sopenharmony_ci#define MT_AGG_ARDCR(_band) MT_WF_AGG(0x01c + (_band) * 0x100) 27162306a36Sopenharmony_ci#define MT_AGG_ARxCR_LIMIT_SHIFT(_n) (4 * (_n)) 27262306a36Sopenharmony_ci#define MT_AGG_ARxCR_LIMIT(_n) GENMASK(2 + \ 27362306a36Sopenharmony_ci MT_AGG_ARxCR_LIMIT_SHIFT(_n), \ 27462306a36Sopenharmony_ci MT_AGG_ARxCR_LIMIT_SHIFT(_n)) 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci#define MT_AGG_ASRCR0 MT_WF_AGG(0x060) 27762306a36Sopenharmony_ci#define MT_AGG_ASRCR1 MT_WF_AGG(0x064) 27862306a36Sopenharmony_ci#define MT_AGG_ASRCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(5, 0)) 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci#define MT_AGG_ACR(_band) MT_WF_AGG(0x070 + (_band) * 0x100) 28162306a36Sopenharmony_ci#define MT_AGG_ACR_NO_BA_RULE BIT(0) 28262306a36Sopenharmony_ci#define MT_AGG_ACR_NO_BA_AR_RULE BIT(1) 28362306a36Sopenharmony_ci#define MT_AGG_ACR_PKT_TIME_EN BIT(2) 28462306a36Sopenharmony_ci#define MT_AGG_ACR_CFEND_RATE GENMASK(15, 4) 28562306a36Sopenharmony_ci#define MT_AGG_ACR_BAR_RATE GENMASK(31, 20) 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci#define MT_AGG_SCR MT_WF_AGG(0x0fc) 28862306a36Sopenharmony_ci#define MT_AGG_SCR_NLNAV_MID_PTEC_DIS BIT(3) 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci#define MT_WF_ARB_BASE ((dev)->reg_map[MT_ARB_BASE]) 29162306a36Sopenharmony_ci#define MT_WF_ARB(ofs) (MT_WF_ARB_BASE + (ofs)) 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci#define MT_ARB_RQCR MT_WF_ARB(0x070) 29462306a36Sopenharmony_ci#define MT_ARB_RQCR_RX_START BIT(0) 29562306a36Sopenharmony_ci#define MT_ARB_RQCR_RXV_START BIT(4) 29662306a36Sopenharmony_ci#define MT_ARB_RQCR_RXV_R_EN BIT(7) 29762306a36Sopenharmony_ci#define MT_ARB_RQCR_RXV_T_EN BIT(8) 29862306a36Sopenharmony_ci#define MT_ARB_RQCR_BAND_SHIFT 16 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci#define MT_ARB_SCR MT_WF_ARB(0x080) 30162306a36Sopenharmony_ci#define MT_ARB_SCR_TX0_DISABLE BIT(8) 30262306a36Sopenharmony_ci#define MT_ARB_SCR_RX0_DISABLE BIT(9) 30362306a36Sopenharmony_ci#define MT_ARB_SCR_TX1_DISABLE BIT(10) 30462306a36Sopenharmony_ci#define MT_ARB_SCR_RX1_DISABLE BIT(11) 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci#define MT_WF_TMAC_BASE ((dev)->reg_map[MT_TMAC_BASE]) 30762306a36Sopenharmony_ci#define MT_WF_TMAC(ofs) (MT_WF_TMAC_BASE + (ofs)) 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci#define MT_TMAC_CDTR MT_WF_TMAC(0x090) 31062306a36Sopenharmony_ci#define MT_TMAC_ODTR MT_WF_TMAC(0x094) 31162306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0) 31262306a36Sopenharmony_ci#define MT_TIMEOUT_VAL_CCA GENMASK(31, 16) 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci#define MT_TMAC_TRCR(_band) MT_WF_TMAC((_band) ? 0x070 : 0x09c) 31562306a36Sopenharmony_ci#define MT_TMAC_TRCR_CCA_SEL GENMASK(31, 30) 31662306a36Sopenharmony_ci#define MT_TMAC_TRCR_SEC_CCA_SEL GENMASK(29, 28) 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci#define MT_TMAC_ICR(_band) MT_WF_TMAC((_band) ? 0x074 : 0x0a4) 31962306a36Sopenharmony_ci#define MT_IFS_EIFS GENMASK(8, 0) 32062306a36Sopenharmony_ci#define MT_IFS_RIFS GENMASK(14, 10) 32162306a36Sopenharmony_ci#define MT_IFS_SIFS GENMASK(22, 16) 32262306a36Sopenharmony_ci#define MT_IFS_SLOT GENMASK(30, 24) 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci#define MT_TMAC_CTCR0 MT_WF_TMAC(0x0f4) 32562306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0) 32662306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_DENSITY GENMASK(15, 12) 32762306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17) 32862306a36Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18) 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci#define MT_WF_RMAC_BASE ((dev)->reg_map[MT_RMAC_BASE]) 33162306a36Sopenharmony_ci#define MT_WF_RMAC(ofs) (MT_WF_RMAC_BASE + (ofs)) 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci#define MT_WF_RFCR(_band) MT_WF_RMAC((_band) ? 0x100 : 0x000) 33462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_STBC_MULTI BIT(0) 33562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FCSFAIL BIT(1) 33662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_VERSION BIT(3) 33762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_PROBEREQ BIT(4) 33862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST BIT(5) 33962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_BCAST BIT(6) 34062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7) 34162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_MAC BIT(8) 34262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_BSSID BIT(9) 34362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_A2_BSSID BIT(10) 34462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11) 34562306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12) 34662306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTL_RSV BIT(13) 34762306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_CTS BIT(14) 34862306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_RTS BIT(15) 34962306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_DUPLICATE BIT(16) 35062306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BSS BIT(17) 35162306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_UC BIT(18) 35262306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_TIM BIT(19) 35362306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_NDPA BIT(20) 35462306a36Sopenharmony_ci#define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21) 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci#define MT_WF_RMAC_MORE(_band) MT_WF_RMAC((_band) ? 0x124 : 0x024) 35762306a36Sopenharmony_ci#define MT_WF_RMAC_MORE_MUAR_MODE GENMASK(31, 30) 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci#define MT_WF_RFCR1(_band) MT_WF_RMAC((_band) ? 0x104 : 0x004) 36062306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_ACK BIT(4) 36162306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BF_POLL BIT(5) 36262306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_BA BIT(6) 36362306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFEND BIT(7) 36462306a36Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFACK BIT(8) 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ci#define MT_CHFREQ(_band) MT_WF_RMAC((_band) ? 0x130 : 0x030) 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci#define MT_WF_RMAC_MAR0 MT_WF_RMAC(0x025c) 36962306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1 MT_WF_RMAC(0x0260) 37062306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1_ADDR GENMASK(15, 0) 37162306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1_START BIT(16) 37262306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1_WRITE BIT(17) 37362306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1_IDX GENMASK(29, 24) 37462306a36Sopenharmony_ci#define MT_WF_RMAC_MAR1_GROUP GENMASK(31, 30) 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME0 MT_WF_RMAC(0x03c4) 37762306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31) 37862306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_EN BIT(30) 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME0 MT_WF_RMAC(0x0380) 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME5 MT_WF_RMAC(0x03d8) 38362306a36Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME6 MT_WF_RMAC(0x03dc) 38462306a36Sopenharmony_ci#define MT_MIB_OBSSTIME_MASK GENMASK(23, 0) 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci#define MT_WF_DMA_BASE ((dev)->reg_map[MT_DMA_BASE]) 38762306a36Sopenharmony_ci#define MT_WF_DMA(ofs) (MT_WF_DMA_BASE + (ofs)) 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci#define MT_DMA_DCR0 MT_WF_DMA(0x000) 39062306a36Sopenharmony_ci#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 2) 39162306a36Sopenharmony_ci#define MT_DMA_DCR0_DAMSDU_EN BIT(16) 39262306a36Sopenharmony_ci#define MT_DMA_DCR0_RX_VEC_DROP BIT(17) 39362306a36Sopenharmony_ci#define MT_DMA_DCR0_RX_HDR_TRANS_EN BIT(19) 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ci#define MT_DMA_RCFR0(_band) MT_WF_DMA(0x070 + (_band) * 0x40) 39662306a36Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_MGMT BIT(2) 39762306a36Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR BIT(3) 39862306a36Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_CTL_BAR BIT(4) 39962306a36Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_TDLS BIT(19) 40062306a36Sopenharmony_ci#define MT_DMA_RCFR0_MCU_RX_BYPASS BIT(21) 40162306a36Sopenharmony_ci#define MT_DMA_RCFR0_RX_DROPPED_UCAST GENMASK(25, 24) 40262306a36Sopenharmony_ci#define MT_DMA_RCFR0_RX_DROPPED_MCAST GENMASK(27, 26) 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci#define MT_WF_PF_BASE ((dev)->reg_map[MT_PF_BASE]) 40562306a36Sopenharmony_ci#define MT_WF_PF(ofs) (MT_WF_PF_BASE + (ofs)) 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci#define MT_WF_PFCR MT_WF_PF(0x000) 40862306a36Sopenharmony_ci#define MT_WF_PFCR_TDLS_EN BIT(9) 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci#define MT_WTBL_BASE(dev) ((dev)->reg_map[MT_WTBL_BASE_ADDR]) 41162306a36Sopenharmony_ci#define MT_WTBL_ENTRY_SIZE 256 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci#define MT_WTBL_OFF_BASE ((dev)->reg_map[MT_WTBL_BASE_OFF]) 41462306a36Sopenharmony_ci#define MT_WTBL_OFF(n) (MT_WTBL_OFF_BASE + (n)) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci#define MT_WTBL_W0_KEY_IDX GENMASK(24, 23) 41762306a36Sopenharmony_ci#define MT_WTBL_W0_RX_KEY_VALID BIT(26) 41862306a36Sopenharmony_ci#define MT_WTBL_W0_RX_IK_VALID BIT(27) 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ci#define MT_WTBL_W2_KEY_TYPE GENMASK(7, 4) 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci#define MT_WTBL_UPDATE MT_WTBL_OFF(0x030) 42362306a36Sopenharmony_ci#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(7, 0) 42462306a36Sopenharmony_ci#define MT_WTBL_UPDATE_RXINFO_UPDATE BIT(11) 42562306a36Sopenharmony_ci#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12) 42662306a36Sopenharmony_ci#define MT_WTBL_UPDATE_RATE_UPDATE BIT(13) 42762306a36Sopenharmony_ci#define MT_WTBL_UPDATE_TX_COUNT_CLEAR BIT(14) 42862306a36Sopenharmony_ci#define MT_WTBL_UPDATE_BUSY BIT(31) 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci#define MT_TOP_MISC(ofs) ((dev)->reg_map[MT_TOP_MISC_BASE] + (ofs)) 43162306a36Sopenharmony_ci#define MT_CONN_ON_MISC MT_TOP_MISC(0x1140) 43262306a36Sopenharmony_ci#define MT_TOP_MISC2_FW_N9_RDY BIT(2) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci#define MT_WTBL_ON_BASE ((dev)->reg_map[MT_WTBL_BASE_ON]) 43562306a36Sopenharmony_ci#define MT_WTBL_ON(_n) (MT_WTBL_ON_BASE + (_n)) 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ci#define MT_WTBL_RICR0 MT_WTBL_ON(0x010) 43862306a36Sopenharmony_ci#define MT_WTBL_RICR1 MT_WTBL_ON(0x014) 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_ci#define MT_WTBL_RIUCR0 MT_WTBL_ON(0x020) 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ci#define MT_WTBL_RIUCR1 MT_WTBL_ON(0x024) 44362306a36Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE0 GENMASK(11, 0) 44462306a36Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE1 GENMASK(23, 12) 44562306a36Sopenharmony_ci#define MT_WTBL_RIUCR1_RATE2_LO GENMASK(31, 24) 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_ci#define MT_WTBL_RIUCR2 MT_WTBL_ON(0x028) 44862306a36Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE2_HI GENMASK(3, 0) 44962306a36Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE3 GENMASK(15, 4) 45062306a36Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE4 GENMASK(27, 16) 45162306a36Sopenharmony_ci#define MT_WTBL_RIUCR2_RATE5_LO GENMASK(31, 28) 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_ci#define MT_WTBL_RIUCR3 MT_WTBL_ON(0x02c) 45462306a36Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE5_HI GENMASK(7, 0) 45562306a36Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE6 GENMASK(19, 8) 45662306a36Sopenharmony_ci#define MT_WTBL_RIUCR3_RATE7 GENMASK(31, 20) 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci#define MT_WTBL_W3_RTS BIT(22) 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci#define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5) 46162306a36Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_20 BIT(8) 46262306a36Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_40 BIT(9) 46362306a36Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_80 BIT(10) 46462306a36Sopenharmony_ci#define MT_WTBL_W5_SHORT_GI_160 BIT(11) 46562306a36Sopenharmony_ci#define MT_WTBL_W5_BW_CAP GENMASK(13, 12) 46662306a36Sopenharmony_ci#define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23) 46762306a36Sopenharmony_ci#define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26) 46862306a36Sopenharmony_ci#define MT_WTBL_W5_RATE_IDX GENMASK(31, 29) 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci#define MT_WTBL_W27_CC_BW_SEL GENMASK(6, 5) 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ci#define MT_LPON(_n) ((dev)->reg_map[MT_LPON_BASE] + (_n)) 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci#define MT_LPON_TCR0(_n) MT_LPON(0x010 + ((_n) * 4)) 47562306a36Sopenharmony_ci#define MT_LPON_TCR2(_n) MT_LPON(0x0f8 + ((_n) - 2) * 4) 47662306a36Sopenharmony_ci#define MT_LPON_TCR_MODE GENMASK(1, 0) 47762306a36Sopenharmony_ci#define MT_LPON_TCR_READ GENMASK(1, 0) 47862306a36Sopenharmony_ci#define MT_LPON_TCR_WRITE BIT(0) 47962306a36Sopenharmony_ci#define MT_LPON_TCR_ADJUST BIT(1) 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci#define MT_LPON_UTTR0 MT_LPON(0x018) 48262306a36Sopenharmony_ci#define MT_LPON_UTTR1 MT_LPON(0x01c) 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ci#define MT_WF_MIB_BASE (dev->reg_map[MT_MIB_BASE]) 48562306a36Sopenharmony_ci#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE + (ofs) + (_band) * 0x200) 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_ci#define MT_WF_MIB_SCR0 MT_WF_MIB(0, 0) 48862306a36Sopenharmony_ci#define MT_MIB_SCR0_AGG_CNT_RANGE_EN BIT(21) 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci#define MT_MIB_M0_MISC_CR(_band) MT_WF_MIB(_band, 0x00c) 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci#define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x014) 49362306a36Sopenharmony_ci#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0) 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci#define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c) 49662306a36Sopenharmony_ci#define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0) 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci#define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x040) 49962306a36Sopenharmony_ci#define MT_MIB_AMPDU_MPDU_COUNT GENMASK(23, 0) 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_ci#define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x044) 50262306a36Sopenharmony_ci#define MT_MIB_AMPDU_ACK_COUNT GENMASK(23, 0) 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci#define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048) 50562306a36Sopenharmony_ci#define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0) 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci#define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x098) 50862306a36Sopenharmony_ci#define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0) 50962306a36Sopenharmony_ci#define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x09c) 51062306a36Sopenharmony_ci#define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0) 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci#define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4)) 51362306a36Sopenharmony_ci#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16) 51462306a36Sopenharmony_ci#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci#define MT_MIB_MB_SDR1(_band, n) MT_WF_MIB(_band, 0x104 + ((n) << 4)) 51762306a36Sopenharmony_ci#define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0) 51862306a36Sopenharmony_ci#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16) 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ci#define MT_MIB_ARNG(n) MT_WF_MIB(0, 0x4b8 + ((n) << 2)) 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci#define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0xa8 + ((n) << 2)) 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ci#define MT_DMA_SHDL(ofs) (dev->reg_map[MT_DMA_SHDL_BASE] + (ofs)) 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci#define MT_DMASHDL_BASE 0x5000a000 52762306a36Sopenharmony_ci#define MT_DMASHDL_OPTIONAL 0x008 52862306a36Sopenharmony_ci#define MT_DMASHDL_PAGE 0x00c 52962306a36Sopenharmony_ci 53062306a36Sopenharmony_ci#define MT_DMASHDL_REFILL 0x010 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE 0x01c 53362306a36Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0) 53462306a36Sopenharmony_ci#define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16) 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA(_n) (0x020 + ((_n) << 2)) 53762306a36Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0) 53862306a36Sopenharmony_ci#define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16) 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci#define MT_DMASHDL_SCHED_SET0 0x0b0 54162306a36Sopenharmony_ci#define MT_DMASHDL_SCHED_SET1 0x0b4 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci#define MT_DMASHDL_Q_MAP(_n) (0x0d0 + ((_n) << 2)) 54462306a36Sopenharmony_ci#define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0) 54562306a36Sopenharmony_ci#define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8)) 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_ci#define MT_LED_BASE_PHYS 0x80024000 54862306a36Sopenharmony_ci#define MT_LED_PHYS(_n) (MT_LED_BASE_PHYS + (_n)) 54962306a36Sopenharmony_ci 55062306a36Sopenharmony_ci#define MT_LED_CTRL MT_LED_PHYS(0x00) 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci#define MT_LED_CTRL_REPLAY(_n) BIT(0 + (8 * (_n))) 55362306a36Sopenharmony_ci#define MT_LED_CTRL_POLARITY(_n) BIT(1 + (8 * (_n))) 55462306a36Sopenharmony_ci#define MT_LED_CTRL_TX_BLINK_MODE(_n) BIT(2 + (8 * (_n))) 55562306a36Sopenharmony_ci#define MT_LED_CTRL_TX_MANUAL_BLINK(_n) BIT(3 + (8 * (_n))) 55662306a36Sopenharmony_ci#define MT_LED_CTRL_BAND(_n) BIT(4 + (8 * (_n))) 55762306a36Sopenharmony_ci#define MT_LED_CTRL_TX_OVER_BLINK(_n) BIT(5 + (8 * (_n))) 55862306a36Sopenharmony_ci#define MT_LED_CTRL_KICK(_n) BIT(7 + (8 * (_n))) 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_ci#define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x10 + ((_n) * 8)) 56162306a36Sopenharmony_ci#define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x14 + ((_n) * 8)) 56262306a36Sopenharmony_ci#define MT_LED_STATUS_OFF GENMASK(31, 24) 56362306a36Sopenharmony_ci#define MT_LED_STATUS_ON GENMASK(23, 16) 56462306a36Sopenharmony_ci#define MT_LED_STATUS_DURATION GENMASK(15, 0) 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci#define MT_PDMA_BUSY 0x82000504 56762306a36Sopenharmony_ci#define MT_PDMA_TX_BUSY BIT(0) 56862306a36Sopenharmony_ci#define MT_PDMA_RX_BUSY BIT(1) 56962306a36Sopenharmony_ci 57062306a36Sopenharmony_ci#define MT_EFUSE_BASE ((dev)->reg_map[MT_EFUSE_ADDR_BASE]) 57162306a36Sopenharmony_ci#define MT_EFUSE_BASE_CTRL 0x000 57262306a36Sopenharmony_ci#define MT_EFUSE_BASE_CTRL_EMPTY BIT(30) 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci#define MT_EFUSE_CTRL 0x008 57562306a36Sopenharmony_ci#define MT_EFUSE_CTRL_AOUT GENMASK(5, 0) 57662306a36Sopenharmony_ci#define MT_EFUSE_CTRL_MODE GENMASK(7, 6) 57762306a36Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8) 57862306a36Sopenharmony_ci#define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14) 57962306a36Sopenharmony_ci#define MT_EFUSE_CTRL_AIN GENMASK(25, 16) 58062306a36Sopenharmony_ci#define MT_EFUSE_CTRL_VALID BIT(29) 58162306a36Sopenharmony_ci#define MT_EFUSE_CTRL_KICK BIT(30) 58262306a36Sopenharmony_ci#define MT_EFUSE_CTRL_SEL BIT(31) 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci#define MT_EFUSE_WDATA(_i) (0x010 + ((_i) * 4)) 58562306a36Sopenharmony_ci#define MT_EFUSE_RDATA(_i) (0x030 + ((_i) * 4)) 58662306a36Sopenharmony_ci 58762306a36Sopenharmony_ci/* INFRACFG host register range on MT7622 */ 58862306a36Sopenharmony_ci#define MT_INFRACFG_MISC 0x700 58962306a36Sopenharmony_ci#define MT_INFRACFG_MISC_AP2CONN_WAKE BIT(1) 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci#define MT_UMAC_BASE 0x7c000000 59262306a36Sopenharmony_ci#define MT_UMAC(ofs) (MT_UMAC_BASE + (ofs)) 59362306a36Sopenharmony_ci#define MT_UDMA_TX_QSEL MT_UMAC(0x008) 59462306a36Sopenharmony_ci#define MT_FW_DL_EN BIT(3) 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci#define MT_UDMA_WLCFG_1 MT_UMAC(0x00c) 59762306a36Sopenharmony_ci#define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0) 59862306a36Sopenharmony_ci#define MT_WL_TX_TMOUT_LMT GENMASK(27, 8) 59962306a36Sopenharmony_ci 60062306a36Sopenharmony_ci#define MT_UDMA_WLCFG_0 MT_UMAC(0x18) 60162306a36Sopenharmony_ci#define MT_WL_RX_AGG_TO GENMASK(7, 0) 60262306a36Sopenharmony_ci#define MT_WL_RX_AGG_LMT GENMASK(15, 8) 60362306a36Sopenharmony_ci#define MT_WL_TX_TMOUT_FUNC_EN BIT(16) 60462306a36Sopenharmony_ci#define MT_WL_TX_DPH_CHK_EN BIT(17) 60562306a36Sopenharmony_ci#define MT_WL_RX_MPSZ_PAD0 BIT(18) 60662306a36Sopenharmony_ci#define MT_WL_RX_FLUSH BIT(19) 60762306a36Sopenharmony_ci#define MT_TICK_1US_EN BIT(20) 60862306a36Sopenharmony_ci#define MT_WL_RX_AGG_EN BIT(21) 60962306a36Sopenharmony_ci#define MT_WL_RX_EN BIT(22) 61062306a36Sopenharmony_ci#define MT_WL_TX_EN BIT(23) 61162306a36Sopenharmony_ci#define MT_WL_RX_BUSY BIT(30) 61262306a36Sopenharmony_ci#define MT_WL_TX_BUSY BIT(31) 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci#define MT_MCU_PTA_BASE 0x81060000 61562306a36Sopenharmony_ci#define MT_MCU_PTA(_n) (MT_MCU_PTA_BASE + (_n)) 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_ci#define MT_ANT_SWITCH_CON(_n) MT_MCU_PTA(0x0c8 + ((_n) - 1) * 4) 61862306a36Sopenharmony_ci#define MT_ANT_SWITCH_CON_MODE(_n) (GENMASK(4, 0) << (_n * 8)) 61962306a36Sopenharmony_ci#define MT_ANT_SWITCH_CON_MODE1(_n) (GENMASK(3, 0) << (_n * 8)) 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_ci#endif 622