162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* Copyright (C) 2020 Felix Fietkau <nbd@nbd.name> */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __MTK_WED_REGS_H 562306a36Sopenharmony_ci#define __MTK_WED_REGS_H 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define MTK_WFDMA_DESC_CTRL_TO_HOST BIT(8) 862306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_LEN1 GENMASK(14, 0) 962306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_LEN1_V2 GENMASK(13, 0) 1062306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_LAST_SEG1 BIT(15) 1162306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_BURST BIT(16) 1262306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_LEN0 GENMASK(29, 16) 1362306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_LAST_SEG0 BIT(30) 1462306a36Sopenharmony_ci#define MTK_WDMA_DESC_CTRL_DMA_DONE BIT(31) 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cistruct mtk_wdma_desc { 1762306a36Sopenharmony_ci __le32 buf0; 1862306a36Sopenharmony_ci __le32 ctrl; 1962306a36Sopenharmony_ci __le32 buf1; 2062306a36Sopenharmony_ci __le32 info; 2162306a36Sopenharmony_ci} __packed __aligned(4); 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define MTK_WED_REV_ID 0x004 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define MTK_WED_RESET 0x008 2662306a36Sopenharmony_ci#define MTK_WED_RESET_TX_BM BIT(0) 2762306a36Sopenharmony_ci#define MTK_WED_RESET_RX_BM BIT(1) 2862306a36Sopenharmony_ci#define MTK_WED_RESET_TX_FREE_AGENT BIT(4) 2962306a36Sopenharmony_ci#define MTK_WED_RESET_WPDMA_TX_DRV BIT(8) 3062306a36Sopenharmony_ci#define MTK_WED_RESET_WPDMA_RX_DRV BIT(9) 3162306a36Sopenharmony_ci#define MTK_WED_RESET_WPDMA_RX_D_DRV BIT(10) 3262306a36Sopenharmony_ci#define MTK_WED_RESET_WPDMA_INT_AGENT BIT(11) 3362306a36Sopenharmony_ci#define MTK_WED_RESET_WED_TX_DMA BIT(12) 3462306a36Sopenharmony_ci#define MTK_WED_RESET_WED_RX_DMA BIT(13) 3562306a36Sopenharmony_ci#define MTK_WED_RESET_WDMA_TX_DRV BIT(16) 3662306a36Sopenharmony_ci#define MTK_WED_RESET_WDMA_RX_DRV BIT(17) 3762306a36Sopenharmony_ci#define MTK_WED_RESET_WDMA_INT_AGENT BIT(19) 3862306a36Sopenharmony_ci#define MTK_WED_RESET_RX_RRO_QM BIT(20) 3962306a36Sopenharmony_ci#define MTK_WED_RESET_RX_ROUTE_QM BIT(21) 4062306a36Sopenharmony_ci#define MTK_WED_RESET_WED BIT(31) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define MTK_WED_CTRL 0x00c 4362306a36Sopenharmony_ci#define MTK_WED_CTRL_WPDMA_INT_AGENT_EN BIT(0) 4462306a36Sopenharmony_ci#define MTK_WED_CTRL_WPDMA_INT_AGENT_BUSY BIT(1) 4562306a36Sopenharmony_ci#define MTK_WED_CTRL_WDMA_INT_AGENT_EN BIT(2) 4662306a36Sopenharmony_ci#define MTK_WED_CTRL_WDMA_INT_AGENT_BUSY BIT(3) 4762306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_TX_BM_EN BIT(8) 4862306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_TX_BM_BUSY BIT(9) 4962306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_TX_FREE_AGENT_EN BIT(10) 5062306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_TX_FREE_AGENT_BUSY BIT(11) 5162306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_RX_BM_EN BIT(12) 5262306a36Sopenharmony_ci#define MTK_WED_CTRL_WED_RX_BM_BUSY BIT(13) 5362306a36Sopenharmony_ci#define MTK_WED_CTRL_RX_RRO_QM_EN BIT(14) 5462306a36Sopenharmony_ci#define MTK_WED_CTRL_RX_RRO_QM_BUSY BIT(15) 5562306a36Sopenharmony_ci#define MTK_WED_CTRL_RX_ROUTE_QM_EN BIT(16) 5662306a36Sopenharmony_ci#define MTK_WED_CTRL_RX_ROUTE_QM_BUSY BIT(17) 5762306a36Sopenharmony_ci#define MTK_WED_CTRL_FINAL_DIDX_READ BIT(24) 5862306a36Sopenharmony_ci#define MTK_WED_CTRL_ETH_DMAD_FMT BIT(25) 5962306a36Sopenharmony_ci#define MTK_WED_CTRL_MIB_READ_CLEAR BIT(28) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS 0x020 6262306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TF_LEN_ERR BIT(0) 6362306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD BIT(1) 6462306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID BIT(4) 6562306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TX_FBUF_LO_TH BIT(8) 6662306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TX_FBUF_HI_TH BIT(9) 6762306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_FBUF_LO_TH BIT(10) /* wed v2 */ 6862306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_FBUF_HI_TH BIT(11) /* wed v2 */ 6962306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR BIT(16) 7062306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR BIT(17) 7162306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT BIT(18) 7262306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_INIT_WDMA_EN BIT(19) 7362306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_BM_DMAD_COHERENT BIT(20) 7462306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TX_DRV_R_RESP_ERR BIT(21) 7562306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TX_DMA_R_RESP_ERR BIT(22) 7662306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_TX_DMA_W_RESP_ERR BIT(23) 7762306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_DMA_RECYCLE BIT(24) 7862306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_RX_DRV_GET_BM_DMAD_SKIP BIT(25) 7962306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_WPDMA_RX_D_DRV_ERR BIT(26) 8062306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_WPDMA_MID_RDY BIT(27) 8162306a36Sopenharmony_ci#define MTK_WED_EXT_INT_STATUS_ERROR_MASK (MTK_WED_EXT_INT_STATUS_TF_LEN_ERR | \ 8262306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD | \ 8362306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID | \ 8462306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR | \ 8562306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR | \ 8662306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_RX_DRV_INIT_WDMA_EN | \ 8762306a36Sopenharmony_ci MTK_WED_EXT_INT_STATUS_TX_DMA_R_RESP_ERR) 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci#define MTK_WED_EXT_INT_MASK 0x028 9062306a36Sopenharmony_ci#define MTK_WED_EXT_INT_MASK1 0x02c 9162306a36Sopenharmony_ci#define MTK_WED_EXT_INT_MASK2 0x030 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define MTK_WED_STATUS 0x060 9462306a36Sopenharmony_ci#define MTK_WED_STATUS_TX GENMASK(15, 8) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define MTK_WED_TX_BM_CTRL 0x080 9762306a36Sopenharmony_ci#define MTK_WED_TX_BM_CTRL_VLD_GRP_NUM GENMASK(6, 0) 9862306a36Sopenharmony_ci#define MTK_WED_TX_BM_CTRL_RSV_GRP_NUM GENMASK(22, 16) 9962306a36Sopenharmony_ci#define MTK_WED_TX_BM_CTRL_PAUSE BIT(28) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define MTK_WED_TX_BM_BASE 0x084 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#define MTK_WED_TX_BM_TKID 0x088 10462306a36Sopenharmony_ci#define MTK_WED_TX_BM_TKID_V2 0x0c8 10562306a36Sopenharmony_ci#define MTK_WED_TX_BM_TKID_START GENMASK(15, 0) 10662306a36Sopenharmony_ci#define MTK_WED_TX_BM_TKID_END GENMASK(31, 16) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#define MTK_WED_TX_BM_BUF_LEN 0x08c 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define MTK_WED_TX_BM_INTF 0x09c 11162306a36Sopenharmony_ci#define MTK_WED_TX_BM_INTF_TKID GENMASK(15, 0) 11262306a36Sopenharmony_ci#define MTK_WED_TX_BM_INTF_TKFIFO_FDEP GENMASK(23, 16) 11362306a36Sopenharmony_ci#define MTK_WED_TX_BM_INTF_TKID_VALID BIT(28) 11462306a36Sopenharmony_ci#define MTK_WED_TX_BM_INTF_TKID_READ BIT(29) 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define MTK_WED_TX_BM_DYN_THR 0x0a0 11762306a36Sopenharmony_ci#define MTK_WED_TX_BM_DYN_THR_LO GENMASK(6, 0) 11862306a36Sopenharmony_ci#define MTK_WED_TX_BM_DYN_THR_LO_V2 GENMASK(8, 0) 11962306a36Sopenharmony_ci#define MTK_WED_TX_BM_DYN_THR_HI GENMASK(22, 16) 12062306a36Sopenharmony_ci#define MTK_WED_TX_BM_DYN_THR_HI_V2 GENMASK(24, 16) 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#define MTK_WED_TX_TKID_CTRL 0x0c0 12362306a36Sopenharmony_ci#define MTK_WED_TX_TKID_CTRL_VLD_GRP_NUM GENMASK(6, 0) 12462306a36Sopenharmony_ci#define MTK_WED_TX_TKID_CTRL_RSV_GRP_NUM GENMASK(22, 16) 12562306a36Sopenharmony_ci#define MTK_WED_TX_TKID_CTRL_PAUSE BIT(28) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define MTK_WED_TX_TKID_DYN_THR 0x0e0 12862306a36Sopenharmony_ci#define MTK_WED_TX_TKID_DYN_THR_LO GENMASK(6, 0) 12962306a36Sopenharmony_ci#define MTK_WED_TX_TKID_DYN_THR_HI GENMASK(22, 16) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci#define MTK_WED_TXP_DW0 0x120 13262306a36Sopenharmony_ci#define MTK_WED_TXP_DW1 0x124 13362306a36Sopenharmony_ci#define MTK_WED_WPDMA_WRITE_TXP GENMASK(31, 16) 13462306a36Sopenharmony_ci#define MTK_WED_TXDP_CTRL 0x130 13562306a36Sopenharmony_ci#define MTK_WED_TXDP_DW9_OVERWR BIT(9) 13662306a36Sopenharmony_ci#define MTK_WED_RX_BM_TKID_MIB 0x1cc 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define MTK_WED_INT_STATUS 0x200 13962306a36Sopenharmony_ci#define MTK_WED_INT_MASK 0x204 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define MTK_WED_GLO_CFG 0x208 14262306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_TX_DMA_EN BIT(0) 14362306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_TX_DMA_BUSY BIT(1) 14462306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_RX_DMA_EN BIT(2) 14562306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_RX_DMA_BUSY BIT(3) 14662306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_RX_BT_SIZE GENMASK(5, 4) 14762306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_TX_WB_DDONE BIT(6) 14862306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_BIG_ENDIAN BIT(7) 14962306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_DIS_BT_SIZE_ALIGN BIT(8) 15062306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_TX_BT_SIZE_LO BIT(9) 15162306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 15262306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 15362306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_MI_DEPTH_RD GENMASK(21, 13) 15462306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_TX_BT_SIZE_HI GENMASK(23, 22) 15562306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_SW_RESET BIT(24) 15662306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 15762306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_OMIT_RX_INFO BIT(27) 15862306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_OMIT_TX_INFO BIT(28) 15962306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_BYTE_SWAP BIT(29) 16062306a36Sopenharmony_ci#define MTK_WED_GLO_CFG_RX_2B_OFFSET BIT(31) 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci#define MTK_WED_RESET_IDX 0x20c 16362306a36Sopenharmony_ci#define MTK_WED_RESET_IDX_TX GENMASK(3, 0) 16462306a36Sopenharmony_ci#define MTK_WED_RESET_IDX_RX GENMASK(17, 16) 16562306a36Sopenharmony_ci#define MTK_WED_RESET_IDX_RX_V2 GENMASK(7, 6) 16662306a36Sopenharmony_ci#define MTK_WED_RESET_WPDMA_IDX_RX GENMASK(31, 30) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define MTK_WED_TX_MIB(_n) (0x2a0 + (_n) * 4) 16962306a36Sopenharmony_ci#define MTK_WED_RX_MIB(_n) (0x2e0 + (_n) * 4) 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define MTK_WED_RING_TX(_n) (0x300 + (_n) * 0x10) 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define MTK_WED_RING_RX(_n) (0x400 + (_n) * 0x10) 17462306a36Sopenharmony_ci#define MTK_WED_RING_RX_DATA(_n) (0x420 + (_n) * 0x10) 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define MTK_WED_SCR0 0x3c0 17762306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_TRIGGER 0x504 17862306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_TRIGGER_RX_DONE BIT(1) 17962306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_TRIGGER_TX_DONE GENMASK(5, 4) 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG 0x508 18262306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_DRV_EN BIT(0) 18362306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_DRV_BUSY BIT(1) 18462306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_EN BIT(2) 18562306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_BUSY BIT(3) 18662306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_BT_SIZE GENMASK(5, 4) 18762306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_WB_DDONE BIT(6) 18862306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7) 18962306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_DIS_BT_SIZE_ALIGN BIT(8) 19062306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_BT_SIZE_LO BIT(9) 19162306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 19262306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 19362306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_MI_DEPTH_RD GENMASK(21, 13) 19462306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_BT_SIZE_HI GENMASK(23, 22) 19562306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_SW_RESET BIT(24) 19662306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 19762306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_OMIT_RX_INFO BIT(27) 19862306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28) 19962306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_BYTE_SWAP BIT(29) 20062306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_2B_OFFSET BIT(31) 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci/* CONFIG_MEDIATEK_NETSYS_V2 */ 20362306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_R0_PKT_PROC BIT(4) 20462306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_R1_PKT_PROC BIT(5) 20562306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_R0_CRX_SYNC BIT(6) 20662306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_R1_CRX_SYNC BIT(7) 20762306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_EVENT_PKT_FMT_VER GENMASK(18, 16) 20862306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_UNSUPPORT_FMT BIT(19) 20962306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_UEVENT_PKT_FMT_CHK BIT(20) 21062306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_RX_DDONE2_WR BIT(21) 21162306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_TKID_KEEP BIT(24) 21262306a36Sopenharmony_ci#define MTK_WED_WPDMA_GLO_CFG_TX_DMAD_DW3_PREV BIT(28) 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define MTK_WED_WPDMA_RESET_IDX 0x50c 21562306a36Sopenharmony_ci#define MTK_WED_WPDMA_RESET_IDX_TX GENMASK(3, 0) 21662306a36Sopenharmony_ci#define MTK_WED_WPDMA_RESET_IDX_RX GENMASK(17, 16) 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci#define MTK_WED_WPDMA_CTRL 0x518 21962306a36Sopenharmony_ci#define MTK_WED_WPDMA_CTRL_SDL1_FIXED BIT(31) 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL 0x520 22262306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_SUBRT_ADV BIT(21) 22362306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_SIG_SRC BIT(22) 22462306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_SRC_SEL GENMASK(17, 16) 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_MASK 0x524 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX 0x530 22962306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_EN BIT(0) 23062306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_CLR BIT(1) 23162306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_TRIG GENMASK(6, 2) 23262306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX1_DONE_EN BIT(8) 23362306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX1_DONE_CLR BIT(9) 23462306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX1_DONE_TRIG GENMASK(14, 10) 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX 0x534 23762306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX0_EN BIT(0) 23862306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX0_CLR BIT(1) 23962306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX0_DONE_TRIG GENMASK(6, 2) 24062306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX1_EN BIT(8) 24162306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX1_CLR BIT(9) 24262306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_RX1_DONE_TRIG GENMASK(14, 10) 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX_FREE 0x538 24562306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_EN BIT(0) 24662306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_CLR BIT(1) 24762306a36Sopenharmony_ci#define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_TRIG GENMASK(6, 2) 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci#define MTK_WED_PCIE_CFG_BASE 0x560 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci#define MTK_WED_PCIE_CFG_BASE 0x560 25262306a36Sopenharmony_ci#define MTK_WED_PCIE_CFG_INTM 0x564 25362306a36Sopenharmony_ci#define MTK_WED_PCIE_CFG_MSIS 0x568 25462306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_TRIGGER 0x570 25562306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_TRIGGER_STATUS BIT(16) 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_CTRL 0x57c 25862306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_CTRL_MSK_EN_POLA BIT(20) 25962306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_CTRL_SRC_SEL GENMASK(17, 16) 26062306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_CTRL_POLL_EN GENMASK(13, 12) 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define MTK_WED_WPDMA_CFG_BASE 0x580 26362306a36Sopenharmony_ci#define MTK_WED_WPDMA_CFG_INT_MASK 0x584 26462306a36Sopenharmony_ci#define MTK_WED_WPDMA_CFG_TX 0x588 26562306a36Sopenharmony_ci#define MTK_WED_WPDMA_CFG_TX_FREE 0x58c 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_ci#define MTK_WED_WPDMA_TX_MIB(_n) (0x5a0 + (_n) * 4) 26862306a36Sopenharmony_ci#define MTK_WED_WPDMA_TX_COHERENT_MIB(_n) (0x5d0 + (_n) * 4) 26962306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_MIB(_n) (0x5e0 + (_n) * 4) 27062306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_COHERENT_MIB(_n) (0x5f0 + (_n) * 4) 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci#define MTK_WED_WPDMA_RING_TX(_n) (0x600 + (_n) * 0x10) 27362306a36Sopenharmony_ci#define MTK_WED_WPDMA_RING_RX(_n) (0x700 + (_n) * 0x10) 27462306a36Sopenharmony_ci#define MTK_WED_WPDMA_RING_RX_DATA(_n) (0x730 + (_n) * 0x10) 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_GLO_CFG 0x75c 27762306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RX_DRV_EN BIT(0) 27862306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RX_DRV_BUSY BIT(1) 27962306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_FSM_RETURN_IDLE BIT(3) 28062306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RST_INIT_COMPLETE BIT(4) 28162306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_INIT_PHASE_RXEN_SEL GENMASK(11, 7) 28262306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RXD_READ_LEN GENMASK(31, 24) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RST_IDX 0x760 28562306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RST_CRX_IDX GENMASK(17, 16) 28662306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_RST_DRV_IDX GENMASK(25, 24) 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_GLO_CFG 0x76c 28962306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_RING 0x770 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_MIB(_n) (0x774 + (_n) * 4) 29262306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_PROCESSED_MIB(_n) (0x784 + (_n) * 4) 29362306a36Sopenharmony_ci#define MTK_WED_WPDMA_RX_D_COHERENT_MIB 0x78c 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci#define MTK_WED_WDMA_RING_TX 0x800 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci#define MTK_WED_WDMA_TX_MIB 0x810 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci#define MTK_WED_WDMA_RING_RX(_n) (0x900 + (_n) * 0x10) 30062306a36Sopenharmony_ci#define MTK_WED_WDMA_RX_THRES(_n) (0x940 + (_n) * 0x4) 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG 0xa04 30362306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_TX_DRV_EN BIT(0) 30462306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_TX_DDONE_CHK BIT(1) 30562306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_RX_DRV_EN BIT(2) 30662306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY BIT(3) 30762306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_BT_SIZE GENMASK(5, 4) 30862306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_TX_WB_DDONE BIT(6) 30962306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_RX_DIS_FSM_AUTO_IDLE BIT(13) 31062306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_WCOMPLETE_SEL BIT(16) 31162306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_INIT_PHASE_RXDMA_BYPASS BIT(17) 31262306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_INIT_PHASE_BYPASS BIT(18) 31362306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_FSM_RETURN_IDLE BIT(19) 31462306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_WAIT_COHERENT BIT(20) 31562306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_AXI_W_AFTER_AW BIT(21) 31662306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_IDLE_DMAD_SUPPLY_SINGLE_W BIT(22) 31762306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_IDLE_DMAD_SUPPLY BIT(23) 31862306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_DYNAMIC_SKIP_DMAD_PREP BIT(24) 31962306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_DYNAMIC_DMAD_RECYCLE BIT(25) 32062306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_RST_INIT_COMPLETE BIT(26) 32162306a36Sopenharmony_ci#define MTK_WED_WDMA_GLO_CFG_RXDRV_CLKGATE_BYPASS BIT(30) 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci#define MTK_WED_WDMA_RESET_IDX 0xa08 32462306a36Sopenharmony_ci#define MTK_WED_WDMA_RESET_IDX_RX GENMASK(17, 16) 32562306a36Sopenharmony_ci#define MTK_WED_WDMA_RESET_IDX_DRV GENMASK(25, 24) 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_CLR 0xa24 32862306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_CLR_RX_DONE GENMASK(17, 16) 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_TRIGGER 0xa28 33162306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_TRIGGER_RX_DONE GENMASK(17, 16) 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_CTRL 0xa2c 33462306a36Sopenharmony_ci#define MTK_WED_WDMA_INT_CTRL_POLL_SRC_SEL GENMASK(17, 16) 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_ci#define MTK_WED_WDMA_CFG_BASE 0xaa0 33762306a36Sopenharmony_ci#define MTK_WED_WDMA_OFFSET0 0xaa4 33862306a36Sopenharmony_ci#define MTK_WED_WDMA_OFFSET1 0xaa8 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci#define MTK_WED_WDMA_OFST0_GLO_INTS GENMASK(15, 0) 34162306a36Sopenharmony_ci#define MTK_WED_WDMA_OFST0_GLO_CFG GENMASK(31, 16) 34262306a36Sopenharmony_ci#define MTK_WED_WDMA_OFST1_TX_CTRL GENMASK(15, 0) 34362306a36Sopenharmony_ci#define MTK_WED_WDMA_OFST1_RX_CTRL GENMASK(31, 16) 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci#define MTK_WED_WDMA_RX_MIB(_n) (0xae0 + (_n) * 4) 34662306a36Sopenharmony_ci#define MTK_WED_WDMA_RX_RECYCLE_MIB(_n) (0xae8 + (_n) * 4) 34762306a36Sopenharmony_ci#define MTK_WED_WDMA_RX_PROCESSED_MIB(_n) (0xaf0 + (_n) * 4) 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ci#define MTK_WED_RX_BM_RX_DMAD 0xd80 35062306a36Sopenharmony_ci#define MTK_WED_RX_BM_RX_DMAD_SDL0 GENMASK(13, 0) 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci#define MTK_WED_RX_BM_BASE 0xd84 35362306a36Sopenharmony_ci#define MTK_WED_RX_BM_INIT_PTR 0xd88 35462306a36Sopenharmony_ci#define MTK_WED_RX_BM_SW_TAIL GENMASK(15, 0) 35562306a36Sopenharmony_ci#define MTK_WED_RX_BM_INIT_SW_TAIL BIT(16) 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci#define MTK_WED_RX_PTR 0xd8c 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci#define MTK_WED_RX_BM_DYN_ALLOC_TH 0xdb4 36062306a36Sopenharmony_ci#define MTK_WED_RX_BM_DYN_ALLOC_TH_H GENMASK(31, 16) 36162306a36Sopenharmony_ci#define MTK_WED_RX_BM_DYN_ALLOC_TH_L GENMASK(15, 0) 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_ci#define MTK_WED_RING_OFS_BASE 0x00 36462306a36Sopenharmony_ci#define MTK_WED_RING_OFS_COUNT 0x04 36562306a36Sopenharmony_ci#define MTK_WED_RING_OFS_CPU_IDX 0x08 36662306a36Sopenharmony_ci#define MTK_WED_RING_OFS_DMA_IDX 0x0c 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci#define MTK_WDMA_RING_TX(_n) (0x000 + (_n) * 0x10) 36962306a36Sopenharmony_ci#define MTK_WDMA_RING_RX(_n) (0x100 + (_n) * 0x10) 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG 0x204 37262306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_TX_DMA_EN BIT(0) 37362306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_TX_DMA_BUSY BIT(1) 37462306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_RX_DMA_EN BIT(2) 37562306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_RX_DMA_BUSY BIT(3) 37662306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_RX_INFO3_PRERES BIT(26) 37762306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_RX_INFO2_PRERES BIT(27) 37862306a36Sopenharmony_ci#define MTK_WDMA_GLO_CFG_RX_INFO1_PRERES BIT(28) 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci#define MTK_WDMA_RESET_IDX 0x208 38162306a36Sopenharmony_ci#define MTK_WDMA_RESET_IDX_TX GENMASK(3, 0) 38262306a36Sopenharmony_ci#define MTK_WDMA_RESET_IDX_RX GENMASK(17, 16) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci#define MTK_WDMA_INT_STATUS 0x220 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK 0x228 38762306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_TX_DONE GENMASK(3, 0) 38862306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_RX_DONE GENMASK(17, 16) 38962306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_TX_DELAY BIT(28) 39062306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_TX_COHERENT BIT(29) 39162306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_RX_DELAY BIT(30) 39262306a36Sopenharmony_ci#define MTK_WDMA_INT_MASK_RX_COHERENT BIT(31) 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ci#define MTK_WDMA_INT_GRP1 0x250 39562306a36Sopenharmony_ci#define MTK_WDMA_INT_GRP2 0x254 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci#define MTK_PCIE_MIRROR_MAP(n) ((n) ? 0x4 : 0x0) 39862306a36Sopenharmony_ci#define MTK_PCIE_MIRROR_MAP_EN BIT(0) 39962306a36Sopenharmony_ci#define MTK_PCIE_MIRROR_MAP_WED_ID BIT(1) 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci/* DMA channel mapping */ 40262306a36Sopenharmony_ci#define HIFSYS_DMA_AG_MAP 0x008 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci#define MTK_WED_RTQM_GLO_CFG 0xb00 40562306a36Sopenharmony_ci#define MTK_WED_RTQM_BUSY BIT(1) 40662306a36Sopenharmony_ci#define MTK_WED_RTQM_Q_RST BIT(2) 40762306a36Sopenharmony_ci#define MTK_WED_RTQM_Q_DBG_BYPASS BIT(5) 40862306a36Sopenharmony_ci#define MTK_WED_RTQM_TXDMAD_FPORT GENMASK(23, 20) 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci#define MTK_WED_RTQM_R2H_MIB(_n) (0xb70 + (_n) * 0x4) 41162306a36Sopenharmony_ci#define MTK_WED_RTQM_R2Q_MIB(_n) (0xb78 + (_n) * 0x4) 41262306a36Sopenharmony_ci#define MTK_WED_RTQM_Q2N_MIB 0xb80 41362306a36Sopenharmony_ci#define MTK_WED_RTQM_Q2H_MIB(_n) (0xb84 + (_n) * 0x4) 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci#define MTK_WED_RTQM_Q2B_MIB 0xb8c 41662306a36Sopenharmony_ci#define MTK_WED_RTQM_PFDBK_MIB 0xb90 41762306a36Sopenharmony_ci 41862306a36Sopenharmony_ci#define MTK_WED_RROQM_GLO_CFG 0xc04 41962306a36Sopenharmony_ci#define MTK_WED_RROQM_RST_IDX 0xc08 42062306a36Sopenharmony_ci#define MTK_WED_RROQM_RST_IDX_MIOD BIT(0) 42162306a36Sopenharmony_ci#define MTK_WED_RROQM_RST_IDX_FDBK BIT(4) 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CTRL0 0xc40 42462306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CTRL1 0xc44 42562306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CNT GENMASK(11, 0) 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CTRL2 0xc48 42862306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CTRL3 0xc4c 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_CTRL0 0xc50 43162306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_CTRL1 0xc54 43262306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_CNT GENMASK(11, 0) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_CTRL2 0xc58 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci#define MTK_WED_RROQ_BASE_L 0xc80 43762306a36Sopenharmony_ci#define MTK_WED_RROQ_BASE_H 0xc84 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_CFG 0xc8c 44062306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_MID_DW GENMASK(5, 0) 44162306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_MOD_DW GENMASK(13, 8) 44262306a36Sopenharmony_ci#define MTK_WED_RROQM_MIOD_ENTRY_DW GENMASK(22, 16) 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci#define MTK_WED_RROQM_MID_MIB 0xcc0 44562306a36Sopenharmony_ci#define MTK_WED_RROQM_MOD_MIB 0xcc4 44662306a36Sopenharmony_ci#define MTK_WED_RROQM_MOD_COHERENT_MIB 0xcc8 44762306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_MIB 0xcd0 44862306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_COHERENT_MIB 0xcd4 44962306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_IND_MIB 0xce0 45062306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_ENQ_MIB 0xce4 45162306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_ANC_MIB 0xce8 45262306a36Sopenharmony_ci#define MTK_WED_RROQM_FDBK_ANC2H_MIB 0xcec 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci#define MTK_WED_RX_BM_RX_DMAD 0xd80 45562306a36Sopenharmony_ci#define MTK_WED_RX_BM_BASE 0xd84 45662306a36Sopenharmony_ci#define MTK_WED_RX_BM_INIT_PTR 0xd88 45762306a36Sopenharmony_ci#define MTK_WED_RX_BM_PTR 0xd8c 45862306a36Sopenharmony_ci#define MTK_WED_RX_BM_PTR_HEAD GENMASK(32, 16) 45962306a36Sopenharmony_ci#define MTK_WED_RX_BM_PTR_TAIL GENMASK(15, 0) 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_ci#define MTK_WED_RX_BM_BLEN 0xd90 46262306a36Sopenharmony_ci#define MTK_WED_RX_BM_STS 0xd94 46362306a36Sopenharmony_ci#define MTK_WED_RX_BM_INTF2 0xd98 46462306a36Sopenharmony_ci#define MTK_WED_RX_BM_INTF 0xd9c 46562306a36Sopenharmony_ci#define MTK_WED_RX_BM_ERR_STS 0xda8 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ci#define MTK_WED_WOCPU_VIEW_MIOD_BASE 0x8000 46862306a36Sopenharmony_ci#define MTK_WED_PCIE_INT_MASK 0x0 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci#endif 471