mtk_wed_regs.h (9744B)
1// SPDX-License-Identifier: GPL-2.0-only 2/* Copyright (C) 2020 Felix Fietkau <nbd@nbd.name> */ 3 4#ifndef __MTK_WED_REGS_H 5#define __MTK_WED_REGS_H 6 7#define MTK_WDMA_DESC_CTRL_LEN1 GENMASK(14, 0) 8#define MTK_WDMA_DESC_CTRL_LAST_SEG1 BIT(15) 9#define MTK_WDMA_DESC_CTRL_BURST BIT(16) 10#define MTK_WDMA_DESC_CTRL_LEN0 GENMASK(29, 16) 11#define MTK_WDMA_DESC_CTRL_LAST_SEG0 BIT(30) 12#define MTK_WDMA_DESC_CTRL_DMA_DONE BIT(31) 13 14struct mtk_wdma_desc { 15 __le32 buf0; 16 __le32 ctrl; 17 __le32 buf1; 18 __le32 info; 19} __packed __aligned(4); 20 21#define MTK_WED_RESET 0x008 22#define MTK_WED_RESET_TX_BM BIT(0) 23#define MTK_WED_RESET_TX_FREE_AGENT BIT(4) 24#define MTK_WED_RESET_WPDMA_TX_DRV BIT(8) 25#define MTK_WED_RESET_WPDMA_RX_DRV BIT(9) 26#define MTK_WED_RESET_WPDMA_INT_AGENT BIT(11) 27#define MTK_WED_RESET_WED_TX_DMA BIT(12) 28#define MTK_WED_RESET_WDMA_RX_DRV BIT(17) 29#define MTK_WED_RESET_WDMA_INT_AGENT BIT(19) 30#define MTK_WED_RESET_WED BIT(31) 31 32#define MTK_WED_CTRL 0x00c 33#define MTK_WED_CTRL_WPDMA_INT_AGENT_EN BIT(0) 34#define MTK_WED_CTRL_WPDMA_INT_AGENT_BUSY BIT(1) 35#define MTK_WED_CTRL_WDMA_INT_AGENT_EN BIT(2) 36#define MTK_WED_CTRL_WDMA_INT_AGENT_BUSY BIT(3) 37#define MTK_WED_CTRL_WED_TX_BM_EN BIT(8) 38#define MTK_WED_CTRL_WED_TX_BM_BUSY BIT(9) 39#define MTK_WED_CTRL_WED_TX_FREE_AGENT_EN BIT(10) 40#define MTK_WED_CTRL_WED_TX_FREE_AGENT_BUSY BIT(11) 41#define MTK_WED_CTRL_RESERVE_EN BIT(12) 42#define MTK_WED_CTRL_RESERVE_BUSY BIT(13) 43#define MTK_WED_CTRL_FINAL_DIDX_READ BIT(24) 44#define MTK_WED_CTRL_MIB_READ_CLEAR BIT(28) 45 46#define MTK_WED_EXT_INT_STATUS 0x020 47#define MTK_WED_EXT_INT_STATUS_TF_LEN_ERR BIT(0) 48#define MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD BIT(1) 49#define MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID BIT(4) 50#define MTK_WED_EXT_INT_STATUS_TX_FBUF_LO_TH BIT(8) 51#define MTK_WED_EXT_INT_STATUS_TX_FBUF_HI_TH BIT(9) 52#define MTK_WED_EXT_INT_STATUS_RX_FBUF_LO_TH BIT(12) 53#define MTK_WED_EXT_INT_STATUS_RX_FBUF_HI_TH BIT(13) 54#define MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR BIT(16) 55#define MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR BIT(17) 56#define MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT BIT(18) 57#define MTK_WED_EXT_INT_STATUS_RX_DRV_INIT_WDMA_EN BIT(19) 58#define MTK_WED_EXT_INT_STATUS_RX_DRV_BM_DMAD_COHERENT BIT(20) 59#define MTK_WED_EXT_INT_STATUS_TX_DRV_R_RESP_ERR BIT(21) 60#define MTK_WED_EXT_INT_STATUS_TX_DRV_W_RESP_ERR BIT(22) 61#define MTK_WED_EXT_INT_STATUS_RX_DRV_DMA_RECYCLE BIT(24) 62#define MTK_WED_EXT_INT_STATUS_ERROR_MASK (MTK_WED_EXT_INT_STATUS_TF_LEN_ERR | \ 63 MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD | \ 64 MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID | \ 65 MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR | \ 66 MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR | \ 67 MTK_WED_EXT_INT_STATUS_RX_DRV_INIT_WDMA_EN | \ 68 MTK_WED_EXT_INT_STATUS_TX_DRV_R_RESP_ERR | \ 69 MTK_WED_EXT_INT_STATUS_TX_DRV_W_RESP_ERR) 70 71#define MTK_WED_EXT_INT_MASK 0x028 72 73#define MTK_WED_STATUS 0x060 74#define MTK_WED_STATUS_TX GENMASK(15, 8) 75 76#define MTK_WED_TX_BM_CTRL 0x080 77#define MTK_WED_TX_BM_CTRL_VLD_GRP_NUM GENMASK(6, 0) 78#define MTK_WED_TX_BM_CTRL_RSV_GRP_NUM GENMASK(22, 16) 79#define MTK_WED_TX_BM_CTRL_PAUSE BIT(28) 80 81#define MTK_WED_TX_BM_BASE 0x084 82 83#define MTK_WED_TX_BM_TKID 0x088 84#define MTK_WED_TX_BM_TKID_START GENMASK(15, 0) 85#define MTK_WED_TX_BM_TKID_END GENMASK(31, 16) 86 87#define MTK_WED_TX_BM_BUF_LEN 0x08c 88 89#define MTK_WED_TX_BM_INTF 0x09c 90#define MTK_WED_TX_BM_INTF_TKID GENMASK(15, 0) 91#define MTK_WED_TX_BM_INTF_TKFIFO_FDEP GENMASK(23, 16) 92#define MTK_WED_TX_BM_INTF_TKID_VALID BIT(28) 93#define MTK_WED_TX_BM_INTF_TKID_READ BIT(29) 94 95#define MTK_WED_TX_BM_DYN_THR 0x0a0 96#define MTK_WED_TX_BM_DYN_THR_LO GENMASK(6, 0) 97#define MTK_WED_TX_BM_DYN_THR_HI GENMASK(22, 16) 98 99#define MTK_WED_INT_STATUS 0x200 100#define MTK_WED_INT_MASK 0x204 101 102#define MTK_WED_GLO_CFG 0x208 103#define MTK_WED_GLO_CFG_TX_DMA_EN BIT(0) 104#define MTK_WED_GLO_CFG_TX_DMA_BUSY BIT(1) 105#define MTK_WED_GLO_CFG_RX_DMA_EN BIT(2) 106#define MTK_WED_GLO_CFG_RX_DMA_BUSY BIT(3) 107#define MTK_WED_GLO_CFG_RX_BT_SIZE GENMASK(5, 4) 108#define MTK_WED_GLO_CFG_TX_WB_DDONE BIT(6) 109#define MTK_WED_GLO_CFG_BIG_ENDIAN BIT(7) 110#define MTK_WED_GLO_CFG_DIS_BT_SIZE_ALIGN BIT(8) 111#define MTK_WED_GLO_CFG_TX_BT_SIZE_LO BIT(9) 112#define MTK_WED_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 113#define MTK_WED_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 114#define MTK_WED_GLO_CFG_MI_DEPTH_RD GENMASK(21, 13) 115#define MTK_WED_GLO_CFG_TX_BT_SIZE_HI GENMASK(23, 22) 116#define MTK_WED_GLO_CFG_SW_RESET BIT(24) 117#define MTK_WED_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 118#define MTK_WED_GLO_CFG_OMIT_RX_INFO BIT(27) 119#define MTK_WED_GLO_CFG_OMIT_TX_INFO BIT(28) 120#define MTK_WED_GLO_CFG_BYTE_SWAP BIT(29) 121#define MTK_WED_GLO_CFG_RX_2B_OFFSET BIT(31) 122 123#define MTK_WED_RESET_IDX 0x20c 124#define MTK_WED_RESET_IDX_TX GENMASK(3, 0) 125#define MTK_WED_RESET_IDX_RX GENMASK(17, 16) 126 127#define MTK_WED_TX_MIB(_n) (0x2a0 + (_n) * 4) 128 129#define MTK_WED_RING_TX(_n) (0x300 + (_n) * 0x10) 130 131#define MTK_WED_RING_RX(_n) (0x400 + (_n) * 0x10) 132 133#define MTK_WED_WPDMA_INT_TRIGGER 0x504 134#define MTK_WED_WPDMA_INT_TRIGGER_RX_DONE BIT(1) 135#define MTK_WED_WPDMA_INT_TRIGGER_TX_DONE GENMASK(5, 4) 136 137#define MTK_WED_WPDMA_GLO_CFG 0x508 138#define MTK_WED_WPDMA_GLO_CFG_TX_DRV_EN BIT(0) 139#define MTK_WED_WPDMA_GLO_CFG_TX_DRV_BUSY BIT(1) 140#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_EN BIT(2) 141#define MTK_WED_WPDMA_GLO_CFG_RX_DRV_BUSY BIT(3) 142#define MTK_WED_WPDMA_GLO_CFG_RX_BT_SIZE GENMASK(5, 4) 143#define MTK_WED_WPDMA_GLO_CFG_TX_WB_DDONE BIT(6) 144#define MTK_WED_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7) 145#define MTK_WED_WPDMA_GLO_CFG_DIS_BT_SIZE_ALIGN BIT(8) 146#define MTK_WED_WPDMA_GLO_CFG_TX_BT_SIZE_LO BIT(9) 147#define MTK_WED_WPDMA_GLO_CFG_MULTI_DMA_EN GENMASK(11, 10) 148#define MTK_WED_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12) 149#define MTK_WED_WPDMA_GLO_CFG_MI_DEPTH_RD GENMASK(21, 13) 150#define MTK_WED_WPDMA_GLO_CFG_TX_BT_SIZE_HI GENMASK(23, 22) 151#define MTK_WED_WPDMA_GLO_CFG_SW_RESET BIT(24) 152#define MTK_WED_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY BIT(26) 153#define MTK_WED_WPDMA_GLO_CFG_OMIT_RX_INFO BIT(27) 154#define MTK_WED_WPDMA_GLO_CFG_OMIT_TX_INFO BIT(28) 155#define MTK_WED_WPDMA_GLO_CFG_BYTE_SWAP BIT(29) 156#define MTK_WED_WPDMA_GLO_CFG_RX_2B_OFFSET BIT(31) 157 158#define MTK_WED_WPDMA_RESET_IDX 0x50c 159#define MTK_WED_WPDMA_RESET_IDX_TX GENMASK(3, 0) 160#define MTK_WED_WPDMA_RESET_IDX_RX GENMASK(17, 16) 161 162#define MTK_WED_WPDMA_INT_CTRL 0x520 163#define MTK_WED_WPDMA_INT_CTRL_SUBRT_ADV BIT(21) 164 165#define MTK_WED_WPDMA_INT_MASK 0x524 166 167#define MTK_WED_PCIE_CFG_BASE 0x560 168 169#define MTK_WED_PCIE_INT_TRIGGER 0x570 170#define MTK_WED_PCIE_INT_TRIGGER_STATUS BIT(16) 171 172#define MTK_WED_WPDMA_CFG_BASE 0x580 173 174#define MTK_WED_WPDMA_TX_MIB(_n) (0x5a0 + (_n) * 4) 175#define MTK_WED_WPDMA_TX_COHERENT_MIB(_n) (0x5d0 + (_n) * 4) 176 177#define MTK_WED_WPDMA_RING_TX(_n) (0x600 + (_n) * 0x10) 178#define MTK_WED_WPDMA_RING_RX(_n) (0x700 + (_n) * 0x10) 179#define MTK_WED_WDMA_RING_RX(_n) (0x900 + (_n) * 0x10) 180#define MTK_WED_WDMA_RX_THRES(_n) (0x940 + (_n) * 0x4) 181 182#define MTK_WED_WDMA_GLO_CFG 0xa04 183#define MTK_WED_WDMA_GLO_CFG_TX_DRV_EN BIT(0) 184#define MTK_WED_WDMA_GLO_CFG_RX_DRV_EN BIT(2) 185#define MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY BIT(3) 186#define MTK_WED_WDMA_GLO_CFG_BT_SIZE GENMASK(5, 4) 187#define MTK_WED_WDMA_GLO_CFG_TX_WB_DDONE BIT(6) 188#define MTK_WED_WDMA_GLO_CFG_RX_DIS_FSM_AUTO_IDLE BIT(13) 189#define MTK_WED_WDMA_GLO_CFG_WCOMPLETE_SEL BIT(16) 190#define MTK_WED_WDMA_GLO_CFG_INIT_PHASE_RXDMA_BYPASS BIT(17) 191#define MTK_WED_WDMA_GLO_CFG_INIT_PHASE_BYPASS BIT(18) 192#define MTK_WED_WDMA_GLO_CFG_FSM_RETURN_IDLE BIT(19) 193#define MTK_WED_WDMA_GLO_CFG_WAIT_COHERENT BIT(20) 194#define MTK_WED_WDMA_GLO_CFG_AXI_W_AFTER_AW BIT(21) 195#define MTK_WED_WDMA_GLO_CFG_IDLE_DMAD_SUPPLY_SINGLE_W BIT(22) 196#define MTK_WED_WDMA_GLO_CFG_IDLE_DMAD_SUPPLY BIT(23) 197#define MTK_WED_WDMA_GLO_CFG_DYNAMIC_SKIP_DMAD_PREP BIT(24) 198#define MTK_WED_WDMA_GLO_CFG_DYNAMIC_DMAD_RECYCLE BIT(25) 199#define MTK_WED_WDMA_GLO_CFG_RST_INIT_COMPLETE BIT(26) 200#define MTK_WED_WDMA_GLO_CFG_RXDRV_CLKGATE_BYPASS BIT(30) 201 202#define MTK_WED_WDMA_RESET_IDX 0xa08 203#define MTK_WED_WDMA_RESET_IDX_RX GENMASK(17, 16) 204#define MTK_WED_WDMA_RESET_IDX_DRV GENMASK(25, 24) 205 206#define MTK_WED_WDMA_INT_TRIGGER 0xa28 207#define MTK_WED_WDMA_INT_TRIGGER_RX_DONE GENMASK(17, 16) 208 209#define MTK_WED_WDMA_INT_CTRL 0xa2c 210#define MTK_WED_WDMA_INT_CTRL_POLL_SRC_SEL GENMASK(17, 16) 211 212#define MTK_WED_WDMA_OFFSET0 0xaa4 213#define MTK_WED_WDMA_OFFSET1 0xaa8 214 215#define MTK_WED_WDMA_RX_MIB(_n) (0xae0 + (_n) * 4) 216#define MTK_WED_WDMA_RX_RECYCLE_MIB(_n) (0xae8 + (_n) * 4) 217#define MTK_WED_WDMA_RX_PROCESSED_MIB(_n) (0xaf0 + (_n) * 4) 218 219#define MTK_WED_RING_OFS_BASE 0x00 220#define MTK_WED_RING_OFS_COUNT 0x04 221#define MTK_WED_RING_OFS_CPU_IDX 0x08 222#define MTK_WED_RING_OFS_DMA_IDX 0x0c 223 224#define MTK_WDMA_RING_RX(_n) (0x100 + (_n) * 0x10) 225 226#define MTK_WDMA_GLO_CFG 0x204 227#define MTK_WDMA_GLO_CFG_RX_INFO_PRERES GENMASK(28, 26) 228 229#define MTK_WDMA_RESET_IDX 0x208 230#define MTK_WDMA_RESET_IDX_TX GENMASK(3, 0) 231#define MTK_WDMA_RESET_IDX_RX GENMASK(17, 16) 232 233#define MTK_WDMA_INT_MASK 0x228 234#define MTK_WDMA_INT_MASK_TX_DONE GENMASK(3, 0) 235#define MTK_WDMA_INT_MASK_RX_DONE GENMASK(17, 16) 236#define MTK_WDMA_INT_MASK_TX_DELAY BIT(28) 237#define MTK_WDMA_INT_MASK_TX_COHERENT BIT(29) 238#define MTK_WDMA_INT_MASK_RX_DELAY BIT(30) 239#define MTK_WDMA_INT_MASK_RX_COHERENT BIT(31) 240 241#define MTK_WDMA_INT_GRP1 0x250 242#define MTK_WDMA_INT_GRP2 0x254 243 244#define MTK_PCIE_MIRROR_MAP(n) ((n) ? 0x4 : 0x0) 245#define MTK_PCIE_MIRROR_MAP_EN BIT(0) 246#define MTK_PCIE_MIRROR_MAP_WED_ID BIT(1) 247 248/* DMA channel mapping */ 249#define HIFSYS_DMA_AG_MAP 0x008 250 251#endif